@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.
- package/dist/actions.d.ts +52 -2
- package/dist/actions.js +56 -6
- package/dist/annexFields.d.ts +32 -2
- package/dist/annexFields.js +48 -5
- package/dist/announce.d.ts +142 -2
- package/dist/announce.js +198 -2
- package/dist/attributes.d.ts +331 -6
- package/dist/attributes.js +339 -27
- package/dist/bridges.d.ts +61 -0
- package/dist/bridges.js +112 -0
- package/dist/builder.d.ts +278 -51
- package/dist/builder.js +267 -30
- package/dist/cadences.d.ts +585 -0
- package/dist/cadences.js +1118 -0
- package/dist/capabilities.d.ts +106 -17
- package/dist/capabilities.js +85 -7
- package/dist/checkMethods.d.ts +240 -0
- package/dist/checkMethods.js +362 -0
- package/dist/component.d.ts +6 -1
- package/dist/componentClient.d.ts +42 -6
- package/dist/componentWire.js +22 -4
- package/dist/composerStates.d.ts +96 -0
- package/dist/composerStates.js +190 -0
- package/dist/conditions.d.ts +424 -0
- package/dist/conditions.js +521 -0
- package/dist/config.d.ts +42 -6
- package/dist/config.js +48 -20
- package/dist/conversions.d.ts +41 -0
- package/dist/conversions.js +50 -0
- package/dist/declarations.d.ts +40 -2
- package/dist/declarations.js +178 -10
- package/dist/descriptors.d.ts +287 -4
- package/dist/descriptors.js +281 -18
- package/dist/document.d.ts +47 -2
- package/dist/document.js +46 -14
- package/dist/entities.d.ts +156 -0
- package/dist/entities.js +259 -0
- package/dist/events.d.ts +711 -1
- package/dist/events.js +412 -1
- package/dist/executor.d.ts +4 -3
- package/dist/executor.js +22 -8
- package/dist/exposure.d.ts +128 -0
- package/dist/exposure.js +168 -0
- package/dist/extension.d.ts +127 -3
- package/dist/extension.js +43 -0
- package/dist/fit.d.ts +198 -0
- package/dist/fit.js +351 -0
- package/dist/functions.d.ts +554 -0
- package/dist/functions.js +712 -0
- package/dist/genres.d.ts +303 -89
- package/dist/genres.js +335 -100
- package/dist/hookGrants.d.ts +15 -1
- package/dist/hookGrants.js +11 -10
- package/dist/hooks.d.ts +34 -5
- package/dist/hooks.js +5 -2
- package/dist/hostElements.d.ts +7 -1
- package/dist/hostElements.js +20 -1
- package/dist/hostState.d.ts +110 -0
- package/dist/hostState.js +140 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.js +48 -0
- package/dist/jsonSchema.d.ts +178 -0
- package/dist/jsonSchema.js +570 -0
- package/dist/libraryDraft.d.ts +27 -0
- package/dist/libraryDraft.js +25 -0
- package/dist/lorebookFile.d.ts +44 -0
- package/dist/lorebookFile.js +202 -0
- package/dist/media.d.ts +127 -12
- package/dist/media.js +45 -1
- package/dist/messageBlocks.d.ts +179 -5
- package/dist/messageBlocks.js +208 -6
- package/dist/participants.d.ts +32 -9
- package/dist/participants.js +13 -2
- package/dist/pluginHarness.d.ts +63 -33
- package/dist/pluginHarness.js +78 -144
- package/dist/pluginPermissions.d.ts +15 -1
- package/dist/pluginPermissions.js +29 -2
- package/dist/preview.d.ts +45 -4
- package/dist/preview.js +52 -12
- package/dist/primers.d.ts +177 -0
- package/dist/primers.js +265 -0
- package/dist/receipt.d.ts +11 -0
- package/dist/receiverRules.js +9 -0
- package/dist/refs.d.ts +9 -1
- package/dist/refs.js +12 -0
- package/dist/registrations.d.ts +384 -0
- package/dist/registrations.js +625 -0
- package/dist/repertoires.d.ts +502 -0
- package/dist/repertoires.js +666 -0
- package/dist/rulesetDocument.d.ts +116 -0
- package/dist/rulesetDocument.js +252 -0
- package/dist/rulesetSections.d.ts +631 -0
- package/dist/rulesetSections.js +1288 -0
- package/dist/rulesetTemplates.d.ts +161 -0
- package/dist/rulesetTemplates.js +242 -0
- package/dist/rulesets.d.ts +899 -0
- package/dist/rulesets.js +1378 -0
- package/dist/sceneSettings.d.ts +8 -0
- package/dist/sceneSettings.js +10 -2
- package/dist/scope.d.ts +44 -3
- package/dist/scope.js +18 -0
- package/dist/scripts.d.ts +31 -8
- package/dist/scripts.js +45 -8
- package/dist/sessionDossier.d.ts +157 -7
- package/dist/sessionLayout.d.ts +291 -138
- package/dist/sessionLayout.js +504 -211
- package/dist/sessionSettings.d.ts +24 -0
- package/dist/settings.d.ts +95 -4
- package/dist/settings.js +293 -4
- package/dist/shapes.d.ts +80 -1
- package/dist/shapes.js +100 -5
- package/dist/speech.d.ts +333 -0
- package/dist/speech.js +199 -0
- package/dist/statShapes.d.ts +8 -1
- package/dist/statShapes.js +8 -1
- package/dist/status.d.ts +14 -0
- package/dist/status.js +12 -0
- package/dist/storage.d.ts +53 -66
- package/dist/storage.js +7 -12
- package/dist/storyTime.d.ts +25 -1
- package/dist/storyTime.js +42 -2
- package/dist/surfaces.d.ts +15 -2
- package/dist/template.d.ts +19 -1
- package/dist/template.js +25 -11
- package/dist/templateScopeAt.d.ts +1 -1
- package/dist/templateScopeAt.js +11 -8
- package/dist/ties.d.ts +211 -0
- package/dist/ties.js +301 -0
- package/dist/turnOrder.d.ts +25 -14
- package/dist/turnOrder.js +21 -8
- package/dist/userAnnex.d.ts +126 -0
- package/dist/userAnnex.js +214 -0
- package/dist/validate.js +114 -19
- package/dist/values.js +6 -0
- package/dist/vocabularies.d.ts +192 -0
- package/dist/vocabularies.js +326 -0
- package/dist/widgetDecls.d.ts +12 -0
- package/dist/widgetDecls.js +2 -0
- package/dist/widgets.d.ts +1062 -29
- package/dist/widgets.js +218 -3
- package/host-elements.d.ts +90 -0
- package/package.json +1 -1
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚧 Repertoires — the kinds of thing a ruleset lets an owner hold, and the
|
|
3
|
+
* pieces each one holds.
|
|
4
|
+
*
|
|
5
|
+
* A **repertoire** is a list a ruleset declares: *things* a character
|
|
6
|
+
* carries, *conditions* they suffer, *exits* out of a place. A **piece** is
|
|
7
|
+
* one item of it — a sword, *Bleeding*, a barred oak door — and every piece,
|
|
8
|
+
* whatever the repertoire, has the same universal parts: a `name`, a
|
|
9
|
+
* `description`, optional `prose`, its `traits` (plain strings a mechanic's
|
|
10
|
+
* predicate can test), whether it is `equipped`, and how long it lasts on its
|
|
11
|
+
* holder (`duration`). A repertoire's own `piece` shape adds what is
|
|
12
|
+
* particular to it.
|
|
13
|
+
*
|
|
14
|
+
* ## Prose and mechanics are siblings
|
|
15
|
+
*
|
|
16
|
+
* A repertoire carries field-level `prose` (what a model should infer pieces
|
|
17
|
+
* of this kind do) beside its `mechanics` (what the handler computes). At
|
|
18
|
+
* `prose` rigour only the first is read; at `mechanics` the second is
|
|
19
|
+
* evaluated too. There is no translation step between them.
|
|
20
|
+
*
|
|
21
|
+
* ## Mechanics: a closed, single-pass set of verbs
|
|
22
|
+
*
|
|
23
|
+
* `modify` · `set` (the owning ruleset only) · `adjustDegree` · `rider` —
|
|
24
|
+
* and 🚧 (2026-10-18, owner ruling ★4: the ruleset handler executes a
|
|
25
|
+
* piece's effects, never a model's arithmetic) five that act **when a piece
|
|
26
|
+
* is used** (`on: 'hit'` or `'use'`): `rollWith` (the check rolls with the
|
|
27
|
+
* best of some modifiers), `harm` and `heal` (an **amount** — dice, a number
|
|
28
|
+
* or a selector's value, `AmountExpr` — on a stat), `cure` (pieces with a
|
|
29
|
+
* trait leave) and `consume` (one use spent).
|
|
30
|
+
* Each may fire `on` an event and hold under a `predicate`. How long an
|
|
31
|
+
* effect lasts is the **piece's** `duration` (a universal part, counted down
|
|
32
|
+
* by the host), never the mechanic's: a mechanic holds while its piece is
|
|
33
|
+
* held. A mechanic that would silently do nothing — a degree adjustment on a
|
|
34
|
+
* rest, a `traverse` on a repertoire that is not relational, a target no
|
|
35
|
+
* selector or selector family names — is refused when it is authored, with
|
|
36
|
+
* the reason named (`repertoireFindings`).
|
|
37
|
+
*
|
|
38
|
+
* (2026-10-17: `bestow`, `situational`, a mechanic's own `duration` and
|
|
39
|
+
* `promptPolicy` were cut — declared and validated, never read by a host.)
|
|
40
|
+
*
|
|
41
|
+
* ## Where a piece lives
|
|
42
|
+
*
|
|
43
|
+
* A piece is stored as an item of an ordinary `list` attribute slot whose
|
|
44
|
+
* `config.repertoire` names the repertoire by its address
|
|
45
|
+
* (`core:ruleset/freeform@1#things`, `repertoireAddress`). Three forms
|
|
46
|
+
* (`SlotPiece`, attributes.ts): written out inline, a reference to a lore
|
|
47
|
+
* entry, or a reference to a compendium row — the last two with optional
|
|
48
|
+
* overrides. No seventh slot type: a repertoire is a list that knows its
|
|
49
|
+
* item's shape.
|
|
50
|
+
*
|
|
51
|
+
* ⚠ Not a *list slot* in general (that holds words and lore references), not
|
|
52
|
+
* a *sheet* (which names slots), never an *inventory* (that is one core slot).
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
import type { I18n } from './i18n.js';
|
|
56
|
+
import { type FieldDecl } from './settings.js';
|
|
57
|
+
import { type Predicate } from './predicates.js';
|
|
58
|
+
import type { SlotAppliesTo, SlotEarshot, SlotPiece, SlotScalar } from './attributes.js';
|
|
59
|
+
import type { StoryTime } from './storyTime.js';
|
|
60
|
+
/** The depths, shallowest first — the order a budget degrades through. */
|
|
61
|
+
/** 🚧 The render depths, shallowest first; the editor's choices. @experimental */
|
|
62
|
+
export declare const RENDER_DEPTHS: readonly ['index', 'summary', 'full'];
|
|
63
|
+
/**
|
|
64
|
+
* 🚧 How deep a piece renders into a prompt: one line (`index`), the
|
|
65
|
+
* declared summary (`summary`), or everything (`full`). A budget degrades a
|
|
66
|
+
* block's depth before it drops it.
|
|
67
|
+
* @experimental
|
|
68
|
+
*/
|
|
69
|
+
export type RenderDepth = (typeof RENDER_DEPTHS)[number];
|
|
70
|
+
/**
|
|
71
|
+
* 🚧 The **repertoire tags** core reads (2026-10-22): what a repertoire's
|
|
72
|
+
* pieces are, said once on the declaration (`tags: ['condition']`), so what a
|
|
73
|
+
* ruleset provides — conditions, casting — is read from the declaration,
|
|
74
|
+
* never guessed from a repertoire's name (`rulesetProvides`). The list is
|
|
75
|
+
* open: a ruleset may tag with words of its own, lowercase and joined by
|
|
76
|
+
* '-'. ⚠ Always _repertoire tag_ where it could stand alone (R3): not a
|
|
77
|
+
* **Tag** label (§22), not a **cast tag** (`{{char:N}}`), not a piece's
|
|
78
|
+
* `traits`.
|
|
79
|
+
* @experimental
|
|
80
|
+
* @ruling PLAN-rulesets-authoring D1 (2026-10-22)
|
|
81
|
+
*/
|
|
82
|
+
export declare const REPERTOIRE_TAGS: readonly ['condition', 'casting', 'weapon', 'armour', 'relationship', 'resource', 'exit', 'note', 'creature', 'class'];
|
|
83
|
+
/** 🚧 A repertoire tag: one of core's (`REPERTOIRE_TAGS`), or a ruleset's own word. @experimental */
|
|
84
|
+
export type RepertoireTag = (typeof REPERTOIRE_TAGS)[number] | (string & {});
|
|
85
|
+
/**
|
|
86
|
+
* 🚧 An **amount expression** (2026-10-22) — how much a `harm` or `heal`
|
|
87
|
+
* moves a stat:
|
|
88
|
+
*
|
|
89
|
+
* · a number — that much (`3`);
|
|
90
|
+
* · a dice string — thrown (`'2d6+1'`, `'d8'`): only in a ruleset one of
|
|
91
|
+
* whose check methods throws dice (`die-target`, `dice-pool`) —
|
|
92
|
+
* `amount-needs-dice` otherwise;
|
|
93
|
+
* · `{ selector }` — the value a selector of the ruleset holds
|
|
94
|
+
* (`{ selector: 'level' }`), or a field of the piece used
|
|
95
|
+
* (`{ selector: 'piece.damage' }`), itself a number or, under a dice
|
|
96
|
+
* method, a dice string.
|
|
97
|
+
* @experimental
|
|
98
|
+
*/
|
|
99
|
+
export type AmountExpr = number | string | {
|
|
100
|
+
readonly selector: string;
|
|
101
|
+
};
|
|
102
|
+
/** The verbs a mechanic may use — closed, single pass. */
|
|
103
|
+
/** 🚧 The closed verb set a mechanic uses (`MechanicDecl.verb`); the editor's choices. @experimental */
|
|
104
|
+
export declare const MECHANIC_VERBS: readonly ['modify', 'set', 'adjustDegree', 'rider', 'rollWith', 'harm', 'heal', 'cure', 'consume'];
|
|
105
|
+
/** @experimental */
|
|
106
|
+
export type MechanicVerb = (typeof MECHANIC_VERBS)[number];
|
|
107
|
+
/**
|
|
108
|
+
* 🚧 The verbs that act when a piece is used (2026-10-18): they need the
|
|
109
|
+
* piece and an event that uses it (`hit`, `use`), so a bridge — which has
|
|
110
|
+
* no piece — never says one. @internal
|
|
111
|
+
*/
|
|
112
|
+
export declare const PIECE_USE_VERBS: ReadonlySet<string>;
|
|
113
|
+
/**
|
|
114
|
+
* The events a mechanic may fire on. `hit`, `use` and `traverse` are the
|
|
115
|
+
* three that resolve a check; `traverse` is a relational repertoire's (an
|
|
116
|
+
* exit is crossed). `elapsed` names `every`; `at` names a story date.
|
|
117
|
+
*/
|
|
118
|
+
/** 🚧 The moments a mechanic may fire on (`MechanicDecl.on`); the editor's choices. @experimental */
|
|
119
|
+
export declare const MECHANIC_EVENTS: readonly ['hit', 'use', 'rest', 'equip', 'turn', 'elapsed', 'at', 'change', 'traverse'];
|
|
120
|
+
/** @experimental */
|
|
121
|
+
export type MechanicEvent = (typeof MECHANIC_EVENTS)[number];
|
|
122
|
+
/**
|
|
123
|
+
* The units a piece's `duration` counts in. `round` is a round-keeping
|
|
124
|
+
* ruleset's; `minute`/`hour`/`day` need a ruleset with a clock; `turn`,
|
|
125
|
+
* `scene` and `until-removed` are counted by play, not by a clock.
|
|
126
|
+
*/
|
|
127
|
+
declare const PIECE_DURATION_UNITS: readonly ['round', 'minute', 'hour', 'day', 'turn', 'scene', 'until-removed'];
|
|
128
|
+
/** What ends a piece's `duration`. */
|
|
129
|
+
declare const PIECE_DURATION_EXPIRIES: readonly ['turn-start', 'turn-end', 'rest', 'scene-end', 'elapsed', 'never'];
|
|
130
|
+
/**
|
|
131
|
+
* 🚧 How long a piece lasts **on its holder** — a universal piece part
|
|
132
|
+
* (`PIECE_FIELDS.duration`): _Poisoned_ for an hour, _Prone_ until removed.
|
|
133
|
+
* The host counts it down and removes the piece when it runs out; a
|
|
134
|
+
* repertoire never redeclares it.
|
|
135
|
+
*
|
|
136
|
+
* · `units` — `round` · `minute` · `hour` · `day` · `turn` · `scene` ·
|
|
137
|
+
* `until-removed`, refused when the ruleset's time cannot count it
|
|
138
|
+
* (`pieceDurationProblem`): a round in a ruleset that keeps no rounds, a
|
|
139
|
+
* minute in one that keeps time by the scene.
|
|
140
|
+
* · `value` — how many units; `expiry` — what ends it (`turn-start` ·
|
|
141
|
+
* `turn-end` · `rest` · `scene-end` · `elapsed` · `never`).
|
|
142
|
+
* · `startedAt` / `spent` — the host's bookkeeping as it counts down.
|
|
143
|
+
*
|
|
144
|
+
* ⚠ Not how long a *spell's effect* lasts once cast: a known spell is held
|
|
145
|
+
* until forgotten, and a ruleset says its effect's length in a field of its
|
|
146
|
+
* own (Vis Itineris: `effectDuration`).
|
|
147
|
+
* @experimental
|
|
148
|
+
*/
|
|
149
|
+
export interface PieceDuration {
|
|
150
|
+
units: (typeof PIECE_DURATION_UNITS)[number];
|
|
151
|
+
value?: number;
|
|
152
|
+
expiry?: (typeof PIECE_DURATION_EXPIRIES)[number];
|
|
153
|
+
startedAt?: {
|
|
154
|
+
turn?: number;
|
|
155
|
+
messageId?: number;
|
|
156
|
+
clock?: StoryTime;
|
|
157
|
+
};
|
|
158
|
+
spent?: number;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 🚧 Why a piece's `duration` cannot be counted by a ruleset that keeps time
|
|
162
|
+
* in `timeUnit`, or `null` when it can. Without a `timeUnit` only the shape
|
|
163
|
+
* is judged. What `checkPiece` and a ruleset's compendium check both ask.
|
|
164
|
+
* @experimental
|
|
165
|
+
*/
|
|
166
|
+
export declare function pieceDurationProblem(duration: unknown, timeUnit?: string): string | null;
|
|
167
|
+
/**
|
|
168
|
+
* 🚧 The condition a mechanic holds under: the SDK's predicate grammar
|
|
169
|
+
* (`predicates.ts`) over a **selector** path, extended with trait strings
|
|
170
|
+
* and the three combinators. A path names a selector the owning ruleset
|
|
171
|
+
* declares, or `piece.<field>` for the repertoire's own piece fields —
|
|
172
|
+
* anything else is refused when authored, never a silent miss at runtime.
|
|
173
|
+
* @experimental
|
|
174
|
+
*/
|
|
175
|
+
export type MechanicPredicate = (Predicate & {
|
|
176
|
+
path: string;
|
|
177
|
+
}) | {
|
|
178
|
+
traits: {
|
|
179
|
+
all?: readonly string[];
|
|
180
|
+
any?: readonly string[];
|
|
181
|
+
none?: readonly string[];
|
|
182
|
+
};
|
|
183
|
+
} | {
|
|
184
|
+
all: readonly MechanicPredicate[];
|
|
185
|
+
} | {
|
|
186
|
+
any: readonly MechanicPredicate[];
|
|
187
|
+
} | {
|
|
188
|
+
not: MechanicPredicate;
|
|
189
|
+
};
|
|
190
|
+
/** What every mechanic may say beside its verb. */
|
|
191
|
+
interface MechanicBase {
|
|
192
|
+
/** The event it fires on. Absent: it holds whenever its owner is resolved. */
|
|
193
|
+
on?: MechanicEvent;
|
|
194
|
+
/** `on: 'elapsed'` only: every how many of the ruleset's time units. */
|
|
195
|
+
every?: number;
|
|
196
|
+
/** `on: 'at'` only: the story date it fires at (`'412-03-05 22:30'`). */
|
|
197
|
+
at?: string;
|
|
198
|
+
predicate?: MechanicPredicate;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 🚧 One mechanic. `target` is a selector the owning ruleset declares, or —
|
|
202
|
+
* for `modify`, `adjustDegree` and `rider` — a **selector family**: a dotted
|
|
203
|
+
* selector's parent (`attack` covers `attack.melee`) or a check's declared
|
|
204
|
+
* `within` (`check` covers every skill check). See `RulesetSelectorDecl`.
|
|
205
|
+
*
|
|
206
|
+
* · `modify` — add `value` to the target; `bonusType` groups typed bonuses.
|
|
207
|
+
* · `set` — the target becomes `value`. Only the ruleset that owns the stat,
|
|
208
|
+
* and only the stat itself, never a family.
|
|
209
|
+
* · `adjustDegree` — a check's degree moves one band (`by`).
|
|
210
|
+
* · `rider` — prose attached to a stat (`target`) or an event (`on`).
|
|
211
|
+
*
|
|
212
|
+
* 🚧 When a piece is used (`on: 'hit'` or `'use'`; 2026-10-18):
|
|
213
|
+
*
|
|
214
|
+
* · `rollWith` — a check made with the piece on `target` (a check or a
|
|
215
|
+
* family) rolls with the highest of the `from` selectors as its modifier
|
|
216
|
+
* instead of its own `base` — a finesse blade with Strength or Dexterity.
|
|
217
|
+
* · `harm` — on a landed check (or a use against nothing), take its
|
|
218
|
+
* `amount` (`AmountExpr`: dice, a number, or a selector — a piece field
|
|
219
|
+
* holding `{ dice, die }`, `{ formula }`, `'2d4+2'` or a number), add
|
|
220
|
+
* `plus` — `'check'` (the modifier the check rolled with) or the highest
|
|
221
|
+
* of some selectors — and the ruleset's `tally` modifies, and take the
|
|
222
|
+
* total off `stat` on the **target** the change names. With no target
|
|
223
|
+
* owner the amount is only told. ⏳ `dice: 'piece.damage'` (the shape
|
|
224
|
+
* before 2026-10-22) means `amount: { selector: 'piece.damage' }`.
|
|
225
|
+
* · `heal` — the same amount and `plus`, added to `stat` on the target
|
|
226
|
+
* (else the holder), never past the stat's maximum.
|
|
227
|
+
* · `cure` — on the target (else the holder), every held piece carrying
|
|
228
|
+
* one of `traits` leaves, and none carrying one lands for the rest of the
|
|
229
|
+
* change set.
|
|
230
|
+
* · `consume` — one use of the piece is spent whenever it is used, landed
|
|
231
|
+
* or not (`uses`, else the stack's `count`; the last leaves).
|
|
232
|
+
*
|
|
233
|
+
* ⚠ `harm`/`heal` move numbers, so a host runs them only where numbers
|
|
234
|
+
* count (the `mechanics` rigour and up); `cure` and `consume` change no
|
|
235
|
+
* number and apply at every rigour.
|
|
236
|
+
* @experimental
|
|
237
|
+
*/
|
|
238
|
+
export type MechanicDecl = MechanicBase & ({
|
|
239
|
+
verb: 'modify';
|
|
240
|
+
target: string;
|
|
241
|
+
value: number;
|
|
242
|
+
bonusType?: string;
|
|
243
|
+
} | {
|
|
244
|
+
verb: 'set';
|
|
245
|
+
target: string;
|
|
246
|
+
value: SlotScalar;
|
|
247
|
+
} | {
|
|
248
|
+
verb: 'adjustDegree';
|
|
249
|
+
target: string;
|
|
250
|
+
by: -1 | 1;
|
|
251
|
+
} | {
|
|
252
|
+
verb: 'rider';
|
|
253
|
+
text: string;
|
|
254
|
+
target?: string;
|
|
255
|
+
} | {
|
|
256
|
+
verb: 'rollWith';
|
|
257
|
+
target: string;
|
|
258
|
+
from: readonly string[];
|
|
259
|
+
} | {
|
|
260
|
+
verb: 'harm';
|
|
261
|
+
amount?: AmountExpr; /** ⏳ say `amount: { selector }` */
|
|
262
|
+
dice?: string;
|
|
263
|
+
stat: string;
|
|
264
|
+
plus?: 'check' | readonly string[];
|
|
265
|
+
} | {
|
|
266
|
+
verb: 'heal';
|
|
267
|
+
amount?: AmountExpr; /** ⏳ say `amount: { selector }` */
|
|
268
|
+
dice?: string;
|
|
269
|
+
stat: string;
|
|
270
|
+
plus?: readonly string[];
|
|
271
|
+
} | {
|
|
272
|
+
verb: 'cure';
|
|
273
|
+
traits: readonly string[];
|
|
274
|
+
} | {
|
|
275
|
+
verb: 'consume';
|
|
276
|
+
});
|
|
277
|
+
/**
|
|
278
|
+
* 🚧 The parts every piece has, whatever its repertoire. A repertoire's own
|
|
279
|
+
* `piece` fields are laid beside these and may not redeclare them.
|
|
280
|
+
* @experimental
|
|
281
|
+
*/
|
|
282
|
+
export declare const PIECE_FIELDS: Readonly<Record<string, FieldDecl>>;
|
|
283
|
+
/**
|
|
284
|
+
* 🚧 What a relational repertoire's pieces carry as well: the owner the piece
|
|
285
|
+
* points `towards` (`location:12`, `character:4`) and, for an exit, the places
|
|
286
|
+
* graph `edge` it decorates.
|
|
287
|
+
* @experimental
|
|
288
|
+
*/
|
|
289
|
+
export declare const RELATIONAL_PIECE_FIELDS: Readonly<Record<string, FieldDecl>>;
|
|
290
|
+
/**
|
|
291
|
+
* 🚧 A piece's fields, flat: the universal parts and a repertoire's own.
|
|
292
|
+
* What an inline piece and a compendium row both are.
|
|
293
|
+
* @experimental
|
|
294
|
+
*/
|
|
295
|
+
export interface PieceProps {
|
|
296
|
+
name: string;
|
|
297
|
+
description: string;
|
|
298
|
+
prose?: string;
|
|
299
|
+
traits?: readonly string[];
|
|
300
|
+
equipped?: boolean;
|
|
301
|
+
duration?: PieceDuration;
|
|
302
|
+
[field: string]: unknown;
|
|
303
|
+
}
|
|
304
|
+
/** What `defineRepertoire` takes. */
|
|
305
|
+
interface RepertoireProps {
|
|
306
|
+
/** The name a person reads. Display text. */
|
|
307
|
+
label: I18n;
|
|
308
|
+
/** What it is for. Display text. */
|
|
309
|
+
description?: I18n;
|
|
310
|
+
/**
|
|
311
|
+
* The repertoire's own piece fields, as an `object` FieldDecl. The
|
|
312
|
+
* universal parts (`PIECE_FIELDS`) are always present and are not restated.
|
|
313
|
+
*/
|
|
314
|
+
piece?: FieldDecl;
|
|
315
|
+
/** Field-level prose: what a model infers pieces of this kind do. Model-facing; inside the hash. */
|
|
316
|
+
prose: string;
|
|
317
|
+
mechanics?: readonly MechanicDecl[];
|
|
318
|
+
/**
|
|
319
|
+
* 🚧 Which prompts may read its pieces — the slot word (`SlotEarshot`):
|
|
320
|
+
* `'all'` (absent) every agent's, `'holder'` only the holder's own voice.
|
|
321
|
+
*/
|
|
322
|
+
earshot?: SlotEarshot;
|
|
323
|
+
/**
|
|
324
|
+
* 🚧 Read by the game master's steps alone (a creature's stat block): kept
|
|
325
|
+
* out of every voice's prompt and every player's view. Separate from
|
|
326
|
+
* `earshot` — who hears it and whether the GM alone does are two questions.
|
|
327
|
+
*/
|
|
328
|
+
gmOnly?: boolean;
|
|
329
|
+
/** The depth its pieces render at when nothing else decides. */
|
|
330
|
+
renderDepth?: RenderDepth;
|
|
331
|
+
/**
|
|
332
|
+
* Which owners hold its pieces: cast members (the default), the world, a
|
|
333
|
+
* location — an exit is held by the place it leads out of.
|
|
334
|
+
*/
|
|
335
|
+
appliesTo?: readonly SlotAppliesTo[];
|
|
336
|
+
/** Pieces point at another owner (`towards`) — relationships, exits. */
|
|
337
|
+
relational?: boolean;
|
|
338
|
+
/** Its pieces may become lorebook entries of a derived entry type. */
|
|
339
|
+
entryable?: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* 🚧 What its pieces are (`REPERTOIRE_TAGS`, open): `['condition']`,
|
|
342
|
+
* `['casting']`. Read by `rulesetProvides`; absent when unstated, so a
|
|
343
|
+
* repertoire that says nothing hashes as it did.
|
|
344
|
+
*/
|
|
345
|
+
tags?: readonly RepertoireTag[];
|
|
346
|
+
/**
|
|
347
|
+
* Piece fields renamed since an earlier version, old → new — so stored
|
|
348
|
+
* pieces read through. Required by `rulesetUpgradeFindings` for a field
|
|
349
|
+
* that disappears.
|
|
350
|
+
*/
|
|
351
|
+
renames?: Readonly<Record<string, string>>;
|
|
352
|
+
/** Piece fields retired since an earlier version: no longer declared, still read. */
|
|
353
|
+
retired?: readonly string[];
|
|
354
|
+
}
|
|
355
|
+
/** @experimental */
|
|
356
|
+
export interface RepertoireDecl extends Omit<RepertoireProps, 'piece'> {
|
|
357
|
+
/** A short name unique within its ruleset — `things`, `conditions`. */
|
|
358
|
+
readonly id: string;
|
|
359
|
+
/** The whole piece shape: the universal parts, the relational ones when it is relational, then its own. */
|
|
360
|
+
readonly piece: FieldDecl;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* 🚧 Why a ruleset, repertoire, bridge or conversion is refused. Thrown by
|
|
364
|
+
* the define doors with every finding joined; each finding opens with its
|
|
365
|
+
* reason's name in brackets (`[unknown-selector] …`).
|
|
366
|
+
* @internal
|
|
367
|
+
*/
|
|
368
|
+
export declare class RulesetError extends Error {
|
|
369
|
+
readonly findings: readonly string[];
|
|
370
|
+
constructor(what: string, findings: readonly string[]);
|
|
371
|
+
}
|
|
372
|
+
/** A finding, opened by its reason's name — `[reason] sentence`. @internal */
|
|
373
|
+
export declare const finding: (reason: string, text: string) => string;
|
|
374
|
+
/**
|
|
375
|
+
* The ruleset id grammar — `owner:ruleset/name@N`. Declared here because a
|
|
376
|
+
* compendium reference is checked here; `rulesets.ts` reads the same pattern.
|
|
377
|
+
* @internal
|
|
378
|
+
*/
|
|
379
|
+
export declare const RULESET_ID_PATTERN: RegExp;
|
|
380
|
+
/**
|
|
381
|
+
* 🚧 A repertoire's address: its ruleset's id and its own name —
|
|
382
|
+
* `core:ruleset/freeform@1#things`. What a slot's `config.repertoire` holds.
|
|
383
|
+
* @experimental
|
|
384
|
+
*/
|
|
385
|
+
export declare const repertoireAddress: (rulesetId: string, repertoireId: string) => string;
|
|
386
|
+
/** 🚧 The two halves of an address, or `undefined` when it is not one. @experimental */
|
|
387
|
+
export declare function parseRepertoireAddress(address: string): {
|
|
388
|
+
ruleset: string;
|
|
389
|
+
repertoire: string;
|
|
390
|
+
} | undefined;
|
|
391
|
+
/**
|
|
392
|
+
* What a repertoire sits in when it is checked against a ruleset: the
|
|
393
|
+
* selectors mechanics may target, the selector families a `modify`,
|
|
394
|
+
* `adjustDegree` or `rider` may target besides, the stats the ruleset owns
|
|
395
|
+
* (the only targets of `set`), its repertoires, and its time unit.
|
|
396
|
+
* @internal
|
|
397
|
+
*/
|
|
398
|
+
export interface RepertoireContext {
|
|
399
|
+
ruleset: string;
|
|
400
|
+
selectors: ReadonlySet<string>;
|
|
401
|
+
/**
|
|
402
|
+
* Names that are no selector but cover some (2026-10-17): every dotted
|
|
403
|
+
* selector's parents (`attack` for `attack.melee`) and every check's
|
|
404
|
+
* declared `within`.
|
|
405
|
+
*/
|
|
406
|
+
families?: ReadonlySet<string>;
|
|
407
|
+
/** Selector names that are the ruleset's own stats. */
|
|
408
|
+
ownStats: ReadonlySet<string>;
|
|
409
|
+
repertoires: ReadonlyMap<string, RepertoireDecl>;
|
|
410
|
+
timeUnit?: string;
|
|
411
|
+
/**
|
|
412
|
+
* 🚧 Whether one of the ruleset's check methods throws dice — what a
|
|
413
|
+
* dice-string amount needs (2026-10-22). Absent: not judged.
|
|
414
|
+
*/
|
|
415
|
+
rollsDice?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Extra paths a predicate may name, never a target — a bridge's own field,
|
|
418
|
+
* by its bare key and its id, and their properties (`mood`, `mood.tone`).
|
|
419
|
+
* Added 2026-10-17.
|
|
420
|
+
*/
|
|
421
|
+
predicatePaths?: ReadonlySet<string>;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* 🚧 The amount a `harm` or `heal` moves its stat by: its `amount`, else the
|
|
425
|
+
* ⏳ `dice: 'piece.<field>'` it said before 2026-10-22, read as
|
|
426
|
+
* `{ selector: 'piece.<field>' }`. `undefined` for any other verb.
|
|
427
|
+
* @experimental
|
|
428
|
+
*/
|
|
429
|
+
export declare function mechanicAmount(m: MechanicDecl): AmountExpr | undefined;
|
|
430
|
+
/**
|
|
431
|
+
* One mechanic's findings outside a repertoire — a bridge's effects. `where`
|
|
432
|
+
* names the declaration in each sentence.
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
export declare const _mechanicFindings: (m: MechanicDecl, i: number, ctx: RepertoireContext | undefined, where: string) => string[];
|
|
436
|
+
/**
|
|
437
|
+
* 🚧 A repertoire's piece rules alone, checked against its ruleset — what a
|
|
438
|
+
* ruleset in sections asks of an entry type that carries ⏳ piece rules
|
|
439
|
+
* (its own words are the entry type's findings). `where` names it.
|
|
440
|
+
* @internal
|
|
441
|
+
*/
|
|
442
|
+
export declare const _repertoireMechanicFindings: (rep: RepertoireDecl, ctx: RepertoireContext, where: string) => string[];
|
|
443
|
+
/**
|
|
444
|
+
* 🚧 Every reason a repertoire is refused, each opened by its reason's name.
|
|
445
|
+
* Without `ctx` it checks what the declaration says by itself; with one it
|
|
446
|
+
* also checks the mechanics against the ruleset it sits in
|
|
447
|
+
* (`unknown-selector`, `set-outside-owner`). `rulesetFindings` passes the
|
|
448
|
+
* context.
|
|
449
|
+
*
|
|
450
|
+
* Reasons: `invalid-id` · `display-text` · `missing-prose` ·
|
|
451
|
+
* `piece-not-object` · `piece-redeclares-universal` · `piece-reserved-field` ·
|
|
452
|
+
* `bad-applies-to` · `bad-earshot` · `bad-gm-only` · `bad-render-depth` ·
|
|
453
|
+
* `rename-still-declared` · `rename-to-nothing` · `retired-still-declared` ·
|
|
454
|
+
* `unknown-verb` · `unknown-event` · `malformed-mechanic` · `inert-pairing` ·
|
|
455
|
+
* `mechanic-duration` · `bad-predicate` · `unknown-selector` ·
|
|
456
|
+
* `set-outside-owner` · 🚧 (2026-10-22) `bad-tags` · `bad-amount` ·
|
|
457
|
+
* `amount-needs-dice`.
|
|
458
|
+
* @internal
|
|
459
|
+
*/
|
|
460
|
+
export declare function repertoireFindings(decl: RepertoireDecl, ctx?: RepertoireContext): string[];
|
|
461
|
+
/**
|
|
462
|
+
* 🚧 Declare a repertoire. Its own findings refuse it here (`RulesetError`);
|
|
463
|
+
* the ones that need its ruleset — selectors, owned stats — refuse the
|
|
464
|
+
* ruleset that lists it. Not registered on its own: a repertoire is reached
|
|
465
|
+
* through the ruleset that declares it.
|
|
466
|
+
* @experimental
|
|
467
|
+
*/
|
|
468
|
+
export declare function defineRepertoire(id: string, props: RepertoireProps): RepertoireDecl;
|
|
469
|
+
/**
|
|
470
|
+
* Put a registered ruleset's repertoires, compendium row ids and time unit
|
|
471
|
+
* where a write can reach them by address. Called by `rulesets.ts` only.
|
|
472
|
+
* @internal
|
|
473
|
+
*/
|
|
474
|
+
export declare function _registerRulesetRepertoires(rulesetId: string, repertoires: readonly RepertoireDecl[], compendiumRows: ReadonlyMap<string, ReadonlySet<string>>, timeUnit?: string): void;
|
|
475
|
+
/** The time unit of the ruleset an address names, when it is registered. @internal */
|
|
476
|
+
export declare const _repertoireTimeUnit: (address: string) => string | undefined;
|
|
477
|
+
/** @internal */
|
|
478
|
+
export declare function _clearRepertoires(): void;
|
|
479
|
+
/**
|
|
480
|
+
* 🚧 Forget one ruleset's repertoires, compendium ids and time unit — what
|
|
481
|
+
* `_registerRulesetRepertoires` filed under it. For a stored ruleset that is
|
|
482
|
+
* republished, retired or deleted; `_withdrawRuleset` calls it.
|
|
483
|
+
* @internal
|
|
484
|
+
*/
|
|
485
|
+
export declare function _withdrawRulesetRepertoires(rulesetId: string): void;
|
|
486
|
+
/** 🚧 The repertoire at an address (`core:ruleset/freeform@1#things`), when a registered ruleset declares it. @experimental */
|
|
487
|
+
export declare const getRepertoire: (address: string) => RepertoireDecl | undefined;
|
|
488
|
+
/**
|
|
489
|
+
* 🚧 Why this piece may not be held in this repertoire, or `null` if it may.
|
|
490
|
+
* An inline piece is checked whole against the piece shape; a reference's
|
|
491
|
+
* `overrides` are checked key by key. A compendium reference to a registered
|
|
492
|
+
* ruleset must name a row it has in this repertoire; one to a ruleset that
|
|
493
|
+
* is not installed is kept — its data parks, it is never refused for that.
|
|
494
|
+
* With `ctx.timeUnit` (the ruleset's), a `duration` it cannot count is
|
|
495
|
+
* refused too (`pieceDurationProblem`); a write through a slot passes it.
|
|
496
|
+
* @experimental
|
|
497
|
+
*/
|
|
498
|
+
export declare function checkPiece(rep: RepertoireDecl, item: SlotPiece, ctx?: {
|
|
499
|
+
timeUnit?: string;
|
|
500
|
+
}): string | null;
|
|
501
|
+
export {};
|
|
502
|
+
//# sourceMappingURL=repertoires.d.ts.map
|