@serene-pub/sdk 0.6.0-pr-5 → 0.6.0-pr-7

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 (144) hide show
  1. package/dist/actions.d.ts +52 -2
  2. package/dist/actions.js +56 -6
  3. package/dist/annexFields.d.ts +32 -2
  4. package/dist/annexFields.js +48 -5
  5. package/dist/announce.d.ts +142 -2
  6. package/dist/announce.js +198 -2
  7. package/dist/attributes.d.ts +331 -6
  8. package/dist/attributes.js +339 -27
  9. package/dist/bridges.d.ts +61 -0
  10. package/dist/bridges.js +112 -0
  11. package/dist/builder.d.ts +278 -51
  12. package/dist/builder.js +267 -30
  13. package/dist/cadences.d.ts +585 -0
  14. package/dist/cadences.js +1118 -0
  15. package/dist/capabilities.d.ts +106 -17
  16. package/dist/capabilities.js +85 -7
  17. package/dist/checkMethods.d.ts +240 -0
  18. package/dist/checkMethods.js +362 -0
  19. package/dist/component.d.ts +6 -1
  20. package/dist/componentClient.d.ts +42 -6
  21. package/dist/componentWire.js +22 -4
  22. package/dist/composerStates.d.ts +96 -0
  23. package/dist/composerStates.js +190 -0
  24. package/dist/conditions.d.ts +424 -0
  25. package/dist/conditions.js +521 -0
  26. package/dist/config.d.ts +42 -6
  27. package/dist/config.js +48 -20
  28. package/dist/conversions.d.ts +41 -0
  29. package/dist/conversions.js +50 -0
  30. package/dist/declarations.d.ts +40 -2
  31. package/dist/declarations.js +178 -10
  32. package/dist/descriptors.d.ts +287 -4
  33. package/dist/descriptors.js +281 -18
  34. package/dist/document.d.ts +47 -2
  35. package/dist/document.js +46 -14
  36. package/dist/entities.d.ts +156 -0
  37. package/dist/entities.js +259 -0
  38. package/dist/events.d.ts +711 -1
  39. package/dist/events.js +412 -1
  40. package/dist/executor.d.ts +4 -3
  41. package/dist/executor.js +22 -8
  42. package/dist/exposure.d.ts +128 -0
  43. package/dist/exposure.js +168 -0
  44. package/dist/extension.d.ts +127 -3
  45. package/dist/extension.js +43 -0
  46. package/dist/fit.d.ts +198 -0
  47. package/dist/fit.js +351 -0
  48. package/dist/functions.d.ts +554 -0
  49. package/dist/functions.js +712 -0
  50. package/dist/genres.d.ts +303 -89
  51. package/dist/genres.js +335 -100
  52. package/dist/hookGrants.d.ts +15 -1
  53. package/dist/hookGrants.js +11 -10
  54. package/dist/hooks.d.ts +34 -5
  55. package/dist/hooks.js +5 -2
  56. package/dist/hostElements.d.ts +7 -1
  57. package/dist/hostElements.js +20 -1
  58. package/dist/hostState.d.ts +110 -0
  59. package/dist/hostState.js +140 -0
  60. package/dist/identity.d.ts +1 -1
  61. package/dist/identity.js +1 -1
  62. package/dist/index.d.ts +25 -0
  63. package/dist/index.js +48 -0
  64. package/dist/jsonSchema.d.ts +178 -0
  65. package/dist/jsonSchema.js +570 -0
  66. package/dist/libraryDraft.d.ts +27 -0
  67. package/dist/libraryDraft.js +25 -0
  68. package/dist/lorebookFile.d.ts +44 -0
  69. package/dist/lorebookFile.js +202 -0
  70. package/dist/media.d.ts +127 -12
  71. package/dist/media.js +45 -1
  72. package/dist/messageBlocks.d.ts +179 -5
  73. package/dist/messageBlocks.js +208 -6
  74. package/dist/participants.d.ts +32 -9
  75. package/dist/participants.js +13 -2
  76. package/dist/pluginHarness.d.ts +63 -33
  77. package/dist/pluginHarness.js +78 -144
  78. package/dist/pluginPermissions.d.ts +15 -1
  79. package/dist/pluginPermissions.js +29 -2
  80. package/dist/preview.d.ts +45 -4
  81. package/dist/preview.js +52 -12
  82. package/dist/primers.d.ts +177 -0
  83. package/dist/primers.js +265 -0
  84. package/dist/receipt.d.ts +11 -0
  85. package/dist/receiverRules.js +9 -0
  86. package/dist/refs.d.ts +9 -1
  87. package/dist/refs.js +12 -0
  88. package/dist/registrations.d.ts +384 -0
  89. package/dist/registrations.js +625 -0
  90. package/dist/repertoires.d.ts +502 -0
  91. package/dist/repertoires.js +666 -0
  92. package/dist/rulesetDocument.d.ts +116 -0
  93. package/dist/rulesetDocument.js +252 -0
  94. package/dist/rulesetSections.d.ts +631 -0
  95. package/dist/rulesetSections.js +1288 -0
  96. package/dist/rulesetTemplates.d.ts +161 -0
  97. package/dist/rulesetTemplates.js +242 -0
  98. package/dist/rulesets.d.ts +899 -0
  99. package/dist/rulesets.js +1378 -0
  100. package/dist/sceneSettings.d.ts +8 -0
  101. package/dist/sceneSettings.js +10 -2
  102. package/dist/scope.d.ts +44 -3
  103. package/dist/scope.js +18 -0
  104. package/dist/scripts.d.ts +31 -8
  105. package/dist/scripts.js +45 -8
  106. package/dist/sessionDossier.d.ts +157 -7
  107. package/dist/sessionLayout.d.ts +291 -138
  108. package/dist/sessionLayout.js +504 -211
  109. package/dist/sessionSettings.d.ts +24 -0
  110. package/dist/settings.d.ts +95 -4
  111. package/dist/settings.js +293 -4
  112. package/dist/shapes.d.ts +80 -1
  113. package/dist/shapes.js +100 -5
  114. package/dist/speech.d.ts +333 -0
  115. package/dist/speech.js +199 -0
  116. package/dist/statShapes.d.ts +8 -1
  117. package/dist/statShapes.js +8 -1
  118. package/dist/status.d.ts +14 -0
  119. package/dist/status.js +12 -0
  120. package/dist/storage.d.ts +53 -66
  121. package/dist/storage.js +7 -12
  122. package/dist/storyTime.d.ts +25 -1
  123. package/dist/storyTime.js +42 -2
  124. package/dist/surfaces.d.ts +15 -2
  125. package/dist/template.d.ts +19 -1
  126. package/dist/template.js +25 -11
  127. package/dist/templateScopeAt.d.ts +1 -1
  128. package/dist/templateScopeAt.js +11 -8
  129. package/dist/ties.d.ts +211 -0
  130. package/dist/ties.js +301 -0
  131. package/dist/turnOrder.d.ts +25 -14
  132. package/dist/turnOrder.js +21 -8
  133. package/dist/userAnnex.d.ts +126 -0
  134. package/dist/userAnnex.js +214 -0
  135. package/dist/validate.js +114 -19
  136. package/dist/values.js +6 -0
  137. package/dist/vocabularies.d.ts +192 -0
  138. package/dist/vocabularies.js +326 -0
  139. package/dist/widgetDecls.d.ts +12 -0
  140. package/dist/widgetDecls.js +2 -0
  141. package/dist/widgets.d.ts +1062 -29
  142. package/dist/widgets.js +218 -3
  143. package/host-elements.d.ts +90 -0
  144. package/package.json +1 -1
@@ -0,0 +1,899 @@
1
+ /**
2
+ * 🚧 Rulesets — a namespaced bundle of mechanics a session's owners are read
3
+ * and resolved by.
4
+ *
5
+ * A ruleset is `<creator>:ruleset/<name>@N` (`core:ruleset/freeform@1`).
6
+ * 🚧 Since 2026-10-23 it is declared in **seven sections** — attributes,
7
+ * functions, entry types, zone types, outcomes and time, library, options
8
+ * (`rulesetSections.ts`), nothing required beyond a name (R9: `{ name }` is
9
+ * a ruleset from scratch). ⏳ The shape before the sections, read into them
10
+ * by `rulesetSections` / `normaliseRuleset`, says in one declaration:
11
+ *
12
+ * · its **voice** — per rigour, the short paragraph a model reads about how
13
+ * play runs under it;
14
+ * · its **conventions** — its check methods (how a risky moment is
15
+ * decided: dice, cards, a spend, a comparison, or nobody's roll at all —
16
+ * `checkMethods.ts`), the degree crosswalk onto the five bands, the unit
17
+ * time is kept in, actions and rests;
18
+ * · its **stats** — attribute slots, as a sheet names them (`sheets.ts`);
19
+ * · its **selectors** — every name a mechanic may target or test, so an
20
+ * unknown one is refused when authored, never missed at runtime;
21
+ * · its **repertoires** — the kinds of piece its owners hold
22
+ * (`repertoires.ts`), and the **compendium** rows that ship with them;
23
+ * · its **scripts**, at declared phases of the handler's fixed order;
24
+ * · its **conversions** from other rulesets (id maps), and which
25
+ * repertoires are **entryable** (become lorebook entry types).
26
+ *
27
+ * A primer names its ruleset (`primers.ts`); the ruleset never names its
28
+ * primers (the back-reference was cut 2026-10-17: nothing read it).
29
+ *
30
+ * Rulesets are genre-independent: a genre says how play is driven and at
31
+ * which **rigour** — `prose`, `mechanics` or `scripts`, each including the
32
+ * levels before — and the one handler (`core:task/ruleset-resolve@1`) reads
33
+ * whichever ruleset the session has. Core's rulesets are declared through
34
+ * the same `defineRuleset` a plugin uses.
35
+ *
36
+ * ⚠ *Mechanics*, never "laws" or "rules": both words already mean something
37
+ * else here.
38
+ * @experimental
39
+ */
40
+ import type { I18n } from './i18n.js';
41
+ import { type AttributeSlotDecl, type SlotId } from './attributes.js';
42
+ import type { SheetSlotEntry } from './sheets.js';
43
+ import type { PlaytestChange, PlaytestMember } from './rulesetTemplates.js';
44
+ import { type Vocabulary, type VocabularyId } from './vocabularies.js';
45
+ import { type RepertoireContext, type RepertoireDecl, type PieceProps } from './repertoires.js';
46
+ import { type ConversionDecl } from './conversions.js';
47
+ import { type EntryDescriptor, type EntryShape, type EntryTypeDecl } from './descriptors.js';
48
+ import { type CheckMethodDecl } from './checkMethods.js';
49
+ import { type RulesetSections } from './rulesetSections.js';
50
+ /** `owner:ruleset/name@N` — `core:ruleset/freeform@1`. @experimental */
51
+ export type RulesetId = string;
52
+ /**
53
+ * 🚧 How much of a ruleset a call resolves: `prose` (what things are, in
54
+ * words), `mechanics` (adds the declared mechanics), `scripts` (adds the
55
+ * ruleset's scripts and its check methods' chance — dice, cards). Each level
56
+ * includes the ones before.
57
+ * @experimental
58
+ */
59
+ export type Rigour = 'prose' | 'mechanics' | 'scripts';
60
+ /** @experimental */
61
+ export declare const RIGOURS: readonly Rigour[];
62
+ /**
63
+ * 🚧 **How strict**, in the interface's words (NOMENCLATURE §28): the rigour
64
+ * ids are never shown. `prose` → _Words only_, `mechanics` → _Rules_,
65
+ * `scripts` → _The rules decide_ (2026-10-22: no level is named for dice — a
66
+ * ruleset may decide by cards, a spend or no chance at all). The ids are
67
+ * unchanged, so a stored session's rigour reads as it did.
68
+ * @experimental
69
+ * @ruling PLAN-rulesets-authoring D1 (2026-10-22)
70
+ */
71
+ export declare const RIGOUR_LABELS: Readonly<Record<Rigour, string>>;
72
+ /**
73
+ * 🚧 The one scale every ruleset's degrees cross-walk onto, worst first —
74
+ * exported for the `dice` message block, whose `five` is one of these.
75
+ * @experimental
76
+ */
77
+ export declare const FIVE_BANDS: readonly ['crit-fail', 'fail', 'partial', 'success', 'crit'];
78
+ /** 🚧 One step of the one scale every ruleset's degrees cross-walk onto. @experimental */
79
+ export type FiveBand = (typeof FIVE_BANDS)[number];
80
+ /**
81
+ * 🚧 One of a ruleset's own degrees of success: its id, the word a person
82
+ * (and a prose render) reads, the five-band value it maps to and, for a
83
+ * margin-read check, the least margin (total − target) it starts at.
84
+ * @experimental
85
+ */
86
+ export interface DegreeBand {
87
+ id: string;
88
+ label: I18n;
89
+ five: FiveBand;
90
+ from?: number;
91
+ }
92
+ /**
93
+ * 🚧 A ruleset's degrees, cross-walked onto `FIVE_BANDS`.
94
+ *
95
+ * · Bands are read by margin: the band is the last one whose `from` the
96
+ * margin reaches; the first band, with no `from`, is the floor.
97
+ * · A band with no `from` after the first is reached only through `natural`.
98
+ * · `naturalShift` — die faces that move the band one step (at or above
99
+ * `high` up, at or below `low` down).
100
+ * · `natural` — die faces that **set** the band outright: a face at or above
101
+ * `high.from` reads as `high.band` (a classic critical, its threat range
102
+ * widened by lowering `from`); at or below `low.to` as `low.band`.
103
+ * @experimental
104
+ */
105
+ export interface DegreeCrosswalk {
106
+ bands: readonly DegreeBand[];
107
+ naturalShift?: {
108
+ high?: number;
109
+ low?: number;
110
+ };
111
+ natural?: {
112
+ high?: {
113
+ from: number;
114
+ band: string;
115
+ };
116
+ low?: {
117
+ to: number;
118
+ band: string;
119
+ };
120
+ };
121
+ }
122
+ /**
123
+ * 🚧 The degrees a ruleset that declares none reads by (2026-10-22: degrees
124
+ * are optional): _Failure_ (`fail`) below the target, _Success_ (`success`)
125
+ * at or above it. `FIVE_BANDS` stays the one outcome scale.
126
+ * @experimental
127
+ */
128
+ export declare const DEFAULT_DEGREES: DegreeCrosswalk;
129
+ /** How bonuses stack: of each type keep the highest bonus and the lowest penalty, or add them all. */
130
+ /** 🚧 How typed bonuses stack; the editor's choices. @experimental */
131
+ export declare const BONUS_STACKINGS: readonly ['highest-per-type', 'sum'];
132
+ /**
133
+ * 🚧 A ruleset's typed bonuses: the `bonusType`s a `modify` may name (Vis
134
+ * Itineris: `gear`, `status`, `circumstance`, `edge`), how they stack
135
+ * (untyped bonuses always add), and the type read as **edge** —
136
+ * net +1 rolls the die twice and keeps the higher, net −1 keeps the lower.
137
+ * The edge type always keeps one highest bonus and one lowest penalty, so
138
+ * any number of sources is one edge and one of each cancels.
139
+ * @experimental
140
+ */
141
+ export interface RulesetBonuses {
142
+ types: readonly string[];
143
+ stacking: (typeof BONUS_STACKINGS)[number];
144
+ edge?: string;
145
+ }
146
+ /**
147
+ * ⏳ The die a check rolls, and the selector whose value modifies a check
148
+ * that names no `base` of its own — the shape before check methods
149
+ * (2026-10-22). Read as one die-target method keyed `die`
150
+ * (`normaliseRuleset`); say `methods` instead.
151
+ */
152
+ interface RulesetDice {
153
+ sides: number;
154
+ modifierOf?: string;
155
+ }
156
+ /** 🚧 The units a ruleset keeps time in; the editor's choices. @experimental */
157
+ export declare const RULESET_TIME_UNITS: readonly ['round', 'minute', 'hour', 'day', 'scene'];
158
+ /** 🚧 The unit a ruleset counts time in; `roundSeconds` for a round. @experimental */
159
+ export interface RulesetTime {
160
+ unit: (typeof RULESET_TIME_UNITS)[number];
161
+ roundSeconds?: number;
162
+ }
163
+ /**
164
+ * The turn economy: how many actions a turn holds (`perTurn`), whether a
165
+ * reaction is had besides, and the kinds of action a turn spends. 🚧
166
+ * `perTurn` (and `reaction`) is read by the handler into the voice block's
167
+ * **turn economy line** where numbers show — _A turn holds 3 actions and a
168
+ * reaction._ (PLAN-rulesets-authoring D1: read, not dropped; lane M2).
169
+ */
170
+ interface RulesetActions {
171
+ perTurn?: number;
172
+ reaction?: boolean;
173
+ kinds?: readonly string[];
174
+ }
175
+ /** A rest: how long it takes, and the traits of what it recharges. */
176
+ interface RulesetRest {
177
+ id: string;
178
+ label: I18n;
179
+ minutes?: number;
180
+ recharges?: readonly string[];
181
+ }
182
+ /**
183
+ * 🚧 **Casting from a pool** (2026-10-22, PLAN-rulesets-authoring D1: a
184
+ * ruleset's numbers live in its declaration, never in the engine) — what a
185
+ * cast costs when a ruleset spends a **pool** for it rather than the piece
186
+ * itself (Vis Itineris's _Spell points_, laid by its `casting: points`
187
+ * setting's choice):
188
+ *
189
+ * · `pool` — the stat a cast spends from: its selector
190
+ * (`itineris-spell-points`) or its slot id;
191
+ * · `cost` — the piece field whose value a cast costs (`level`; `0` costs
192
+ * nothing); `piece.level` reads the same;
193
+ * · `repertoire` — the one repertoire casts come out of; absent, every
194
+ * repertoire tagged `casting`;
195
+ * · `refill` — the rest (`rest[].id`) that fills the pool back; absent, the
196
+ * long rest, else the longest;
197
+ * · `max` — the selector whose value the pool fills back to (a derived
198
+ * value, `spell-points-max`); absent, the pool's own maximum.
199
+ *
200
+ * ⚠ Not a **casting** repertoire tag (what a repertoire's pieces are); a
201
+ * casting pool is what a cast from them spends. Read by the host's handler
202
+ * (`castingPoolOf`); refused when authored with the reason named
203
+ * (`bad-casting`, `unknown-selector`, `unknown-repertoire`).
204
+ * @experimental
205
+ * @ruling PLAN-rulesets-authoring D1 (2026-10-22)
206
+ */
207
+ export interface RulesetCasting {
208
+ pool: string;
209
+ cost: string;
210
+ repertoire?: string;
211
+ refill?: string;
212
+ max?: string;
213
+ }
214
+ /**
215
+ * 🚧 One of a ruleset's **difficulty bands** — a named target a check is
216
+ * rolled against (_Hard_, 20): its id, the word a person reads, the target
217
+ * number and, on exactly one band, `default: true` — the difficulty an
218
+ * automatic roll uses when nobody picked one (the Lair's _Decide checks at once_).
219
+ *
220
+ * What a `roll` message block offers the person deciding a check (the
221
+ * Lair's game master): the bands in the ruleset's order, plus _No check_.
222
+ * 🚧 Held by a check method that is made against a target (`die-target`,
223
+ * `card-draw`, `compare` — its `bands`); the top-level
224
+ * `RulesetProps.difficultyBands` is ⏳, read as the `die` method's.
225
+ *
226
+ * ⚠ Not a **degree band** (`DegreeBand`, what a roll's result reads as) —
227
+ * a difficulty band is what the roll is made against; not a budget band
228
+ * (an entry type's `sourceKind`); and not the Dungeon Crawler's
229
+ * `core:slot/difficulty@1` (how harsh the whole table is — Gentle, Fair,
230
+ * Brutal).
231
+ * @experimental
232
+ * @ruling Lair rewrite D3 (2026-10-21)
233
+ */
234
+ export interface DifficultyBand {
235
+ id: string;
236
+ label: I18n;
237
+ description?: I18n;
238
+ /** The total a check must reach — the target its margin is read from. A whole number. */
239
+ target: number;
240
+ /** The band an automatic roll is made against. Exactly one band says so. */
241
+ default?: true;
242
+ }
243
+ /** @experimental */
244
+ export interface RulesetConventions {
245
+ /** ⏳ One die-target method, the shape before check methods — say `methods` (`normaliseRuleset`). */
246
+ dice?: RulesetDice;
247
+ /**
248
+ * 🚧 How a risky moment is decided, by a name of the ruleset's own
249
+ * (`{ d20: { kind: 'die-target', sides: 20 } }`): see `checkMethods.ts`.
250
+ * Absent (and no `dice`): nothing is decided by chance; every check is
251
+ * judged (`none`).
252
+ * @ruling PLAN-rulesets-authoring R1, D1 (2026-10-22)
253
+ */
254
+ methods?: Readonly<Record<string, CheckMethodDecl>>;
255
+ /** 🚧 The method a check uses when its selector names none. Required when there are two or more. */
256
+ defaultMethod?: string;
257
+ /**
258
+ * The ruleset's own degrees, cross-walked onto `FIVE_BANDS`. 🚧 Optional
259
+ * since 2026-10-22: absent, a check reads as _Failure_ or _Success_
260
+ * (`DEFAULT_DEGREES`).
261
+ */
262
+ degrees?: DegreeCrosswalk;
263
+ time: RulesetTime;
264
+ actions?: RulesetActions;
265
+ rest?: readonly RulesetRest[];
266
+ bonuses?: RulesetBonuses;
267
+ /** 🚧 What a cast spends when it spends a pool (`RulesetCasting`); absent, a cast spends its piece. */
268
+ casting?: RulesetCasting;
269
+ }
270
+ /** The conventions a ruleset setting's choice may replace — every one but time, key by key. */
271
+ type RulesetConventionsPatch = Partial<Omit<RulesetConventions, 'time'>>;
272
+ /**
273
+ * One choice of a ruleset setting: its id, the words a person reads, and
274
+ * the conventions it lays over the ruleset's own when chosen. A choice with
275
+ * no `conventions` is read by the handler by its id (how dying works, say).
276
+ */
277
+ interface RulesetSettingChoice {
278
+ id: string;
279
+ label: I18n;
280
+ description?: I18n;
281
+ conventions?: RulesetConventionsPatch;
282
+ }
283
+ /**
284
+ * 🚧 A **ruleset setting** — one way a table may play a ruleset (how degrees
285
+ * read, how many actions a turn holds), a closed list of choices with a
286
+ * default. A session holds its chosen values; the handler resolves the
287
+ * ruleset's conventions through them (`rulesetConventionsFor`).
288
+ * @experimental
289
+ */
290
+ export interface RulesetSettingDecl {
291
+ label: I18n;
292
+ description?: I18n;
293
+ choices: readonly RulesetSettingChoice[];
294
+ default: string;
295
+ }
296
+ /**
297
+ * 🚧 A **ruleset preset** — a named set of setting values offered as one
298
+ * pick (_Classic_ restores the rules as printed). Settings it does not name
299
+ * keep their defaults. ⚠ Not a session, sampling or layout preset.
300
+ * @experimental
301
+ */
302
+ export interface RulesetPresetDecl {
303
+ id: string;
304
+ label: I18n;
305
+ description?: I18n;
306
+ values: Readonly<Record<string, string>>;
307
+ }
308
+ /**
309
+ * 🚧 A name a mechanic may target or test, beyond the ruleset's stats (each
310
+ * stat is a selector by its slot name already):
311
+ *
312
+ * · `stat` — another slot's value.
313
+ * · `check` — something decided by a check method: `base` is the selector
314
+ * whose value the check reads (a die-target's modifier — an ability
315
+ * modifier, proficiency arriving as a `modify` on the check; a dice
316
+ * pool's size; a comparison's value). No `base`: the method's fallback
317
+ * (`modifierOf`, `poolOf`), else a bare die. 🚧 `method` names the check
318
+ * method it is decided by (a key of `conventions.methods`); absent, the
319
+ * ruleset's `defaultMethod` (2026-10-22).
320
+ * · `derived` — a value computed from other selectors (by a script). 🚧
321
+ * `onSheet: true` (2026-10-18) puts it on the ruleset's sheet beside the
322
+ * stats, under its `label` — armour class: worked out, never stored, and
323
+ * still what a player reads first.
324
+ * · `tally` — a number modifies add up on and nothing rolls (a damage
325
+ * bonus). ⚠ Not a check: a host never rolls a die for it.
326
+ *
327
+ * **Selector families.** A dotted name's parents cover it: a `modify` on
328
+ * `attack` reaches `attack.melee` and `attack.ranged`, one on `save` every
329
+ * `save.*`, though neither parent is declared. A check may also declare the
330
+ * generic check it counts **within** (`within: 'check'` on `skill.stealth`),
331
+ * so a `modify` on `check` reaches every skill and ability check but not an
332
+ * attack or a save. A family is a legal target for `modify`, `adjustDegree`
333
+ * and `rider` — never for `set`, which writes one stored value
334
+ * (`rulesetSelectorFamily`).
335
+ * @experimental
336
+ */
337
+ export type RulesetSelectorDecl = {
338
+ kind: 'stat';
339
+ slot: SlotId;
340
+ } | {
341
+ kind: 'check';
342
+ base?: string;
343
+ within?: string;
344
+ method?: string;
345
+ } | {
346
+ kind: 'derived';
347
+ from: readonly string[];
348
+ onSheet?: boolean;
349
+ label?: I18n;
350
+ } | {
351
+ kind: 'tally';
352
+ };
353
+ /** Where a compendium row comes from, and the licence that travels with it. */
354
+ interface CompendiumSource {
355
+ document: string;
356
+ licence: string;
357
+ }
358
+ /**
359
+ * 🚧 One compendium row: its bookkeeping — id, version, source, language —
360
+ * and its **piece**, nested (2026-10-17), so a piece field may be called
361
+ * anything, `source` included, without being taken for the row's own.
362
+ * @experimental
363
+ */
364
+ export interface CompendiumRow {
365
+ id: string;
366
+ version: string;
367
+ source?: CompendiumSource;
368
+ lang?: string;
369
+ piece: PieceProps;
370
+ }
371
+ /** 🚧 The rows that ship with a ruleset, by repertoire id. `source` is the default for rows that name none. @experimental */
372
+ export interface CompendiumDecl {
373
+ source?: CompendiumSource;
374
+ rows: Readonly<Record<string, readonly CompendiumRow[]>>;
375
+ }
376
+ /** 🚧 The handler's fixed phase order a ruleset script plugs into (§25); the editor shows it. @experimental */
377
+ export declare const RULESET_SCRIPT_PHASES: readonly ['effects', 'derived', 'pre-roll', 'post-roll', 'render'];
378
+ /**
379
+ * A script the handler runs at one phase of its fixed order, by priority
380
+ * within the phase. `seedKey` names the seeded script row.
381
+ */
382
+ interface RulesetScriptDecl {
383
+ phase: (typeof RULESET_SCRIPT_PHASES)[number];
384
+ priority: number;
385
+ seedKey: string;
386
+ }
387
+ /**
388
+ * 🚧 One of a ruleset's stats: a sheet entry, and whether the ruleset only
389
+ * **borrows** the slot. A slot a ruleset lists is owned by it — pickable
390
+ * only in its sessions (`slotPickableIn`) — unless it is `borrowed`: a
391
+ * general slot other rulesets and genres read too (core's health, level,
392
+ * mood). ⚠ Not the slot's `rulesetOwned`, which a slot may still spell.
393
+ * @experimental
394
+ */
395
+ export interface RulesetStatEntry extends SheetSlotEntry {
396
+ borrowed?: true;
397
+ }
398
+ /**
399
+ * What `defineRuleset` takes: a name, and 🚧 the seven sections
400
+ * (`RulesetSections` — attributes, functions, entry types, zone types,
401
+ * outcomes, time, library, options), every one optional (R9). ⏳ The keys
402
+ * before the sections (`conventions`, `difficultyBands`, `settings`,
403
+ * `presets`, `stats`, `selectors`, `repertoires`, `compendium`, `scripts`,
404
+ * `conversions`, `entryable`) are still read — into the sections by
405
+ * `rulesetSections` — and refused beside the section each became
406
+ * (`legacy-beside-section`).
407
+ * @experimental
408
+ */
409
+ export interface RulesetProps extends RulesetSections {
410
+ /** The name a person reads. Display text. */
411
+ name: I18n;
412
+ description?: I18n;
413
+ /**
414
+ * Per rigour, what a model reads about play under this ruleset. Model-facing; at most ~60 tokens each.
415
+ * 🚧 Optional since 2026-10-23 (R9): a ruleset from scratch has no voice. Said, it says the prose line.
416
+ */
417
+ voice?: Partial<Record<Rigour, string>>;
418
+ /** ⏳ The shape before the sections: methods → `functions`, degrees → `outcomes`, time, actions and rests → `time`. */
419
+ conventions?: RulesetConventions;
420
+ /**
421
+ * ⏳ The targets a check may be rolled against, in the order a person
422
+ * reads them (easiest first, by convention) — `DifficultyBand`. Since
423
+ * 2026-10-22 a check method holds its own (`methods.<name>.bands`); this
424
+ * top-level list is read as the ⏳ `conventions.dice` method's
425
+ * (`normaliseRuleset`) and is refused beside `methods`. Absent when
426
+ * unstated, so a ruleset that says nothing hashes as it did.
427
+ * @ruling Lair rewrite D3 (2026-10-21); PLAN-rulesets-authoring D1 (2026-10-22)
428
+ */
429
+ difficultyBands?: readonly DifficultyBand[];
430
+ /** ⏳ The ways a table may play it, by setting name; each choice may lay conventions over `conventions`. Read as `options`. */
431
+ settings?: Readonly<Record<string, RulesetSettingDecl>>;
432
+ /** ⏳ Named sets of setting values offered as one pick. Read as `options.presets`. */
433
+ presets?: readonly RulesetPresetDecl[];
434
+ /**
435
+ * ⏳ The ruleset's stats, in order, as a sheet names slots — read as
436
+ * `attributes`. Each is owned by the ruleset unless marked `borrowed`.
437
+ */
438
+ stats?: readonly RulesetStatEntry[];
439
+ /** ⏳ Read as `functions` (checks, worked-out values, tallies) and `attributes` (another slot's name). */
440
+ selectors?: Readonly<Record<string, RulesetSelectorDecl>>;
441
+ /** ⏳ Read as `entryTypes`. */
442
+ repertoires?: readonly RepertoireDecl[];
443
+ /** ⏳ Read as `library`. */
444
+ compendium?: CompendiumDecl;
445
+ /** ⏳ Read as function modules the ruleset carries (`functions`), their bodies the seeded rows. */
446
+ scripts?: readonly RulesetScriptDecl[];
447
+ /** ⏳ Read as `options.conversions`. */
448
+ conversions?: readonly ConversionDecl[];
449
+ /** ⏳ Repertoire ids whose pieces become lorebook entry types. Absent: every repertoire declaring `entryable`. */
450
+ entryable?: readonly string[];
451
+ /**
452
+ * 🚧 The **vocabularies this ruleset plays** (A19, R27): shared words it
453
+ * answers to — the common vocabulary, a custom one another package shares
454
+ * — natively, or with `map` onto its own stats. The declarations, never
455
+ * ids (A18); stored as their ids. A ruleset is itself a vocabulary of its
456
+ * own stats (`rulesetVocabulary`), so it never lists itself. Absent when
457
+ * unstated, so a ruleset that says nothing hashes as it did.
458
+ * @ruling A19, R27, R28
459
+ */
460
+ plays?: readonly Vocabulary[];
461
+ /**
462
+ * 🚧 Played members read as this ruleset's own stats (A19):
463
+ * `[[common.cast.health, vigourSlot]]` — objects on both sides; the left a
464
+ * member of a vocabulary it plays, the right one of its own `stats`.
465
+ * Stored as slot-id pairs. A reference to the left resolves to the right
466
+ * in a session on this ruleset (`resolveAttributeRef`).
467
+ * @ruling A19
468
+ */
469
+ map?: readonly (readonly [AttributeSlotDecl, AttributeSlotDecl])[];
470
+ /**
471
+ * 🚧 A **ruleset template** (2026-10-22, PLAN-rulesets-authoring D3): an
472
+ * archetype to start a ruleset of one's own from — complete and small,
473
+ * with sample rows and a playtest scene beside it (`RulesetTemplate`) —
474
+ * never one a session or lorebook plays. Declared with
475
+ * `defineRulesetTemplate`; `defineRuleset` refuses it
476
+ * (`template-not-played`), so it is never offered under Rules, and a copy
477
+ * (`reidRulesetDocument`) is never a template. Absent when unstated, so a
478
+ * ruleset that says nothing hashes as it did.
479
+ * @ruling PLAN-rulesets-authoring D3 (2026-10-22)
480
+ */
481
+ template?: true;
482
+ /**
483
+ * 🚧 The author's own **handbook** pages (2026-10-23, D8): `{ title, body }`
484
+ * beside the pages the handbook generator writes from the sections. A page
485
+ * titled as a generated one replaces it. Documentation for people: never
486
+ * read into a prompt. Absent when unstated, so a ruleset that says nothing
487
+ * hashes as it did.
488
+ */
489
+ handbook?: readonly HandbookPage[];
490
+ /**
491
+ * 🚧 Playtest scenes **saved as tests** (2026-10-23, D8): what the editor's
492
+ * _Save as a test_ keeps and _Load_ reads back. No session plays them.
493
+ * Absent when unstated, so a ruleset that says nothing hashes as it did.
494
+ */
495
+ playtests?: readonly SavedPlaytest[];
496
+ }
497
+ /**
498
+ * 🚧 One page an author writes into a **handbook** (2026-10-23, D8): a
499
+ * title and its body, Markdown. A ruleset's or a genre's `handbook` lists
500
+ * them beside the generated pages.
501
+ * @experimental
502
+ */
503
+ export interface HandbookPage {
504
+ title: string;
505
+ body: string;
506
+ }
507
+ /**
508
+ * 🚧 A playtest scene **saved as a test** (2026-10-23, D8): its name, the
509
+ * sample party, the situation, the one change it puts through the rules (or
510
+ * none), How strict it runs and the seed it rolls from.
511
+ * @experimental
512
+ */
513
+ export interface SavedPlaytest {
514
+ name: string;
515
+ party: readonly PlaytestMember[];
516
+ situation?: I18n;
517
+ change: PlaytestChange | null;
518
+ rigour?: Rigour;
519
+ seed?: string;
520
+ }
521
+ /**
522
+ * 🚧 Every reason a `handbook` is refused (`bad-handbook`): a list of
523
+ * `{ title, body }`, each title said once.
524
+ * @experimental
525
+ */
526
+ export declare function handbookFindings(handbook: unknown, at: string): string[];
527
+ /**
528
+ * 🚧 Every reason a ruleset's saved tests are refused (`bad-playtests`): a
529
+ * list of `{ name, party, situation?, change, rigour?, seed? }`, each named
530
+ * once, a party of one to four by name, a change or `null`. What a test
531
+ * names is not checked against the ruleset: a stale test is read, never
532
+ * refused.
533
+ * @experimental
534
+ */
535
+ export declare function savedPlaytestFindings(playtests: unknown, at: string): string[];
536
+ /**
537
+ * 🚧 Where a ruleset's declaration came from: `code` (core or a plugin, at
538
+ * import) or `stored` (authored on the pub and loaded from a row —
539
+ * `defineStoredRuleset`). Absent on a declaration means `code`, so a code
540
+ * ruleset hashes as it always did.
541
+ * @experimental
542
+ */
543
+ export type RulesetOrigin = 'code' | 'stored';
544
+ /**
545
+ * A declared ruleset: its props as written, except `plays` and `map`, stored
546
+ * by id (the declarations' identities) — what `resolveAttributeRef` reads.
547
+ * @experimental
548
+ */
549
+ export interface RulesetDecl extends Omit<RulesetProps, 'plays' | 'map' | 'stats' | 'repertoires'> {
550
+ readonly id: RulesetId;
551
+ /** ⏳ The stats as declared — always a list on the registered declaration (empty for a ruleset in sections), so a reader of the shape before them reads nothing rather than throwing. */
552
+ readonly stats: readonly RulesetStatEntry[];
553
+ /** ⏳ The repertoires as declared — always a list on the registered declaration (empty for a ruleset in sections). */
554
+ readonly repertoires: readonly RepertoireDecl[];
555
+ /** 🚧 `stored` for an authored ruleset; left out for one declared in code. */
556
+ readonly origin?: 'stored';
557
+ /** 🚧 Who authored a stored ruleset (the pub's user id). */
558
+ readonly authorUserId?: number | string;
559
+ /** 🚧 The ids of the vocabularies it plays, in its order (`RulesetProps.plays`). */
560
+ readonly plays?: readonly VocabularyId[];
561
+ /** 🚧 `[played member's slot id, own stat's slot id]` pairs (`RulesetProps.map`). */
562
+ readonly map?: readonly (readonly [SlotId, SlotId])[];
563
+ }
564
+ /**
565
+ * 🚧 Every selector a ruleset's mechanics may name: each stat by its slot
566
+ * name (`mood`), then the declared ones.
567
+ * @experimental
568
+ */
569
+ export declare function rulesetSelectors(decl: Pick<RulesetProps, 'stats' | 'selectors'>): ReadonlyMap<string, RulesetSelectorDecl>;
570
+ /**
571
+ * 🚧 Every name a `modify` or `adjustDegree` may target to reach `selector`:
572
+ * itself, its dotted parents (`attack.melee` → `attack`), and — for a check
573
+ * that declares one — the generic check it counts `within`, with that
574
+ * name's own family in turn. What a host folds onto a check, so the engine
575
+ * and the authoring check agree on what "covers" means. A name that is no
576
+ * selector is its own family alone.
577
+ * @experimental
578
+ */
579
+ export declare function rulesetSelectorFamily(decl: Pick<RulesetProps, 'stats' | 'selectors'>, selector: string): readonly string[];
580
+ /**
581
+ * The context a repertoire's mechanics are checked in.
582
+ * @internal
583
+ */
584
+ export declare function rulesetContext(decl: RulesetDecl | (RulesetProps & {
585
+ id: string;
586
+ })): RepertoireContext;
587
+ /** 🚧 The repertoires whose pieces become lorebook entry types. @experimental */
588
+ export declare const rulesetEntryable: (decl: Pick<RulesetProps, 'entryable' | 'repertoires'> & Pick<RulesetSections, 'entryTypes'>) => readonly string[];
589
+ /**
590
+ * 🚧 The derived entry type an entryable repertoire yields —
591
+ * `core:entry/freeform.things@1` for `things` on `core:ruleset/freeform@1`.
592
+ * @experimental
593
+ */
594
+ export declare function rulesetEntryTypeId(rulesetId: RulesetId, repertoireId: string): string;
595
+ /**
596
+ * 🚧 The parts every entry type answers with beyond its own fields — which
597
+ * field plays title, key, priority, parent; what the embedding reads; the
598
+ * band it competes in; where it renders; what an amendment means — and the
599
+ * fields every entry carries (priority, supply). Core's entry types declare
600
+ * them (`core-catalog`'s `ENTRY_UNIVERSAL_PARTS`); a derived entry type takes
601
+ * them whole, so the two never drift. Keys, provenance and `derived_from`
602
+ * are columns every row has, and need no declaration.
603
+ * @experimental
604
+ */
605
+ export interface EntryUniversalParts extends Omit<EntryShape, 'fields'> {
606
+ fields: NonNullable<EntryShape['fields']>;
607
+ }
608
+ /**
609
+ * 🚧 The derived entry types a ruleset yields, as declarations — one per
610
+ * entryable repertoire (`rulesetEntryable`): id `rulesetEntryTypeId`, name
611
+ * and description the repertoire's, fields the repertoire's **whole piece
612
+ * shape** (name, description, prose, traits, the relational parts when it is
613
+ * relational, then its own) with the universal entry fields laid beside it.
614
+ * Pure; `deriveRulesetEntryTypes` registers them.
615
+ *
616
+ * Refused (`RulesetError`, `[entry-field-collision]`) when a piece field
617
+ * shares a name with a universal entry field — the entry could not hold both.
618
+ * @experimental
619
+ */
620
+ export declare function rulesetEntryTypeDecls(ruleset: Pick<RulesetDecl, 'id' | 'entryable'> & {
621
+ repertoires?: RulesetDecl['repertoires'];
622
+ } & Pick<RulesetSections, 'entryTypes'>, universal: EntryUniversalParts): EntryTypeDecl[];
623
+ /**
624
+ * 🚧 Register a ruleset's derived entry types — `<creator>:entry/<ruleset>.<repertoire>@1`
625
+ * for each entryable repertoire (§21 amendment). Core and rulesets are the
626
+ * authors of entry types; this is the rulesets' door, and a plugin ruleset's
627
+ * types derive under its own namespace. Idempotent: an identical
628
+ * re-derivation is a no-op.
629
+ * @experimental
630
+ */
631
+ export declare function deriveRulesetEntryTypes(ruleset: Pick<RulesetDecl, 'id' | 'entryable'> & {
632
+ repertoires?: RulesetDecl['repertoires'];
633
+ } & Pick<RulesetSections, 'entryTypes'>, universal: EntryUniversalParts): EntryDescriptor[];
634
+ /**
635
+ * 🚧 The repertoire a derived entry type id was derived from, when it is one
636
+ * and its ruleset is registered — `core:entry/vis-itineris.weapons@1` → Vis Itineris's
637
+ * `weapons`. What lets one piece checker validate an entry of the type.
638
+ * @experimental
639
+ */
640
+ export declare function derivedEntryTypeSource(entryTypeId: string): {
641
+ ruleset: RulesetDecl;
642
+ repertoire: RepertoireDecl;
643
+ } | undefined;
644
+ /**
645
+ * 🚧 A ruleset's settings in the shape before the sections — its ⏳
646
+ * `settings`, else its options' choices (`sectionsSettings`).
647
+ * @internal
648
+ */
649
+ export declare const settingsOf: (decl: Pick<RulesetProps, 'settings' | 'options'>) => Readonly<Record<string, RulesetSettingDecl>>;
650
+ /** 🚧 A ruleset's presets: its ⏳ `presets`, else its options'. @internal */
651
+ export declare const presetsOf: (decl: Pick<RulesetProps, 'presets' | 'options'>) => readonly RulesetPresetDecl[];
652
+ /**
653
+ * 🚧 A session's full setting values for a ruleset: each setting's default,
654
+ * then the preset's values, then the session's own. A name the ruleset does
655
+ * not declare, or a choice a setting does not offer, is left out — it reads
656
+ * as the layer beneath, never as an error at play time (`rulesetFindings`
657
+ * refuses it where it is authored).
658
+ * @experimental
659
+ */
660
+ export declare function rulesetSettingValues(decl: Pick<RulesetProps, 'settings' | 'presets' | 'options'>, chosen?: {
661
+ preset?: string;
662
+ values?: Readonly<Record<string, string>>;
663
+ }): Record<string, string>;
664
+ /**
665
+ * 🚧 The preset whose values these are exactly, if any — what a picker shows
666
+ * as selected. @experimental
667
+ */
668
+ export declare function rulesetPresetOf(decl: Pick<RulesetProps, 'settings' | 'presets' | 'options'>, values: Readonly<Record<string, string>>): string | undefined;
669
+ /**
670
+ * 🚧 A ruleset's conventions as a session plays them: its own, with each
671
+ * chosen setting's `conventions` laid over key by key. One setting owns each
672
+ * key (`setting-overlap`), so the order settings are read in never matters.
673
+ * @experimental
674
+ */
675
+ export declare function rulesetConventionsFor(decl: Pick<RulesetProps, 'conventions' | 'settings' | 'presets' | 'options'> & RulesetSections, values?: Readonly<Record<string, string>>): RulesetConventions;
676
+ /**
677
+ * 🚧 A ruleset's conventions as a host reads them (`normaliseRuleset`):
678
+ * every check method by name — the ⏳ `dice` read as the `die` method, with
679
+ * the ⏳ top-level `difficultyBands` as its bands — the default method when
680
+ * one is in force, and the degrees in force (`DEFAULT_DEGREES` when none are
681
+ * declared).
682
+ * @experimental
683
+ */
684
+ export interface NormalisedConventions extends Omit<RulesetConventions, 'dice' | 'methods' | 'defaultMethod' | 'degrees' | 'time'> {
685
+ methods: Readonly<Record<string, CheckMethodDecl>>;
686
+ defaultMethod?: string;
687
+ degrees: DegreeCrosswalk;
688
+ /** 🚧 Absent for a ruleset that keeps no time (R9, 2026-10-23: a ruleset in sections may say none). */
689
+ time?: RulesetTime;
690
+ }
691
+ /** What `normaliseRuleset` reads: a declaration, a document, or the parts of one. */
692
+ type Normalisable = {
693
+ conventions?: RulesetConventions | NormalisedConventions;
694
+ difficultyBands?: readonly DifficultyBand[];
695
+ repertoires?: readonly RepertoireDecl[];
696
+ settings?: RulesetProps['settings'];
697
+ presets?: RulesetProps['presets'];
698
+ } & RulesetSections;
699
+ /**
700
+ * 🚧 A ruleset with its ⏳ aliases folded in — what `normaliseRuleset`
701
+ * returns: its conventions as today's readers take them, and 🚧 its seven
702
+ * `sections` (`rulesetSections`) as every new reader does.
703
+ * @experimental
704
+ */
705
+ export type NormalisedRuleset<T> = Omit<T, 'conventions' | 'difficultyBands'> & {
706
+ conventions: NormalisedConventions;
707
+ sections: RulesetSections;
708
+ };
709
+ /**
710
+ * 🚧 **The one reading of a ruleset's check methods** — what the host and
711
+ * the engine call at every entry (PLAN-rulesets-authoring D1, 2026-10-22).
712
+ * The ⏳ aliases folded in:
713
+ *
714
+ * · `conventions.dice` → one die-target method keyed `die`
715
+ * (`LEGACY_DIE_METHOD`, the default), its `sides` and `modifierOf`
716
+ * carried over;
717
+ * · the top-level `difficultyBands` → that method's `bands`;
718
+ * · `degrees` absent → `DEFAULT_DEGREES`;
719
+ * · `defaultMethod` absent with one method → that one;
720
+ * · a `harm` / `heal` that says `dice: 'piece.<field>'` → `amount:
721
+ * { selector: 'piece.<field>' }`.
722
+ *
723
+ * With `values` (a session's setting values), the conventions are the ones
724
+ * the session plays (`rulesetConventionsFor`) before they are read. Pure:
725
+ * the registry keeps the declaration as written (so a stored document, and
726
+ * its hash, is unchanged until rewritten — the data upgrade persists this
727
+ * result). Idempotent. A malformed declaration still reads (an empty method
728
+ * list); `rulesetFindings` is what refuses it.
729
+ * @experimental
730
+ * @ruling PLAN-rulesets-authoring D1, D6 (2026-10-22)
731
+ */
732
+ export declare function normaliseRuleset<T extends Normalisable>(decl: T, values?: Readonly<Record<string, string>>): NormalisedRuleset<T>;
733
+ /**
734
+ * 🚧 The conventions half of `normaliseRuleset`: the ⏳ `dice` / top-level
735
+ * `difficultyBands` folded into `methods`, the default method, the degrees
736
+ * in force — from the declaration's ⏳ conventions, or, for a ruleset in
737
+ * sections, from what its sections read back as (`sectionsConventions`:
738
+ * deciding references to core's check-method functions, outcomes with a
739
+ * full ladder, time, turns, rests). With `values`, a session's setting
740
+ * values laid first (`rulesetConventionsFor`). Never reads `rulesetSections`
741
+ * of the shapes before them, so the two readings never call each other.
742
+ * @internal
743
+ */
744
+ export declare function normaliseConventions(decl: Normalisable, values?: Readonly<Record<string, string>>): {
745
+ conventions: NormalisedConventions;
746
+ };
747
+ /**
748
+ * 🚧 Whether a ruleset **decides** anything by its rules (D3, 2026-10-23):
749
+ * one of its function references (declared, or ⏳ read from its check
750
+ * methods) is a deciding function that decides — a dice, card, spend or
751
+ * comparison resolver, or a deciding module that is a way — its body
752
+ * exports `decide`, or one of its checks names it as its way
753
+ * (`functionRefDecides`, `functionWayKeys`). A ruleset that
754
+ * only judges in words (`none` / `core:function/judge@1`), or decides
755
+ * nothing, plays `prose` alone. What _The rules decide_ waits on (R6).
756
+ * @experimental
757
+ * @ruling PLAN-rulesets-functions D3 (2026-10-23)
758
+ */
759
+ export declare const rulesetDecides: (decl: unknown) => boolean;
760
+ /**
761
+ * 🚧 The check method a check is decided by: the one its selector names
762
+ * (`method`), else the ruleset's default — with its key — or, when the
763
+ * ruleset names none, `{ key: null, method: NONE_CHECK_METHOD }`: nothing
764
+ * resolves it, the game master judges.
765
+ * @experimental
766
+ */
767
+ export declare function rulesetCheckMethod(decl: Normalisable & Pick<RulesetProps, 'stats' | 'selectors'>, selector?: string): {
768
+ key: string | null;
769
+ method: CheckMethodDecl;
770
+ };
771
+ /** 🚧 Whether any of a ruleset's check methods throws dice (`die-target`, `dice-pool`). @experimental */
772
+ export declare const rulesetRollsDice: (decl: Normalisable) => boolean;
773
+ /**
774
+ * 🚧 The difficulty bands a check is made against: the named method's
775
+ * (`methodKey`); else the default method's; else the first method's that
776
+ * holds any — what a `roll` block offers (`rollBlockBands`). The ⏳
777
+ * top-level `difficultyBands` read as the `die` method's. Empty when no
778
+ * method holds any.
779
+ * @experimental
780
+ */
781
+ export declare function rulesetDifficultyBands(decl: Normalisable, methodKey?: string): readonly DifficultyBand[];
782
+ /**
783
+ * 🚧 The band an automatic roll is made against — the one `default: true`
784
+ * difficulty band of the method a check uses (`rulesetDifficultyBands`) —
785
+ * or `undefined` when it holds none.
786
+ * @experimental
787
+ */
788
+ export declare const defaultDifficultyBand: (decl: Normalisable, methodKey?: string) => DifficultyBand | undefined;
789
+ /**
790
+ * 🚧 What a validator says about a ruleset beyond its refusals — each
791
+ * opened by its reason's name, none refusing (2026-10-22):
792
+ *
793
+ * · `legacy-dice` ⏳ — `conventions.dice`: say a die-target method.
794
+ * · `legacy-difficulty-bands` ⏳ — the top-level `difficultyBands`: a
795
+ * method holds its own.
796
+ * · `legacy-amount` ⏳ — a `harm` / `heal` that says `dice`: say `amount`.
797
+ * · `package-method-kind` — a package's own check method kind: a host
798
+ * with no resolver for it refuses its checks politely, in words (lane
799
+ * M2, 2026-10-22: never a silent `none`).
800
+ * · `untagged-repertoires` ⏳ — no repertoire declares `tags`, so what
801
+ * the ruleset provides (conditions, casting) is guessed from repertoire
802
+ * names (`guessRepertoireTags`).
803
+ * · `natural-without-die` — `degrees.natural` / `naturalShift` read a die
804
+ * face, and no die-target method throws one.
805
+ * @experimental
806
+ */
807
+ export declare function rulesetWarnings(decl: RulesetProps | RulesetDecl): string[];
808
+ /**
809
+ * 🚧 Every reason a ruleset is refused, each opened by its reason's name.
810
+ *
811
+ * Reasons: `invalid-id` · `display-text` · `missing-voice` · `unknown-rigour`
812
+ * · `empty-voice` · `voice-too-long` · `missing-conventions` · `bad-dice` ·
813
+ * `no-bands` · `bad-band` · `duplicate-band` · `no-success-band` ·
814
+ * `bad-time-unit` · `bad-actions` · `bad-rest` · `unknown-stat` ·
815
+ * `duplicate-stat` · `bad-stat-default` · `bad-borrowed` · `bad-selector` ·
816
+ * `duplicate-selector` · `unknown-selector` · `derived-cycle` ·
817
+ * `duplicate-repertoire` · `unknown-repertoire` · `bad-row` ·
818
+ * `duplicate-row` · `missing-source` · `bad-script-phase` · `bad-script` ·
819
+ * `duplicate-script` · `bad-bonuses` · `bad-setting` · `setting-overlap` ·
820
+ * `bad-preset` · `bad-difficulty` · `duplicate-difficulty` ·
821
+ * `difficulty-default` · `difficulty-without-dice` · 🚧 (2026-10-22, check
822
+ * methods) `bad-method` · `unknown-method-kind` · `unknown-method` ·
823
+ * `no-default-method` · `unknown-degree` · `bands-without-target` ·
824
+ * `dice-beside-methods` · `difficulty-beside-methods` · 🚧 `bad-casting` ·
825
+ * `bad-template` (2026-10-22, M3) · every repertoire
826
+ * reason (`repertoireFindings`, in this ruleset's context — `bad-tags`,
827
+ * `bad-amount`, `amount-needs-dice` among them) and every conversion reason
828
+ * (`conversionFindings`). What warns and never refuses is `rulesetWarnings`.
829
+ * @internal
830
+ */
831
+ export declare function rulesetFindings(id: string, input: RulesetProps | RulesetDecl): string[];
832
+ /**
833
+ * 🚧 What upgrading a ruleset from `prev` to `next` would leave unread or
834
+ * refuse: a repertoire or stat that disappears, a piece field that
835
+ * disappears without a `renames` entry or a `retired` mark on its
836
+ * repertoire, a field whose field type changes (a stored `'heavy'` read as
837
+ * an integer), and a field that becomes required with no default (every
838
+ * stored piece without it would be refused at its next write). Shape changes
839
+ * never rewrite stored data, so a version that breaks it silently is refused
840
+ * here instead.
841
+ *
842
+ * Reasons: `not-same-ruleset` · `dropped-repertoire` · `dropped-stat` ·
843
+ * `dropped-field` · `changed-field-type` · `newly-required`.
844
+ * @experimental
845
+ */
846
+ export declare function rulesetUpgradeFindings(prev: RulesetDecl, next: RulesetDecl): string[];
847
+ /** 🚧 Reserve a template's id against the registry. Called by `rulesetTemplates.ts` only. @internal */
848
+ export declare function _reserveRulesetTemplateId(id: RulesetId): void;
849
+ /** 🚧 Forget every reserved template id. Called by `_clearRulesetTemplates` only. @internal */
850
+ export declare function _releaseRulesetTemplateIds(): void;
851
+ /** 🚧 Whether an id is a ruleset template's — what a genre may never name. @experimental */
852
+ export declare const isRulesetTemplateId: (id: unknown) => boolean;
853
+ /**
854
+ * 🚧 A declaration as the registry keeps it — frozen, `plays` and `map` by
855
+ * id — whether or not it is registered (a template's is not).
856
+ * @internal
857
+ */
858
+ export declare function _rulesetDeclOf(id: RulesetId, props: RulesetProps, stored?: {
859
+ userId: number | string;
860
+ }): RulesetDecl;
861
+ /**
862
+ * 🚧 Declare a ruleset. Written below the slots its stats name and with its
863
+ * repertoires built (`defineRepertoire`); refused on any finding
864
+ * (`RulesetError`). An identical re-declaration is a no-op; a different one
865
+ * under a claimed id throws with both hashes.
866
+ * @experimental
867
+ */
868
+ export declare function defineRuleset(id: RulesetId, props: RulesetProps): RulesetDecl;
869
+ /**
870
+ * 🚧 Declare a ruleset **authored on the pub** — loaded from a stored row
871
+ * rather than imported from a package (PLAN-ruleset-editor §3). The same
872
+ * validation as `defineRuleset`, plus: the owner segment may not be `core`
873
+ * or an installed plugin's id (`reserveAttributeOwner` — one list of
874
+ * reserved owners for every stored declaration), and an id code holds is
875
+ * refused. Declaring a stored id a second time **replaces** it — that is
876
+ * what a publish does — where a code id must be identical.
877
+ * @experimental
878
+ */
879
+ export declare function defineStoredRuleset(id: RulesetId, props: RulesetProps, meta: {
880
+ userId: number | string;
881
+ }): RulesetDecl;
882
+ /**
883
+ * 🚧 Forget a ruleset and everything registered with it — its repertoires,
884
+ * compendium ids, stat listings and derived entry types. Never `core:`'s. For
885
+ * a stored ruleset's republish, retire or delete, and a package's withdrawal.
886
+ * Values stored against it stay where they are (parked data).
887
+ * @internal
888
+ */
889
+ export declare function _withdrawRuleset(id: RulesetId): boolean;
890
+ /** 🚧 The plugin-facing door — the same registration, minus core's namespace. @internal */
891
+ export declare function definePluginRuleset(pluginId: string, id: RulesetId, props: RulesetProps): RulesetDecl;
892
+ /** @experimental */
893
+ export declare const getRuleset: (id: RulesetId) => RulesetDecl | undefined;
894
+ /** @experimental */
895
+ export declare const rulesets: () => RulesetDecl[];
896
+ /** @internal */
897
+ export declare function _clearRulesets(): void;
898
+ export {};
899
+ //# sourceMappingURL=rulesets.d.ts.map