@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.
- package/README.md +184 -5
- package/dist/src/ai/case.d.ts +2 -1
- package/dist/src/ai/case.d.ts.map +1 -1
- package/dist/src/ai/case.js +1 -1
- package/dist/src/ai/case.js.map +1 -1
- package/dist/src/ai/hash.d.ts +1 -1
- package/dist/src/ai/hash.js +3 -3
- package/dist/src/ai/hash.js.map +1 -1
- package/dist/src/ai/prompt.d.ts +8 -1
- package/dist/src/ai/prompt.d.ts.map +1 -1
- package/dist/src/ai/prompt.js +20 -1
- package/dist/src/ai/prompt.js.map +1 -1
- package/dist/src/ai/service.d.ts +16 -5
- package/dist/src/ai/service.d.ts.map +1 -1
- package/dist/src/ai/service.js +12 -7
- package/dist/src/ai/service.js.map +1 -1
- package/dist/src/ai/types.d.ts +17 -2
- package/dist/src/ai/types.d.ts.map +1 -1
- package/dist/src/ai/types.js +3 -2
- package/dist/src/ai/types.js.map +1 -1
- package/dist/src/ai/worker.d.ts +5 -0
- package/dist/src/ai/worker.d.ts.map +1 -1
- package/dist/src/ai/worker.js +9 -2
- package/dist/src/ai/worker.js.map +1 -1
- package/dist/src/appealService.d.ts +105 -0
- package/dist/src/appealService.d.ts.map +1 -0
- package/dist/src/appealService.js +548 -0
- package/dist/src/appealService.js.map +1 -0
- package/dist/src/appeals.d.ts +194 -0
- package/dist/src/appeals.d.ts.map +1 -0
- package/dist/src/appeals.js +107 -0
- package/dist/src/appeals.js.map +1 -0
- package/dist/src/audit.d.ts +7 -3
- package/dist/src/audit.d.ts.map +1 -1
- package/dist/src/audit.js +18 -3
- package/dist/src/audit.js.map +1 -1
- package/dist/src/chatwarden.d.ts +129 -9
- package/dist/src/chatwarden.d.ts.map +1 -1
- package/dist/src/chatwarden.js +94 -19
- package/dist/src/chatwarden.js.map +1 -1
- package/dist/src/decide.d.ts +2 -0
- package/dist/src/decide.d.ts.map +1 -1
- package/dist/src/decide.js +12 -7
- package/dist/src/decide.js.map +1 -1
- package/dist/src/documents.d.ts +1 -1
- package/dist/src/documents.d.ts.map +1 -1
- package/dist/src/documents.js +3 -1
- package/dist/src/documents.js.map +1 -1
- package/dist/src/events.d.ts +38 -0
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +3 -0
- package/dist/src/events.js.map +1 -1
- package/dist/src/index.d.ts +9 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/nameService.d.ts +90 -0
- package/dist/src/nameService.d.ts.map +1 -0
- package/dist/src/nameService.js +224 -0
- package/dist/src/nameService.js.map +1 -0
- package/dist/src/names.d.ts +68 -0
- package/dist/src/names.d.ts.map +1 -0
- package/dist/src/names.js +87 -0
- package/dist/src/names.js.map +1 -0
- package/dist/src/notices.d.ts +53 -5
- package/dist/src/notices.d.ts.map +1 -1
- package/dist/src/notices.js +93 -8
- package/dist/src/notices.js.map +1 -1
- package/dist/src/policy.d.ts +9 -0
- package/dist/src/policy.d.ts.map +1 -1
- package/dist/src/policy.js +20 -2
- package/dist/src/policy.js.map +1 -1
- package/dist/src/profile.d.ts +23 -1
- package/dist/src/profile.d.ts.map +1 -1
- package/dist/src/profile.js +14 -2
- package/dist/src/profile.js.map +1 -1
- package/dist/src/retention.d.ts +31 -1
- package/dist/src/retention.d.ts.map +1 -1
- package/dist/src/retention.js +41 -3
- package/dist/src/retention.js.map +1 -1
- package/dist/src/sanctions.d.ts +29 -1
- package/dist/src/sanctions.d.ts.map +1 -1
- package/dist/src/sanctions.js +52 -9
- package/dist/src/sanctions.js.map +1 -1
- package/dist/src/staffViews.d.ts +18 -0
- package/dist/src/staffViews.d.ts.map +1 -1
- package/dist/src/staffViews.js +14 -0
- package/dist/src/staffViews.js.map +1 -1
- package/dist/src/types.d.ts +198 -6
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/package.json +2 -2
- package/src/ai/case.ts +4 -2
- package/src/ai/hash.ts +3 -3
- package/src/ai/prompt.ts +23 -1
- package/src/ai/service.ts +21 -12
- package/src/ai/types.ts +14 -2
- package/src/ai/worker.ts +10 -2
- package/src/appealService.ts +584 -0
- package/src/appeals.ts +256 -0
- package/src/audit.ts +18 -3
- package/src/chatwarden.ts +199 -21
- package/src/decide.ts +13 -7
- package/src/documents.ts +6 -3
- package/src/events.ts +23 -1
- package/src/index.ts +12 -1
- package/src/nameService.ts +255 -0
- package/src/names.ts +121 -0
- package/src/notices.ts +112 -14
- package/src/policy.ts +20 -3
- package/src/profile.ts +34 -2
- package/src/retention.ts +63 -3
- package/src/sanctions.ts +72 -9
- package/src/staffViews.ts +30 -0
- package/src/types.ts +210 -7
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { RuleRef } from './rules.js';
|
|
2
|
+
import type { SanctionKind, SubjectId } from './types.js';
|
|
3
|
+
/** The longest statement, in characters. A constant, not a setting: it bounds what is stored. @experimental */
|
|
4
|
+
export declare const APPEAL_STATEMENT_MAX = 1000;
|
|
5
|
+
/** What a moderator may rule on an appeal: the sanction stands, is made lighter, or is lifted. @experimental */
|
|
6
|
+
export declare const APPEAL_OUTCOMES: readonly ["uphold", "reduce", "revoke"];
|
|
7
|
+
export type AppealOutcome = (typeof APPEAL_OUTCOMES)[number];
|
|
8
|
+
/**
|
|
9
|
+
* Where an appeal stands. `open` until decided; `upheld`, `reduced` and `revoked` are the three outcomes; `moot` means the sanction was
|
|
10
|
+
* revoked by someone else while the appeal was open, so nobody ruled on it.
|
|
11
|
+
* @experimental
|
|
12
|
+
*/
|
|
13
|
+
export type AppealStatus = 'open' | 'upheld' | 'reduced' | 'revoked' | 'moot';
|
|
14
|
+
/**
|
|
15
|
+
* How appeals run. Every field is optional; a profile without `appeals` has them off.
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
18
|
+
export interface AppealSettings {
|
|
19
|
+
/** Default false. */
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
/** Appeals one player may file in any rolling 7 days. 1 to 20, default 3. */
|
|
22
|
+
perPlayerPerWeek?: number;
|
|
23
|
+
/** May the moderator who made the original decision decide the appeal? Default false. For a team of one. */
|
|
24
|
+
allowSelfReview?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What the kit reads: every field filled in.
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
|
+
export interface ResolvedAppeals {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
perPlayerPerWeek: number;
|
|
33
|
+
allowSelfReview: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validate and fill. Throws ProfileError naming the field (`appeals.perPlayerPerWeek`), never echoing the value. `path` names the
|
|
37
|
+
* settings in the error (default `appeals`). The result is a new object that shares nothing with the input; each value is read from
|
|
38
|
+
* `input` once.
|
|
39
|
+
* @experimental
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveAppeals(input: AppealSettings | undefined, path?: string): ResolvedAppeals;
|
|
42
|
+
/** What a player sees of an appeal. No staff field, no reason, no id of a sanction or a person. @experimental */
|
|
43
|
+
export interface PlayerAppeal {
|
|
44
|
+
id: string;
|
|
45
|
+
/** The notice it was filed from. */
|
|
46
|
+
noticeId: string;
|
|
47
|
+
status: 'open' | 'upheld' | 'reduced' | 'revoked';
|
|
48
|
+
createdAt: number;
|
|
49
|
+
decidedAt: number | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Why a filing was refused. `not_found` is one answer for "not yours", "no such notice" and "malformed", so notice ids cannot be probed.
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
export type AppealRefusal = 'off' | 'not_found' | 'not_appealable' | 'statement_invalid' | 'already_appealed' | 'rate';
|
|
56
|
+
/** @experimental */
|
|
57
|
+
export type AppealFileResult = {
|
|
58
|
+
ok: true;
|
|
59
|
+
appeal: PlayerAppeal;
|
|
60
|
+
} | {
|
|
61
|
+
ok: false;
|
|
62
|
+
refused: AppealRefusal;
|
|
63
|
+
retryAfterMs?: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Clean a statement before it is counted or stored: line and paragraph separators become newlines and tabs spaces; control, bidirectional
|
|
67
|
+
* and zero-width characters, the soft hyphen, the Hangul fillers, the braille blank, the grapheme joiner, variation selectors, annotation
|
|
68
|
+
* marks, tag characters, NUL and lone surrogates are removed; every line loses its trailing space; runs of blank lines
|
|
69
|
+
* collapse to one; the whole is trimmed. Pure, idempotent, never throws; anything that is not a string, and a string longer than twenty times
|
|
70
|
+
* the cap, gives an empty string (which the filing refuses). Count the result in code points, not UTF-16 units.
|
|
71
|
+
* @experimental
|
|
72
|
+
*/
|
|
73
|
+
export declare function normalizeStatement(input: unknown): string;
|
|
74
|
+
/** The length of a cleaned statement in characters (code points), the unit {@link APPEAL_STATEMENT_MAX} counts in. */
|
|
75
|
+
export declare function statementLength(text: string): number;
|
|
76
|
+
/** The four sanction kinds an appeal can concern, lightest first: a reduction must go to a lower kind, or to the same kind and shorter. */
|
|
77
|
+
export declare const SANCTION_KIND_ORDER: readonly ["warning", "chat", "area", "ban"];
|
|
78
|
+
/**
|
|
79
|
+
* A moderator's ruling on an appeal.
|
|
80
|
+
* @experimental
|
|
81
|
+
*/
|
|
82
|
+
export interface AppealDecision {
|
|
83
|
+
appealId: string;
|
|
84
|
+
outcome: AppealOutcome;
|
|
85
|
+
/** A staff ref the audit trail accepts. */
|
|
86
|
+
actor: string;
|
|
87
|
+
/** Private, 1 to 500 characters after trimming. Never shown to the player. */
|
|
88
|
+
reason: string;
|
|
89
|
+
/** `reduce` only: the lighter outcome that replaces the sanction. A warning has no length (`null`). */
|
|
90
|
+
to?: {
|
|
91
|
+
kind: 'warning' | 'chat' | 'area' | 'ban';
|
|
92
|
+
durationMs: number | null;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** @experimental */
|
|
96
|
+
export type AppealDecideResult = {
|
|
97
|
+
ok: true;
|
|
98
|
+
status: 'upheld' | 'reduced' | 'revoked';
|
|
99
|
+
replacementGroupId?: string;
|
|
100
|
+
} | {
|
|
101
|
+
ok: false;
|
|
102
|
+
error: 'not_found' | 'already_decided' | 'invalid' | 'same_decider' | 'gone';
|
|
103
|
+
};
|
|
104
|
+
/** Below this many sanctions in the window a rule has no rate. */
|
|
105
|
+
export declare const APPEAL_STATS_MIN_SANCTIONS = 10;
|
|
106
|
+
/** A rule whose rate is at or above this is `elevated`. */
|
|
107
|
+
export declare const APPEAL_RATE_ELEVATED = 0.15;
|
|
108
|
+
/** A rule whose rate is at or above this is `high`. */
|
|
109
|
+
export declare const APPEAL_RATE_HIGH = 0.3;
|
|
110
|
+
/**
|
|
111
|
+
* One appeal as staff see it in a list. The statement is NOT here (see {@link AppealDetail}); `statementFlagged` says whether it trips the
|
|
112
|
+
* term filter, so the hub can mask it. Carries a staff ref: staff channels only, never send to a player.
|
|
113
|
+
* @experimental
|
|
114
|
+
*/
|
|
115
|
+
export interface AppealSummary {
|
|
116
|
+
id: string;
|
|
117
|
+
createdAt: number;
|
|
118
|
+
status: AppealStatus;
|
|
119
|
+
/** A staff ref. */
|
|
120
|
+
person: SubjectId;
|
|
121
|
+
/** The sanction. `decidedBy` is who made the original decision (the actor on its row); `''` and the appeal's own times when its rows are gone. */
|
|
122
|
+
sanction: {
|
|
123
|
+
groupId: string;
|
|
124
|
+
refCode: string;
|
|
125
|
+
kind: SanctionKind;
|
|
126
|
+
rule: RuleRef | null;
|
|
127
|
+
startsAt: number;
|
|
128
|
+
endsAt: number | null;
|
|
129
|
+
decidedBy: string;
|
|
130
|
+
automated: boolean;
|
|
131
|
+
};
|
|
132
|
+
statementFlagged: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* One appeal in full, for one staff read (audited by the route).
|
|
136
|
+
* @experimental
|
|
137
|
+
*/
|
|
138
|
+
export interface AppealDetail extends AppealSummary {
|
|
139
|
+
/** The player's words. Staff only. Null once purged. Masked by the hub when `statementFlagged`. */
|
|
140
|
+
statement: string | null;
|
|
141
|
+
/** Who decided (or, for a moot appeal, who revoked the sanction), when, and why (private; empty for a moot appeal), once it is no longer open. */
|
|
142
|
+
decided: {
|
|
143
|
+
by: string;
|
|
144
|
+
at: number;
|
|
145
|
+
reason: string;
|
|
146
|
+
replacementGroupId: string | null;
|
|
147
|
+
} | null;
|
|
148
|
+
/** The report whose decision made the sanction, when known. */
|
|
149
|
+
reportId: string | null;
|
|
150
|
+
/** What the player was shown with the sanction: their own lines, as the notice kept them (already masked where blocked). */
|
|
151
|
+
shown: Array<{
|
|
152
|
+
text: string;
|
|
153
|
+
day: string;
|
|
154
|
+
}>;
|
|
155
|
+
}
|
|
156
|
+
/** @experimental */
|
|
157
|
+
export interface AppealPage {
|
|
158
|
+
items: AppealSummary[];
|
|
159
|
+
/** An opaque cursor for the next page, or null when this page was not full. */
|
|
160
|
+
next: string | null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The appeal counts of one rule over a window. `granted` is REVOKED appeals only: a reduction is a severity dispute, not a false positive,
|
|
164
|
+
* so it is `lightened`, shown beside the rate and never in it.
|
|
165
|
+
* @experimental
|
|
166
|
+
*/
|
|
167
|
+
export interface AppealRuleStats {
|
|
168
|
+
rule: number | 'uncovered';
|
|
169
|
+
/** Sanctions given under the rule in the window (warning, chat, area, ban; notes are not counted, a reduction counts once). */
|
|
170
|
+
sanctions: number;
|
|
171
|
+
/** Appeals filed in the window (any outcome, a moot one included). */
|
|
172
|
+
appealed: number;
|
|
173
|
+
/** Revoked on appeal. */
|
|
174
|
+
granted: number;
|
|
175
|
+
/** Reduced on appeal. */
|
|
176
|
+
lightened: number;
|
|
177
|
+
/** granted / sanctions, or null below {@link APPEAL_STATS_MIN_SANCTIONS} sanctions. */
|
|
178
|
+
rate: number | null;
|
|
179
|
+
band: 'normal' | 'elevated' | 'high' | null;
|
|
180
|
+
}
|
|
181
|
+
/** @experimental */
|
|
182
|
+
export interface AppealStats {
|
|
183
|
+
windowDays: number;
|
|
184
|
+
/** By rule number, `'uncovered'` last. */
|
|
185
|
+
perRule: AppealRuleStats[];
|
|
186
|
+
overall: {
|
|
187
|
+
sanctions: number;
|
|
188
|
+
appealed: number;
|
|
189
|
+
granted: number;
|
|
190
|
+
lightened: number;
|
|
191
|
+
rate: number | null;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=appeals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appeals.d.ts","sourceRoot":"","sources":["../../src/appeals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM1D,+GAA+G;AAC/G,eAAO,MAAM,oBAAoB,OAAO,CAAC;AASzC,gHAAgH;AAChH,eAAO,MAAM,eAAe,yCAA0C,CAAC;AACvE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9E;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,qBAAqB;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4GAA4G;IAC5G,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAaD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,EAAE,IAAI,SAAY,GAA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AAA;KAAE,GAAG,IAAI,CAAC;IAC9F,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,4HAA4H;IAC5H,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7C;AAED,oBAAoB;AACpB,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,+HAA+H;IAC/H,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,oBAAoB;AACpB,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC3G"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { ProfileError } from './profileError.js';
|
|
2
|
+
// The appeal settings: whether players may appeal a sanction, how many a week, and whether the moderator who made a decision may
|
|
3
|
+
// decide its appeal. Pure data and validation, no state and no clock; the service that acts on them comes later. Off until set, so a
|
|
4
|
+
// kit that sets nothing behaves exactly as before.
|
|
5
|
+
/** The longest statement, in characters. A constant, not a setting: it bounds what is stored. @experimental */
|
|
6
|
+
export const APPEAL_STATEMENT_MAX = 1000;
|
|
7
|
+
/** The allowed whole-number range of `perPlayerPerWeek`, and its default. */
|
|
8
|
+
const PER_WEEK_MIN = 1;
|
|
9
|
+
const PER_WEEK_MAX = 20;
|
|
10
|
+
const PER_WEEK_DEFAULT = 3;
|
|
11
|
+
const KEYS = ['enabled', 'perPlayerPerWeek', 'allowSelfReview'];
|
|
12
|
+
/** What a moderator may rule on an appeal: the sanction stands, is made lighter, or is lifted. @experimental */
|
|
13
|
+
export const APPEAL_OUTCOMES = ['uphold', 'reduce', 'revoke'];
|
|
14
|
+
function isPlain(v) {
|
|
15
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
16
|
+
return false;
|
|
17
|
+
const proto = Object.getPrototypeOf(v);
|
|
18
|
+
return proto === Object.prototype || proto === null;
|
|
19
|
+
}
|
|
20
|
+
/** An own, defined value: a key left out, `undefined` and an inherited property all read as "not given". */
|
|
21
|
+
function given(o, key) {
|
|
22
|
+
return Object.hasOwn(o, key) ? o[key] : undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Validate and fill. Throws ProfileError naming the field (`appeals.perPlayerPerWeek`), never echoing the value. `path` names the
|
|
26
|
+
* settings in the error (default `appeals`). The result is a new object that shares nothing with the input; each value is read from
|
|
27
|
+
* `input` once.
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
|
+
export function resolveAppeals(input, path = 'appeals') {
|
|
31
|
+
if (input === undefined)
|
|
32
|
+
return { enabled: false, perPlayerPerWeek: PER_WEEK_DEFAULT, allowSelfReview: false };
|
|
33
|
+
if (!isPlain(input))
|
|
34
|
+
throw new ProfileError(path, 'must be an object');
|
|
35
|
+
for (const k of Object.keys(input))
|
|
36
|
+
if (!KEYS.includes(k))
|
|
37
|
+
throw new ProfileError(`${path}.${k}`, 'is not a known setting');
|
|
38
|
+
const enabled = given(input, 'enabled');
|
|
39
|
+
const perWeek = given(input, 'perPlayerPerWeek');
|
|
40
|
+
const self = given(input, 'allowSelfReview');
|
|
41
|
+
if (enabled !== undefined && typeof enabled !== 'boolean')
|
|
42
|
+
throw new ProfileError(`${path}.enabled`, 'must be true or false');
|
|
43
|
+
if (perWeek !== undefined && (typeof perWeek !== 'number' || !Number.isSafeInteger(perWeek) || perWeek < PER_WEEK_MIN || perWeek > PER_WEEK_MAX)) {
|
|
44
|
+
throw new ProfileError(`${path}.perPlayerPerWeek`, `must be a whole number from ${PER_WEEK_MIN} to ${PER_WEEK_MAX}`);
|
|
45
|
+
}
|
|
46
|
+
if (self !== undefined && typeof self !== 'boolean')
|
|
47
|
+
throw new ProfileError(`${path}.allowSelfReview`, 'must be true or false');
|
|
48
|
+
return {
|
|
49
|
+
enabled: enabled ?? false,
|
|
50
|
+
perPlayerPerWeek: perWeek ?? PER_WEEK_DEFAULT,
|
|
51
|
+
allowSelfReview: self ?? false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** The most UTF-16 units of raw text the cleaner will look at: far past the cap, so a huge paste is refused without being worked through. */
|
|
55
|
+
const STATEMENT_RAW_MAX = APPEAL_STATEMENT_MAX * 20;
|
|
56
|
+
// Line and paragraph separators and the C1 next-line become a newline; a tab becomes a space.
|
|
57
|
+
const NEWLINES = /\r\n|[\r\u0085\u2028\u2029]/g;
|
|
58
|
+
// Control characters other than newline (tab is handled before), bidirectional controls and marks, zero-width and invisible format
|
|
59
|
+
// characters, the soft hyphen, the Mongolian vowel separator, the Hangul fillers (U+115F, U+1160, U+3164, U+FFA0), the braille blank
|
|
60
|
+
// (U+2800), the combining grapheme joiner (U+034F), the variation selectors (U+FE00 to U+FE0E; U+FE0F, the emoji presentation selector, is kept: it is common and harmless) and the interlinear annotation marks
|
|
61
|
+
// (U+FFF9 to U+FFFB). Each draws nothing, so a statement made of them would look blank to the staff reader.
|
|
62
|
+
// eslint-disable-next-line no-control-regex, no-misleading-character-class
|
|
63
|
+
const STRIPPED = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u180e\u200b-\u200f\u202a-\u202e\u2060-\u2069\u2800\u3164\ufe00-\ufe0e\ufeff\uffa0\ufff9-\ufffb]/g;
|
|
64
|
+
// Beyond the BMP (so this one needs the `u` flag): the tag characters (U+E0000 to U+E007F), which can carry hidden text, and the
|
|
65
|
+
// variation selectors supplement (U+E0100 to U+E01EF).
|
|
66
|
+
// eslint-disable-next-line no-misleading-character-class
|
|
67
|
+
const STRIPPED_ASTRAL = /[\u{e0000}-\u{e007f}\u{e0100}-\u{e01ef}]/gu;
|
|
68
|
+
// A surrogate with no partner: it cannot be stored as UTF-8 (SQLite writes U+FFFD, the memory store keeps it), so both are removed first.
|
|
69
|
+
const LONE_SURROGATE = /[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;
|
|
70
|
+
/**
|
|
71
|
+
* Clean a statement before it is counted or stored: line and paragraph separators become newlines and tabs spaces; control, bidirectional
|
|
72
|
+
* and zero-width characters, the soft hyphen, the Hangul fillers, the braille blank, the grapheme joiner, variation selectors, annotation
|
|
73
|
+
* marks, tag characters, NUL and lone surrogates are removed; every line loses its trailing space; runs of blank lines
|
|
74
|
+
* collapse to one; the whole is trimmed. Pure, idempotent, never throws; anything that is not a string, and a string longer than twenty times
|
|
75
|
+
* the cap, gives an empty string (which the filing refuses). Count the result in code points, not UTF-16 units.
|
|
76
|
+
* @experimental
|
|
77
|
+
*/
|
|
78
|
+
export function normalizeStatement(input) {
|
|
79
|
+
if (typeof input !== 'string' || input.length > STATEMENT_RAW_MAX)
|
|
80
|
+
return '';
|
|
81
|
+
const text = input
|
|
82
|
+
.replace(NEWLINES, '\n')
|
|
83
|
+
.replace(/\t/g, ' ')
|
|
84
|
+
.replace(LONE_SURROGATE, '')
|
|
85
|
+
.replace(STRIPPED, '')
|
|
86
|
+
.replace(STRIPPED_ASTRAL, '')
|
|
87
|
+
.split('\n')
|
|
88
|
+
.map((line) => line.trimEnd())
|
|
89
|
+
.join('\n')
|
|
90
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
91
|
+
.trim();
|
|
92
|
+
// U+FE0F is kept inside a text, but it draws nothing: a statement of nothing else is as blank as any other invisible one.
|
|
93
|
+
return /^[\s️]*$/.test(text) ? '' : text;
|
|
94
|
+
}
|
|
95
|
+
/** The length of a cleaned statement in characters (code points), the unit {@link APPEAL_STATEMENT_MAX} counts in. */
|
|
96
|
+
export function statementLength(text) {
|
|
97
|
+
return [...text].length;
|
|
98
|
+
}
|
|
99
|
+
/** The four sanction kinds an appeal can concern, lightest first: a reduction must go to a lower kind, or to the same kind and shorter. */
|
|
100
|
+
export const SANCTION_KIND_ORDER = ['warning', 'chat', 'area', 'ban'];
|
|
101
|
+
/** Below this many sanctions in the window a rule has no rate. */
|
|
102
|
+
export const APPEAL_STATS_MIN_SANCTIONS = 10;
|
|
103
|
+
/** A rule whose rate is at or above this is `elevated`. */
|
|
104
|
+
export const APPEAL_RATE_ELEVATED = 0.15;
|
|
105
|
+
/** A rule whose rate is at or above this is `high`. */
|
|
106
|
+
export const APPEAL_RATE_HIGH = 0.3;
|
|
107
|
+
//# sourceMappingURL=appeals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appeals.js","sourceRoot":"","sources":["../../src/appeals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,iIAAiI;AACjI,qIAAqI;AACrI,mDAAmD;AAEnD,+GAA+G;AAC/G,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAEzC,6EAA6E;AAC7E,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,gBAAgB,GAAG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AAC"}
|
package/dist/src/audit.d.ts
CHANGED
|
@@ -10,8 +10,12 @@ export type Role = (typeof ROLES)[number];
|
|
|
10
10
|
* The three `ai.*` actions target a report and carry no detail: `ai.read` is written by the AI itself (an `ai:` actor, no role)
|
|
11
11
|
* when a read finishes, `ai.rerun` by a moderator who asked for another read, `ai.outcome` by a moderator whose decision was
|
|
12
12
|
* recorded against a read.
|
|
13
|
+
*
|
|
14
|
+
* The three appeal and name actions (0.1.9): `appeal.view` is a staff read of the inbox, one appeal or the numbers (its target is the
|
|
15
|
+
* `appeal`, or none for the list and the numbers); `appeal.decide` points at the `appeal` decided and needs it; `name.rename_required`
|
|
16
|
+
* points at the `person` asked to rename and needs it. None of them carries a detail: a statement, a reason or a name never reaches the trail.
|
|
13
17
|
*/
|
|
14
|
-
export declare const AUDIT_ACTIONS: readonly ["report.view", "report.decide", "sanction.apply", "sanction.revoke", "gap.close", "term.add", "term.update", "term.toggle", "exception.add", "exception.update", "exception.toggle", "history.view", "suggest", "policy.view", "blocked.view", "case.takeover", "reason.add", "reason.update", "reason.toggle", "policy.update", "policy.reset", "report.dismiss_case", "report.dismiss_reporter", "ai.read", "ai.rerun", "ai.outcome"];
|
|
18
|
+
export declare const AUDIT_ACTIONS: readonly ["report.view", "report.decide", "sanction.apply", "sanction.revoke", "gap.close", "term.add", "term.update", "term.toggle", "exception.add", "exception.update", "exception.toggle", "history.view", "suggest", "policy.view", "blocked.view", "case.takeover", "reason.add", "reason.update", "reason.toggle", "policy.update", "policy.reset", "report.dismiss_case", "report.dismiss_reporter", "ai.read", "ai.rerun", "ai.outcome", "appeal.view", "appeal.decide", "name.rename_required"];
|
|
15
19
|
export type AuditAction = (typeof AUDIT_ACTIONS)[number];
|
|
16
20
|
/**
|
|
17
21
|
* What a `policy.update` or `policy.reset` row says it did: the editable sections it changed, and the reason the owner gave.
|
|
@@ -24,8 +28,8 @@ export interface AuditDetail {
|
|
|
24
28
|
}
|
|
25
29
|
/** The longest reason a policy audit row keeps. */
|
|
26
30
|
export declare const AUDIT_REASON_MAX = 2000;
|
|
27
|
-
/** What an entry points at: a report id, a sanction group id, a person (a staff ref), a term id, an exception id
|
|
28
|
-
export declare const AUDIT_TARGET_TYPES: readonly ["report", "sanction", "person", "term", "exception", "reason"];
|
|
31
|
+
/** What an entry points at: a report id, a sanction group id, a person (a staff ref), a term id, an exception id, a saved reason id or an appeal id. */
|
|
32
|
+
export declare const AUDIT_TARGET_TYPES: readonly ["report", "sanction", "person", "term", "exception", "reason", "appeal"];
|
|
29
33
|
export type AuditTargetType = (typeof AUDIT_TARGET_TYPES)[number];
|
|
30
34
|
export interface AuditTarget {
|
|
31
35
|
type: AuditTargetType;
|
package/dist/src/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/audit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEvD,8DAA8D;AAC9D,eAAO,MAAM,KAAK,2CAA4C,CAAC;AAC/D,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/audit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEvD,8DAA8D;AAC9D,eAAO,MAAM,KAAK,2CAA4C,CAAC;AAC/D,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,2eA8BhB,CAAC;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E,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAQ7E;AAoDD;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;gBAEhC,IAAI,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE;IAM7E;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAuBxC;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS;CAiC/B"}
|
package/dist/src/audit.js
CHANGED
|
@@ -11,6 +11,10 @@ export const ROLES = ['moderator', 'senior', 'owner'];
|
|
|
11
11
|
* The three `ai.*` actions target a report and carry no detail: `ai.read` is written by the AI itself (an `ai:` actor, no role)
|
|
12
12
|
* when a read finishes, `ai.rerun` by a moderator who asked for another read, `ai.outcome` by a moderator whose decision was
|
|
13
13
|
* recorded against a read.
|
|
14
|
+
*
|
|
15
|
+
* The three appeal and name actions (0.1.9): `appeal.view` is a staff read of the inbox, one appeal or the numbers (its target is the
|
|
16
|
+
* `appeal`, or none for the list and the numbers); `appeal.decide` points at the `appeal` decided and needs it; `name.rename_required`
|
|
17
|
+
* points at the `person` asked to rename and needs it. None of them carries a detail: a statement, a reason or a name never reaches the trail.
|
|
14
18
|
*/
|
|
15
19
|
export const AUDIT_ACTIONS = [
|
|
16
20
|
'report.view',
|
|
@@ -39,17 +43,24 @@ export const AUDIT_ACTIONS = [
|
|
|
39
43
|
'ai.read',
|
|
40
44
|
'ai.rerun',
|
|
41
45
|
'ai.outcome',
|
|
46
|
+
'appeal.view',
|
|
47
|
+
'appeal.decide',
|
|
48
|
+
'name.rename_required',
|
|
42
49
|
];
|
|
43
50
|
/** The longest reason a policy audit row keeps. */
|
|
44
51
|
export const AUDIT_REASON_MAX = 2000;
|
|
45
52
|
/** The actions that point at a report (and only at one), and carry nothing else. */
|
|
46
53
|
const AI_ACTIONS = ['ai.read', 'ai.rerun', 'ai.outcome'];
|
|
54
|
+
/** The actions that point at an appeal (and only at one). `appeal.view` may point at none: the list and the numbers are not about one. */
|
|
55
|
+
const APPEAL_ACTIONS = ['appeal.view', 'appeal.decide'];
|
|
56
|
+
/** The actions that cannot be recorded without a target. */
|
|
57
|
+
const TARGET_REQUIRED = [...AI_ACTIONS, 'appeal.decide', 'name.rename_required'];
|
|
47
58
|
/** An actor that is the AI itself, not a person: `ai:` and the adapter's id (`ai:anthropic:claude-haiku-5-5`). */
|
|
48
59
|
const AI_ACTOR_PREFIX = 'ai:';
|
|
49
60
|
/** The actions whose row carries an {@link AuditDetail}, and the only ones that may. */
|
|
50
61
|
const DETAIL_ACTIONS = ['policy.update', 'policy.reset'];
|
|
51
|
-
/** What an entry points at: a report id, a sanction group id, a person (a staff ref), a term id, an exception id
|
|
52
|
-
export const AUDIT_TARGET_TYPES = ['report', 'sanction', 'person', 'term', 'exception', 'reason'];
|
|
62
|
+
/** What an entry points at: a report id, a sanction group id, a person (a staff ref), a term id, an exception id, a saved reason id or an appeal id. */
|
|
63
|
+
export const AUDIT_TARGET_TYPES = ['report', 'sanction', 'person', 'term', 'exception', 'reason', 'appeal'];
|
|
53
64
|
/** The largest page. */
|
|
54
65
|
export const AUDIT_PAGE_MAX = 200;
|
|
55
66
|
/** A list query that cannot be answered: a `before` cursor we did not issue, or an unknown `action` / bad `actor`. */
|
|
@@ -140,7 +151,7 @@ function parse(input) {
|
|
|
140
151
|
}
|
|
141
152
|
const extra = parsedDetail === undefined ? {} : { detail: parsedDetail };
|
|
142
153
|
if (target === undefined)
|
|
143
|
-
return
|
|
154
|
+
return TARGET_REQUIRED.includes(action) ? null : { actor, role: roleOut, action, ...extra };
|
|
144
155
|
if (typeof target !== 'object' || target === null)
|
|
145
156
|
return null;
|
|
146
157
|
const { type, ref } = target;
|
|
@@ -148,6 +159,10 @@ function parse(input) {
|
|
|
148
159
|
return null;
|
|
149
160
|
if (AI_ACTIONS.includes(action) && type !== 'report')
|
|
150
161
|
return null;
|
|
162
|
+
if (APPEAL_ACTIONS.includes(action) && type !== 'appeal')
|
|
163
|
+
return null;
|
|
164
|
+
if (action === 'name.rename_required' && type !== 'person')
|
|
165
|
+
return null;
|
|
151
166
|
return { actor, role: roleOut, action, target: { type, ref }, ...extra };
|
|
152
167
|
}
|
|
153
168
|
/**
|
package/dist/src/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG/D,8DAA8D;AAC9D,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAG/D;;;;;;;;;;;GAWG;AACH,M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