@serene-pub/sdk 0.6.0-pr-7 → 0.6.0-pr-8
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/annexFields.d.ts +14 -0
- package/dist/annexFields.js +7 -0
- package/dist/announce.d.ts +26 -13
- package/dist/announce.js +31 -0
- package/dist/appletCard.d.ts +17 -0
- package/dist/appletCard.js +60 -0
- package/dist/attributes.d.ts +3 -3
- package/dist/attributes.js +1 -1
- package/dist/builder.d.ts +23 -6
- package/dist/builder.js +57 -5
- package/dist/cadences.d.ts +11 -2
- package/dist/cadences.js +27 -2
- package/dist/characterProfile.d.ts +137 -0
- package/dist/characterProfile.js +24 -0
- package/dist/component.d.ts +1 -1
- package/dist/componentImports.d.ts +1 -1
- package/dist/componentImports.js +2 -0
- package/dist/declarations.js +4 -0
- package/dist/descriptors.d.ts +68 -3
- package/dist/descriptors.js +23 -0
- package/dist/document.d.ts +8 -0
- package/dist/document.js +44 -1
- package/dist/events.d.ts +35 -4
- package/dist/events.js +7 -3
- package/dist/executor.js +26 -5
- package/dist/extension.d.ts +17 -0
- package/dist/fit.d.ts +4 -1
- package/dist/fit.js +43 -1
- package/dist/functions.d.ts +7 -1
- package/dist/functions.js +3 -1
- package/dist/genres.d.ts +7 -0
- package/dist/genres.js +32 -1
- package/dist/hookGrants.js +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -0
- package/dist/layout.d.ts +18 -0
- package/dist/libraryDraft.d.ts +2 -0
- package/dist/libraryDraft.js +5 -1
- package/dist/lorebookFile.d.ts +8 -0
- package/dist/lorebookFile.js +21 -0
- package/dist/participants.d.ts +53 -8
- package/dist/participants.js +9 -5
- package/dist/pluginPermissions.js +1 -1
- package/dist/promptBlocks.d.ts +5 -1
- package/dist/promptBlocks.js +23 -8
- package/dist/registry.js +6 -3
- package/dist/sceneSettings.d.ts +4 -0
- package/dist/sceneSettings.js +7 -4
- package/dist/sessionDossier.d.ts +57 -0
- package/dist/sessionLayout.d.ts +296 -85
- package/dist/sessionLayout.js +397 -133
- package/dist/settings.d.ts +28 -1
- package/dist/settings.js +50 -2
- package/dist/shapes.d.ts +6 -1
- package/dist/shapes.js +6 -1
- package/dist/sheetLatitude.d.ts +148 -0
- package/dist/sheetLatitude.js +161 -0
- package/dist/storyTime.js +6 -4
- package/dist/surfaces.d.ts +11 -1
- package/dist/template.d.ts +26 -1
- package/dist/templateCheck.d.ts +24 -0
- package/dist/templateCheck.js +299 -7
- package/dist/templateFit.js +4 -0
- package/dist/templateIds.d.ts +6 -0
- package/dist/templateIds.js +9 -0
- package/dist/turnLock.d.ts +10 -1
- package/dist/turnLock.js +6 -1
- package/dist/turnOrder.d.ts +37 -4
- package/dist/turnOrder.js +49 -11
- package/dist/validate.d.ts +4 -2
- package/dist/validate.js +15 -11
- package/dist/variableLayouts.d.ts +141 -0
- package/dist/variableLayouts.js +183 -0
- package/dist/variables.d.ts +35 -7
- package/dist/variables.js +34 -1
- package/dist/widgetDecls.js +12 -0
- package/dist/widgets.d.ts +384 -41
- package/dist/widgets.js +23 -0
- package/package.json +1 -1
package/dist/settings.d.ts
CHANGED
|
@@ -356,6 +356,20 @@ export interface FieldDecl<T extends FieldType = FieldType, O extends readonly s
|
|
|
356
356
|
* object reads as `[<id>]` rows (`readLogitBiasValue`).
|
|
357
357
|
*/
|
|
358
358
|
format?: 'json' | 'story-time' | 'logit-bias';
|
|
359
|
+
/**
|
|
360
|
+
* 🚧 For a `string` field only (★W3, 2026-11-04): its blank drawn as a named
|
|
361
|
+
* choice rather than an empty box. A form draws a choice list of `label`
|
|
362
|
+
* (what a blank does — *Default (main)*) and `other` (*Another channel*), with
|
|
363
|
+
* the text box only for `other`; the box carries no placeholder — the field's
|
|
364
|
+
* `description` is drawn once, under it. Choosing `label` stores blank, so a blank means what it
|
|
365
|
+
* always meant; nothing about the stored value changes. Any other field
|
|
366
|
+
* type is refused (`settingsSchemaFindings`, `checkSchema`).
|
|
367
|
+
* ⚠ Not an `enum`: the second choice is free text.
|
|
368
|
+
*/
|
|
369
|
+
unset?: {
|
|
370
|
+
label: I18nText;
|
|
371
|
+
other: I18nText;
|
|
372
|
+
};
|
|
359
373
|
/**
|
|
360
374
|
* 🚧 For a `json` field only: the most its value may weigh, counted as the
|
|
361
375
|
* UTF-8 bytes of its JSON text. Absent, `JSON_FIELD_MAX_BYTES` (16384); an
|
|
@@ -388,7 +402,8 @@ export declare function fieldLabel(decl: {
|
|
|
388
402
|
/**
|
|
389
403
|
* Every display-text fault in one settings schema, as sentences that
|
|
390
404
|
* name the field: each field's `label` and its `description`; each
|
|
391
|
-
* `members[]` band's label and description;
|
|
405
|
+
* `members[]` band's label and description; a field's `unset` (its shape, its
|
|
406
|
+
* two labels, and that only a `string` field has one); and the
|
|
392
407
|
* same for a `list`'s `item` and an `object`'s `fields`, recursively. A schema
|
|
393
408
|
* that is not an object is one finding. Run at every door a schema arrives
|
|
394
409
|
* through — `register()` for node params, `genre()` for a shape's fields,
|
|
@@ -551,6 +566,18 @@ export type PluginConfigState = {
|
|
|
551
566
|
};
|
|
552
567
|
/** @internal */
|
|
553
568
|
export declare function configState(schema: SettingsSchema, values: Record<string, unknown>): PluginConfigState;
|
|
569
|
+
/**
|
|
570
|
+
* 🚧 **Undescribed setting parts** (P5, ruled 2026-11-04): which of `description`
|
|
571
|
+
* (a sentence of purpose), `group` and `reach` a user-facing setting lacks. Empty
|
|
572
|
+
* means described. One predicate for the compiler's `W_SETTING_UNDESCRIBED` and for
|
|
573
|
+
* the form deriver that folds a flagged field under Advanced — never two copies.
|
|
574
|
+
* An `'admin'`-reach setting is not user-facing, so it is never flagged. A setting
|
|
575
|
+
* kind with no `reach` (a plugin setting) passes `{ reach: false }`.
|
|
576
|
+
* @experimental
|
|
577
|
+
*/
|
|
578
|
+
export declare function undescribedSettingParts(decl: Pick<FieldDecl, 'description' | 'group' | 'reach'>, opts?: {
|
|
579
|
+
reach?: boolean;
|
|
580
|
+
}): Array<'description' | 'group' | 'reach'>;
|
|
554
581
|
/** @experimental */
|
|
555
582
|
export interface FormGroup {
|
|
556
583
|
group: string;
|
package/dist/settings.js
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* @ruling 12 §6, F6, 03 §3, 13 §6, F16, 12 §7
|
|
32
32
|
*/
|
|
33
33
|
import { pluginRuleRef } from './pluginRuleRef.js';
|
|
34
|
-
import { i18nFindings, i18nText } from './i18n.js';
|
|
34
|
+
import { i18nFindings, i18nText, isI18n } from './i18n.js';
|
|
35
35
|
/** @experimental */
|
|
36
36
|
export const secret = (value) => ({ $secret: true, value });
|
|
37
37
|
/** @internal */
|
|
@@ -44,10 +44,17 @@ export const isSecret = (v) => !!v && typeof v === 'object' && v.$secret === tru
|
|
|
44
44
|
export function fieldLabel(decl, language = 'en') {
|
|
45
45
|
return i18nText(decl.label, language);
|
|
46
46
|
}
|
|
47
|
+
/** Why this field may not declare `unset`, or null — the one rule both finders use. */
|
|
48
|
+
function unsetMisfit(decl) {
|
|
49
|
+
return decl.unset !== undefined && decl.type !== 'string'
|
|
50
|
+
? "only a string field has a named blank — remove 'unset', or declare the field type: 'string'"
|
|
51
|
+
: null;
|
|
52
|
+
}
|
|
47
53
|
/**
|
|
48
54
|
* Every display-text fault in one settings schema, as sentences that
|
|
49
55
|
* name the field: each field's `label` and its `description`; each
|
|
50
|
-
* `members[]` band's label and description;
|
|
56
|
+
* `members[]` band's label and description; a field's `unset` (its shape, its
|
|
57
|
+
* two labels, and that only a `string` field has one); and the
|
|
51
58
|
* same for a `list`'s `item` and an `object`'s `fields`, recursively. A schema
|
|
52
59
|
* that is not an object is one finding. Run at every door a schema arrives
|
|
53
60
|
* through — `register()` for node params, `genre()` for a shape's fields,
|
|
@@ -88,6 +95,18 @@ export function settingsSchemaFindings(schema, where) {
|
|
|
88
95
|
out.push(...i18nFindings(m.description, `${band}.description`));
|
|
89
96
|
});
|
|
90
97
|
}
|
|
98
|
+
if (f.unset !== undefined) {
|
|
99
|
+
const u = f.unset;
|
|
100
|
+
if (!u || typeof u !== 'object' || Array.isArray(u))
|
|
101
|
+
out.push(`${at}.unset: the named blank is an object — { label: 'Default (main)', other: 'Another channel' }`);
|
|
102
|
+
else {
|
|
103
|
+
const misfit = unsetMisfit(f);
|
|
104
|
+
if (misfit)
|
|
105
|
+
out.push(`${at}.unset: ${misfit}`);
|
|
106
|
+
out.push(...i18nFindings(u.label, `${at}.unset.label`, { required: true }));
|
|
107
|
+
out.push(...i18nFindings(u.other, `${at}.unset.other`, { required: true }));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
91
110
|
if (f.item !== undefined)
|
|
92
111
|
out.push(...settingsSchemaFindings({ item: f.item }, at));
|
|
93
112
|
if (f.fields !== undefined)
|
|
@@ -175,6 +194,13 @@ export function checkSchema(schema) {
|
|
|
175
194
|
fix: "remove 'lend' — only a secret is withheld from other packages' pipelines, so only a secret can be lent" +
|
|
176
195
|
pluginRuleRef('secrets'),
|
|
177
196
|
});
|
|
197
|
+
if (unsetMisfit(d))
|
|
198
|
+
f.push({
|
|
199
|
+
field: key,
|
|
200
|
+
severity: 'error',
|
|
201
|
+
message: `'${key}' says 'unset', which only a string field has`,
|
|
202
|
+
fix: "remove 'unset', or declare the field type: 'string' — the named blank is a choice beside a text box",
|
|
203
|
+
});
|
|
178
204
|
if (d.type === 'secret') {
|
|
179
205
|
if (!SECRET_KEY.test(key))
|
|
180
206
|
f.push({
|
|
@@ -744,6 +770,28 @@ export function configState(schema, values) {
|
|
|
744
770
|
message: `waiting on ${missing.join(', ')} in plugin settings`,
|
|
745
771
|
};
|
|
746
772
|
}
|
|
773
|
+
// ── The undescribed rule ────────────────────────────────────────────────────
|
|
774
|
+
/**
|
|
775
|
+
* 🚧 **Undescribed setting parts** (P5, ruled 2026-11-04): which of `description`
|
|
776
|
+
* (a sentence of purpose), `group` and `reach` a user-facing setting lacks. Empty
|
|
777
|
+
* means described. One predicate for the compiler's `W_SETTING_UNDESCRIBED` and for
|
|
778
|
+
* the form deriver that folds a flagged field under Advanced — never two copies.
|
|
779
|
+
* An `'admin'`-reach setting is not user-facing, so it is never flagged. A setting
|
|
780
|
+
* kind with no `reach` (a plugin setting) passes `{ reach: false }`.
|
|
781
|
+
* @experimental
|
|
782
|
+
*/
|
|
783
|
+
export function undescribedSettingParts(decl, opts = {}) {
|
|
784
|
+
if (decl.reach === 'admin')
|
|
785
|
+
return [];
|
|
786
|
+
const missing = [];
|
|
787
|
+
if (!isI18n(decl.description))
|
|
788
|
+
missing.push('description');
|
|
789
|
+
if (!decl.group)
|
|
790
|
+
missing.push('group');
|
|
791
|
+
if (opts.reach !== false && !decl.reach)
|
|
792
|
+
missing.push('reach');
|
|
793
|
+
return missing;
|
|
794
|
+
}
|
|
747
795
|
/** Declaration order within a group; group order is first appearance. @experimental */
|
|
748
796
|
export function formLayout(schema) {
|
|
749
797
|
const groups = [];
|
package/dist/shapes.d.ts
CHANGED
|
@@ -359,7 +359,12 @@ export declare const S: {
|
|
|
359
359
|
readonly turnEntries: string;
|
|
360
360
|
/**
|
|
361
361
|
* **Sprite choices**: what a line's speaker can show
|
|
362
|
-
* — `{ characterId, set, defaultSet, labels, last, recent, decidedBy }`.
|
|
362
|
+
* — `{ castMemberId, characterId, set, defaultSet, labels, last, recent, decidedBy }`.
|
|
363
|
+
* 🚧 `castMemberId` (the speaker's cast member) is the identity; the card
|
|
364
|
+
* the art comes from **cascades**: the member's own sprite sets per its
|
|
365
|
+
* configuration, else the card active on the timeline (the dated card at
|
|
366
|
+
* the reading). ⏳ `characterId` (removed in S5) is that card, null when
|
|
367
|
+
* the member's own sets draw.
|
|
363
368
|
* `set` is the sprite set in force for the line (a session override, the
|
|
364
369
|
* cast member's amendment, or the card's default — `decidedBy` says
|
|
365
370
|
* which); `labels` are that set's sprite labels with an image; `last` is
|
package/dist/shapes.js
CHANGED
|
@@ -395,7 +395,12 @@ export const S = {
|
|
|
395
395
|
turnEntries: defineShape({ id: 'core:shape/turn-entries@1' }),
|
|
396
396
|
/**
|
|
397
397
|
* **Sprite choices**: what a line's speaker can show
|
|
398
|
-
* — `{ characterId, set, defaultSet, labels, last, recent, decidedBy }`.
|
|
398
|
+
* — `{ castMemberId, characterId, set, defaultSet, labels, last, recent, decidedBy }`.
|
|
399
|
+
* 🚧 `castMemberId` (the speaker's cast member) is the identity; the card
|
|
400
|
+
* the art comes from **cascades**: the member's own sprite sets per its
|
|
401
|
+
* configuration, else the card active on the timeline (the dated card at
|
|
402
|
+
* the reading). ⏳ `characterId` (removed in S5) is that card, null when
|
|
403
|
+
* the member's own sets draw.
|
|
399
404
|
* `set` is the sprite set in force for the line (a session override, the
|
|
400
405
|
* cast member's amendment, or the card's default — `decidedBy` says
|
|
401
406
|
* which); `labels` are that set's sprite labels with an image; `last` is
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚧 **Sheet latitude** (owner rulings 2026-11-05, plan §25 ★1 and ★7).
|
|
3
|
+
*
|
|
4
|
+
* Purpose: say how far each role (the session owner, a player) may change sheets and move
|
|
5
|
+
* items **by hand**, and judge one hand edit against it — one pure function the host's write
|
|
6
|
+
* gate and the sheet's edit controls both call, so the two never disagree.
|
|
7
|
+
*
|
|
8
|
+
* Why it exists: before it, a hand edit was judged by an attribute's `changedBy` and a slot's
|
|
9
|
+
* lock alone, and a table that wanted looser (or no) hand editing had no word for it.
|
|
10
|
+
*
|
|
11
|
+
* Owns: the levels, the judge, its types.
|
|
12
|
+
*
|
|
13
|
+
* Does NOT own: who a person is in the session, whose a sheet is, the stored setting (the app
|
|
14
|
+
* resolves those and passes them in); the refusal the person finally reads (the app's — it
|
|
15
|
+
* quotes {@link HAND_EDIT_SENTENCES} and may say any cause its own way); runs and pipelines
|
|
16
|
+
* (never judged here — the latitude limits a person's hand only).
|
|
17
|
+
*
|
|
18
|
+
* ⚠ Not `changedBy` (an attribute's own word for who may change it — the judge *reads* it); not
|
|
19
|
+
* a slot lock (`configs[slot].lock`, `none · people · all` — the judge *reads* it); not `reach`
|
|
20
|
+
* (a setting's word for who sees it); not earshot (which prompts read a value).
|
|
21
|
+
*
|
|
22
|
+
* Pure: no I/O, never throws — it runs in the browser too.
|
|
23
|
+
*/
|
|
24
|
+
import type { AttributeChanger } from './rulesetSections.js';
|
|
25
|
+
/**
|
|
26
|
+
* 🚧 The sheet-latitude levels, one per role:
|
|
27
|
+
*
|
|
28
|
+
* - `as-ruled` — _As the rules say_: the session owner changes anyone's values as the game
|
|
29
|
+
* master; a player changes their own as the holder; each attribute's `changedBy` decides
|
|
30
|
+
* (writer `gm` for the owner, `holder` for a player; the game master may change what the
|
|
31
|
+
* holder may).
|
|
32
|
+
* - `no-edits` — _No editing by hand_.
|
|
33
|
+
* - `all-own` — _Everything on their own characters_: every value on the role's own,
|
|
34
|
+
* `changedBy` set aside.
|
|
35
|
+
* - `all-any` — _Everything on anyone's_: every value on anyone's (the world and places too),
|
|
36
|
+
* `changedBy` set aside.
|
|
37
|
+
*
|
|
38
|
+
* **Own**: for a player, the cards they own (`characters.userId`) and their card-less seat; for
|
|
39
|
+
* the session owner, their own cards plus the world, the people nobody plays (NPCs) and the
|
|
40
|
+
* places. Watchers never change anything (no setting).
|
|
41
|
+
*
|
|
42
|
+
* `all-own` and `all-any` pass `changedBy` — `rules` included — but **never** a lock `all` and
|
|
43
|
+
* **never** an unheard value (owner ruling ★4, 2026-11-05).
|
|
44
|
+
* @experimental
|
|
45
|
+
*/
|
|
46
|
+
export declare const SHEET_LATITUDES: readonly ["as-ruled", "no-edits", "all-own", "all-any"];
|
|
47
|
+
/** @experimental */
|
|
48
|
+
export type SheetLatitude = (typeof SHEET_LATITUDES)[number];
|
|
49
|
+
/**
|
|
50
|
+
* 🚧 The item-move levels, one per role:
|
|
51
|
+
*
|
|
52
|
+
* - `follow-sheet` — _Follow sheet editing_: each side of a move is judged as a `set` under the
|
|
53
|
+
* sheet latitude.
|
|
54
|
+
* - `no-moves` — _No moving by hand_.
|
|
55
|
+
* - `own-items` — _Their own items_: a side on the role's own passes, `changedBy` set aside (so
|
|
56
|
+
* a player gives their own items away: the receiving side becomes an offer the receiver
|
|
57
|
+
* accepts as their own `put-on`).
|
|
58
|
+
* - `any-items` — _Anyone's_.
|
|
59
|
+
*
|
|
60
|
+
* A **give** is two sides judged separately (`take-from` on the giver, `put-on` on the
|
|
61
|
+
* receiver); a **drop** is the giver's side only; a **pick-up** the receiver's side only.
|
|
62
|
+
* `own-items` and `any-items` pass `changedBy` — `rules` included — but **never** a lock `all`
|
|
63
|
+
* and **never** an unheard value (owner ruling ★4, 2026-11-05).
|
|
64
|
+
* @experimental
|
|
65
|
+
*/
|
|
66
|
+
export declare const ITEM_MOVE_LATITUDES: readonly ["follow-sheet", "no-moves", "own-items", "any-items"];
|
|
67
|
+
/** @experimental */
|
|
68
|
+
export type ItemMoveLatitude = (typeof ITEM_MOVE_LATITUDES)[number];
|
|
69
|
+
/**
|
|
70
|
+
* 🚧 Who puts a hand on the sheet. A watcher is a guest who is not a player.
|
|
71
|
+
* @experimental
|
|
72
|
+
*/
|
|
73
|
+
export type HandEditorRole = 'owner' | 'player' | 'watcher';
|
|
74
|
+
/**
|
|
75
|
+
* 🚧 What the hand does: change a value, set or clear a stat's lock, or one side of an item move.
|
|
76
|
+
* @experimental
|
|
77
|
+
*/
|
|
78
|
+
export type HandEditAct = 'set' | 'configure' | 'take-from' | 'put-on';
|
|
79
|
+
/**
|
|
80
|
+
* 🚧 Why a hand edit is refused — the app maps each to its sentence.
|
|
81
|
+
* @experimental
|
|
82
|
+
*/
|
|
83
|
+
export declare const HAND_EDIT_CAUSES: readonly ["watching", "owner-locks", "unheard", "locked", "no-edits", "not-theirs", "changed-by", "no-moves"];
|
|
84
|
+
/** @experimental */
|
|
85
|
+
export type HandEditCause = (typeof HAND_EDIT_CAUSES)[number];
|
|
86
|
+
/**
|
|
87
|
+
* 🚧 The default sentence a person reads for each {@link HandEditCause} (owner ruling ★sl-5,
|
|
88
|
+
* 2026-11-05: the SDK ships one per cause, the app may say any cause its own way). `attribute`
|
|
89
|
+
* is the value's name as the person reads it (_Health_), filled in by the caller; a sentence
|
|
90
|
+
* that names no attribute ignores it.
|
|
91
|
+
*
|
|
92
|
+
* ⚠ Not the judge (`sheetLatitudeAllows` returns the cause, never words).
|
|
93
|
+
* @experimental
|
|
94
|
+
*/
|
|
95
|
+
export declare const HAND_EDIT_SENTENCES: Readonly<Record<HandEditCause, (words: {
|
|
96
|
+
attribute: string;
|
|
97
|
+
}) => string>>;
|
|
98
|
+
/**
|
|
99
|
+
* 🚧 One hand edit, with everything the judge reads (the caller resolves each).
|
|
100
|
+
* @experimental
|
|
101
|
+
*/
|
|
102
|
+
export interface SheetLatitudeQuestion {
|
|
103
|
+
role: HandEditorRole;
|
|
104
|
+
act: HandEditAct;
|
|
105
|
+
/** Whose the value is, seen from `role` (the caller resolves it): `own` or `other`. */
|
|
106
|
+
whose: 'own' | 'other';
|
|
107
|
+
/** The role's sheet latitude in force. Ignored for a watcher and for `configure`. */
|
|
108
|
+
latitude: SheetLatitude;
|
|
109
|
+
/** The role's item-move latitude in force, for `take-from` / `put-on`. Absent: `follow-sheet`. */
|
|
110
|
+
itemMoves?: ItemMoveLatitude;
|
|
111
|
+
/** The attribute's `changedBy`, when the slot files under one of the session's rules' attributes. Absent or empty: anyone. */
|
|
112
|
+
changedBy?: readonly AttributeChanger[];
|
|
113
|
+
/** The slot's lock (`configs[slot].lock`). Absent: `none`. */
|
|
114
|
+
lock?: 'none' | 'people' | 'all';
|
|
115
|
+
/** False when the value's earshot keeps it from this person. Absent: heard. */
|
|
116
|
+
heard?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 🚧 The judge's answer: allowed, or refused with the cause.
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
export type SheetLatitudeVerdict = {
|
|
123
|
+
ok: true;
|
|
124
|
+
} | {
|
|
125
|
+
ok: false;
|
|
126
|
+
cause: HandEditCause;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* 🚧 Judge one hand edit against the sheet latitude, the item-move latitude, the slot's lock and
|
|
130
|
+
* the attribute's `changedBy`. The first cause that applies wins: a watcher (`watching`); a
|
|
131
|
+
* `configure` by anyone but the session owner (`owner-locks`); an unheard value (`unheard`); a
|
|
132
|
+
* lock (`locked` — `all` for everyone, `people` for a player); the item-move level; the sheet
|
|
133
|
+
* level. Pure, never throws; the host's write gate and the sheet's edit controls both call it.
|
|
134
|
+
* @experimental
|
|
135
|
+
*/
|
|
136
|
+
export declare function sheetLatitudeAllows(q: SheetLatitudeQuestion): SheetLatitudeVerdict;
|
|
137
|
+
/**
|
|
138
|
+
* 🚧 A stored value read defensively: one of the levels, else `as-ruled` (the default when a
|
|
139
|
+
* genre says nothing).
|
|
140
|
+
* @experimental
|
|
141
|
+
*/
|
|
142
|
+
export declare function sheetLatitudeOf(value: unknown): SheetLatitude;
|
|
143
|
+
/**
|
|
144
|
+
* 🚧 A stored value read defensively: one of the levels, else `follow-sheet`.
|
|
145
|
+
* @experimental
|
|
146
|
+
*/
|
|
147
|
+
export declare function itemMoveLatitudeOf(value: unknown): ItemMoveLatitude;
|
|
148
|
+
//# sourceMappingURL=sheetLatitude.d.ts.map
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚧 The sheet-latitude levels, one per role:
|
|
3
|
+
*
|
|
4
|
+
* - `as-ruled` — _As the rules say_: the session owner changes anyone's values as the game
|
|
5
|
+
* master; a player changes their own as the holder; each attribute's `changedBy` decides
|
|
6
|
+
* (writer `gm` for the owner, `holder` for a player; the game master may change what the
|
|
7
|
+
* holder may).
|
|
8
|
+
* - `no-edits` — _No editing by hand_.
|
|
9
|
+
* - `all-own` — _Everything on their own characters_: every value on the role's own,
|
|
10
|
+
* `changedBy` set aside.
|
|
11
|
+
* - `all-any` — _Everything on anyone's_: every value on anyone's (the world and places too),
|
|
12
|
+
* `changedBy` set aside.
|
|
13
|
+
*
|
|
14
|
+
* **Own**: for a player, the cards they own (`characters.userId`) and their card-less seat; for
|
|
15
|
+
* the session owner, their own cards plus the world, the people nobody plays (NPCs) and the
|
|
16
|
+
* places. Watchers never change anything (no setting).
|
|
17
|
+
*
|
|
18
|
+
* `all-own` and `all-any` pass `changedBy` — `rules` included — but **never** a lock `all` and
|
|
19
|
+
* **never** an unheard value (owner ruling ★4, 2026-11-05).
|
|
20
|
+
* @experimental
|
|
21
|
+
*/
|
|
22
|
+
export const SHEET_LATITUDES = Object.freeze([
|
|
23
|
+
'as-ruled',
|
|
24
|
+
'no-edits',
|
|
25
|
+
'all-own',
|
|
26
|
+
'all-any',
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* 🚧 The item-move levels, one per role:
|
|
30
|
+
*
|
|
31
|
+
* - `follow-sheet` — _Follow sheet editing_: each side of a move is judged as a `set` under the
|
|
32
|
+
* sheet latitude.
|
|
33
|
+
* - `no-moves` — _No moving by hand_.
|
|
34
|
+
* - `own-items` — _Their own items_: a side on the role's own passes, `changedBy` set aside (so
|
|
35
|
+
* a player gives their own items away: the receiving side becomes an offer the receiver
|
|
36
|
+
* accepts as their own `put-on`).
|
|
37
|
+
* - `any-items` — _Anyone's_.
|
|
38
|
+
*
|
|
39
|
+
* A **give** is two sides judged separately (`take-from` on the giver, `put-on` on the
|
|
40
|
+
* receiver); a **drop** is the giver's side only; a **pick-up** the receiver's side only.
|
|
41
|
+
* `own-items` and `any-items` pass `changedBy` — `rules` included — but **never** a lock `all`
|
|
42
|
+
* and **never** an unheard value (owner ruling ★4, 2026-11-05).
|
|
43
|
+
* @experimental
|
|
44
|
+
*/
|
|
45
|
+
export const ITEM_MOVE_LATITUDES = Object.freeze([
|
|
46
|
+
'follow-sheet',
|
|
47
|
+
'no-moves',
|
|
48
|
+
'own-items',
|
|
49
|
+
'any-items',
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* 🚧 Why a hand edit is refused — the app maps each to its sentence.
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
55
|
+
export const HAND_EDIT_CAUSES = Object.freeze([
|
|
56
|
+
'watching',
|
|
57
|
+
'owner-locks',
|
|
58
|
+
'unheard',
|
|
59
|
+
'locked',
|
|
60
|
+
'no-edits',
|
|
61
|
+
'not-theirs',
|
|
62
|
+
'changed-by',
|
|
63
|
+
'no-moves',
|
|
64
|
+
]);
|
|
65
|
+
/**
|
|
66
|
+
* 🚧 The default sentence a person reads for each {@link HandEditCause} (owner ruling ★sl-5,
|
|
67
|
+
* 2026-11-05: the SDK ships one per cause, the app may say any cause its own way). `attribute`
|
|
68
|
+
* is the value's name as the person reads it (_Health_), filled in by the caller; a sentence
|
|
69
|
+
* that names no attribute ignores it.
|
|
70
|
+
*
|
|
71
|
+
* ⚠ Not the judge (`sheetLatitudeAllows` returns the cause, never words).
|
|
72
|
+
* @experimental
|
|
73
|
+
*/
|
|
74
|
+
export const HAND_EDIT_SENTENCES = Object.freeze({
|
|
75
|
+
watching: () => "You're watching this session; only its players and owner change sheets.",
|
|
76
|
+
'owner-locks': () => 'Only the session owner locks or unlocks a stat.',
|
|
77
|
+
unheard: ({ attribute }) => `Only whoever hears ${attribute} can change it.`,
|
|
78
|
+
locked: ({ attribute }) => `${attribute} is locked.`,
|
|
79
|
+
'no-edits': () => "Sheets aren't changed by hand in this session. The session owner can change that in the session's settings, under Players.",
|
|
80
|
+
'not-theirs': ({ attribute }) => `You can change only your own characters' ${attribute}.`,
|
|
81
|
+
'changed-by': ({ attribute }) => `Only the game master or the rules change ${attribute}.`,
|
|
82
|
+
'no-moves': () => "Items aren't moved by hand in this session. The session owner can change that in the session's settings, under Players.",
|
|
83
|
+
});
|
|
84
|
+
const OK = Object.freeze({ ok: true });
|
|
85
|
+
const refuse = (cause) => ({ ok: false, cause });
|
|
86
|
+
/** Step 6: the sheet latitude (a `set`, or a move under `follow-sheet`). */
|
|
87
|
+
function bySheetLatitude(q) {
|
|
88
|
+
switch (q.latitude) {
|
|
89
|
+
case 'no-edits':
|
|
90
|
+
return refuse('no-edits');
|
|
91
|
+
case 'all-any':
|
|
92
|
+
return OK;
|
|
93
|
+
case 'all-own':
|
|
94
|
+
return q.whose === 'own' ? OK : refuse('not-theirs');
|
|
95
|
+
default: {
|
|
96
|
+
// `as-ruled`, and anything unrecognised: the rules decide.
|
|
97
|
+
if (q.role === 'player' && q.whose === 'other')
|
|
98
|
+
return refuse('not-theirs');
|
|
99
|
+
const by = q.changedBy;
|
|
100
|
+
if (!by || by.length === 0 || by.includes('everyone'))
|
|
101
|
+
return OK;
|
|
102
|
+
const writer = q.role === 'owner' ? 'gm' : 'holder';
|
|
103
|
+
if (by.includes(writer))
|
|
104
|
+
return OK;
|
|
105
|
+
if (writer === 'gm' && by.includes('holder'))
|
|
106
|
+
return OK;
|
|
107
|
+
return refuse('changed-by');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* 🚧 Judge one hand edit against the sheet latitude, the item-move latitude, the slot's lock and
|
|
113
|
+
* the attribute's `changedBy`. The first cause that applies wins: a watcher (`watching`); a
|
|
114
|
+
* `configure` by anyone but the session owner (`owner-locks`); an unheard value (`unheard`); a
|
|
115
|
+
* lock (`locked` — `all` for everyone, `people` for a player); the item-move level; the sheet
|
|
116
|
+
* level. Pure, never throws; the host's write gate and the sheet's edit controls both call it.
|
|
117
|
+
* @experimental
|
|
118
|
+
*/
|
|
119
|
+
export function sheetLatitudeAllows(q) {
|
|
120
|
+
if (q.role === 'watcher')
|
|
121
|
+
return refuse('watching');
|
|
122
|
+
if (q.act === 'configure')
|
|
123
|
+
return q.role === 'owner' ? OK : refuse('owner-locks');
|
|
124
|
+
if (q.heard === false)
|
|
125
|
+
return refuse('unheard');
|
|
126
|
+
if (q.lock === 'all' || (q.lock === 'people' && q.role === 'player'))
|
|
127
|
+
return refuse('locked');
|
|
128
|
+
if (q.act === 'take-from' || q.act === 'put-on') {
|
|
129
|
+
switch (q.itemMoves ?? 'follow-sheet') {
|
|
130
|
+
case 'no-moves':
|
|
131
|
+
return refuse('no-moves');
|
|
132
|
+
case 'own-items':
|
|
133
|
+
return q.whose === 'own' ? OK : refuse('not-theirs');
|
|
134
|
+
case 'any-items':
|
|
135
|
+
return OK;
|
|
136
|
+
default:
|
|
137
|
+
break; // `follow-sheet`: judged as a `set`
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return bySheetLatitude(q);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* 🚧 A stored value read defensively: one of the levels, else `as-ruled` (the default when a
|
|
144
|
+
* genre says nothing).
|
|
145
|
+
* @experimental
|
|
146
|
+
*/
|
|
147
|
+
export function sheetLatitudeOf(value) {
|
|
148
|
+
return SHEET_LATITUDES.includes(value)
|
|
149
|
+
? value
|
|
150
|
+
: 'as-ruled';
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 🚧 A stored value read defensively: one of the levels, else `follow-sheet`.
|
|
154
|
+
* @experimental
|
|
155
|
+
*/
|
|
156
|
+
export function itemMoveLatitudeOf(value) {
|
|
157
|
+
return ITEM_MOVE_LATITUDES.includes(value)
|
|
158
|
+
? value
|
|
159
|
+
: 'follow-sheet';
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=sheetLatitude.js.map
|
package/dist/storyTime.js
CHANGED
|
@@ -511,11 +511,13 @@ export function advanceStoryTime(from, by, unit, calendar) {
|
|
|
511
511
|
return { problem: `The clock does not land: ${landing}` };
|
|
512
512
|
const spelled = formatStoryTime(start, calendar);
|
|
513
513
|
const out = { ...start };
|
|
514
|
-
const stepDays = (days) => {
|
|
514
|
+
const stepDays = (days, past) => {
|
|
515
515
|
if (days === 0)
|
|
516
516
|
return null;
|
|
517
517
|
if (!has(out.month) || !has(out.day))
|
|
518
|
-
return
|
|
518
|
+
return past === 'midnight'
|
|
519
|
+
? `The clock has no date at ${spelled}, so it can't run past midnight.`
|
|
520
|
+
: `The clock has no day at ${spelled}, so it can't count days.`;
|
|
519
521
|
if (calendar) {
|
|
520
522
|
const moved = storyTimeOfDayIndex(storyDayIndex(out, calendar) + days, calendar);
|
|
521
523
|
out.year = moved.year;
|
|
@@ -533,10 +535,10 @@ export function advanceStoryTime(from, by, unit, calendar) {
|
|
|
533
535
|
const total = (has(out.hour) ? out.hour : 0) * 60 + (has(out.minute) ? out.minute : 0) + by * (unit === 'hours' ? 60 : 1);
|
|
534
536
|
out.hour = floorDiv(mod(total, 1440), 60);
|
|
535
537
|
out.minute = mod(total, 60);
|
|
536
|
-
problem = stepDays(floorDiv(total, 1440));
|
|
538
|
+
problem = stepDays(floorDiv(total, 1440), 'midnight');
|
|
537
539
|
}
|
|
538
540
|
else if (unit === 'days')
|
|
539
|
-
problem = stepDays(by);
|
|
541
|
+
problem = stepDays(by, 'days');
|
|
540
542
|
else if (unit === 'months') {
|
|
541
543
|
if (!has(out.month))
|
|
542
544
|
return { problem: `The clock stands at ${spelled}, with no month to count months from.` };
|
package/dist/surfaces.d.ts
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
import type { TurnOrderV1 } from './turnOrder.js';
|
|
51
51
|
import type { ComponentFramework } from './extension.js';
|
|
52
52
|
import type { SettingsSchema } from './settings.js';
|
|
53
|
-
import { type ActionsV1, type AnnexV1, type AttendanceV1, type LayoutV1, type MessageV1, type SessionV1, type ViewerV1, type WidgetRequestKind, type WidgetEvent, type WidgetPayload, type WidgetProtocolVersion, type WidgetScopedSectionName, type WidgetSectionScope, type WidgetWriteGrant, type AppletGrant } from './widgets.js';
|
|
53
|
+
import { type ActionsV1, type AnnexV1, type AttendanceV1, type LayoutV1, type MessageV1, type SessionV1, type ViewerV1, type WidgetRequestKind, type WidgetEvent, type WidgetPayload, type WidgetProtocolVersion, type WidgetScopedSectionName, type WidgetSectionScope, type WidgetWriteGrant, type AppletGrant, type FrontEndMount } from './widgets.js';
|
|
54
54
|
/**
|
|
55
55
|
* Where a package's entry module lives, in the order the toolchain looks.
|
|
56
56
|
* One list, shared by `serene-pub build` and the preview harness, so "the
|
|
@@ -156,6 +156,16 @@ export type HostFrameMessage = {
|
|
|
156
156
|
assetsBase?: string;
|
|
157
157
|
/** 🚧 M0 (L1): whether the viewer has this session in full screen as the frame boots; later changes arrive as the `fullscreen` event. Absent from hosts that predate it. */
|
|
158
158
|
fullscreen?: boolean;
|
|
159
|
+
/** 🚧 m3-core: what this frame is mounted as — `applet` (the launcher, and an applet genre's session view), `widget` (a frame placed in a session), `page` (a plugin page). Absent from hosts that predate it. */
|
|
160
|
+
mount?: FrontEndMount;
|
|
161
|
+
/**
|
|
162
|
+
* 🚧 m3: whether a session is mounted around this frame — `true` on a session page (the
|
|
163
|
+
* `session` section follows), `false` for an applet's launcher (no session ever comes),
|
|
164
|
+
* absent from hosts that predate it and from mounts that are neither. The same `applet`
|
|
165
|
+
* mount serves both places, so this is how a frame tells the launcher from the game
|
|
166
|
+
* without waiting to see which section arrives first.
|
|
167
|
+
*/
|
|
168
|
+
inSession?: boolean;
|
|
159
169
|
} | {
|
|
160
170
|
t: 'session';
|
|
161
171
|
session: SessionV1;
|
package/dist/template.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { I18n, SlotDecl } from './descriptors.js';
|
|
12
12
|
import type { FieldDecl } from './settings.js';
|
|
13
|
+
import type { VariableLayoutOffer } from './variableLayouts.js';
|
|
13
14
|
/** @experimental */
|
|
14
15
|
export interface TemplateRef {
|
|
15
16
|
/** The root identifier, e.g. `message` in `{{ message.author.name }}`. */
|
|
@@ -99,6 +100,17 @@ export interface VarField {
|
|
|
99
100
|
* answer for a dropped key and a null one.
|
|
100
101
|
*/
|
|
101
102
|
optional?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* 🚧 Root only: the variable whose **variable layout** writes this key out
|
|
105
|
+
* (`core:var/characters@1`) — the key `rendersAt` maps to it. Only such a
|
|
106
|
+
* key may be named by the `layout` helper (Handlebars) or filter (Liquid),
|
|
107
|
+
* and its layouts are the ones that variable offers. Set by the host on the
|
|
108
|
+
* scope it checks against (`laidOutScope`); absent on plain data — a port's
|
|
109
|
+
* output, a prompt field, an annex key — which never has a layout.
|
|
110
|
+
* ⚠ Not the variable's own `scope` (what its layout reads), and ignored on
|
|
111
|
+
* a nested field.
|
|
112
|
+
*/
|
|
113
|
+
laidOutBy?: string;
|
|
102
114
|
}
|
|
103
115
|
/**
|
|
104
116
|
* What one root name in a template's scope is.
|
|
@@ -162,9 +174,13 @@ export interface TemplateFinding {
|
|
|
162
174
|
* - `unknown-name` — a root the scope does not have.
|
|
163
175
|
* - `unknown-path` — a field the declared type contradicts.
|
|
164
176
|
* - `unknown-helper` — a Handlebars helper nobody registered.
|
|
177
|
+
* - 🚧 `layout-argument` — a `layout` call that does not name a laid-out key
|
|
178
|
+
* and a quoted layout reference (`{{{layout characters "core/json@1"}}}`).
|
|
179
|
+
* - 🚧 `unknown-layout` — a layout reference that is malformed, or that the
|
|
180
|
+
* key's variable does not offer.
|
|
165
181
|
* @experimental
|
|
166
182
|
*/
|
|
167
|
-
export type TemplateFindingKind = 'syntax' | 'unknown-name' | 'unknown-path' | 'unknown-helper';
|
|
183
|
+
export type TemplateFindingKind = 'syntax' | 'unknown-name' | 'unknown-path' | 'unknown-helper' | 'layout-argument' | 'unknown-layout';
|
|
168
184
|
/**
|
|
169
185
|
* What a host's engines register, as names — the checker's input
|
|
170
186
|
* (`@serene-pub/sdk/template-check`). Declared here, on the barrel, so a
|
|
@@ -192,6 +208,15 @@ export interface TemplateCheckOptions {
|
|
|
192
208
|
* undeclared. Non-empty: name and path findings are warnings.
|
|
193
209
|
*/
|
|
194
210
|
untyped?: readonly string[];
|
|
211
|
+
/**
|
|
212
|
+
* 🚧 The layouts each laid-out variable offers, by variable id — what a
|
|
213
|
+
* `layout` call may name for a key whose root carries `laidOutBy`. A
|
|
214
|
+
* reference its variable does not offer is an error. Absent (no host in
|
|
215
|
+
* view, as in the packager): a reference can't be checked, and is a
|
|
216
|
+
* warning. ⚠ Not a preset's `variableLayouts` (the one layout a preset
|
|
217
|
+
* chooses per variable).
|
|
218
|
+
*/
|
|
219
|
+
variableLayoutOffers?: Readonly<Record<string, readonly VariableLayoutOffer[]>>;
|
|
195
220
|
}
|
|
196
221
|
/** @experimental */
|
|
197
222
|
export interface TemplateSourceCheck {
|
package/dist/templateCheck.d.ts
CHANGED
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
* - **unknown-path** — a field the declared type positively contradicts
|
|
21
21
|
* (`characters.nmae`, a field read straight off a list).
|
|
22
22
|
* - **unknown-helper** — a Handlebars helper nobody registered.
|
|
23
|
+
* - **layout-argument** — a `layout` call that does not name a variable in
|
|
24
|
+
* scope that a variable layout writes out, and a layout reference in quotes.
|
|
25
|
+
* - **unknown-layout** — a layout reference that is malformed, or that the
|
|
26
|
+
* variable does not offer (checked only when the host supplies offers).
|
|
23
27
|
*
|
|
24
28
|
* Conservative by construction: an `'any'` root, a record's author-chosen
|
|
25
29
|
* key, a dynamic lookup (`lookup`, `a[k]`) and a subexpression's result are
|
|
@@ -57,4 +61,24 @@ export declare function checkTemplateSource(engine: string, src: string, scope:
|
|
|
57
61
|
* @experimental
|
|
58
62
|
*/
|
|
59
63
|
export declare function checkTemplateSourceReport(engine: string, src: string, scope: TemplateScope, options?: TemplateCheckOptions): TemplateSourceCheck;
|
|
64
|
+
/** One `layout` call in a source, as the render pre-pass reads it. @experimental */
|
|
65
|
+
export interface VariableLayoutCall {
|
|
66
|
+
/** The variable's name as written: `characters`. */
|
|
67
|
+
key: string;
|
|
68
|
+
/** The layout reference as written, grammatical or not: `core/json@1`. */
|
|
69
|
+
reference: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Every `layout` call in `src`, in source order, duplicates kept, calls inside
|
|
73
|
+
* blocks included. A call is listed when its key is a simple root name and its
|
|
74
|
+
* reference a string literal — whether or not the reference is well-formed or
|
|
75
|
+
* offered, because the render pre-pass must see every call it will meet and
|
|
76
|
+
* the check is what refuses. A call written wrongly (a path for a key, a
|
|
77
|
+
* reference that is not a literal, the wrong number of arguments, a Liquid
|
|
78
|
+
* `layout` that is not the first filter) is not listed. Same parser and walk
|
|
79
|
+
* as {@link checkTemplateSource}. A source that does not parse, or an engine
|
|
80
|
+
* this checker does not read, lists nothing.
|
|
81
|
+
* @experimental
|
|
82
|
+
*/
|
|
83
|
+
export declare function variableLayoutCalls(engine: string, src: string, options?: TemplateCheckOptions): VariableLayoutCall[];
|
|
60
84
|
//# sourceMappingURL=templateCheck.d.ts.map
|