@serene-pub/sdk 0.6.0-pr-1
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/LICENSE +202 -0
- package/NOTICE +17 -0
- package/README.md +368 -0
- package/dist/actions.d.ts +572 -0
- package/dist/actions.js +829 -0
- package/dist/annexFields.d.ts +234 -0
- package/dist/annexFields.js +413 -0
- package/dist/announce.d.ts +464 -0
- package/dist/announce.js +426 -0
- package/dist/attributes.d.ts +670 -0
- package/dist/attributes.js +904 -0
- package/dist/bands.d.ts +125 -0
- package/dist/bands.js +256 -0
- package/dist/builder.d.ts +683 -0
- package/dist/builder.js +677 -0
- package/dist/candidates.d.ts +109 -0
- package/dist/candidates.js +118 -0
- package/dist/capabilities.d.ts +744 -0
- package/dist/capabilities.js +679 -0
- package/dist/channels.d.ts +106 -0
- package/dist/channels.js +129 -0
- package/dist/clauses.d.ts +40 -0
- package/dist/clauses.js +43 -0
- package/dist/component.d.ts +33 -0
- package/dist/component.js +27 -0
- package/dist/componentBuild.d.ts +48 -0
- package/dist/componentBuild.js +84 -0
- package/dist/componentClient.d.ts +100 -0
- package/dist/componentClient.js +13 -0
- package/dist/componentImports.d.ts +51 -0
- package/dist/componentImports.js +106 -0
- package/dist/componentModule.d.ts +8 -0
- package/dist/componentModule.js +270 -0
- package/dist/componentWire.d.ts +130 -0
- package/dist/componentWire.js +280 -0
- package/dist/config.d.ts +295 -0
- package/dist/config.js +231 -0
- package/dist/connections.d.ts +89 -0
- package/dist/connections.js +131 -0
- package/dist/declarations.d.ts +290 -0
- package/dist/declarations.js +794 -0
- package/dist/descriptors.d.ts +1774 -0
- package/dist/descriptors.js +1329 -0
- package/dist/dev.d.ts +136 -0
- package/dist/dev.js +161 -0
- package/dist/document.d.ts +202 -0
- package/dist/document.js +312 -0
- package/dist/engines.d.ts +117 -0
- package/dist/engines.js +203 -0
- package/dist/eventMapLaws.d.ts +63 -0
- package/dist/eventMapLaws.js +128 -0
- package/dist/events.d.ts +554 -0
- package/dist/events.js +633 -0
- package/dist/executor.d.ts +771 -0
- package/dist/executor.js +1829 -0
- package/dist/extension.d.ts +448 -0
- package/dist/extension.js +315 -0
- package/dist/facets.d.ts +53 -0
- package/dist/facets.js +60 -0
- package/dist/foldedSections.d.ts +74 -0
- package/dist/foldedSections.js +161 -0
- package/dist/genres.d.ts +507 -0
- package/dist/genres.js +633 -0
- package/dist/guardedConnection.d.ts +138 -0
- package/dist/guardedConnection.js +341 -0
- package/dist/handlebarsReach.d.ts +122 -0
- package/dist/handlebarsReach.js +222 -0
- package/dist/hash.d.ts +146 -0
- package/dist/hash.js +166 -0
- package/dist/hookGrants.d.ts +47 -0
- package/dist/hookGrants.js +68 -0
- package/dist/hooks.d.ts +290 -0
- package/dist/hooks.js +113 -0
- package/dist/hostElements.d.ts +447 -0
- package/dist/hostElements.js +702 -0
- package/dist/i18n.d.ts +94 -0
- package/dist/i18n.js +123 -0
- package/dist/identity.d.ts +93 -0
- package/dist/identity.js +135 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +176 -0
- package/dist/layout.d.ts +194 -0
- package/dist/layout.js +40 -0
- package/dist/media.d.ts +202 -0
- package/dist/media.js +70 -0
- package/dist/messageBlocks.d.ts +487 -0
- package/dist/messageBlocks.js +683 -0
- package/dist/migration.d.ts +128 -0
- package/dist/migration.js +261 -0
- package/dist/names.d.ts +78 -0
- package/dist/names.js +136 -0
- package/dist/nodeInput.d.ts +399 -0
- package/dist/nodeInput.js +178 -0
- package/dist/participants.d.ts +291 -0
- package/dist/participants.js +252 -0
- package/dist/personGate.d.ts +62 -0
- package/dist/personGate.js +77 -0
- package/dist/pick.d.ts +84 -0
- package/dist/pick.js +103 -0
- package/dist/pluginHarness.d.ts +235 -0
- package/dist/pluginHarness.js +558 -0
- package/dist/pluginPermissions.d.ts +25 -0
- package/dist/pluginPermissions.js +97 -0
- package/dist/pluginRuleRef.d.ts +13 -0
- package/dist/pluginRuleRef.js +10 -0
- package/dist/predicates.d.ts +182 -0
- package/dist/predicates.js +249 -0
- package/dist/preview.d.ts +120 -0
- package/dist/preview.js +82 -0
- package/dist/promptBlocks.d.ts +130 -0
- package/dist/promptBlocks.js +197 -0
- package/dist/rankingDecisions.d.ts +60 -0
- package/dist/rankingDecisions.js +48 -0
- package/dist/receipt.d.ts +313 -0
- package/dist/receipt.js +60 -0
- package/dist/receiverRules.d.ts +24 -0
- package/dist/receiverRules.js +94 -0
- package/dist/refs.d.ts +117 -0
- package/dist/refs.js +137 -0
- package/dist/registry.d.ts +230 -0
- package/dist/registry.js +273 -0
- package/dist/review.d.ts +108 -0
- package/dist/review.js +97 -0
- package/dist/sampling.d.ts +152 -0
- package/dist/sampling.js +712 -0
- package/dist/scope.d.ts +65 -0
- package/dist/scope.js +128 -0
- package/dist/scripts.d.ts +243 -0
- package/dist/scripts.js +326 -0
- package/dist/sessionLayout.d.ts +339 -0
- package/dist/sessionLayout.js +503 -0
- package/dist/sessionSettings.d.ts +70 -0
- package/dist/sessionSettings.js +2 -0
- package/dist/settings.d.ts +501 -0
- package/dist/settings.js +604 -0
- package/dist/settingsSlot.d.ts +108 -0
- package/dist/settingsSlot.js +166 -0
- package/dist/shapes.d.ts +373 -0
- package/dist/shapes.js +408 -0
- package/dist/sheets.d.ts +165 -0
- package/dist/sheets.js +251 -0
- package/dist/statShapes.d.ts +96 -0
- package/dist/statShapes.js +112 -0
- package/dist/status.d.ts +103 -0
- package/dist/status.js +125 -0
- package/dist/storage.d.ts +145 -0
- package/dist/storage.js +33 -0
- package/dist/storyTime.d.ts +308 -0
- package/dist/storyTime.js +560 -0
- package/dist/surfaces.d.ts +501 -0
- package/dist/surfaces.js +292 -0
- package/dist/template.d.ts +312 -0
- package/dist/template.js +554 -0
- package/dist/templateCheck.d.ts +60 -0
- package/dist/templateCheck.js +516 -0
- package/dist/templateFit.d.ts +157 -0
- package/dist/templateFit.js +349 -0
- package/dist/templateIds.d.ts +138 -0
- package/dist/templateIds.js +144 -0
- package/dist/templateScopeAt.d.ts +131 -0
- package/dist/templateScopeAt.js +354 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.js +383 -0
- package/dist/tokenizers.d.ts +113 -0
- package/dist/tokenizers.js +184 -0
- package/dist/turnLock.d.ts +96 -0
- package/dist/turnLock.js +79 -0
- package/dist/turnOrder.d.ts +143 -0
- package/dist/turnOrder.js +128 -0
- package/dist/validate.d.ts +74 -0
- package/dist/validate.js +1399 -0
- package/dist/values.d.ts +212 -0
- package/dist/values.js +390 -0
- package/dist/variables.d.ts +493 -0
- package/dist/variables.js +662 -0
- package/dist/verdicts.d.ts +275 -0
- package/dist/verdicts.js +348 -0
- package/dist/widgetDecls.d.ts +88 -0
- package/dist/widgetDecls.js +119 -0
- package/dist/widgets.d.ts +1527 -0
- package/dist/widgets.js +208 -0
- package/dist/wire.d.ts +126 -0
- package/dist/wire.js +140 -0
- package/dist/worldinfo.d.ts +150 -0
- package/dist/worldinfo.js +212 -0
- package/host-elements.d.ts +914 -0
- package/package.json +67 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attribute slots — the declared vocabulary behind stats and states.
|
|
3
|
+
*
|
|
4
|
+
* ## Three levels, and only the middle one is new here
|
|
5
|
+
*
|
|
6
|
+
* A stat is three things, not one (entries plan Part 3): a **declaration**
|
|
7
|
+
* ("Health is an integer with a max, and it attaches to cast members"), a
|
|
8
|
+
* **configuration** ("this character's Health caps at 20"), and a **value**
|
|
9
|
+
* ("health = 12, as of message 47"). This file owns the first. The other two
|
|
10
|
+
* are rows in the host's `attribute_configs` and `attribute_values`, keyed by
|
|
11
|
+
* the id declared here.
|
|
12
|
+
*
|
|
13
|
+
* ## Core owns the types; nobody owns them but core
|
|
14
|
+
*
|
|
15
|
+
* `SlotType` is a **closed set of six**, and it is closed because each member
|
|
16
|
+
* is logic core implements: a bounded integer is a bar, an enum is a chip, a
|
|
17
|
+
* list is a chip row, a derived slot is never written at all. Genres, plugins
|
|
18
|
+
* and admins compose *definitions* from those types — `hp`, `gold`, `weather`,
|
|
19
|
+
* `mood` — the same way a genre composes a session shape from declared fields.
|
|
20
|
+
* A composed definition cannot introduce behaviour core does not already
|
|
21
|
+
* understand, which is why authorship can be open here where it is not for the
|
|
22
|
+
* types.
|
|
23
|
+
*
|
|
24
|
+
* ## One registry, two sources
|
|
25
|
+
*
|
|
26
|
+
* Node types project into `pipeline_definition_registry` rows because a *spec* has to
|
|
27
|
+
* be able to reference one that this build does not declare. A slot has no such
|
|
28
|
+
* consumer: every read of one goes through this registry in-process, and every
|
|
29
|
+
* write is validated against it at write time.
|
|
30
|
+
*
|
|
31
|
+
* People author slots too, and theirs live in the host's
|
|
32
|
+
* `attribute_declarations` table — but that table is a **source**, never a
|
|
33
|
+
* second answer. The host loads every stored row into *this* registry, at boot
|
|
34
|
+
* and again on every write (`defineStoredAttributeSlot`), and validation
|
|
35
|
+
* consults nothing else: `getAttributeSlot` stays the only door, and `origin`
|
|
36
|
+
* says which source an entry came through. A table a validator read directly
|
|
37
|
+
* would be a second answer to "what is Health" that nothing reconciles, and the
|
|
38
|
+
* two would drift the first time a row was written without this registry
|
|
39
|
+
* hearing about it.
|
|
40
|
+
*
|
|
41
|
+
* A card or lorebook naming a slot this install lacks keeps its values as
|
|
42
|
+
* opaque data — shown, not validated — which is the standing "never refuse,
|
|
43
|
+
* fall back and say so" rule for a stale binding.
|
|
44
|
+
*
|
|
45
|
+
* ## The catch: two kinds of prose
|
|
46
|
+
*
|
|
47
|
+
* `label` and `description` are what a person reads, so they are stripped from
|
|
48
|
+
* the content hash and copyediting one is free. **`descriptor` is what the
|
|
49
|
+
* model reads**, so editing it changes every prompt the slot appears in — it is
|
|
50
|
+
* contract, it is inside the hash, and changing it means `@N+1`. Conflating
|
|
51
|
+
* the two would ship prompt-changing edits silently.
|
|
52
|
+
*
|
|
53
|
+
* `derive`, `rules` and `scripts` sit inside the hash beside `descriptor`, for
|
|
54
|
+
* a plainer reason still: they are what the number *does* to itself, and that
|
|
55
|
+
* is never a copyedit. `examples` are stripped along with the display text and
|
|
56
|
+
* the reason is the inverse — an example is the *test* of a declaration rather
|
|
57
|
+
* than part of it, and writing one down must not force an `@N+1` on everything
|
|
58
|
+
* already storing values under the id.
|
|
59
|
+
*
|
|
60
|
+
* ⚠ **"Slot" here is not a pipeline slot.** NOMENCLATURE §"slot" is a declared
|
|
61
|
+
* parameter address on a node type (`SlotDecl` in descriptors.ts). This is an
|
|
62
|
+
* *attribute* slot, and prose says the qualified word. The two never meet: one
|
|
63
|
+
* is a key on a descriptor, the other is an id in this registry.
|
|
64
|
+
*
|
|
65
|
+
* The exported API says the qualified word too — `defineAttributeSlot`,
|
|
66
|
+
* `getAttributeSlot`, `attributeSlots` — because the unqualified names sat one
|
|
67
|
+
* import line away from the pipeline `slot()` address helper, and a name that
|
|
68
|
+
* reads correctly only if you know which module it came from is a name that
|
|
69
|
+
* will be imported wrong. The *types* keep the short names (`SlotId`,
|
|
70
|
+
* `SlotConfig`, `SlotValue`): they are only ever written next to this file's
|
|
71
|
+
* functions, so they cannot be mistaken at a call site.
|
|
72
|
+
*/
|
|
73
|
+
import type { I18n } from './descriptors.js';
|
|
74
|
+
import type { FieldDecl } from './settings.js';
|
|
75
|
+
import { type StatShapeId, type StatShapeKind } from './statShapes.js';
|
|
76
|
+
/** `owner:slot/name@N` — `core:slot/hp@1`, `acme.rp:slot/tension@1`. @experimental */
|
|
77
|
+
export type SlotId = string;
|
|
78
|
+
/** @experimental */
|
|
79
|
+
export declare function assertSlotId(id: string): void;
|
|
80
|
+
/** Who declared it: `core`, a plugin's id, or the username frozen in at authoring. @internal */
|
|
81
|
+
export declare const slotOwner: (id: string) => string;
|
|
82
|
+
/** The slug — the data key a value is filed under for the life of the card carrying it. @experimental */
|
|
83
|
+
export declare const slotSlug: (id: string) => string;
|
|
84
|
+
/** The major. `@N+1` is a different slot, not an edit to this one. @experimental */
|
|
85
|
+
export declare const slotVersion: (id: string) => number;
|
|
86
|
+
/** @internal */
|
|
87
|
+
export declare function reserveAttributeOwner(segment: string): void;
|
|
88
|
+
/** @internal */
|
|
89
|
+
export declare const isReservedAttributeOwner: (segment: string) => boolean;
|
|
90
|
+
/** Back to `core` alone — for tests, and for a host tearing an install down. @internal */
|
|
91
|
+
export declare function _clearReservedAttributeOwners(): void;
|
|
92
|
+
/**
|
|
93
|
+
* What a slot's value *is*. Six, and no more without a core release.
|
|
94
|
+
*
|
|
95
|
+
* - `integer` — a bounded number. `min`/`max` in the config make it a bar.
|
|
96
|
+
* - `enum` — one of a declared set. A chip.
|
|
97
|
+
* - `text` — a line of prose nobody computes with.
|
|
98
|
+
* - `boolean` — on or off.
|
|
99
|
+
* - `list` — several of something: a chip row. Its items come from `config.of`
|
|
100
|
+
* when there is one and are free text when there is not, which makes it the
|
|
101
|
+
* one type that is two shapes. The sixth, and added because an inventory, a
|
|
102
|
+
* set of conditions and a list of known facts were each being spelled as
|
|
103
|
+
* comma-separated `text` — a spelling no bar, no chip and no rule can read,
|
|
104
|
+
* and one nobody can add a single item to without rewriting the line.
|
|
105
|
+
* - `derived` — computed from other facts and a clock, and therefore **never
|
|
106
|
+
* stored**. Storing a derived value guarantees staleness, which is why
|
|
107
|
+
* derived-vs-stored is a property of the declaration rather than a habit.
|
|
108
|
+
* @experimental
|
|
109
|
+
*/
|
|
110
|
+
export type SlotType = 'integer' | 'enum' | 'text' | 'boolean' | 'list' | 'derived';
|
|
111
|
+
/**
|
|
112
|
+
* Which owners a slot may attach to: a cast member, the world, a location
|
|
113
|
+
* (🚧 attributes phase 4 — a `core:entry/location` lore entry holding state
|
|
114
|
+
* of its own: what is lying in the place, how it stands), or several.
|
|
115
|
+
* @experimental
|
|
116
|
+
*/
|
|
117
|
+
export type SlotAppliesTo = 'cast' | 'world' | 'location';
|
|
118
|
+
/**
|
|
119
|
+
* The computations a `derived` slot may name. Closed and core-owned for the
|
|
120
|
+
* same reason `SlotType` is: each one is code core runs.
|
|
121
|
+
*
|
|
122
|
+
* The SDK declares the *name* and what it needs; the host implements the
|
|
123
|
+
* arithmetic, because the inputs (the session's story date) are the host's.
|
|
124
|
+
* @experimental
|
|
125
|
+
*/
|
|
126
|
+
export interface DerivationDecl {
|
|
127
|
+
id: string;
|
|
128
|
+
/** The slot whose value this derivation reads, named in the slot's config as `from`. */
|
|
129
|
+
requiresFrom: boolean;
|
|
130
|
+
description: string;
|
|
131
|
+
}
|
|
132
|
+
/** @experimental */
|
|
133
|
+
export declare const derivations: Readonly<{
|
|
134
|
+
/**
|
|
135
|
+
* How old someone is: a `birthdate` value on the same owner, against the
|
|
136
|
+
* session's story date. Absent — not zero — when either is missing, which
|
|
137
|
+
* is the whole reason age is derived and not typed in.
|
|
138
|
+
*/
|
|
139
|
+
readonly age: Readonly<{
|
|
140
|
+
id: "core:derive/age@1";
|
|
141
|
+
requiresFrom: true;
|
|
142
|
+
description: "A birthdate slot on the same owner, read against the session's story date.";
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* A LiquidJS expression written on the declaration itself (`derive`),
|
|
146
|
+
* evaluated over the state pinned at run start.
|
|
147
|
+
*
|
|
148
|
+
* It earns an id even though the *text* is the author's, because a derived
|
|
149
|
+
* slot always names the computation behind it: a receipt says which one
|
|
150
|
+
* produced a number, and "an expression" is an answer only if it is one
|
|
151
|
+
* declared thing rather than a hole in the set. What the author supplies is
|
|
152
|
+
* the expression; the evaluator is still core's.
|
|
153
|
+
*
|
|
154
|
+
* `requiresFrom: false` — the expression names whatever it reads, which is
|
|
155
|
+
* exactly the reason it is not `age`.
|
|
156
|
+
*/
|
|
157
|
+
readonly liquid: Readonly<{
|
|
158
|
+
id: "core:derive/liquid@1";
|
|
159
|
+
requiresFrom: false;
|
|
160
|
+
description: "A LiquidJS expression on the declaration, evaluated over the state pinned at run start.";
|
|
161
|
+
}>;
|
|
162
|
+
}>;
|
|
163
|
+
/** @experimental */
|
|
164
|
+
export type DerivationId = (typeof derivations)[keyof typeof derivations]['id'];
|
|
165
|
+
/** @experimental */
|
|
166
|
+
export declare const getDerivation: (id: string) => DerivationDecl | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* What attaching a slot decides.
|
|
169
|
+
*
|
|
170
|
+
* One open shape rather than a union per type, because it is stored as JSON and
|
|
171
|
+
* read back by code that has the declaration in hand: `checkSlotConfig` is what
|
|
172
|
+
* says which keys mean anything for which type, and it says so in one place
|
|
173
|
+
* instead of in a type the database cannot enforce anyway.
|
|
174
|
+
*
|
|
175
|
+
* Every layer stores **deviations only** — a card, a lorebook and a session each
|
|
176
|
+
* hold the keys they change and nothing else, so raising a genre's default cap
|
|
177
|
+
* reaches every owner who never overrode it.
|
|
178
|
+
* @experimental
|
|
179
|
+
*/
|
|
180
|
+
export interface SlotConfig {
|
|
181
|
+
/** `integer`: the floor and the ceiling. A bar needs both to be drawn as one. */
|
|
182
|
+
min?: number;
|
|
183
|
+
max?: number;
|
|
184
|
+
/** `enum`: the values this owner may take. */
|
|
185
|
+
of?: readonly string[];
|
|
186
|
+
/** `text`: how long a line may be. `list`: how long each free-text item may be. */
|
|
187
|
+
maxLength?: number;
|
|
188
|
+
/**
|
|
189
|
+
* `list`: the ceiling on how many items it holds. A refusal and never a
|
|
190
|
+
* trim (`applyListOp`) — silently dropping the sword somebody just picked
|
|
191
|
+
* up is how an inventory starts lying about itself.
|
|
192
|
+
*/
|
|
193
|
+
maxItems?: number;
|
|
194
|
+
/**
|
|
195
|
+
* `list`: whether the same item twice is two items. **True unless stated**,
|
|
196
|
+
* because the common case is a set — conditions, known facts, keys on a
|
|
197
|
+
* ring — where a repeat is a bug in whatever wrote it. Say `false` for the
|
|
198
|
+
* case where it is not one (three rations).
|
|
199
|
+
*/
|
|
200
|
+
unique?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* 🚧 `text`: the lore entry types a value may instead be a **reference**
|
|
203
|
+
* to — `['core:entry/location']` — as `{ entryId }` (the lore reference
|
|
204
|
+
* items use, without a held count). Absent, the slot holds words only.
|
|
205
|
+
* Which entry a reference names, and whether it is one of these types in
|
|
206
|
+
* the session's own lorebook, is the host's check at the write: the SDK
|
|
207
|
+
* sees an id and nothing behind it (owner ruling 2026-09-26, location as a
|
|
208
|
+
* premade stat).
|
|
209
|
+
*/
|
|
210
|
+
entryTypes?: readonly string[];
|
|
211
|
+
/** `derived`: which computation, and the slot it reads. */
|
|
212
|
+
derivation?: string;
|
|
213
|
+
from?: SlotId;
|
|
214
|
+
[key: string]: unknown;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* One stored thing. `null` is "explicitly cleared", absent is "inherit".
|
|
218
|
+
*
|
|
219
|
+
* Wider than any one type's legal values on purpose: this is what the column
|
|
220
|
+
* holds, and the declaration is what narrows it (`checkSlotValue`).
|
|
221
|
+
* @experimental
|
|
222
|
+
*/
|
|
223
|
+
export type SlotScalar = number | string | boolean | null;
|
|
224
|
+
/**
|
|
225
|
+
* 🚧 A list item that points at a lore entry rather than naming something in
|
|
226
|
+
* words — the companion who is a cast member's entry, the clue that is a
|
|
227
|
+
* history entry, the sword that is an item.
|
|
228
|
+
*
|
|
229
|
+
* Stored as the entry's id alone. `name` is what the host fills in at READ
|
|
230
|
+
* (the entry's title, now), so a template and a widget can say it; it is
|
|
231
|
+
* never stored — `slotValueForStorage` drops it — because a copied title is a
|
|
232
|
+
* second answer to "what is this called" that goes stale on the first rename.
|
|
233
|
+
* @experimental
|
|
234
|
+
*/
|
|
235
|
+
export interface SlotLoreRef {
|
|
236
|
+
entryId: number;
|
|
237
|
+
/**
|
|
238
|
+
* 🚧 The **held count** — how many of the entry this owner holds (phase 3a,
|
|
239
|
+
* owner ruling 2026-09-26: counts live on the holder AND on the item
|
|
240
|
+
* entry's supply). A whole number, at least 1; absent means one. Stored.
|
|
241
|
+
*
|
|
242
|
+
* A reference appears once per list whatever `unique` says, because the
|
|
243
|
+
* count is its multiplicity: two references to one entry would be two
|
|
244
|
+
* answers to "how many". ⚠ Not `quantity`, which was the retired
|
|
245
|
+
* possession edge's word (phase 3b).
|
|
246
|
+
*/
|
|
247
|
+
count?: number;
|
|
248
|
+
/** The entry's title as of the read. Filled by the host; never stored. */
|
|
249
|
+
name?: string;
|
|
250
|
+
}
|
|
251
|
+
/** One item of a `list`: a word, or a lore reference. @experimental */
|
|
252
|
+
export type SlotListItem = SlotScalar | SlotLoreRef;
|
|
253
|
+
/**
|
|
254
|
+
* A stored attribute value: one thing, or — for a `list` — several. One thing
|
|
255
|
+
* may be a lore reference only on a `text` slot whose config names
|
|
256
|
+
* `entryTypes` (🚧 2026-09-26: a location is words or a place entry).
|
|
257
|
+
* @experimental
|
|
258
|
+
*/
|
|
259
|
+
export type SlotValue = SlotScalar | SlotLoreRef | readonly SlotListItem[];
|
|
260
|
+
/** Is this list item a lore reference? @experimental */
|
|
261
|
+
export declare const isSlotLoreRef: (item: unknown) => item is SlotLoreRef;
|
|
262
|
+
/** 🚧 How many of its entry a reference holds: its `count`, or one when it states none. @experimental */
|
|
263
|
+
export declare const slotLoreRefCount: (ref: SlotLoreRef) => number;
|
|
264
|
+
/**
|
|
265
|
+
* 🚧 How many of one entry a stored value holds — the held count summed over
|
|
266
|
+
* every reference to it (a valid list has at most one). A word never counts,
|
|
267
|
+
* and a value that is not a list holds nothing. The reader a pipeline's supply
|
|
268
|
+
* check sums across owners (phase 3a).
|
|
269
|
+
* @experimental
|
|
270
|
+
*/
|
|
271
|
+
export declare function heldCountIn(value: unknown, entryId: number): number;
|
|
272
|
+
/**
|
|
273
|
+
* 🚧 One list item as a person or a prompt reads it: a word as itself, a lore
|
|
274
|
+
* reference by its title (the one a read filled in, else `entry N`) with its
|
|
275
|
+
* held count when it holds more than one — `Rusty key ×2`. The one spelling a
|
|
276
|
+
* state block, a ledger line and a widget share, so none of them shows a
|
|
277
|
+
* `{ entryId }` object.
|
|
278
|
+
* @experimental
|
|
279
|
+
*/
|
|
280
|
+
export declare function slotListItemText(item: SlotListItem): string;
|
|
281
|
+
/**
|
|
282
|
+
* A value as it is STORED: every lore reference down to its `entryId` and its
|
|
283
|
+
* held `count` (the `name` a read filled in is dropped; a count of one is
|
|
284
|
+
* dropped too — one held is spelled bare). Everything else is itself.
|
|
285
|
+
* @experimental
|
|
286
|
+
*/
|
|
287
|
+
export declare function slotValueForStorage(value: SlotValue): SlotValue;
|
|
288
|
+
/**
|
|
289
|
+
* One rule on a declaration: when this holds, do this to the value.
|
|
290
|
+
*
|
|
291
|
+
* Every member is a **LiquidJS expression as text**, and this file never runs
|
|
292
|
+
* one — the SDK has no evaluator and deliberately does not grow one. It
|
|
293
|
+
* declares the shape; the host evaluates it at the one write gate, in a fixed
|
|
294
|
+
* phase order (extraction scripts → rules → validation and the turn lock →
|
|
295
|
+
* apply or propose). A rule that wrote a value itself would be a second door
|
|
296
|
+
* into rows the gate exists to be the only door to.
|
|
297
|
+
*
|
|
298
|
+
* Exactly one of `set`, `add` or `remove`, refused at the declaration
|
|
299
|
+
* otherwise: a rule that both set and added has no order anybody could read
|
|
300
|
+
* off it. `when` absent means *always*.
|
|
301
|
+
*
|
|
302
|
+
* ⚠ Liquid has no parentheses and binds right to left, so `a and b or c` is
|
|
303
|
+
* not what most people read. The editor says so and the docs say so; this file
|
|
304
|
+
* cannot, because it never parses the string.
|
|
305
|
+
* @experimental
|
|
306
|
+
*/
|
|
307
|
+
export interface SlotRule {
|
|
308
|
+
/** The condition. Absent = always. */
|
|
309
|
+
when?: string;
|
|
310
|
+
/** The new value. */
|
|
311
|
+
set?: string;
|
|
312
|
+
/** `list`: items to put in. `integer`: a **signed delta** — `-1` takes one off. */
|
|
313
|
+
add?: string;
|
|
314
|
+
/** `list`: items to take out. An item that is not there is not an error. */
|
|
315
|
+
remove?: string;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* A worked case the **host's** tests run against the declaration.
|
|
319
|
+
*
|
|
320
|
+
* Carried and shape-checked here, never executed: "given this state, this slot
|
|
321
|
+
* comes out 12" is a sentence only something with an evaluator can check, and
|
|
322
|
+
* that is the host. Stripped from the content hash — see the file header on
|
|
323
|
+
* the two kinds of prose, and the third kind this is.
|
|
324
|
+
* @experimental
|
|
325
|
+
*/
|
|
326
|
+
export interface SlotExample {
|
|
327
|
+
/** The state to evaluate against, in the shape the host pins at run start. */
|
|
328
|
+
state: Record<string, unknown>;
|
|
329
|
+
/** What the slot should come out as. */
|
|
330
|
+
expect: SlotValue;
|
|
331
|
+
}
|
|
332
|
+
/** @experimental */
|
|
333
|
+
export interface AttributeSlotProps {
|
|
334
|
+
/**
|
|
335
|
+
* What the value is, in core's closed set. Optional when `shape` is
|
|
336
|
+
* given: the shape's field decides it (`slotTypeForKind`), and stating
|
|
337
|
+
* both is allowed only when they agree. `derived` has no shape.
|
|
338
|
+
*/
|
|
339
|
+
type?: SlotType;
|
|
340
|
+
/**
|
|
341
|
+
* 🚧 The value's **stat shape**: a catalogue shape's id
|
|
342
|
+
* (`'core:stat-shape/number@1'`, `statShapes.ts`) or a `FieldDecl` of the
|
|
343
|
+
* slot's own. What the shape bounds is the floor `config` deviates from.
|
|
344
|
+
* Absent, the shape is read off `type` (`fieldForSlotType`) — every slot
|
|
345
|
+
* declared before shapes existed keeps meaning what it meant.
|
|
346
|
+
*
|
|
347
|
+
* Inside the content hash: it is what the value IS.
|
|
348
|
+
*/
|
|
349
|
+
shape?: StatShapeId | FieldDecl;
|
|
350
|
+
/** The name a person reads. Display text: stripped from the content hash. */
|
|
351
|
+
label?: I18n;
|
|
352
|
+
/** What it is, shown where it is attached. Display text: stripped. */
|
|
353
|
+
description?: I18n;
|
|
354
|
+
/**
|
|
355
|
+
* How the **model** is told what this is, in the state block a template
|
|
356
|
+
* renders.
|
|
357
|
+
*
|
|
358
|
+
* ⚠ Inside the content hash, unlike `label` and `description`. Editing it
|
|
359
|
+
* changes generation everywhere the slot appears, so it is a version bump
|
|
360
|
+
* and not a copyedit.
|
|
361
|
+
*/
|
|
362
|
+
descriptor: string;
|
|
363
|
+
/** Which owner kinds may carry it. */
|
|
364
|
+
appliesTo: readonly SlotAppliesTo[];
|
|
365
|
+
/** The base configuration every attachment starts from. */
|
|
366
|
+
config?: SlotConfig;
|
|
367
|
+
/** The value a read falls back to when no layer has one. */
|
|
368
|
+
default?: SlotValue;
|
|
369
|
+
/**
|
|
370
|
+
* `derived` only: a LiquidJS expression computing the value, over the state
|
|
371
|
+
* pinned at run start.
|
|
372
|
+
*
|
|
373
|
+
* Written here rather than in `config.derivation` so that an author's
|
|
374
|
+
* derivation and one of core's look different at a glance. A slot with
|
|
375
|
+
* `derive` names `core:derive/liquid@1` implicitly (`slotDerivation`) and
|
|
376
|
+
* needs no `from`, because the expression says what it reads.
|
|
377
|
+
* `config.derivation` keeps working, and `age` is why: it reads a birthdate
|
|
378
|
+
* against the session's story date, which no expression can reach.
|
|
379
|
+
*
|
|
380
|
+
* ⚠ Inside the content hash: it is what the number *is*.
|
|
381
|
+
*/
|
|
382
|
+
derive?: string;
|
|
383
|
+
/**
|
|
384
|
+
* What happens to this slot on its own, at the write gate.
|
|
385
|
+
*
|
|
386
|
+
* A list although the product shows one. One rule per slot is today's
|
|
387
|
+
* answer and may not be tomorrow's, and a shape that already holds many is
|
|
388
|
+
* what keeps the second one from being a migration. Order is the order they
|
|
389
|
+
* are evaluated in.
|
|
390
|
+
*
|
|
391
|
+
* ⚠ Inside the content hash.
|
|
392
|
+
*/
|
|
393
|
+
rules?: readonly SlotRule[];
|
|
394
|
+
/**
|
|
395
|
+
* Script rows that propose changes to this slot — extraction over the
|
|
396
|
+
* provider's text, ahead of the rules.
|
|
397
|
+
*
|
|
398
|
+
* Opaque strings on purpose: a script is a row in the host's tables, and
|
|
399
|
+
* the SDK has nothing to resolve one against. A list for the same reason
|
|
400
|
+
* `rules` is one.
|
|
401
|
+
*
|
|
402
|
+
* ⚠ Inside the content hash.
|
|
403
|
+
*/
|
|
404
|
+
scripts?: readonly string[];
|
|
405
|
+
/** Worked cases the host's tests execute. Stripped from the hash — see `SlotExample`. */
|
|
406
|
+
examples?: readonly SlotExample[];
|
|
407
|
+
/**
|
|
408
|
+
* 🚧 `false` for a slot a **mechanism** keeps rather than a stat a person
|
|
409
|
+
* tracks — the session's sprite set: never offered as an attribute a
|
|
410
|
+
* session may add, never carried in from its world, and refused as a
|
|
411
|
+
* pick (ruled 2026-09-25). A genre may still list it in its baseline.
|
|
412
|
+
* Absent is pickable. Inside the content hash when stated.
|
|
413
|
+
*/
|
|
414
|
+
pickable?: false;
|
|
415
|
+
/**
|
|
416
|
+
* 🚧 **Earshot**: which prompts may read this slot's value (lair pass R1,
|
|
417
|
+
* 2026-09-28).
|
|
418
|
+
*
|
|
419
|
+
* · `'all'` (the default) — every agent a run builds a prompt for: the
|
|
420
|
+
* planner, the scene, the state-keeper, every voice.
|
|
421
|
+
* · `'holder'` — only the **holder's own voice**: the prompt written in
|
|
422
|
+
* the voice of the cast member who carries the value. Every other
|
|
423
|
+
* prompt, another member's voice included, is built as if the value
|
|
424
|
+
* were not there. The Lair's whisper is the first.
|
|
425
|
+
*
|
|
426
|
+
* Enforced by the host where state becomes a prompt, never in the state
|
|
427
|
+
* itself: `session-state@1` still carries the value (a run's voices share
|
|
428
|
+
* one read). A person's view follows the value's data audience, not
|
|
429
|
+
* earshot: the host gives a `'holder'` value the audience `owner` +
|
|
430
|
+
* `character:<holder>`, so the stats widget shows it to the session's
|
|
431
|
+
* owner and to whoever portrays the holder, and to nobody else.
|
|
432
|
+
*
|
|
433
|
+
* `'holder'` is refused unless `appliesTo` is exactly `['cast']` — a world
|
|
434
|
+
* or a place has no voice to hold it. `'all'` is dropped at registration,
|
|
435
|
+
* so saying the default and saying nothing are one declaration and one
|
|
436
|
+
* hash. Inside the content hash when `'holder'`: it decides which prompts
|
|
437
|
+
* the value reaches.
|
|
438
|
+
*/
|
|
439
|
+
earshot?: SlotEarshot;
|
|
440
|
+
}
|
|
441
|
+
/** 🚧 Which prompts may read a slot: every agent's, or only its holder's own voice. @experimental */
|
|
442
|
+
export type SlotEarshot = 'all' | 'holder';
|
|
443
|
+
/** 🚧 The earshots a slot may declare. @experimental */
|
|
444
|
+
export declare const SLOT_EARSHOTS: readonly SlotEarshot[];
|
|
445
|
+
/** 🚧 A slot's earshot, the default read in: `'holder'` only when it says so. @experimental */
|
|
446
|
+
export declare const slotEarshot: (decl: Pick<AttributeSlotProps, 'earshot'>) => SlotEarshot;
|
|
447
|
+
/** 🚧 May a session pick this slot as an attribute of its own or carry it in from its world? @experimental */
|
|
448
|
+
export declare const slotPickable: (decl: Pick<AttributeSlotProps, 'pickable'>) => boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Which source a registry entry came through.
|
|
451
|
+
*
|
|
452
|
+
* · `code` — a genre, a plugin or core declared it at module load. It arrives
|
|
453
|
+
* and leaves with the package that declares it, and is never retired by
|
|
454
|
+
* hand.
|
|
455
|
+
* · `stored` — a person authored it and the host loaded the row. One author,
|
|
456
|
+
* so re-loading an edited row is a replace rather than a conflict; and it
|
|
457
|
+
* is the only kind that can be retired.
|
|
458
|
+
* @experimental
|
|
459
|
+
*/
|
|
460
|
+
export type SlotOrigin = 'code' | 'stored';
|
|
461
|
+
/** @experimental */
|
|
462
|
+
export interface AttributeSlotDecl extends AttributeSlotProps {
|
|
463
|
+
readonly id: SlotId;
|
|
464
|
+
/** Always present on a registered declaration: stated, or read off its `shape`. */
|
|
465
|
+
readonly type: SlotType;
|
|
466
|
+
readonly origin: SlotOrigin;
|
|
467
|
+
/**
|
|
468
|
+
* `stored` only: who wrote the row. The id already froze the author's
|
|
469
|
+
* username as its owner segment; this is the account the row belongs to,
|
|
470
|
+
* which is a different question the moment somebody is renamed.
|
|
471
|
+
*/
|
|
472
|
+
readonly authorUserId?: number | string;
|
|
473
|
+
/**
|
|
474
|
+
* Retired: nothing new is written to it, everything already written stays.
|
|
475
|
+
* `stored` only — a code slot leaves with its package instead.
|
|
476
|
+
*/
|
|
477
|
+
readonly retired?: boolean;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* What is kept out of this registry's content hash beyond `i18n`/`description`.
|
|
481
|
+
*
|
|
482
|
+
* `label`, because renaming a bar is a copyedit. `examples`, because they are
|
|
483
|
+
* the declaration's tests rather than its content — see `SlotExample`.
|
|
484
|
+
*
|
|
485
|
+
* `descriptor`, `derive`, `rules` and `scripts` are deliberately absent:
|
|
486
|
+
* model-facing prose and behaviour are both content, and editing either means
|
|
487
|
+
* `@N+1` rather than a quiet republish.
|
|
488
|
+
* @experimental
|
|
489
|
+
*/
|
|
490
|
+
export declare const SLOT_DISPLAY_KEYS: {
|
|
491
|
+
readonly display: readonly ['label', 'examples'];
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Declare an attribute slot in code.
|
|
495
|
+
*
|
|
496
|
+
* The same two refusals every registry here makes: an id has exactly one owner,
|
|
497
|
+
* and an identical re-declaration is a no-op (a dev-server reload re-running a
|
|
498
|
+
* module must not throw). A *different* declaration under a claimed id throws
|
|
499
|
+
* with both hashes named.
|
|
500
|
+
* @internal
|
|
501
|
+
*/
|
|
502
|
+
export declare function defineAttributeSlot(id: SlotId, props: AttributeSlotProps): AttributeSlotDecl;
|
|
503
|
+
/**
|
|
504
|
+
* The plugin-facing door — same registration, minus the ability to claim core's
|
|
505
|
+
* namespace. A plugin that could redefine `core:slot/hp@1` would change what
|
|
506
|
+
* every character's health means on the instance without appearing anywhere.
|
|
507
|
+
* @experimental
|
|
508
|
+
*/
|
|
509
|
+
export declare function definePluginAttributeSlot(pluginId: string, id: SlotId, props: AttributeSlotProps): AttributeSlotDecl;
|
|
510
|
+
/**
|
|
511
|
+
* The person-facing door: a slot somebody authored, loaded from the host's
|
|
512
|
+
* `attribute_declarations` row.
|
|
513
|
+
*
|
|
514
|
+
* Every check `defineAttributeSlot` makes, plus one of its own — the owner
|
|
515
|
+
* segment must not be reserved. `core` and every installed plugin id are off
|
|
516
|
+
* limits, because a user slug that collided with one would be redefined the
|
|
517
|
+
* next time that package loaded, underneath values already filed against it.
|
|
518
|
+
*
|
|
519
|
+
* It **replaces** rather than comparing hashes, which is the whole difference
|
|
520
|
+
* between the two doors and is explained at `register`.
|
|
521
|
+
* @internal
|
|
522
|
+
*/
|
|
523
|
+
export declare function defineStoredAttributeSlot(id: SlotId, props: AttributeSlotProps, meta: {
|
|
524
|
+
userId: number | string;
|
|
525
|
+
}): AttributeSlotDecl;
|
|
526
|
+
/** @internal */
|
|
527
|
+
export declare const getAttributeSlot: (id: SlotId) => AttributeSlotDecl | undefined;
|
|
528
|
+
/** @internal */
|
|
529
|
+
export declare const attributeSlots: () => AttributeSlotDecl[];
|
|
530
|
+
/** @internal */
|
|
531
|
+
export declare function _clearAttributeSlots(): void;
|
|
532
|
+
/**
|
|
533
|
+
* Withdraw a package's slot declaration (plugin disabled, uninstalled or
|
|
534
|
+
* upgraded). Values stay where they are and read as opaque data; a write is
|
|
535
|
+
* refused as undeclared until the package declares it again. Only a code
|
|
536
|
+
* declaration outside `core:` is withdrawn — a stored slot is somebody's and
|
|
537
|
+
* leaves by retirement, and core's leave with the build.
|
|
538
|
+
* @internal
|
|
539
|
+
*/
|
|
540
|
+
export declare function _withdrawAttributeSlot(id: SlotId): boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Retire a stored slot: nothing new is written to it, everything already
|
|
543
|
+
* written stays.
|
|
544
|
+
*
|
|
545
|
+
* Not a delete, and the difference is the point. Panels grey it with the label
|
|
546
|
+
* it last had, the ledger and the charts keep every row, the prompt drops it,
|
|
547
|
+
* and a write is refused with a sentence (`checkSlotValue`). A hard delete is a
|
|
548
|
+
* separate, explicit purge *after* retirement that shows the counts first —
|
|
549
|
+
* because what is being deleted is somebody's play, not a definition.
|
|
550
|
+
* @internal
|
|
551
|
+
*/
|
|
552
|
+
export declare function retireAttributeSlot(id: SlotId): AttributeSlotDecl;
|
|
553
|
+
/** Undo a retirement. Writes are taken again; nothing about the stored values changed either way. @internal */
|
|
554
|
+
export declare function reviveAttributeSlot(id: SlotId): AttributeSlotDecl;
|
|
555
|
+
/**
|
|
556
|
+
* The display-text findings of one slot declaration (R-20): `label` and
|
|
557
|
+
* `description`, both optional — a slot may be listed by its id — but a blank
|
|
558
|
+
* one is a label that draws nothing where the author meant to say something.
|
|
559
|
+
* Run by the code door here and by the host's **write** door for an authored
|
|
560
|
+
* slot (the app's `declareSlot` / `updateSlot`), never by a reload.
|
|
561
|
+
* @internal
|
|
562
|
+
*/
|
|
563
|
+
export declare function attributeSlotDisplayFindings(id: SlotId, props: AttributeSlotProps): string[];
|
|
564
|
+
/** The `SlotType` each stat kind is stored and checked as. @experimental */
|
|
565
|
+
export declare function slotTypeForKind(kind: StatShapeKind): Exclude<SlotType, 'derived'>;
|
|
566
|
+
/**
|
|
567
|
+
* The field a slot declared by `type` alone is read as — how every slot from
|
|
568
|
+
* before stat shapes means what it always meant. `derived` has none: it is
|
|
569
|
+
* computed, and what it computes is not declared as a field.
|
|
570
|
+
* @experimental
|
|
571
|
+
*/
|
|
572
|
+
export declare function fieldForSlotType(type: SlotType): FieldDecl | undefined;
|
|
573
|
+
/** The shape a slot's value takes, as a field: its catalogue shape's, its own inline one, or its type's. @experimental */
|
|
574
|
+
export declare function slotField(decl: Pick<AttributeSlotProps, 'type' | 'shape'>): FieldDecl | undefined;
|
|
575
|
+
/** The catalogue shape a slot names, when it names one (an inline `FieldDecl` names none). @experimental */
|
|
576
|
+
export declare const slotStatShapeId: (decl: Pick<AttributeSlotProps, 'shape'>) => StatShapeId | undefined;
|
|
577
|
+
/** Which kind of stat a slot is; `undefined` for a derived slot, which is computed rather than kept. @experimental */
|
|
578
|
+
export declare const slotStatShapeKind: (decl: Pick<AttributeSlotProps, 'type' | 'shape'>) => StatShapeKind | undefined;
|
|
579
|
+
/**
|
|
580
|
+
* What a field bounds, as the configuration keys a layer deviates from: a
|
|
581
|
+
* number's `min`/`max`; a choice's options (`of`, or its `members`' keys); a
|
|
582
|
+
* list's item count (`max` → `maxItems`), its items' closed set and length; a
|
|
583
|
+
* line's length (`max` → `maxLength`).
|
|
584
|
+
* @experimental
|
|
585
|
+
*/
|
|
586
|
+
export declare function fieldSlotConfig(field: FieldDecl | undefined): SlotConfig;
|
|
587
|
+
/**
|
|
588
|
+
* The configuration in force for one owner: the declaration's own config with
|
|
589
|
+
* each layer's deviations laid over it, nearest layer last.
|
|
590
|
+
*
|
|
591
|
+
* Merging keys rather than replacing objects is what makes "deviations only"
|
|
592
|
+
* real — a session that raised a cap must not silently drop the enum options
|
|
593
|
+
* the lorebook declared beside it.
|
|
594
|
+
* @internal
|
|
595
|
+
*/
|
|
596
|
+
export declare function resolveSlotConfig(decl: AttributeSlotDecl, ...layers: readonly (SlotConfig | null | undefined)[]): SlotConfig;
|
|
597
|
+
/**
|
|
598
|
+
* Why this value may not be stored under this slot, or `null` if it may.
|
|
599
|
+
*
|
|
600
|
+
* A sentence rather than a boolean, because every caller — a socket handler, a
|
|
601
|
+
* node, a review gate — has to tell a person what was wrong, and three callers
|
|
602
|
+
* inventing three wordings for one rule is how a validator stops being one.
|
|
603
|
+
*
|
|
604
|
+
* ⚠ A value is checked against the configuration valid at **its own anchor**,
|
|
605
|
+
* not against the current one (plan Part 3). Callers pass that config in; this
|
|
606
|
+
* function never reaches for a current one, because doing so is precisely the
|
|
607
|
+
* mistake that retroactively invalidates a legitimate historical value.
|
|
608
|
+
* @internal
|
|
609
|
+
*/
|
|
610
|
+
export declare function checkSlotValue(decl: AttributeSlotDecl, value: SlotValue, config?: SlotConfig): string | null;
|
|
611
|
+
/** What a change does to the value already there. @experimental */
|
|
612
|
+
export type SlotChangeOp = 'set' | 'add' | 'remove';
|
|
613
|
+
/**
|
|
614
|
+
* A list after an op, or the reason it stayed as it was.
|
|
615
|
+
*
|
|
616
|
+
* Two fields rather than a throw or a bare array, because both answers have to
|
|
617
|
+
* reach somebody: the gate needs the list to store, a review card needs the
|
|
618
|
+
* sentence to show. `refusal` mirrors `checkSlotValue` — a sentence, or `null`
|
|
619
|
+
* when there is nothing to say — so one shape reads for both halves of a write.
|
|
620
|
+
* @experimental
|
|
621
|
+
*/
|
|
622
|
+
export interface SlotListOpResult {
|
|
623
|
+
/** The list as it now stands. Identical in content to `current` when `refusal` is set. */
|
|
624
|
+
value: readonly SlotListItem[];
|
|
625
|
+
/** Why the op did not apply, or `null` if it did. */
|
|
626
|
+
refusal: string | null;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Apply one list op, purely.
|
|
630
|
+
*
|
|
631
|
+
* It shapes the list; it does not judge the items. `unique` and `maxItems` are
|
|
632
|
+
* properties of the *list*, so they belong here — `add` dedups rather than
|
|
633
|
+
* growing a set that is not one, and an overflow is refused rather than
|
|
634
|
+
* trimmed, because silently dropping the sword somebody just picked up is how
|
|
635
|
+
* an inventory starts lying. Whether `sword` is a legal item at all is
|
|
636
|
+
* `checkSlotValue`'s question, asked of the result.
|
|
637
|
+
*
|
|
638
|
+
* `remove` of something that is not there is not an error: the state asked for
|
|
639
|
+
* — it is not in the list — is the state afterwards, and refusing would make a
|
|
640
|
+
* rule that fires twice fail the second time for having already worked.
|
|
641
|
+
*
|
|
642
|
+
* The refusal says "this list" rather than naming the slot, because the op is
|
|
643
|
+
* given a config and not a declaration. The caller knows which slot it asked
|
|
644
|
+
* about; only it can put the label in front.
|
|
645
|
+
* @experimental
|
|
646
|
+
*/
|
|
647
|
+
export declare function applyListOp(current: readonly SlotListItem[] | null | undefined, op: SlotChangeOp, items: readonly SlotListItem[], config?: SlotConfig): SlotListOpResult;
|
|
648
|
+
/**
|
|
649
|
+
* Whether a slot may attach to this kind of owner.
|
|
650
|
+
*
|
|
651
|
+
* The owner *kinds* the host stores (`card`, `cast_member`, `lorebook`,
|
|
652
|
+
* `session`, `session_cast`, `location`, `session_location`) collapse to the
|
|
653
|
+
* three a declaration talks about: a lorebook and a session are the **world**,
|
|
654
|
+
* a location entry and its session layer are a **location**, everything that
|
|
655
|
+
* is somebody is the **cast**. A declaration should not have to know the
|
|
656
|
+
* host's storage layout to say "this is a character stat".
|
|
657
|
+
* @internal
|
|
658
|
+
*/
|
|
659
|
+
export declare const slotAppliesTo: (decl: AttributeSlotDecl, owner: SlotAppliesTo) => boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Which derivation computes this slot, or `undefined` when nothing does.
|
|
662
|
+
*
|
|
663
|
+
* One reader, because the question now has two spellings: an expression on the
|
|
664
|
+
* declaration means `core:derive/liquid@1`, one of core's computations names
|
|
665
|
+
* itself in `config`. A host, a client and a receipt each working that out for
|
|
666
|
+
* themselves is how the three start disagreeing about which one ran.
|
|
667
|
+
* @experimental
|
|
668
|
+
*/
|
|
669
|
+
export declare const slotDerivation: (decl: AttributeSlotDecl) => string | undefined;
|
|
670
|
+
//# sourceMappingURL=attributes.d.ts.map
|