@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
package/dist/announce.js
CHANGED
|
@@ -32,8 +32,10 @@ const actionKeysOf = (v) => {
|
|
|
32
32
|
return actionsOf({ id: v.id, contributes }).map((a) => a.key);
|
|
33
33
|
};
|
|
34
34
|
import { genre as makeGenre, genreIdOf, sessionEvents } from './genres.js';
|
|
35
|
+
import { registrationRange, } from './registrations.js';
|
|
35
36
|
import { eventById, isEventId, isSessionEventDecl } from './events.js';
|
|
36
37
|
import { makeValueToolkit } from './values.js';
|
|
38
|
+
import { SAVE_MESSAGE_SPEC_ID } from './descriptors.js';
|
|
37
39
|
import { ACTION_IDENTITY, actionsOf } from './actions.js';
|
|
38
40
|
import { i18nFindings } from './i18n.js';
|
|
39
41
|
import { declarationFindings, labelFindings, storedSwap, subjectsOf, swapInputFindings, } from './declarations.js';
|
|
@@ -119,6 +121,102 @@ export function storedEventDeclaration(d) {
|
|
|
119
121
|
recordedBy,
|
|
120
122
|
};
|
|
121
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Keys that would make a preset build on another preset — refused (R2).
|
|
126
|
+
* @experimental
|
|
127
|
+
* @ruling R2
|
|
128
|
+
*/
|
|
129
|
+
export const PRESET_PARENT_KEYS = Object.freeze(['extends', 'base', 'parent', 'from', 'preset', 'inherits']);
|
|
130
|
+
/** The one sentence for a preset that names a parent — the builder's refusal and C37's. */
|
|
131
|
+
const presetParentSentence = (where, k) => `${where} names '${k}' — a preset never builds on another preset (R2): it is one set of changes on ` +
|
|
132
|
+
`the genre's defaults. To start from another preset, copy its register / drop / change / settings`;
|
|
133
|
+
/**
|
|
134
|
+
* 🚧 **One level**, judged on a STORED preset (R2, R3) — the verdict the
|
|
135
|
+
* builder's refusal gives at `preset()`, for a preset that arrives as data (an
|
|
136
|
+
* announcement, a manifest, a row): it names a parent (`extends`, `base`, …),
|
|
137
|
+
* it belongs to no genre, or it drops or changes a registration that neither
|
|
138
|
+
* its genre's defaults nor its own `register` list holds (a change on a
|
|
139
|
+
* change). As sentences; empty when it is one set of changes on one genre's
|
|
140
|
+
* defaults. Conformance C37 reads it; a host's install may too.
|
|
141
|
+
* @experimental
|
|
142
|
+
* @ruling R2, R3, R22
|
|
143
|
+
*/
|
|
144
|
+
export function presetLevelFindings(preset, genreDefaults) {
|
|
145
|
+
if (!preset || typeof preset !== 'object')
|
|
146
|
+
return ['a preset is an object — make it with preset({ … })'];
|
|
147
|
+
const where = `preset '${preset.slug ?? '?'}'`;
|
|
148
|
+
const out = [];
|
|
149
|
+
for (const k of PRESET_PARENT_KEYS)
|
|
150
|
+
if (preset[k] !== undefined)
|
|
151
|
+
out.push(presetParentSentence(where, k));
|
|
152
|
+
if (typeof preset.genre !== 'string' || !preset.genre)
|
|
153
|
+
out.push(`${where} names no genre — a preset belongs to one genre (R3) and changes that genre's defaults`);
|
|
154
|
+
const changes = preset.registrations;
|
|
155
|
+
if (changes && genreDefaults) {
|
|
156
|
+
const held = new Set([...genreDefaults.map((r) => r.key), ...(changes.register ?? []).map((r) => r.key)]);
|
|
157
|
+
for (const key of changes.drop ?? [])
|
|
158
|
+
if (!held.has(key))
|
|
159
|
+
out.push(`${where} drops '${key}', which its genre's defaults do not register — a preset changes the genre's defaults, never another preset's changes (R2)`);
|
|
160
|
+
for (const c of changes.change ?? [])
|
|
161
|
+
if (!held.has(c.key))
|
|
162
|
+
out.push(`${where} changes '${c.key}', which its genre's defaults do not register — a preset changes the genre's defaults, never another preset's changes (R2)`);
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
const isRegistrationShaped = (v) => !!v &&
|
|
167
|
+
typeof v === 'object' &&
|
|
168
|
+
typeof v.key === 'string' &&
|
|
169
|
+
!!v.trigger &&
|
|
170
|
+
typeof v.pipeline === 'string';
|
|
171
|
+
const isPresetShaped = (v) => !!v && typeof v === 'object' && typeof v.slug === 'string' && ('bindings' in v || 'genre' in v);
|
|
172
|
+
/** The fields a preset's `change` may state beside `of`. */
|
|
173
|
+
const PRESET_CHANGE_KEYS = ['values', 'mode', 'when', 'allowStacking', 'caps', 'order', 'label'];
|
|
174
|
+
/** `<package>@<range>` — a package requirement with a semver range (A16). */
|
|
175
|
+
const PACKAGE_REQUIREMENT = /^([a-z0-9]+(?:[.-][a-z0-9]+)*)@([~^<>=]*\s*\d[\w.+\-<>=|^~* ]*)$/;
|
|
176
|
+
/**
|
|
177
|
+
* 🚧 One `requires` entry read (A16): a package with a version range
|
|
178
|
+
* (`acme.dice@^1.2`), or a declared id (`acme:spec/x`, `core:event/x@1` — the
|
|
179
|
+
* `@1` of an event is its version, part of the id) with an optional range
|
|
180
|
+
* written after it (`acme:spec/x@^2`). `undefined` when it is neither.
|
|
181
|
+
* @experimental
|
|
182
|
+
* @ruling A16
|
|
183
|
+
*/
|
|
184
|
+
export function parseRequirement(entry) {
|
|
185
|
+
if (typeof entry !== 'string' || !entry)
|
|
186
|
+
return undefined;
|
|
187
|
+
if (!entry.includes(':')) {
|
|
188
|
+
const m = PACKAGE_REQUIREMENT.exec(entry);
|
|
189
|
+
if (m)
|
|
190
|
+
return { requirement: entry, package: m[1], range: m[2].trim() };
|
|
191
|
+
return /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/.test(entry) ? { requirement: entry, package: entry } : undefined;
|
|
192
|
+
}
|
|
193
|
+
const pkg = entry.slice(0, entry.indexOf(':'));
|
|
194
|
+
const at = entry.lastIndexOf('@');
|
|
195
|
+
if (at > entry.indexOf(':')) {
|
|
196
|
+
const tail = entry.slice(at + 1);
|
|
197
|
+
// A whole number is a declared id's version (`core:event/x@1`), not a range.
|
|
198
|
+
if (!/^\d+$/.test(tail))
|
|
199
|
+
return { requirement: entry, package: pkg, id: entry.slice(0, at), range: tail };
|
|
200
|
+
}
|
|
201
|
+
return { requirement: entry, package: pkg, id: entry };
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 🚧 The version ranges a manifest's (or an announcement's) `requires`
|
|
205
|
+
* names (A16) — one per entry that carries a range. The host enforces them
|
|
206
|
+
* at install (lane 5b); a preset whose requirement is missing or disabled is
|
|
207
|
+
* withdrawn, and nothing is deleted.
|
|
208
|
+
* @experimental
|
|
209
|
+
* @ruling A16
|
|
210
|
+
*/
|
|
211
|
+
export function requirementRanges(manifest) {
|
|
212
|
+
const out = [];
|
|
213
|
+
for (const entry of manifest?.requires ?? []) {
|
|
214
|
+
const r = parseRequirement(entry);
|
|
215
|
+
if (r?.range)
|
|
216
|
+
out.push({ requirement: r.requirement, package: r.package, ...(r.id ? { id: r.id } : {}), range: r.range });
|
|
217
|
+
}
|
|
218
|
+
return out;
|
|
219
|
+
}
|
|
122
220
|
const isBindingObject = (v) => !!v && typeof v === 'object' && 'spec' in v;
|
|
123
221
|
/**
|
|
124
222
|
* The stored form of a preset. Every reference is read down to its id and
|
|
@@ -133,11 +231,35 @@ export function preset(input) {
|
|
|
133
231
|
if (typeof input.genre === 'string')
|
|
134
232
|
throw new Error(`${where} names its genre as a string — pass the genre value (import it), or use('${input.genre}')`);
|
|
135
233
|
const genre = isExternalRef(input.genre) ? input.genre.id : genreIdOf(input.genre);
|
|
234
|
+
// One level (R2): a preset is one set of changes on the genre's
|
|
235
|
+
// defaults, never on another preset. Cloning copies the changes.
|
|
236
|
+
for (const k of PRESET_PARENT_KEYS)
|
|
237
|
+
if (input[k] !== undefined)
|
|
238
|
+
throw new Error(presetParentSentence(where, k));
|
|
239
|
+
if (input.history !== undefined)
|
|
240
|
+
throw new Error(`${where} sets history — when a session's history settles is its genre's to say (history.settle), never a preset's.`);
|
|
241
|
+
const registrations = presetRegistrationsOf(input, where);
|
|
242
|
+
if (input.default !== undefined && input.default !== true)
|
|
243
|
+
throw new Error(`${where}.default: true, or leave it out`);
|
|
244
|
+
const requires = new Set();
|
|
245
|
+
for (const r of input.requires ?? []) {
|
|
246
|
+
if (!parseRequirement(r))
|
|
247
|
+
throw new Error(`${where}.requires: '${r}' is not a requirement — '<package>@<range>', such as 'acme.dice@^1.2'`);
|
|
248
|
+
requires.add(r);
|
|
249
|
+
}
|
|
250
|
+
for (const d of [...(input.register ?? []), ...(input.change ?? []).map((c) => c.of)]) {
|
|
251
|
+
const range = d ? registrationRange(d) : undefined;
|
|
252
|
+
if (range)
|
|
253
|
+
requires.add(`${d.pipeline.slice(0, d.pipeline.indexOf(':'))}@${range}`);
|
|
254
|
+
}
|
|
136
255
|
const bindings = {};
|
|
137
|
-
|
|
256
|
+
// ⏳ The bindings alias (D4): kept exactly as it was, so a preset still
|
|
257
|
+
// declared with it stores — and hashes — as it always did.
|
|
258
|
+
const aliased = input.bindings !== undefined;
|
|
259
|
+
if (aliased && !Array.isArray(input.bindings))
|
|
138
260
|
throw new Error(`${where}: bindings is a list of specs — [createSession, { spec: respond, config: tuned }]; ` +
|
|
139
261
|
`each is bound on the events its inlet lock answers`);
|
|
140
|
-
for (const [i, raw] of input.bindings.entries()) {
|
|
262
|
+
for (const [i, raw] of (input.bindings ?? []).entries()) {
|
|
141
263
|
const entry = isBindingObject(raw) ? raw : { spec: raw };
|
|
142
264
|
const at = `${where} binding ${i + 1}`;
|
|
143
265
|
const id = specIdOf(entry.spec, at);
|
|
@@ -173,6 +295,16 @@ export function preset(input) {
|
|
|
173
295
|
bindings[event] = { spec: id, ...(configSlug !== undefined ? { config: configSlug } : {}) };
|
|
174
296
|
}
|
|
175
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* 🚧 A person's message is always saved through a pipeline (owner ruling
|
|
300
|
+
* 2026-10-15). A preset that binds nothing on `message-offered` binds
|
|
301
|
+
* core's default save, `core:spec/save-message` — written into the
|
|
302
|
+
* stored preset here, so the preset shows what saves a message rather
|
|
303
|
+
* than a host deciding it out of sight. A preset that binds its own spec
|
|
304
|
+
* there (a genre that refuses, rewrites or routes a message) keeps it.
|
|
305
|
+
*/
|
|
306
|
+
if (aliased && !bindings[sessionEvents.messageOffered])
|
|
307
|
+
bindings[sessionEvents.messageOffered] = { spec: SAVE_MESSAGE_SPEC_ID };
|
|
176
308
|
const include = (pick, n) => {
|
|
177
309
|
const at = `${where} action ${n + 1}`;
|
|
178
310
|
if (typeof pick === 'string')
|
|
@@ -208,6 +340,10 @@ export function preset(input) {
|
|
|
208
340
|
label: input.label,
|
|
209
341
|
description: input.description,
|
|
210
342
|
bindings,
|
|
343
|
+
// 🚧 D4: present only when declared, so a preset on the aliases hashes as it did.
|
|
344
|
+
...(registrations ? { registrations } : {}),
|
|
345
|
+
...(input.default ? { default: true } : {}),
|
|
346
|
+
...(requires.size ? { requires: [...requires].sort() } : {}),
|
|
211
347
|
...(input.actions ? { actions: { include: input.actions.include.flatMap(include) } } : {}),
|
|
212
348
|
...(input.defaults
|
|
213
349
|
? {
|
|
@@ -221,7 +357,67 @@ export function preset(input) {
|
|
|
221
357
|
// nothing hashes as it always did — the announcement is content-hashed
|
|
222
358
|
// like every other declaration here.
|
|
223
359
|
...(input.enabled === undefined ? {} : { enabled: input.enabled }),
|
|
360
|
+
...(input.callsPerTurn !== undefined ? { callsPerTurn: assertCallsPerTurn(input.callsPerTurn, where) } : {}),
|
|
361
|
+
...(input.cast ? { cast: assertCastFloor(input.cast, where) } : {}),
|
|
362
|
+
...(input.settings && Object.keys(input.settings).length ? { settings: { ...input.settings } } : {}),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const assertCallsPerTurn = (v, where) => {
|
|
366
|
+
if (typeof v !== 'number' || !Number.isInteger(v) || v < 0)
|
|
367
|
+
throw new Error(`${where}.callsPerTurn is a whole number of model calls (0 or more)`);
|
|
368
|
+
return v;
|
|
369
|
+
};
|
|
370
|
+
const assertCastFloor = (v, where) => {
|
|
371
|
+
for (const k of ['characters', 'personas']) {
|
|
372
|
+
const n = v[k];
|
|
373
|
+
if (n !== undefined && (typeof n !== 'number' || !Number.isInteger(n) || n < 0))
|
|
374
|
+
throw new Error(`${where}.cast.${k} is a whole number (0 or more)`);
|
|
375
|
+
}
|
|
376
|
+
return { ...(v.characters !== undefined ? { characters: v.characters } : {}), ...(v.personas !== undefined ? { personas: v.personas } : {}) };
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* A preset's `register` / `drop` / `change`, read down to the stored changes
|
|
380
|
+
* (keys for the dropped and changed, derived from the registrations handed
|
|
381
|
+
* in). Throws the first mistake, with the fix.
|
|
382
|
+
*/
|
|
383
|
+
function presetRegistrationsOf(input, where) {
|
|
384
|
+
if (input.register === undefined && input.drop === undefined && input.change === undefined)
|
|
385
|
+
return undefined;
|
|
386
|
+
const one = (v, at) => {
|
|
387
|
+
if (isPresetShaped(v) && !isRegistrationShaped(v))
|
|
388
|
+
throw new Error(`${at} names a preset — a preset never builds on another preset (R2); name registrations`);
|
|
389
|
+
if (!isRegistrationShaped(v))
|
|
390
|
+
throw new Error(`${at} is not a registration — make it with register(trigger, pipeline, { … })`);
|
|
391
|
+
return v;
|
|
224
392
|
};
|
|
393
|
+
const list = (v, name) => {
|
|
394
|
+
if (v === undefined)
|
|
395
|
+
return [];
|
|
396
|
+
if (!Array.isArray(v))
|
|
397
|
+
throw new Error(`${where}.${name} is a list of registrations`);
|
|
398
|
+
return v;
|
|
399
|
+
};
|
|
400
|
+
const register = list(input.register, 'register').map((r, i) => one(r, `${where}.register[${i}]`));
|
|
401
|
+
const drop = list(input.drop, 'drop').map((r, i) => one(r, `${where}.drop[${i}]`).key);
|
|
402
|
+
const change = list(input.change, 'change').map((raw, i) => {
|
|
403
|
+
const at = `${where}.change[${i}]`;
|
|
404
|
+
if (!raw || typeof raw !== 'object')
|
|
405
|
+
throw new Error(`${at}: { of: registration, …changes }`);
|
|
406
|
+
const c = raw;
|
|
407
|
+
const of = one(c.of, `${at}.of`);
|
|
408
|
+
for (const k of Object.keys(c))
|
|
409
|
+
if (k !== 'of' && !PRESET_CHANGE_KEYS.includes(k))
|
|
410
|
+
throw new Error(`${at}: '${k}' is not something a preset changes — one of ${PRESET_CHANGE_KEYS.join(', ')}`);
|
|
411
|
+
return Object.freeze({
|
|
412
|
+
key: of.key,
|
|
413
|
+
...Object.fromEntries(PRESET_CHANGE_KEYS.filter((k) => c[k] !== undefined).map((k) => [k, c[k]])),
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
return Object.freeze({
|
|
417
|
+
...(register.length ? { register: Object.freeze(register) } : {}),
|
|
418
|
+
...(drop.length ? { drop: Object.freeze(drop) } : {}),
|
|
419
|
+
...(change.length ? { change: Object.freeze(change) } : {}),
|
|
420
|
+
});
|
|
225
421
|
}
|
|
226
422
|
const NS = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/;
|
|
227
423
|
/** @internal The builder behind `announcementOf()`; author a package with `defineExtension()`. */
|
package/dist/attributes.d.ts
CHANGED
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
import type { I18n } from './descriptors.js';
|
|
75
75
|
import type { FieldDecl } from './settings.js';
|
|
76
76
|
import { type StatShapeId, type StatShapeKind } from './statShapes.js';
|
|
77
|
+
import { type PieceDuration } from './repertoires.js';
|
|
77
78
|
/** `owner:slot/name@N` — `core:slot/hp@1`, `acme.rp:slot/tension@1`. @experimental */
|
|
78
79
|
export type SlotId = string;
|
|
79
80
|
/** @experimental */
|
|
@@ -160,6 +161,33 @@ export declare const derivations: Readonly<{
|
|
|
160
161
|
requiresFrom: false;
|
|
161
162
|
description: "A LiquidJS expression on the declaration, evaluated over the state pinned at run start.";
|
|
162
163
|
}>;
|
|
164
|
+
/**
|
|
165
|
+
* The clock's part of the day, by the book's own calendar `periods` (default
|
|
166
|
+
* morning 5 · day 12 · dusk 18 · night 22). Absent when the clock has no hour.
|
|
167
|
+
*/
|
|
168
|
+
readonly dayPeriod: Readonly<{
|
|
169
|
+
id: "core:derive/day-period@1";
|
|
170
|
+
requiresFrom: false;
|
|
171
|
+
description: "The part of the day the story clock is in, by the calendar's periods.";
|
|
172
|
+
}>;
|
|
173
|
+
/**
|
|
174
|
+
* The clock's season, by the book's own calendar `seasons`. Absent without
|
|
175
|
+
* seasons, months, or a clock with a month and day.
|
|
176
|
+
*/
|
|
177
|
+
readonly season: Readonly<{
|
|
178
|
+
id: "core:derive/season@1";
|
|
179
|
+
requiresFrom: false;
|
|
180
|
+
description: "The season the story clock is in, by the calendar's seasons.";
|
|
181
|
+
}>;
|
|
182
|
+
/**
|
|
183
|
+
* The clock's part of the day over the default periods always (morning, day,
|
|
184
|
+
* dusk, night), whatever the calendar declares.
|
|
185
|
+
*/
|
|
186
|
+
readonly timeOfDay: Readonly<{
|
|
187
|
+
id: "core:derive/time-of-day@1";
|
|
188
|
+
requiresFrom: false;
|
|
189
|
+
description: "The default part of the day (morning, day, dusk, night) the story clock is in.";
|
|
190
|
+
}>;
|
|
163
191
|
}>;
|
|
164
192
|
/** @experimental */
|
|
165
193
|
export type DerivationId = (typeof derivations)[keyof typeof derivations]['id'];
|
|
@@ -209,7 +237,20 @@ export interface SlotConfig {
|
|
|
209
237
|
* premade stat).
|
|
210
238
|
*/
|
|
211
239
|
entryTypes?: readonly string[];
|
|
212
|
-
/**
|
|
240
|
+
/**
|
|
241
|
+
* 🚧 `list`: the repertoire whose pieces it holds, by address —
|
|
242
|
+
* `core:ruleset/freeform@1#things` (`repertoireAddress`). Absent, the list
|
|
243
|
+
* holds words and lore references only.
|
|
244
|
+
*/
|
|
245
|
+
repertoire?: string;
|
|
246
|
+
/**
|
|
247
|
+
* `derived`: which computation, and the slot it reads.
|
|
248
|
+
*
|
|
249
|
+
* 🚧 On a slot that is NOT `derived` it names the slot's **derived default**:
|
|
250
|
+
* the reading a read uses when no layer holds a value, before the
|
|
251
|
+
* declaration's `default`. A hand write wins. Read order: layers, derived
|
|
252
|
+
* default, declaration default.
|
|
253
|
+
*/
|
|
213
254
|
derivation?: string;
|
|
214
255
|
from?: SlotId;
|
|
215
256
|
[key: string]: unknown;
|
|
@@ -249,8 +290,100 @@ export interface SlotLoreRef {
|
|
|
249
290
|
/** The entry's title as of the read. Filled by the host; never stored. */
|
|
250
291
|
name?: string;
|
|
251
292
|
}
|
|
252
|
-
/**
|
|
253
|
-
|
|
293
|
+
/**
|
|
294
|
+
* 🚧 A piece's overrides on a referenced lore entry or compendium row: the
|
|
295
|
+
* piece fields this holder's copy changes (a sword's new nickname, a door
|
|
296
|
+
* now barred) and no others. Checked key by key against the repertoire's
|
|
297
|
+
* piece shape. Never an edit to the entry or the row.
|
|
298
|
+
* @experimental
|
|
299
|
+
*/
|
|
300
|
+
export type PieceOverrides = Readonly<Record<string, unknown>>;
|
|
301
|
+
/**
|
|
302
|
+
* 🚧 A piece written out where it is held: the universal parts (`name`,
|
|
303
|
+
* `description`, `prose?`, `traits?`, `equipped?`, `duration?` —
|
|
304
|
+
* `PIECE_FIELDS`) and the repertoire's own fields, flat.
|
|
305
|
+
* @experimental
|
|
306
|
+
*/
|
|
307
|
+
export interface InlinePiece {
|
|
308
|
+
kind: 'inline';
|
|
309
|
+
name: string;
|
|
310
|
+
description: string;
|
|
311
|
+
prose?: string;
|
|
312
|
+
traits?: readonly string[];
|
|
313
|
+
/** 🚧 Worn, wielded or readied (2026-10-17, universal). */
|
|
314
|
+
equipped?: boolean;
|
|
315
|
+
/** 🚧 How long it lasts on its holder (2026-10-17, universal) — `PieceDuration`. */
|
|
316
|
+
duration?: PieceDuration;
|
|
317
|
+
/** How many are held; absent means one. */
|
|
318
|
+
count?: number;
|
|
319
|
+
[field: string]: unknown;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* 🚧 A referenced piece as the host read it — the lore entry or the
|
|
323
|
+
* compendium row, **before** this holder's overrides — so a widget draws it
|
|
324
|
+
* without carrying the compendium or reading the lorebook. Filled by the
|
|
325
|
+
* host at read time on a `lore` or `compendium` piece; never stored, never
|
|
326
|
+
* written back (`slotValueForStorage` drops it). Absent: the host could not
|
|
327
|
+
* read it (an entry gone, a ruleset not installed) — draw the reference by
|
|
328
|
+
* its id.
|
|
329
|
+
* @experimental
|
|
330
|
+
*/
|
|
331
|
+
export interface SlotPieceResolved {
|
|
332
|
+
/** The entry's title, or the row's name. */
|
|
333
|
+
name: string;
|
|
334
|
+
description?: string;
|
|
335
|
+
prose?: string;
|
|
336
|
+
traits?: readonly string[];
|
|
337
|
+
/**
|
|
338
|
+
* Its key facts, in words, in the repertoire's declared order — the
|
|
339
|
+
* field's key, its label, its value (`damage` · _Damage_ · _1d8 Slashing_).
|
|
340
|
+
*/
|
|
341
|
+
keyProps: readonly {
|
|
342
|
+
key: string;
|
|
343
|
+
label: string;
|
|
344
|
+
value: string;
|
|
345
|
+
}[];
|
|
346
|
+
/** The name of the ruleset whose library holds a compendium row (_Vis Itineris_). */
|
|
347
|
+
compendiumName?: string;
|
|
348
|
+
}
|
|
349
|
+
/** 🚧 A piece that is a lore entry, with this holder's overrides. @experimental */
|
|
350
|
+
export interface LorePiece {
|
|
351
|
+
kind: 'lore';
|
|
352
|
+
entryId: number;
|
|
353
|
+
count?: number;
|
|
354
|
+
overrides?: PieceOverrides;
|
|
355
|
+
/** The entry's title as of the read. Filled by the host; never stored. */
|
|
356
|
+
name?: string; /** 🚧 The entry as the host read it. Filled by the host; never stored. @experimental */
|
|
357
|
+
resolved?: SlotPieceResolved;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* 🚧 A piece that is a compendium row, pinned to the row's `version`, with
|
|
361
|
+
* this holder's overrides. `compendiumId` is the ruleset whose compendium
|
|
362
|
+
* holds it.
|
|
363
|
+
* @experimental
|
|
364
|
+
*/
|
|
365
|
+
export interface CompendiumPiece {
|
|
366
|
+
kind: 'compendium';
|
|
367
|
+
compendiumId: string;
|
|
368
|
+
pieceId: string;
|
|
369
|
+
version: string;
|
|
370
|
+
count?: number;
|
|
371
|
+
overrides?: PieceOverrides;
|
|
372
|
+
/** The row's name as of the read. Filled by the host; never stored. */
|
|
373
|
+
name?: string; /** 🚧 The row as the host read it. Filled by the host; never stored. @experimental */
|
|
374
|
+
resolved?: SlotPieceResolved;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* 🚧 A structured list item — a **piece** of a repertoire. Legal only in a
|
|
378
|
+
* list slot whose `config.repertoire` names one (`repertoires.ts`); a plain
|
|
379
|
+
* list holds words and lore references.
|
|
380
|
+
* @experimental
|
|
381
|
+
*/
|
|
382
|
+
export type SlotPiece = InlinePiece | LorePiece | CompendiumPiece;
|
|
383
|
+
/** 🚧 Is this list item a piece? @experimental */
|
|
384
|
+
export declare const isSlotPiece: (item: unknown) => item is SlotPiece;
|
|
385
|
+
/** One item of a `list`: a word, a lore reference, or (🚧 on a repertoire) a piece. @experimental */
|
|
386
|
+
export type SlotListItem = SlotScalar | SlotLoreRef | SlotPiece;
|
|
254
387
|
/**
|
|
255
388
|
* A stored attribute value: one thing, or — for a `list` — several. One thing
|
|
256
389
|
* may be a lore reference only on a `text` slot whose config names
|
|
@@ -286,6 +419,25 @@ export declare function slotListItemText(item: SlotListItem): string;
|
|
|
286
419
|
* @experimental
|
|
287
420
|
*/
|
|
288
421
|
export declare function slotValueForStorage(value: SlotValue): SlotValue;
|
|
422
|
+
/**
|
|
423
|
+
* 🚧 One band of a slot's words ({@link AttributeSlotProps.words}): a value
|
|
424
|
+
* whose share of the stat's maximum is at most `upTo` reads `label`.
|
|
425
|
+
* @experimental
|
|
426
|
+
*/
|
|
427
|
+
export interface SlotWordsBand {
|
|
428
|
+
readonly upTo: number;
|
|
429
|
+
readonly label: I18n;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* 🚧 The words a value reads at a table that keeps no numbers: the first
|
|
433
|
+
* band its share of `max` fits (`max` absent or 0: a value above none is the
|
|
434
|
+
* whole), or `null` when the slot declares none.
|
|
435
|
+
* @experimental
|
|
436
|
+
*/
|
|
437
|
+
export declare function slotWordsFor(bands: readonly {
|
|
438
|
+
upTo: number;
|
|
439
|
+
label: string;
|
|
440
|
+
}[] | undefined, value: unknown, max: unknown): string | null;
|
|
289
441
|
/**
|
|
290
442
|
* One rule on a declaration: when this holds, do this to the value.
|
|
291
443
|
*
|
|
@@ -363,6 +515,21 @@ export interface AttributeSlotProps {
|
|
|
363
515
|
descriptor: string;
|
|
364
516
|
/** Which owner kinds may carry it. */
|
|
365
517
|
appliesTo: readonly SlotAppliesTo[];
|
|
518
|
+
/**
|
|
519
|
+
* 🚧 **What its values survive** (M0, SHAPES F1): `session` — they
|
|
520
|
+
* die with the session (its session layer: `session`, `session_cast`,
|
|
521
|
+
* `player_seat`, `session_location`); `world` — they live on the book,
|
|
522
|
+
* dated on its timeline (`lorebook`, `cast_member`, `location`). Absent:
|
|
523
|
+
* `session`. A ruleset attribute's `scope` lands here. The player's own
|
|
524
|
+
* (`owner: 'player'` on a ruleset attribute) is a `cast` slot read on the
|
|
525
|
+
* player's seat. Declared only until lane T3.
|
|
526
|
+
*/
|
|
527
|
+
scope?: 'session' | 'world';
|
|
528
|
+
/**
|
|
529
|
+
* 🚧 This follows the player into the next chapter: a `next-chapter`
|
|
530
|
+
* session seeds its value from the session it follows (M0, F5).
|
|
531
|
+
*/
|
|
532
|
+
nextChapter?: true;
|
|
366
533
|
/** The base configuration every attachment starts from. */
|
|
367
534
|
config?: SlotConfig;
|
|
368
535
|
/** The value a read falls back to when no layer has one. */
|
|
@@ -413,6 +580,76 @@ export interface AttributeSlotProps {
|
|
|
413
580
|
* Absent is pickable. Inside the content hash when stated.
|
|
414
581
|
*/
|
|
415
582
|
pickable?: false;
|
|
583
|
+
/**
|
|
584
|
+
* 🚧 The ruleset that declares this slot (`core:ruleset/vis-itineris@1`), when
|
|
585
|
+
* one does. Such a slot is **pickable only in a session whose ruleset it
|
|
586
|
+
* is** (`slotPickableIn`) — so a ruleset's stats never flood every
|
|
587
|
+
* session's picker. Declaration-level; the host honours it where it lists
|
|
588
|
+
* pickable slots. Inside the content hash when stated (added 2026-10-16,
|
|
589
|
+
* rulesets W3-S).
|
|
590
|
+
*
|
|
591
|
+
* ⏳ Redundant since 2026-10-17: a slot a ruleset lists under its `stats`
|
|
592
|
+
* is owned by it without saying so (`slotRulesetOwners`), unless that
|
|
593
|
+
* ruleset marks the entry `borrowed`. Still accepted for a plugin that
|
|
594
|
+
* spells it; the two are read together.
|
|
595
|
+
*/
|
|
596
|
+
rulesetOwned?: string;
|
|
597
|
+
/**
|
|
598
|
+
* 🚧 The fewest **active player seats** a session needs before this slot
|
|
599
|
+
* is tracked at all (owner ruling 2026-10-17: "What does Ann do when
|
|
600
|
+
* you're away?" is a question for a table with other seats). `2` on
|
|
601
|
+
* the Dungeon Crawler's standing order: a solo session leaves the slot
|
|
602
|
+
* out of its vocabulary — no sheet row, no form question, a write
|
|
603
|
+
* refused — and it appears the moment a second seat joins. Absent or
|
|
604
|
+
* `1`: always tracked. Read by the host's vocabulary from its seat
|
|
605
|
+
* count; inside the content hash when stated, as `rulesetOwned` is.
|
|
606
|
+
*/
|
|
607
|
+
minSeats?: number;
|
|
608
|
+
/**
|
|
609
|
+
* 🚧 The **ruleset setting** this slot is tracked under (2026-10-18): a
|
|
610
|
+
* slot only one way of playing a ruleset uses — Vis Itineris's spell
|
|
611
|
+
* points under `casting: points`, a crawl's spell slots under `casting:
|
|
612
|
+
* slots` — is left out of a session whose setting holds another choice,
|
|
613
|
+
* as `minSeats` leaves a slot out below its seat count: no sheet row, no
|
|
614
|
+
* form question, a write refused. The values already filed stay, and read
|
|
615
|
+
* again the moment the setting comes back. Read by the host's vocabulary
|
|
616
|
+
* from the session's ruleset settings (the setting's default when the
|
|
617
|
+
* session chose none). 🚧 A session that does not play `ruleset` does not
|
|
618
|
+
* track it either (2026-10-19, PLAN-dc-after-walk2 Q2-3): the setting is
|
|
619
|
+
* that ruleset's, and the slot means nothing without it — a Story
|
|
620
|
+
* session's sheet showed an empty "Spell slots" row. Inside the content
|
|
621
|
+
* hash when stated, as `minSeats` is.
|
|
622
|
+
*/
|
|
623
|
+
whenRulesetSetting?: {
|
|
624
|
+
/** The ruleset whose setting is read (`core:ruleset/vis-itineris@1`). */
|
|
625
|
+
readonly ruleset: string;
|
|
626
|
+
/** The setting's name (`casting`). */
|
|
627
|
+
readonly setting: string;
|
|
628
|
+
/** The choices under which the slot is tracked (`['points']`). */
|
|
629
|
+
readonly is: readonly string[];
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* 🚧 How a bounded number reads at a table that **keeps no numbers** (a
|
|
633
|
+
* ruleset of words, the Freeform ruleset — PLAN-dc-after-walk2 Q2-3, owner
|
|
634
|
+
* ruling ★3): bands, first fitting first, each `upTo` a share of the
|
|
635
|
+
* stat's own maximum (0 to 1) and its words — core's health reads
|
|
636
|
+
* _unhurt_, _hurt_, _badly hurt_, _at death's door_. A widget draws the
|
|
637
|
+
* words in place of the number there, and a number with no words not at
|
|
638
|
+
* all; everywhere else they change nothing. Inside the content hash when
|
|
639
|
+
* stated.
|
|
640
|
+
* @experimental
|
|
641
|
+
*/
|
|
642
|
+
words?: readonly SlotWordsBand[];
|
|
643
|
+
/**
|
|
644
|
+
* 🚧 A stat drawn on a sheet **only while it holds something**
|
|
645
|
+
* (PLAN-dc-after-walk2 Q3-8): a mechanism's passing state — a crawl's
|
|
646
|
+
* death saves while somebody lies dying — that would otherwise stand on
|
|
647
|
+
* every sheet as an empty row. Nothing, null and blank text read as
|
|
648
|
+
* nothing. Tracked, written and read as any other stat; only a widget's
|
|
649
|
+
* drawing changes. Inside the content hash when stated.
|
|
650
|
+
* @experimental
|
|
651
|
+
*/
|
|
652
|
+
shownWhenSet?: true;
|
|
416
653
|
/**
|
|
417
654
|
* 🚧 **Earshot**: which prompts may read this slot's value.
|
|
418
655
|
*
|
|
@@ -447,6 +684,36 @@ export declare const SLOT_EARSHOTS: readonly SlotEarshot[];
|
|
|
447
684
|
export declare const slotEarshot: (decl: Pick<AttributeSlotProps, 'earshot'>) => SlotEarshot;
|
|
448
685
|
/** 🚧 May a session pick this slot as an attribute of its own or carry it in from its world? @experimental */
|
|
449
686
|
export declare const slotPickable: (decl: Pick<AttributeSlotProps, 'pickable'>) => boolean;
|
|
687
|
+
/** Record the slots a registering ruleset owns. Called by `rulesets.ts` only. @internal */
|
|
688
|
+
export declare function _registerRulesetStats(rulesetId: string, slotIds: readonly SlotId[]): void;
|
|
689
|
+
/** @internal */
|
|
690
|
+
export declare function _clearRulesetStats(): void;
|
|
691
|
+
/**
|
|
692
|
+
* 🚧 Forget that one ruleset lists any slot (`_registerRulesetStats`'s
|
|
693
|
+
* inverse); a slot nobody lists any more is dropped from the index.
|
|
694
|
+
* @internal
|
|
695
|
+
*/
|
|
696
|
+
export declare function _withdrawRulesetStats(rulesetId: string): void;
|
|
697
|
+
/**
|
|
698
|
+
* 🚧 The rulesets that own a slot: every registered ruleset that lists it
|
|
699
|
+
* under its `stats` (not `borrowed`), with the slot's own `rulesetOwned` if
|
|
700
|
+
* it spells one. Empty: no ruleset's — pickable in every session.
|
|
701
|
+
* @experimental
|
|
702
|
+
*/
|
|
703
|
+
export declare function slotRulesetOwners(decl: Pick<AttributeSlotProps, 'rulesetOwned'> & {
|
|
704
|
+
id?: SlotId;
|
|
705
|
+
}): readonly string[];
|
|
706
|
+
/**
|
|
707
|
+
* 🚧 May a session whose ruleset is `sessionRuleset` pick this slot? A slot a
|
|
708
|
+
* ruleset owns (`slotRulesetOwners`: listed under its `stats`, or spelled
|
|
709
|
+
* `rulesetOwned`) is pickable only in the sessions of a ruleset that owns
|
|
710
|
+
* it; every other slot answers as `slotPickable` does. Pass the declaration
|
|
711
|
+
* with its `id`, so the derived owners are read.
|
|
712
|
+
* @experimental
|
|
713
|
+
*/
|
|
714
|
+
export declare const slotPickableIn: (decl: Pick<AttributeSlotProps, 'pickable' | 'rulesetOwned'> & {
|
|
715
|
+
id?: SlotId;
|
|
716
|
+
}, sessionRuleset: string | null | undefined) => boolean;
|
|
450
717
|
/**
|
|
451
718
|
* Which source a registry entry came through.
|
|
452
719
|
*
|
|
@@ -500,14 +767,35 @@ export declare const SLOT_DISPLAY_KEYS: {
|
|
|
500
767
|
* with both hashes named.
|
|
501
768
|
* @internal
|
|
502
769
|
*/
|
|
503
|
-
export declare function defineAttributeSlot(id:
|
|
770
|
+
export declare function defineAttributeSlot<const Id extends SlotId, const P extends AttributeSlotProps>(id: Id, props: P): DeclaredAttributeSlot<Id, P>;
|
|
771
|
+
/**
|
|
772
|
+
* 🚧 A slot declaration that remembers, in its TYPE, what was declared — its
|
|
773
|
+
* id and its props (A5, A18): what `sessionOf(genre)` and `vocabulary(…)` read
|
|
774
|
+
* to type a condition's property (`s.world.weather` is an enum of the slot's
|
|
775
|
+
* own choices). The value is the plain registered `AttributeSlotDecl`;
|
|
776
|
+
* `__declared` is a phantom, never set.
|
|
777
|
+
* @experimental
|
|
778
|
+
* @ruling A5, A18
|
|
779
|
+
*/
|
|
780
|
+
export type DeclaredAttributeSlot<Id extends SlotId = SlotId, P extends AttributeSlotProps = AttributeSlotProps> = AttributeSlotDecl & {
|
|
781
|
+
readonly id: Id;
|
|
782
|
+
readonly __declared?: P;
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* 🚧 The rulesets' door: the slot a ruleset's own attribute files its values
|
|
786
|
+
* under (`rulesetAttributeSlotDecls`, `<owner>.<ruleset>:slot/<attribute>@N`),
|
|
787
|
+
* registered by `defineRuleset` with the ruleset and withdrawn with it. A
|
|
788
|
+
* code declaration, so an identical re-declaration is a no-op.
|
|
789
|
+
* @internal
|
|
790
|
+
*/
|
|
791
|
+
export declare function _defineRulesetAttributeSlot(id: SlotId, props: AttributeSlotProps): AttributeSlotDecl;
|
|
504
792
|
/**
|
|
505
793
|
* The plugin-facing door — same registration, minus the ability to claim core's
|
|
506
794
|
* namespace. A plugin that could redefine `core:slot/hp@1` would change what
|
|
507
795
|
* every character's health means on the instance without appearing anywhere.
|
|
508
796
|
* @experimental
|
|
509
797
|
*/
|
|
510
|
-
export declare function definePluginAttributeSlot(pluginId: string, id:
|
|
798
|
+
export declare function definePluginAttributeSlot<const Id extends SlotId, const P extends AttributeSlotProps>(pluginId: string, id: Id, props: P): DeclaredAttributeSlot<Id, P>;
|
|
511
799
|
/**
|
|
512
800
|
* The person-facing door: a slot somebody authored, loaded from the host's
|
|
513
801
|
* `attribute_declarations` row.
|
|
@@ -577,7 +865,9 @@ export declare function slotField(decl: Pick<AttributeSlotProps, 'type' | 'shape
|
|
|
577
865
|
/** The catalogue shape a slot names, when it names one (an inline `FieldDecl` names none). @experimental */
|
|
578
866
|
export declare const slotStatShapeId: (decl: Pick<AttributeSlotProps, 'shape'>) => StatShapeId | undefined;
|
|
579
867
|
/** Which kind of stat a slot is; `undefined` for a derived slot, which is computed rather than kept. @experimental */
|
|
580
|
-
export declare const slotStatShapeKind: (decl: Pick<AttributeSlotProps, 'type' | 'shape'>
|
|
868
|
+
export declare const slotStatShapeKind: (decl: Pick<AttributeSlotProps, 'type' | 'shape'> & {
|
|
869
|
+
config?: Pick<SlotConfig, 'repertoire'>;
|
|
870
|
+
}) => StatShapeKind | undefined;
|
|
581
871
|
/**
|
|
582
872
|
* What a field bounds, as the configuration keys a layer deviates from: a
|
|
583
873
|
* number's `min`/`max`; a choice's options (`of`, or its `members`' keys); a
|
|
@@ -586,6 +876,41 @@ export declare const slotStatShapeKind: (decl: Pick<AttributeSlotProps, 'type' |
|
|
|
586
876
|
* @experimental
|
|
587
877
|
*/
|
|
588
878
|
export declare function fieldSlotConfig(field: FieldDecl | undefined): SlotConfig;
|
|
879
|
+
/**
|
|
880
|
+
* 🚧 One owner's **stat configuration**, as a document (owner ruling
|
|
881
|
+
* 2026-10-15): which owner, which attribute slot, and the deviations this
|
|
882
|
+
* owner makes from the slot's own config — `{ max: 26 }`, never the whole.
|
|
883
|
+
* The ONE format a pipeline's `core:outlet/set-stat-config@1` and a person's
|
|
884
|
+
* card or session editor (`state:configure`) both send.
|
|
885
|
+
*
|
|
886
|
+
* `owner` is a participant reference — `player-seat:<id>`, `character:<id>`
|
|
887
|
+
* — or `world`; `config`'s keys are only those `statConfigKeys` names.
|
|
888
|
+
* @experimental
|
|
889
|
+
*/
|
|
890
|
+
export interface StatConfigDocument {
|
|
891
|
+
owner: string;
|
|
892
|
+
slot: SlotId;
|
|
893
|
+
config: SlotConfig;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* 🚧 The configuration keys an owner may set on this slot: what its stat
|
|
897
|
+
* shape bounds (`fieldSlotConfig`'s keys) — a number's `min` and `max`; a
|
|
898
|
+
* choice's `of`; a list's `maxItems` and, by its item, `of` or
|
|
899
|
+
* `maxLength`; a line's `maxLength` — and, on every kept slot, the
|
|
900
|
+
* `descriptor` (the model-facing sentence in this world, R5). A derived
|
|
901
|
+
* slot takes none. Nothing else is stored per owner: a key outside these
|
|
902
|
+
* would be kept and read by nobody.
|
|
903
|
+
* @experimental
|
|
904
|
+
*/
|
|
905
|
+
export declare function statConfigKeys(decl: Pick<AttributeSlotProps, 'type' | 'shape'>): readonly string[];
|
|
906
|
+
/**
|
|
907
|
+
* 🚧 Why this owner configuration may not be stored for this slot — one
|
|
908
|
+
* sentence per fault, empty when it may. Asked of the document's `config`
|
|
909
|
+
* alone; whether its `min` still sits under the owner's `max` once merged
|
|
910
|
+
* with what is in force is the writer's to ask (it holds the layers).
|
|
911
|
+
* @experimental
|
|
912
|
+
*/
|
|
913
|
+
export declare function statConfigRefusals(decl: AttributeSlotDecl, config: unknown): string[];
|
|
589
914
|
/**
|
|
590
915
|
* The configuration in force for one owner: the declaration's own config with
|
|
591
916
|
* each layer's deviations laid over it, nearest layer last.
|