@chatwarden/core 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +184 -5
  2. package/dist/src/ai/case.d.ts +2 -1
  3. package/dist/src/ai/case.d.ts.map +1 -1
  4. package/dist/src/ai/case.js +1 -1
  5. package/dist/src/ai/case.js.map +1 -1
  6. package/dist/src/ai/hash.d.ts +1 -1
  7. package/dist/src/ai/hash.js +3 -3
  8. package/dist/src/ai/hash.js.map +1 -1
  9. package/dist/src/ai/prompt.d.ts +8 -1
  10. package/dist/src/ai/prompt.d.ts.map +1 -1
  11. package/dist/src/ai/prompt.js +20 -1
  12. package/dist/src/ai/prompt.js.map +1 -1
  13. package/dist/src/ai/service.d.ts +16 -5
  14. package/dist/src/ai/service.d.ts.map +1 -1
  15. package/dist/src/ai/service.js +12 -7
  16. package/dist/src/ai/service.js.map +1 -1
  17. package/dist/src/ai/types.d.ts +17 -2
  18. package/dist/src/ai/types.d.ts.map +1 -1
  19. package/dist/src/ai/types.js +3 -2
  20. package/dist/src/ai/types.js.map +1 -1
  21. package/dist/src/ai/worker.d.ts +5 -0
  22. package/dist/src/ai/worker.d.ts.map +1 -1
  23. package/dist/src/ai/worker.js +9 -2
  24. package/dist/src/ai/worker.js.map +1 -1
  25. package/dist/src/appealService.d.ts +105 -0
  26. package/dist/src/appealService.d.ts.map +1 -0
  27. package/dist/src/appealService.js +548 -0
  28. package/dist/src/appealService.js.map +1 -0
  29. package/dist/src/appeals.d.ts +194 -0
  30. package/dist/src/appeals.d.ts.map +1 -0
  31. package/dist/src/appeals.js +107 -0
  32. package/dist/src/appeals.js.map +1 -0
  33. package/dist/src/audit.d.ts +7 -3
  34. package/dist/src/audit.d.ts.map +1 -1
  35. package/dist/src/audit.js +18 -3
  36. package/dist/src/audit.js.map +1 -1
  37. package/dist/src/chatwarden.d.ts +129 -9
  38. package/dist/src/chatwarden.d.ts.map +1 -1
  39. package/dist/src/chatwarden.js +94 -19
  40. package/dist/src/chatwarden.js.map +1 -1
  41. package/dist/src/decide.d.ts +2 -0
  42. package/dist/src/decide.d.ts.map +1 -1
  43. package/dist/src/decide.js +12 -7
  44. package/dist/src/decide.js.map +1 -1
  45. package/dist/src/documents.d.ts +1 -1
  46. package/dist/src/documents.d.ts.map +1 -1
  47. package/dist/src/documents.js +3 -1
  48. package/dist/src/documents.js.map +1 -1
  49. package/dist/src/events.d.ts +38 -0
  50. package/dist/src/events.d.ts.map +1 -1
  51. package/dist/src/events.js +3 -0
  52. package/dist/src/events.js.map +1 -1
  53. package/dist/src/index.d.ts +9 -5
  54. package/dist/src/index.d.ts.map +1 -1
  55. package/dist/src/index.js +5 -2
  56. package/dist/src/index.js.map +1 -1
  57. package/dist/src/nameService.d.ts +90 -0
  58. package/dist/src/nameService.d.ts.map +1 -0
  59. package/dist/src/nameService.js +224 -0
  60. package/dist/src/nameService.js.map +1 -0
  61. package/dist/src/names.d.ts +68 -0
  62. package/dist/src/names.d.ts.map +1 -0
  63. package/dist/src/names.js +87 -0
  64. package/dist/src/names.js.map +1 -0
  65. package/dist/src/notices.d.ts +53 -5
  66. package/dist/src/notices.d.ts.map +1 -1
  67. package/dist/src/notices.js +93 -8
  68. package/dist/src/notices.js.map +1 -1
  69. package/dist/src/policy.d.ts +9 -0
  70. package/dist/src/policy.d.ts.map +1 -1
  71. package/dist/src/policy.js +20 -2
  72. package/dist/src/policy.js.map +1 -1
  73. package/dist/src/profile.d.ts +23 -1
  74. package/dist/src/profile.d.ts.map +1 -1
  75. package/dist/src/profile.js +14 -2
  76. package/dist/src/profile.js.map +1 -1
  77. package/dist/src/retention.d.ts +31 -1
  78. package/dist/src/retention.d.ts.map +1 -1
  79. package/dist/src/retention.js +41 -3
  80. package/dist/src/retention.js.map +1 -1
  81. package/dist/src/sanctions.d.ts +29 -1
  82. package/dist/src/sanctions.d.ts.map +1 -1
  83. package/dist/src/sanctions.js +52 -9
  84. package/dist/src/sanctions.js.map +1 -1
  85. package/dist/src/staffViews.d.ts +18 -0
  86. package/dist/src/staffViews.d.ts.map +1 -1
  87. package/dist/src/staffViews.js +14 -0
  88. package/dist/src/staffViews.js.map +1 -1
  89. package/dist/src/types.d.ts +198 -6
  90. package/dist/src/types.d.ts.map +1 -1
  91. package/dist/src/types.js.map +1 -1
  92. package/package.json +2 -2
  93. package/src/ai/case.ts +4 -2
  94. package/src/ai/hash.ts +3 -3
  95. package/src/ai/prompt.ts +23 -1
  96. package/src/ai/service.ts +21 -12
  97. package/src/ai/types.ts +14 -2
  98. package/src/ai/worker.ts +10 -2
  99. package/src/appealService.ts +584 -0
  100. package/src/appeals.ts +256 -0
  101. package/src/audit.ts +18 -3
  102. package/src/chatwarden.ts +199 -21
  103. package/src/decide.ts +13 -7
  104. package/src/documents.ts +6 -3
  105. package/src/events.ts +23 -1
  106. package/src/index.ts +12 -1
  107. package/src/nameService.ts +255 -0
  108. package/src/names.ts +121 -0
  109. package/src/notices.ts +112 -14
  110. package/src/policy.ts +20 -3
  111. package/src/profile.ts +34 -2
  112. package/src/retention.ts +63 -3
  113. package/src/sanctions.ts +72 -9
  114. package/src/staffViews.ts +30 -0
  115. package/src/types.ts +210 -7
package/README.md CHANGED
@@ -117,19 +117,21 @@ For the moderators' screens and the player's notices, mount the routes in
117
117
  | `cw.reports` | `submit` and `addDetail` (players; see "Reporting settings"), `list`, `get` and `reporterRecord` (staff). `reporterRecord(person)` is how the reports a person filed stand: `{ reports, open, actioned, dismissed, badFaith, suspendedUntil, reasonMatched, reasonDecided, accuracy }`. `reporterAccuracy(people)` is how often each person's recent reports turned out to be unfounded (see "Reporter accuracy"). |
118
118
  | `cw.decide(input)` | A moderator closes a report and writes the sanctions and notices in one transaction. Safe to send twice. `reason` is required, except for a `no_action` with no actions (a one-click dismissal): leave it out and the standard reason `NO_ACTION_DEFAULT_REASON` (`No action needed`) is stored. |
119
119
  | `cw.sanctions` | `apply` and `revoke`, for a moderator who acts without a report. `forPerson(subject)` and `list({ cursor?, limit?, source? })` (staff) read sanctions as `SanctionGroupView`s: one per group, built from the person's own row, so no IP, hash or stored value is in them. |
120
- | `cw.blocked` | `list({ days })` and `countsByTerm({ days })` (staff), with `days` 1, 7 or 30: the lines the slur filter blocked, with the raw text, and the strikes per term. |
120
+ | `cw.blocked` | `list({ days })` and `countsByTerm({ days })` (staff), with `days` 1, 7 or 30: the lines the slur filter blocked, with the raw text, and the strikes per term. `names({ days })` (`@experimental`) lists the blocked names kept as evidence with `names.keepBlocked`. |
121
121
  | `cw.reports.dismissMany(input)` | Staff, `@experimental`. "Nothing wrong here" for every open report about one person (`scope: { person }`, merged aliases included) or from one reporter (`scope: { reporter }`) in one call: at most 200 (`BULK_DISMISS_MAX`), `more: true` when there are more. Each report is closed like a single `no_action` decision with no actions and the standard reason (its own transaction, its own `report.closed` event); a bulk never marks bad faith and never counts toward a suspension. A case another moderator holds is skipped and counted unless `ignoreClaims`; `dryRun` counts and writes nothing. It writes no audit row: the staff layer does. Safe to run again. |
122
122
  | `cw.cases` | The team workbench (staff): `claim(person, actor, { takeOver? })` and `release` a soft claim on a person's case (`releaseWhenDone` is what a decision does: it ends the claim only when the person has no other open report, so one case per person is held until its last report is decided), `next(actor, { category?, reason?, rankDownHabitual? })` to claim the oldest open case nobody holds (with `rankDownHabitual`, a case whose open reports all come from habitual false reporters and none has waited 24 hours is served after the ordinary ones, never skipped for good), `holder` / `holders` to read claims, and `view` / `viewers` for who has a case open. A claim lasts 10 minutes from the last beat on your clock, lives in the store (so several server processes on one database agree, and two moderators racing for one case never both win), and is a courtesy: the core never refuses a decision because of one (the HTTP routes do). Viewing is a 30 second hint kept in this process's memory and never stored; it tracks only people with an open report, and one actor keeps at most 20 cases open. A claimer that loses a database lock race to another process is retried (3 attempts) and gets the normal "claimed" answer. |
123
123
  | `cw.changes.token()` | A cheap, opaque change token for the queue. It differs after any report filed or decided, sanction applied or revoked, rule gap closed, claim taken, taken over or released, or saved reason changed, and is the same otherwise (a claim heartbeat does not move it). It is kept in the store, so a restart does not rewind it (the in-memory store is the exception: it starts again at "0"). |
124
124
  | `cw.reasons` | Saved decision reasons (staff): `list`, `add({ label, text })`, `update(id, patch)` and `setActive(id, active)`. A label is up to 40 characters, a text up to 500 (counted as characters, an emoji is one), at most 200 reasons; a label holds no control character, a text none but a newline. |
125
125
  | `cw.notices` | A player's pending notices, acknowledgements and "My record". Built so no identifier can leak. |
126
126
  | `cw.doors` | `check` a person at the door (login, join) against bans. |
127
- | `cw.names.check` | May a player use this as a name? |
127
+ | `cw.names` | `check(text, opts?)`: may a player use this as a name? (`name_not_allowed`, and `name_profane` with `names.profanity`). `@experimental` since 0.1.9: `flagged`, `requireRename`, `pendingRename`, `renamed`, `renamesEnabled`, `renamesOf`. See "Names". |
128
+ | `cw.appeals` | `@experimental`. Appeals against sanctions: `file`, `mine` (players), `list`, `get`, `decide`, `stats`, `openCount`, `forPerson` (staff). Off until `appeals.enabled`. See "Appeals". |
129
+ | `cw.people` | `canonical`, `aliases`, and `accountIds(subject)` (`@experimental`, staff, server side only): the account ids you passed as `RawWho.accountId` for that person, so a game can find the player to rename. |
128
130
  | `cw.history`, `cw.suggest` | A person's recent record, and what the preset suggests as the next step. |
129
131
  | `cw.rules`, `cw.profile`, `cw.limits`, `cw.summary`, `cw.documents` | The rules, standard and numbers in force, and the written code of conduct and guides. `cw.profile` and `cw.summary` are read live: the profile in force is your code's profile with the owner's stored edits on top (see "The editable profile"), so read it when you need it and never keep it. |
130
132
  | `cw.policy` | The editable profile: `get` (it also reports `limits`, read only: the chat rate in force and the signals retention), `save`, `preview`, `reset` and `refresh`. The lengths a moderator is offered, the ladder, the first offences, the repeat rule, the area and severe rules and the guideline outcome texts can be edited at runtime and are stored in your store. |
131
133
  | `cw.gaps`, `cw.audit` | Rule gaps for the periodic review, and the staff audit trail. |
132
- | `cw.on(type, listener)` | Events: `report.created`, `report.closed`, `sanction.applied`, `sanction.revoked`, `gap.created`, `auto.restricted`. |
134
+ | `cw.on(type, listener)` | Events: `report.created`, `report.closed`, `sanction.applied`, `sanction.revoked`, `gap.created`, `auto.restricted`, and, new in 0.1.9, `appeal.created`, `appeal.decided` and `rename.required` (`@experimental`; ids, codes and times only, never a statement, a reason or a name). |
133
135
  | `cw.purge`, `cw.ready`, `cw.flush`, `cw.close` | Housekeeping. |
134
136
 
135
137
  ## Deciding a report
@@ -287,6 +289,18 @@ These may change before 0.2, and are marked `@experimental` in the types: `PaceS
287
289
  `PolicyDropped`, `PolicyLimits`, `PolicyState.limits` and `.dropped`), `SuggestContext.hideSignalText`, `Suggestion.signals`, `signalBoost` in
288
290
  `cw.cases.next`, `BUILTIN_SIGNAL_KINDS`, `withMemorySignals`, the `pace` prop of `RestrictedChatLine` and `secondsLeft` in `@chatwarden/player-react`.
289
291
 
292
+ ## What is experimental in 0.1.9
293
+
294
+ These may change before 0.2, and are marked `@experimental` in the types: `AppealSettings`, `ResolvedAppeals`, `resolveAppeals`, `cw.appeals` and every appeal type
295
+ (`PlayerAppeal`, `AppealFileResult`, `AppealRefusal`, `AppealDecision`, `AppealDecideResult`, `AppealSummary`, `AppealDetail`, `AppealPage`, `AppealStats`,
296
+ `AppealRuleStats`, `AppealRow`), `normalizeStatement`, `NameSettings`, `ResolvedNames`, `resolveNames`, `cw.names.flagged`, `cw.names.requireRename`,
297
+ `cw.names.pendingRename`, `cw.names.renamed`, `cw.names.renamesEnabled`, `cw.names.renamesOf`, `cw.blocked.names`, `BlockedNameRow`, `cw.people.accountIds`,
298
+ the `appeals` and `names` profile sections, the events `appeal.created`, `appeal.decided` and `rename.required`, the optional `Store` methods for appeals,
299
+ blocked names and `withdrawNotice`, `withMemoryAppeals` and `withMemoryNames`, and, in the other packages, `AppealDialog`, `nameReasonText` and the
300
+ `appeals` prop of `NoticeQueue` and `MyRecord` in `@chatwarden/player-react`, `appealsRateLimit` and `includeAccounts` in `@chatwarden/http`, and the
301
+ Appeals and Names screens of `@chatwarden/hub-react`. The names a game already used (`cw.names.check` and its reasons, `cw.notices`, `cw.sanctions`) are
302
+ not experimental, but some of their unions are wider now: see "Upgrading to 0.1.9".
303
+
290
304
  ## Slow mode and flood control
291
305
 
292
306
  Optional and off until you set it, `@experimental` until 0.2 and new in 0.1.8. Three checks pace one player's lines in one room: **slow mode**
@@ -393,6 +407,168 @@ console.log(cw.signals.counts(cw.rooms.subjectAt('lobby-7', 'p1') ?? 's_unknown'
393
407
  - **Reads** (staff only, never to a player): `cw.signals.counts(subject, { windowDays?, kinds? })`, `kinds()`, `boosted(people)` and `forRecord(subject)`.
394
408
  The `@chatwarden/http` routes read them for you and show a count only to a role that holds `history.read`.
395
409
 
410
+ ## Appeals
411
+
412
+ Optional and off until you turn it on, `@experimental` until 0.2 and new in 0.1.9. A player who thinks a sanction was a mistake asks for a second look from
413
+ the notice they were sent. A moderator reads what they wrote and keeps the decision, makes it lighter or removes it, and the player gets a plain message with
414
+ the outcome. Appeals are not a second queue: in the hub they are a view of the Cases screen.
415
+
416
+ ```ts
417
+ import { createChatwarden, type RawWho } from '@chatwarden/core';
418
+ import { openStore } from '@chatwarden/store-sqlite';
419
+
420
+ const cw = await createChatwarden({
421
+ store: openStore({ path: './chatwarden.db' }),
422
+ secret: process.env.CHATWARDEN_SECRET!,
423
+ platform: { identify: (ctx) => ctx as RawWho },
424
+ overrides: { appeals: { enabled: true, perPlayerPerWeek: 3 } },
425
+ });
426
+
427
+ // The player files from one of their own sanction notices. `who` is what your game knows about them.
428
+ const who: RawWho = { clientKey: 'a-client-key' };
429
+ const notice = cw.notices.pending(who).find((n) => n.kind === 'chat');
430
+ if (notice !== undefined) {
431
+ const filed = cw.appeals.file(who, { noticeId: notice.id, statement: 'It was a joke between friends, and we had stopped.' });
432
+ console.log(filed.ok ? 'sent' : filed.refused);
433
+ }
434
+
435
+ // A different moderator decides: uphold, reduce (with the lighter outcome in `to`) or revoke. The reason is private.
436
+ const waiting = cw.appeals.list({ status: 'open' }).items[0];
437
+ if (waiting !== undefined) {
438
+ const result = await cw.appeals.decide({
439
+ appealId: waiting.id,
440
+ outcome: 'reduce',
441
+ actor: 'second.moderator@example.com',
442
+ reason: 'A warning is enough for a first offence.',
443
+ to: { kind: 'warning', durationMs: null },
444
+ });
445
+ console.log(result.ok ? result.status : result.error);
446
+ }
447
+ ```
448
+
449
+ - **Turning it on.** `overrides.appeals` takes `enabled` (default `false`), `perPlayerPerWeek` (1 to 20, default 3) and `allowSelfReview` (default `false`), or
450
+ the owner sets them in the hub (Settings, Advanced). With appeals off every appeal route answers as if it did not exist, a notice keeps the old
451
+ `appealUrl` link if you gave one, and no response body changes. `appeals.enabled: true` in the profile or `overrides` over a store with no appeal methods throws when the kit is created; the owner's saved setting never does: saving it on such a store is refused (`invalid_profile`, path `layer.appeals.enabled`), and one already stored leaves appeals off and warns `chatwarden.appeals_unsupported_store`.
452
+ - **What can be appealed.** A warning, a chat restriction, an area ban or a full ban that is in the player's record (the same 90-day rule "My record" uses), from
453
+ its notice. A report outcome, a note and the four message notices (below) cannot. There is one appeal for each sanction for as long as it is kept. A sanction
454
+ made lighter on appeal is a new sanction with its own notice, and can be appealed once.
455
+ - **The statement.** It is the one new free text a player writes: at most `APPEAL_STATEMENT_MAX` (1000) characters, refused when over and never cut. The kit
456
+ cleans it first (`normalizeStatement`: control, bidirectional, zero-width and other invisible characters and stray surrogates are removed, blank-line runs
457
+ collapse, the text is trimmed) and counts what is left in code points. It is kept in the appeal row and nowhere else: never in an event, a webhook, a
458
+ Discord post, a log line, an audit row or an AI prompt. Staff read it only through `cw.appeals.get`, which the staff routes audit, and the hub masks it
459
+ when it trips the term filter. It is cleared 90 days after the decision (`retention.appealStatementsMs`; 0 clears it at the decision) and the row is deleted
460
+ after 365 days (`retention.appealsMs`, never less than 90). An open appeal keeps its statement until it is decided.
461
+ - **Filing.** `cw.appeals.file(who, { noticeId, statement })` answers `{ ok: true, appeal }` or `{ ok: false, refused }`, with `refused` one of `off`,
462
+ `not_found` (one answer for a notice that is not theirs and one that does not exist), `not_appealable`, `statement_invalid`, `already_appealed` and `rate`
463
+ (with `retryAfterMs`), checked in that order. A refusal writes nothing. `cw.appeals.mine(who)` lists the player's own appeals, newest first. What a player
464
+ gets back is an id, the notice id, a status and two times: no staff ref, no reason and no sanction or person id.
465
+ - **Deciding.** `cw.appeals.decide({ appealId, outcome, actor, reason, to? })` is one transaction. `uphold` keeps the sanction. `revoke` lifts it and withdraws
466
+ its notice. `reduce` needs `to`: a lower kind, or the same kind and shorter (permanent is the longest), and the replacement keeps the original start time, so
467
+ the ladder's 90-day lookback does not restart. Each outcome tells the player through a notice of kind `appeal_upheld`, `appeal_reduced` or `appeal_revoked`
468
+ (`reduce` also sends the replacement's own notice). It answers `{ ok: true, status, replacementGroupId? }` or `{ ok: false, error }` with `error` one of
469
+ `not_found`, `already_decided` (a second call, or the loser of a race, writes nothing), `invalid`, `same_decider` and `gone`. An appeal whose sanction someone
470
+ else revoked while it was open is closed as `moot`: nobody ruled on it, the player is sent nothing more, and a decide on it answers `gone`.
471
+ - **One login per person.** The kit refuses `same_decider` when `actor` is the staff ref that made the original decision, unless `appeals.allowSelfReview` is on.
472
+ It compares staff refs, so a team that shares one login looks like a team of one and the rule cannot hold: give each moderator their own login and `actor`.
473
+ A sanction the kit gave by itself (an automatic timeout) has no human decider and any holder of the permission may decide its appeal. A team of one sets
474
+ `allowSelfReview`, or lowers who may decide with `permissions` in `@chatwarden/http`.
475
+ - **The mistake rate.** `cw.appeals.stats({ days })` (30, 90 or 365; 90 by default) gives, for each rule, the sanctions given, the appeals filed, how many were
476
+ revoked (`granted`), how many were reduced (`lightened`), a `rate` and a `band`. **A reduction is not a false positive**: it disputes how severe a sanction
477
+ was, not whether it was right, so it is counted as `lightened`, shown beside the rate and never inside it. `rate` is `granted` over `sanctions`, and is
478
+ `null` below `APPEAL_STATS_MIN_SANCTIONS` (10) sanctions. The band is `elevated` from `APPEAL_RATE_ELEVATED` (0.15) and `high` from `APPEAL_RATE_HIGH` (0.30). The
479
+ hub shows it only behind Settings, Advanced, "Mistakes by rule", never on a queue or a card.
480
+ - **What a decided appeal teaches the AI.** All of it is a no-op without `ai`. A reduce or a revoke marks the original decision reversed, so it stops being a
481
+ standard example. A revoke also keeps the decision's pseudonymised lines as one corrective example (the opposite sign: "a moderator acted on this, and a
482
+ second moderator decided on appeal that it was not a violation"). The stats of `cw.ai.stats()` change with it: **an AI false positive is a recommendation to
483
+ act where the moderator chose no action or a revoke corrected it; a reduce is not one.** Rules at the elevated or high band are given to the read as a caution
484
+ (the rule number and the band word, never a rate, a count or a person), outside the input hash. The statement never reaches the AI. This changes the prompt
485
+ (version 4): see "The AI (levels 1 and 2)" for what that costs once, on upgrade.
486
+ - **Events.** `appeal.created` and `appeal.decided` are announced after the commit, never for a refusal and never for a `moot` closure. Like `report.created`
487
+ they carry ids, codes and times, and never the statement, the reason or the player's handle. `@chatwarden/http` can send them as webhooks and
488
+ `@chatwarden/discord` posts them.
489
+ - **Your store needs the appeal methods.** The SQLite store has them (migration 22, which is one-way: back up the database before upgrading, since 0.1.8
490
+ and older tools cannot read a database 0.1.9 has opened); the in-memory store has them only through `withMemoryAppeals(store)`. For a store you wrote:
491
+ every appeal method is optional on `Store`. Also optional, and worth adding: `closeOrphanAppeals` (without it an appeal whose sanction rows retention removed
492
+ stays open and cannot be decided), the trailing `clearStatement` argument of `decideAppeal` and `closeAppealsForGroup` (without it a statement is cleared at
493
+ the next purge, not at the decision), and the second argument of `purgeNotices(before, unseen?)`, the ceiling for an unseen message notice (a store that
494
+ ignores it keeps an unseen appeal outcome or rename request until the player sees it).
495
+
496
+ ## Names
497
+
498
+ Optional, `@experimental` until 0.2 and new in 0.1.9, except that `cw.names.check` has been here since 0.1.0 and keeps its contract. This part checks a name
499
+ more closely, can keep a blocked name as evidence, lets a moderator ask a player to choose a new name, and hides a name the word list flags in the hub.
500
+
501
+ ```ts
502
+ import { createChatwarden, type RawWho } from '@chatwarden/core';
503
+ import { openStore } from '@chatwarden/store-sqlite';
504
+
505
+ const cw = await createChatwarden({
506
+ store: openStore({ path: './chatwarden.db' }),
507
+ secret: process.env.CHATWARDEN_SECRET!,
508
+ platform: { identify: (ctx) => ctx as RawWho },
509
+ overrides: { names: { profanity: true, keepBlocked: true, renames: true } },
510
+ });
511
+
512
+ // At sign-up: may this be a name? `who` is only used to tie kept evidence to a person; it never changes the answer.
513
+ const who: RawWho = { clientKey: 'a-client-key', accountId: 'acct-1042' };
514
+ const checked = cw.names.check('big_snerp_99', { who });
515
+ if (!checked.ok) console.log(checked.reason, checked.rule); // 'name_not_allowed' or 'name_profane', and the Community Rule
516
+
517
+ // A moderator asked for a new name. The game hears it, finds its player and sends them to its own rename screen.
518
+ cw.on('rename.required', (event) => {
519
+ for (const accountId of cw.people.accountIds(event.target)) console.log('rename screen for', accountId);
520
+ });
521
+
522
+ // At login: is the player still held at the rename screen? After they chose a new name, say so.
523
+ if (cw.names.pendingRename(who)) console.log('hold at the rename screen');
524
+ cw.names.renamed(who);
525
+ ```
526
+
527
+ - **Settings.** `overrides.names` takes `profanity` (default `false`), `keepBlocked` (default `false`), `renames` (default `false`) and `maskInHub` (default
528
+ `true`), or the owner sets them in the hub (Settings, Advanced, Names).
529
+ - **The check.** `cw.names.check(text, opts?)` is synchronous, keeps no state and never echoes the name. The answer is `{ ok: true }` or
530
+ `{ ok: false, reason, rule }`, with `reason` `'name_not_allowed'` (the matcher's name rules) or `'name_profane'` (the profanity filter, only with
531
+ `names.profanity`, on the name and on the name with underscores and digits read as spaces). A matcher or filter that throws lets the name through. `name_profane` is
532
+ a new value of `reason`: a `switch` that ends in `assertNever` will not compile until it handles it, though a kit never sends it with `names.profanity` off.
533
+ `cw.names.flagged(text)` is the staff-side read that asks only the matcher and stores nothing.
534
+ - **Evidence, only if you opt in.** With `names.keepBlocked` a blocked name is kept with the term it hit and, when `who` finds one, the person: at most 5 an hour
535
+ per person and 200 an hour overall (in memory, per process), after which the check still answers and keeps nothing more. An allowed name is never stored and a
536
+ name is never logged. Kept names are deleted after 30 days (`retention.blockedNamesMs`) and read by staff with `cw.blocked.names({ days })`. They need a store
537
+ with the blocked-name methods (SQLite, or `withMemoryNames(store)`).
538
+ - **Asking for a new name.** `cw.names.requireRename({ subject, actor, reason, rule? })` is for staff and needs `names.renames`. It writes one notice of kind
539
+ `rename_required` (it names no name, no reason and no excerpt; it is not a sanction, is not on "My record" and needs no acknowledgement) and then emits
540
+ `rename.required`. It answers `{ ok: true, noticeId }` or `{ ok: false, error }` with `error` `off`, `not_found`, `pending` (a request is already waiting) or
541
+ `invalid`. `cw.names.renamesEnabled()` says whether it can work now (the setting is on and the store can release a rename), and `cw.names.renamesOf(subject)`
542
+ lists a person's requests for the hub.
543
+ - **A game must act on `rename.required` and call `renamed`.** The kit cannot make a game rename anyone. It never learns the new name and never checks that one was
544
+ chosen. Listen for the event (or take it by webhook with `includeAccounts`, see `@chatwarden/http`), find the player with `cw.people.accountIds(event.target)`
545
+ (the account ids you passed as `RawWho.accountId`; a guest has none; server side only), hold them with `cw.names.pendingRename(who)` at login, and call
546
+ `cw.names.renamed(who)` when they have a new name. That withdraws the notice and answers `true`. A game that ignores the event leaves a notice nobody acts on,
547
+ and a player stays pending until the game calls `renamed`.
548
+ - **Hiding names in the hub is on by default.** This is the one default-on display change of 0.1.9. With `names.maskInHub` (default `true`), a handle the matcher
549
+ flags is shown in the hub as "Blocked words, hidden" until a moderator chooses Show, in queue rows, the case, the Person page, the transcript, the command bar and
550
+ the appeals. It changes only what the hub shows, only for flagged handles. To show names as before, set `overrides.names.maskInHub: false` or switch it off in
551
+ Settings, Advanced, Names. `@chatwarden/http` marks a flagged handle with `handleFlagged` in its staff bodies.
552
+ - **Your store.** The blocked-name methods are optional on `Store`. So is `withdrawNotice(id, at)`, which releases a rename notice (it has no sanction group): a
553
+ store without it cannot release a rename, `renamesEnabled()` is `false` and `requireRename` answers `off`. The SQLite store has all of them; the in-memory store
554
+ has `withdrawNotice` built in and the blocked-name methods through `withMemoryNames(store)`.
555
+
556
+ ## Upgrading to 0.1.9
557
+
558
+ - **From 0.1.8.** SQLite migration 22 is one-way: a database it has run on cannot be opened by 0.1.8 or older. Back it up first.
559
+ - **Unions are wider.** `NoticeKind` gains `rename_required`, `appeal_upheld`, `appeal_reduced` and `appeal_revoked`; `NameReason` gains `name_profane`;
560
+ `AUDIT_ACTIONS` gains `appeal.view`, `appeal.decide` and `name.rename_required` and `AUDIT_TARGET_TYPES` gains `appeal`; `KIT_EVENT_TYPES` gains
561
+ `appeal.created`, `appeal.decided` and `rename.required`. Code with a `switch` that ends in `assertNever` will not compile until it handles them, though none
562
+ of the new values is sent until you turn the feature on.
563
+ - **Types you build by hand.** `RetentionPolicy` gains `appealStatementsMs`, `appealsMs` and `blockedNamesMs`; `PurgeResult` gains `appeals`, `appealStatements`,
564
+ `blockedNames` and `appealsClosed`; `ResolvedProfile` gains `appeals` and `names`; `POLICY_SECTIONS` gains `appeals` and `names`; `AiOutcomeRow` gains `corrective`.
565
+ - **A false positive means something different.** A reduction on appeal is not a false positive. `AppealRuleStats.granted` counts revokes only, and the AI's
566
+ `falsePositives` counts a recommendation to act that the moderator dismissed, or that a revoke corrected.
567
+ - **The AI re-reads once.** The prompt version is now 4, with appeals on or off: every stored read is marked stale and read again, once per open report. See "The AI
568
+ (levels 1 and 2)".
569
+ - **A custom `Store`.** Everything new is optional and its absence turns the feature off (appeals need their methods, renames need `withdrawNotice`, kept names need the
570
+ blocked-name methods). `purgeNotices` has an optional second argument.
571
+
396
572
  ## The AI (levels 1 and 2)
397
573
 
398
574
  Optional help for the moderator, `@experimental` until 0.2 and new in 0.1.7. With an adapter, the kit reads each new report after the player's
@@ -428,7 +604,7 @@ console.log(cw.ai.status()); // { available: true, level: 0, maxLevel: 2, state:
428
604
  note (redacted), your Community Rules and the standard. Flags, mutes and report counts are never sent, nor any id, handle, IP, hash, room or
429
605
  tag. The one exception is the signal feed `feeds.ai` (`profile.signals`, off unless you set it): the counts you chose about the reported player
430
606
  only are sent as one last row, a label, a number of players and a number of days, and the read records what it was shown (shown to moderators as
431
- "Context included: N signal counts"). The prompt version is 3 for everyone, whether or not you use signals: the stable part of the prompt gained a short paragraph about context, so it changes the input hash, and after upgrading from 0.1.7 every stored read is marked stale and read again, once per open report, the first time its case is opened or when the background sweep reaches it. Those reads spend your daily call and money caps, and your provider's prompt cache starts cold. A line the word filter blocked is sent as typed unless you set `blockedLines: 'mask'`: the model needs the words to judge intent.
607
+ "Context included: N signal counts"). The prompt version is 4 for everyone (3 in 0.1.8), whether or not you use signals or appeals: the stable part of the prompt gained a short paragraph about appeal cautions and corrective examples, so it changes the input hash, and after upgrading from 0.1.8 every stored read is marked stale and read again, once per open report, the first time its case is opened or when the background sweep reaches it. Those reads spend your daily call and money caps, and your provider's prompt cache starts cold. A line the word filter blocked is sent as typed unless you set `blockedLines: 'mask'`: the model needs the words to judge intent.
432
608
  - **What it costs.** `dailyBudgetMicros` (default $1.00 a UTC day) is set in code and a hub cannot raise it. The owner also sets a ceiling on
433
609
  calls a day (`profile.ai.dailyCalls`, default 5 000), so an adapter that reports no cost still cannot run unbounded. There are at most 30 calls
434
610
  a minute and 2 at once, a hard deadline per call (`timeoutMs`) and a breaker that opens after repeated failures. At a limit, reads pause. A call that a shutdown aborts books nothing, so a restart loop around a slow provider can under-count the day's money; the call ceiling still bounds it.
@@ -508,7 +684,7 @@ in a browser.
508
684
  | `gate` | `(roomId, subject) => boolean`: who may chat. False refuses the line with `'gate'`. |
509
685
  | `onReport` | Told once for each stored report. It carries subject ids and the evidence: staff channels only. |
510
686
  | `onAutoRestrict` | Told when a blocked line earned an automatic timeout. The same moment is also the `auto.restricted` event. |
511
- | `retention` | How long rows are kept and how often the purge runs (every 6 hours by default), or `false` to run `purge()` yourself. Defaults: reports 90 days, strikes 30, notices 90, audit 365, signals 90 (`signalsMs`, never less than 14). Floors apply. |
687
+ | `retention` | How long rows are kept and how often the purge runs (every 6 hours by default), or `false` to run `purge()` yourself. Defaults: reports 90 days, strikes 30, notices 90, audit 365, signals 90 (`signalsMs`, never less than 14), appeal statements 90 (`appealStatementsMs`, may be 0), appeals 365 (`appealsMs`, never less than 90), kept blocked names 30 (`blockedNamesMs`, may be 0). Floors apply. |
512
688
  | `profile` | `'relaxed'`, `'standard'` (default), `'strict'`, or your own profile from `defineProfile`. |
513
689
  | `overrides` | Changes to the profile, merged onto it (`{ profanity: { mode: 'allow' } }`). A list you give replaces the preset's list. |
514
690
  | `limits` | The numbers the kit enforces: line length and rate, strikes and timeouts, report limits. Each must be a whole number above 0. |
@@ -537,6 +713,9 @@ Bad options throw at creation (`ProfileError`, `RangeError`), before the store i
537
713
  - **Chat text is kept in two places only.** An evidence buffer in memory (the last 100 lines or 15 minutes of each room), and the
538
714
  excerpt copied into a report or a notice when one is made. Reports and notices are deleted by retention. A player's notice
539
715
  quotes only their own lines.
716
+ - **Two more kinds of player text, both opt-in.** An appeal statement (at most 1000 characters, only when appeals are on) is kept in the appeal row and cleared 90 days after
717
+ the decision. A blocked name (only with `names.keepBlocked`) is kept for 30 days. Neither is ever logged, sent in an event, a webhook or a Discord post, or shown to
718
+ another player, and a statement never reaches the AI.
540
719
  - **Moderators' words stay with moderators.** A decision's reason, a gap note, a reporter's note and a moderator's identity are
541
720
  never shown to a player.
542
721
  - **The kit enforces nothing about who may call it.** It has no login. Put your own authentication in front of every staff read,
@@ -2,6 +2,7 @@ import type { DocumentPolicy } from '../documents.js';
2
2
  import type { ReportReason } from '../reporting.js';
3
3
  import type { ReportRecord } from '../types.js';
4
4
  import type { ChosenLines } from './lines.js';
5
+ import type { BuildAIInputArgs } from './prompt.js';
5
6
  import type { AIExampleInput, AIReadInput, AISignal } from './types.js';
6
7
  /** A report ready to be read (or to be compared with a stored read). */
7
8
  export interface Prepared {
@@ -23,7 +24,7 @@ export interface Prepared {
23
24
  /** The real ids of the lines the reported person wrote (among the chosen). */
24
25
  ownLineIds: ReadonlySet<string>;
25
26
  /** The same input with casebook examples and the signal counts about P1 in it (at most two examples are used). The hash does not change. */
26
- build(examples: readonly AIExampleInput[], signals?: readonly AISignal[]): AIReadInput;
27
+ build(examples: readonly AIExampleInput[], signals?: readonly AISignal[], cautions?: BuildAIInputArgs['cautions']): AIReadInput;
27
28
  }
28
29
  export interface PrepareArgs {
29
30
  report: ReportRecord;
@@ -1 +1 @@
1
- {"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/ai/case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMxE,wEAAwE;AACxE,MAAM,WAAW,QAAQ;IACvB,gEAAgE;IAChE,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,2EAA2E;IAC3E,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,uDAAuD;IACvD,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,oEAAoE;IACpE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,8EAA8E;IAC9E,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,4IAA4I;IAC5I,KAAK,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,EAAE,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,GAAG,WAAW,CAAC;CACxF;AAED,MAAM,WAAW,WAAW;IA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AC5I,KAAK,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,EAAE,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,EAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC;CACjI;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,CA2BvD"}
@@ -8,7 +8,7 @@ export function prepareCase(args) {
8
8
  const chosen = chooseLines(report, { mask: args.mask });
9
9
  const reasonId = report.reportedReason ?? null;
10
10
  const reason = reasonId === null ? null : { id: reasonId, label: reasonLabel(args.reasons, reasonId) ?? reasonId };
11
- const build = (examples, signals) => buildAIInput({ policy, reason, chosen, examples, ...(signals === undefined ? {} : { signals }) });
11
+ const build = (examples, signals, cautions) => buildAIInput({ policy, reason, chosen, examples, ...(signals === undefined ? {} : { signals }), ...(cautions === undefined ? {} : { cautions }) });
12
12
  const input = build([]);
13
13
  // The tripwire reads what the players typed (the raw text), whatever is sent.
14
14
  const rawOf = new Map(report.excerpt.map((l) => [l.lineId, l.raw]));
@@ -1 +1 @@
1
- {"version":3,"file":"case.js","sourceRoot":"","sources":["../../../src/ai/case.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAuC3C,MAAM,UAAU,WAAW,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{ AIReadInput } from './types.js';
6
6
  * used instead (`AIStoredRead.exampleIds`). The `example:` rows are therefore left out of the variable part before hashing; no
7
7
  * other row of the data block can begin that way (a chat line starts `L<n> `, the rest are fixed keys). The same goes for the signal
8
8
  * counts row (`Context about P1, ...`): counts move all day, so keying the hash on them would re-read every open report each time
9
- * someone muted someone; the row is a snapshot taken when the read is made. The fields are framed as a
9
+ * someone muted someone; the row is a snapshot taken when the read is made, and so is the row of appeal cautions (`Caution on appeal history: ...`). The fields are framed as a
10
10
  * JSON array, so no part can slide into the next. Object key order in `input` cannot matter: only those values are read. A hex
11
11
  * string of 64 characters.
12
12
  * @experimental
@@ -1,5 +1,5 @@
1
1
  import { sha256Hex } from '../crypto.js';
2
- import { SIGNALS_ROW } from './prompt.js';
2
+ import { CAUTIONS_ROW, SIGNALS_ROW } from './prompt.js';
3
3
  /**
4
4
  * The input hash a stored read is valid for (design section 6): sha256 over the prompt version, the rendered stable prefix (the
5
5
  * policy text that changes meaning), the case's own rendered inputs and the adapter id, in that order. The casebook examples are
@@ -7,7 +7,7 @@ import { SIGNALS_ROW } from './prompt.js';
7
7
  * used instead (`AIStoredRead.exampleIds`). The `example:` rows are therefore left out of the variable part before hashing; no
8
8
  * other row of the data block can begin that way (a chat line starts `L<n> `, the rest are fixed keys). The same goes for the signal
9
9
  * counts row (`Context about P1, ...`): counts move all day, so keying the hash on them would re-read every open report each time
10
- * someone muted someone; the row is a snapshot taken when the read is made. The fields are framed as a
10
+ * someone muted someone; the row is a snapshot taken when the read is made, and so is the row of appeal cautions (`Caution on appeal history: ...`). The fields are framed as a
11
11
  * JSON array, so no part can slide into the next. Object key order in `input` cannot matter: only those values are read. A hex
12
12
  * string of 64 characters.
13
13
  * @experimental
@@ -15,7 +15,7 @@ import { SIGNALS_ROW } from './prompt.js';
15
15
  export function inputHash(input, adapterId) {
16
16
  const caseInputs = input.prompt.variable
17
17
  .split('\n')
18
- .filter((row) => !row.startsWith('example: ') && !row.startsWith(SIGNALS_ROW))
18
+ .filter((row) => !row.startsWith('example: ') && !row.startsWith(SIGNALS_ROW) && !row.startsWith(CAUTIONS_ROW))
19
19
  .join('\n');
20
20
  return sha256Hex(JSON.stringify([input.promptVersion, input.prompt.stable, caseInputs, adapterId]));
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/ai/hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,KAAkB,EAAE,SAAiB;IAC7D,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ;SACrC,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;SAC7E,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACtG,CAAC"}
1
+ {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/ai/hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGxD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,KAAkB,EAAE,SAAiB;IAC7D,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ;SACrC,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;SAC9G,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACtG,CAAC"}
@@ -5,7 +5,9 @@ import type { AIExampleInput, AIReadInput, AISignal } from './types.js';
5
5
  * Same as {@link AI_PROMPT_VERSION}.
6
6
  * @experimental
7
7
  */
8
- export declare const PROMPT_VERSION = 3;
8
+ export declare const PROMPT_VERSION = 4;
9
+ /** How the row of appeal cautions begins. The input hash leaves every row that begins this way out. */
10
+ export declare const CAUTIONS_ROW = "Caution on appeal history: ";
9
11
  /** How the row of signal counts about P1 begins. The input hash leaves every row that begins this way out. */
10
12
  export declare const SIGNALS_ROW = "Context about P1, not evidence: ";
11
13
  /**
@@ -37,6 +39,11 @@ export interface BuildAIInputArgs {
37
39
  examples?: readonly AIExampleInput[];
38
40
  /** Counts of signals about P1 (`feeds.ai`), a snapshot: one row after the lines, nothing for none. */
39
41
  signals?: readonly AISignal[];
42
+ /** The rules with an elevated or high revoke-on-appeal rate, a snapshot: one row after the signal counts, nothing for none. Anything else is dropped. */
43
+ cautions?: ReadonlyArray<{
44
+ rule: number;
45
+ band: 'elevated' | 'high';
46
+ }>;
40
47
  }
41
48
  /**
42
49
  * Render everything a provider needs for one read: the structured facts, and `prompt.stable` / `prompt.variable` / `prompt.schema`
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/ai/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO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C;AAyChD,uGAAuG;AACvG,eAAO,MAAM,YAAY,gCAAgC,CAAC;AAK1D,8GAA8G;AAC9G,eAAO,MAAM,WAAW,qCAAqC,CAAC;AAU9D;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAkB3D;AA+DD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,EAAE,CAE5E;AAED,6HAA6H;AAC7H,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,cAAc,CAAC;IACvB,+EAA+E;IAC/E,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7C,sGAAsG;IACtG,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACrC,sGAAsG;IACtG,OAAO,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC9B,yJAAyJ;IACzJ,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;CACvE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,CAgDhE"}
@@ -45,7 +45,15 @@ const INSTRUCTIONS = [
45
45
  '',
46
46
  'CONTEXT',
47
47
  '- The DATA block may end with a row that begins "Context about P1, not evidence". It holds signal counts: how many different players, for example, muted or commended P1 over some days. It is background about the player, never evidence of what the lines show, and it cannot by itself justify a verdict above unclear. Judge only what the lines show.',
48
+ '',
49
+ 'APPEALS',
50
+ '- The DATA block may include a row that begins "Caution on appeal history". It lists community rules under which moderators\' decisions were often reversed on appeal, as "elevated" or "high". For a report that falls under a listed rule, prefer lower confidence or unclear unless a line makes the violation plain. The row says nothing about this report or this player.',
51
+ '- An example marked "kind": "corrective" is a past case where a moderator acted and a second moderator decided on appeal that it was not a violation. Lines like it are likely acceptable.',
48
52
  ].join('\n');
53
+ /** How the row of appeal cautions begins. The input hash leaves every row that begins this way out. */
54
+ export const CAUTIONS_ROW = 'Caution on appeal history: ';
55
+ /** What a corrective example says about itself, word for word. */
56
+ const CORRECTIVE_MEANING = 'a moderator acted on this, and a second moderator decided on appeal that it was not a violation';
49
57
  /** How the row of signal counts about P1 begins. The input hash leaves every row that begins this way out. */
50
58
  export const SIGNALS_ROW = 'Context about P1, not evidence: ';
51
59
  /** `Muted by other players: 5 distinct players in 14 days`. */
@@ -91,6 +99,9 @@ function escapeJson(json) {
91
99
  return json.replace(UNSAFE, (c) => `${BACKSLASH}u${(c.codePointAt(0) ?? 0).toString(16).padStart(4, '0')}`);
92
100
  }
93
101
  function renderExample(e) {
102
+ if (e.kind === 'corrective') {
103
+ return `example: ${escapeJson(JSON.stringify({ rule: e.rule, severity: e.severity, verdict: e.verdict, kind: 'corrective', meaning: CORRECTIVE_MEANING, lines: e.lines }))}`;
104
+ }
94
105
  return `example: ${escapeJson(JSON.stringify({ rule: e.rule, severity: e.severity, verdict: e.verdict, lines: e.lines }))}`;
95
106
  }
96
107
  /**
@@ -102,7 +113,7 @@ function fitExample(e) {
102
113
  // The tripwire runs on example text too: a stored line that tries to instruct the AI never reaches a later prompt (design layer 5).
103
114
  if (e.lines.some((l) => looksLikeInjection(String(l.text))))
104
115
  return null;
105
- const out = { rule: e.rule, severity: e.severity, verdict: e.verdict, lines: [] };
116
+ const out = { ...(e.kind === 'corrective' ? { kind: 'corrective' } : {}), rule: e.rule, severity: e.severity, verdict: e.verdict, lines: [] };
106
117
  for (const l of e.lines.slice(0, EXAMPLE_LINES)) {
107
118
  const line = { who: oneLine(String(l.who)), text: redactText(String(l.text), [], () => null) };
108
119
  const withLine = (text) => ({ ...out, lines: [...out.lines, { who: line.who, text }] });
@@ -162,6 +173,12 @@ export function buildAIInput(args) {
162
173
  const lines = chosen.lines.map((l) => ({ ref: l.ref, secondsIn: l.secondsIn, who: l.who, text: l.text, blocked: l.blocked, filtered: l.filtered }));
163
174
  const people = chosen.people.map((p) => ({ alias: p.alias, role: p.role }));
164
175
  const signals = (args.signals ?? []).map((s) => ({ label: oneLine(s.label), polarity: s.polarity, distinct: s.distinct, windowDays: s.windowDays }));
176
+ // A caution is a rule number and one of two words, copied value by value: nothing else a caller passes can reach the prompt.
177
+ const cautions = [];
178
+ for (const c of args.cautions ?? []) {
179
+ if (Number.isSafeInteger(c.rule) && c.rule >= 1 && (c.band === 'elevated' || c.band === 'high'))
180
+ cautions.push({ rule: c.rule, band: c.band });
181
+ }
165
182
  const data = [
166
183
  '<data>',
167
184
  ...examples.map(renderExample),
@@ -173,6 +190,7 @@ export function buildAIInput(args) {
173
190
  ...lines.map((l) => `${l.ref} +${l.secondsIn}s ${l.who}${l.blocked ? ' blocked' : l.filtered ? ' filtered' : ''} ${lit(l.text)}`),
174
191
  // After the lines, so it is the last thing in the block. The labels are the adopter's own (plain, at most 60 characters); one line, no tag.
175
192
  ...(signals.length === 0 ? [] : [escapeJson(`${SIGNALS_ROW}${signals.map(countRow).join('; ')}.`)]),
193
+ ...(cautions.length === 0 ? [] : [`${CAUTIONS_ROW}${cautions.map((c) => `CR ${c.rule} ${c.band}`).join('; ')}.`]),
176
194
  '</data>',
177
195
  ];
178
196
  return {
@@ -190,6 +208,7 @@ export function buildAIInput(args) {
190
208
  standard: oneLine(profile.aiContext),
191
209
  examples,
192
210
  ...(signals.length === 0 ? {} : { signals }),
211
+ ...(cautions.length === 0 ? {} : { cautions }),
193
212
  prompt: { stable: `${INSTRUCTIONS}\n\n${aiPolicyText(policy)}`, variable: `${data.join('\n')}\n`, schema: AI_OUTPUT_SCHEMA },
194
213
  };
195
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"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CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACnF,CAAC,CAAC;QACF,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;QACpC,QAAQ;QACR,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;QAC5C,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC9C,MAAM,EAAE,EAAE,MAAM,EAAE,GAAG,YAAY,OAAO,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE;KAC7H,CAAC;AACJ,CAAC"}
@@ -182,11 +182,15 @@ export interface AiFacade {
182
182
  since?: number;
183
183
  }): AiStatsView;
184
184
  /**
185
- * The one function the appeals inbox calls when a decision is reversed (a granted appeal, a take-back): the report's casebook row can
186
- * never teach again, loses its example text, and counts as an AI false positive when the AI had recommended action. True when the
187
- * report has a row.
185
+ * The one function the appeals inbox calls when a decision is reversed on appeal: the report's casebook row can never teach as a
186
+ * positive example again and loses its example text. With `{ corrective: true }` (a REVOKE: a second moderator found the decision
187
+ * wrong) the example text is kept and becomes a corrective example, and the row counts as an AI false positive when the AI had
188
+ * recommended action. Without it (a REDUCE: the rule applied, the sanction was too heavy) the row only stops teaching: it is not a
189
+ * false positive and teaches nothing. True when the report has a row.
188
190
  */
189
- markReversed(reportId: string): boolean;
191
+ markReversed(reportId: string, opts?: {
192
+ corrective?: boolean;
193
+ }): boolean;
190
194
  /** A senior's "don't teach" mark on a decided case: the row can never teach again and loses its example text. True when the report has a row. */
191
195
  dontTeach(reportId: string): boolean;
192
196
  /** Resolves when no read is queued or running (tests, graceful shutdown). */
@@ -238,6 +242,11 @@ export interface AiServiceDeps {
238
242
  exampleRetentionMs: () => number;
239
243
  /** The signal counts about a person for the AI read (`feeds.ai`): empty with the feed off. Without it no signals are sent. */
240
244
  signals?: (subject: SubjectId) => AISignal[];
245
+ /** The rules with an elevated or high revoke-on-appeal rate (90 days): empty with appeals off. Without it no cautions are sent. */
246
+ cautions?: () => Array<{
247
+ rule: number;
248
+ band: 'elevated' | 'high';
249
+ }>;
241
250
  }
242
251
  export declare class AiService implements AiFacade {
243
252
  protected readonly store: AiStore;
@@ -279,7 +288,9 @@ export declare class AiService implements AiFacade {
279
288
  stats(q?: {
280
289
  since?: number;
281
290
  }): AiStatsView;
282
- markReversed(reportId: string): boolean;
291
+ markReversed(reportId: string, opts?: {
292
+ corrective?: boolean;
293
+ }): boolean;
283
294
  dontTeach(reportId: string): boolean;
284
295
  private mark;
285
296
  idle(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/ai/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGrD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,KAAK,EAAE,eAAe,EAAa,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzI,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,UAAU,EAA8B,MAAM,aAAa,CAAC;AAErE,OAAO,KAAK,E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