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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/annexFields.d.ts +14 -0
  2. package/dist/annexFields.js +7 -0
  3. package/dist/announce.d.ts +62 -16
  4. package/dist/announce.js +90 -4
  5. package/dist/appletCard.d.ts +17 -0
  6. package/dist/appletCard.js +60 -0
  7. package/dist/attributes.d.ts +3 -3
  8. package/dist/attributes.js +1 -1
  9. package/dist/builder.d.ts +28 -13
  10. package/dist/builder.js +57 -5
  11. package/dist/cadences.d.ts +8 -1
  12. package/dist/cadences.js +27 -2
  13. package/dist/characterProfile.d.ts +137 -0
  14. package/dist/characterProfile.js +24 -0
  15. package/dist/component.d.ts +1 -1
  16. package/dist/componentImports.d.ts +1 -1
  17. package/dist/componentImports.js +2 -0
  18. package/dist/componentWire.js +28 -0
  19. package/dist/conditions.d.ts +5 -1
  20. package/dist/conditions.js +7 -0
  21. package/dist/declarations.d.ts +63 -1
  22. package/dist/declarations.js +176 -7
  23. package/dist/descriptors.d.ts +145 -6
  24. package/dist/descriptors.js +106 -5
  25. package/dist/document.d.ts +9 -1
  26. package/dist/document.js +44 -1
  27. package/dist/events.d.ts +82 -8
  28. package/dist/events.js +42 -5
  29. package/dist/executor.d.ts +27 -0
  30. package/dist/executor.js +32 -8
  31. package/dist/exposure.d.ts +35 -1
  32. package/dist/exposure.js +64 -2
  33. package/dist/extension.d.ts +30 -2
  34. package/dist/extension.js +3 -1
  35. package/dist/fit.d.ts +4 -1
  36. package/dist/fit.js +43 -1
  37. package/dist/functions.d.ts +7 -1
  38. package/dist/functions.js +3 -1
  39. package/dist/genres.d.ts +67 -2
  40. package/dist/genres.js +160 -8
  41. package/dist/hookGrants.js +10 -0
  42. package/dist/hostElements.d.ts +3 -3
  43. package/dist/hostElements.js +12 -4
  44. package/dist/index.d.ts +5 -0
  45. package/dist/index.js +10 -0
  46. package/dist/layout.d.ts +18 -0
  47. package/dist/libraryDraft.d.ts +2 -0
  48. package/dist/libraryDraft.js +5 -1
  49. package/dist/lorebookFile.d.ts +8 -0
  50. package/dist/lorebookFile.js +21 -0
  51. package/dist/participants.d.ts +83 -8
  52. package/dist/participants.js +9 -5
  53. package/dist/pluginPermissions.js +1 -1
  54. package/dist/promptBlocks.d.ts +5 -1
  55. package/dist/promptBlocks.js +23 -8
  56. package/dist/provisos.d.ts +92 -0
  57. package/dist/provisos.js +273 -0
  58. package/dist/receiverRules.js +1 -1
  59. package/dist/registrations.d.ts +154 -14
  60. package/dist/registrations.js +293 -23
  61. package/dist/registry.js +6 -3
  62. package/dist/repertoires.d.ts +13 -1
  63. package/dist/repertoires.js +5 -1
  64. package/dist/rulesetDocument.d.ts +11 -0
  65. package/dist/rulesetDocument.js +17 -0
  66. package/dist/rulesetSections.d.ts +12 -0
  67. package/dist/rulesetSections.js +8 -0
  68. package/dist/rulesets.js +6 -0
  69. package/dist/sceneSettings.d.ts +7 -1
  70. package/dist/sceneSettings.js +10 -5
  71. package/dist/sessionDossier.d.ts +159 -2
  72. package/dist/sessionLayout.d.ts +296 -85
  73. package/dist/sessionLayout.js +397 -133
  74. package/dist/sessionSettings.d.ts +18 -0
  75. package/dist/settings.d.ts +28 -1
  76. package/dist/settings.js +50 -2
  77. package/dist/shapes.d.ts +15 -1
  78. package/dist/shapes.js +15 -1
  79. package/dist/sheetLatitude.d.ts +148 -0
  80. package/dist/sheetLatitude.js +161 -0
  81. package/dist/speech.d.ts +14 -3
  82. package/dist/storyTime.d.ts +77 -1
  83. package/dist/storyTime.js +117 -8
  84. package/dist/surfaces.d.ts +49 -2
  85. package/dist/surfaces.js +3 -0
  86. package/dist/template.d.ts +38 -1
  87. package/dist/templateCheck.d.ts +24 -0
  88. package/dist/templateCheck.js +465 -10
  89. package/dist/templateFit.js +8 -1
  90. package/dist/templateIds.d.ts +6 -0
  91. package/dist/templateIds.js +9 -0
  92. package/dist/turnLock.d.ts +10 -1
  93. package/dist/turnLock.js +6 -1
  94. package/dist/turnOrder.d.ts +37 -4
  95. package/dist/turnOrder.js +49 -11
  96. package/dist/validate.d.ts +4 -2
  97. package/dist/validate.js +84 -11
  98. package/dist/variableLayouts.d.ts +160 -0
  99. package/dist/variableLayouts.js +202 -0
  100. package/dist/variables.d.ts +237 -20
  101. package/dist/variables.js +292 -33
  102. package/dist/widgetDecls.js +12 -0
  103. package/dist/widgets.d.ts +449 -47
  104. package/dist/widgets.js +31 -0
  105. package/host-elements.d.ts +4 -2
  106. package/package.json +1 -1
@@ -54,6 +54,24 @@ export interface SessionSettingsV1 {
54
54
  playerLabel?: string;
55
55
  scenario: string | null;
56
56
  lorebookId: number | null;
57
+ /**
58
+ * 🚧 Whether the lorebook that governs this session keeps a **timeline**
59
+ * (its Timeline switch): the attached lorebook's, else the session's own
60
+ * notes'. Resolved once per run, like the rest of the document.
61
+ *
62
+ * It holds for the session's life (a session keeps the lorebook it
63
+ * started with) except when that lorebook's owner flips the switch; the
64
+ * next run reads the new value.
65
+ *
66
+ * `false`: the session's story time does not move and a pipeline writes
67
+ * nothing dated to the lorebook (each outlet refuses or writes undated, as
68
+ * its contract says).
69
+ * `true`: the lorebook keeps time — but the story's present (and so
70
+ * `core:var/current-date@1`) may still be absent: a lorebook line with no
71
+ * story clock and no dated history entry has none, and a session on it
72
+ * writes its optionally dated rows undated.
73
+ */
74
+ timeline: boolean;
57
75
  tags: string[];
58
76
  channels: string[];
59
77
  /** What core:query/session-cast@1 publishes, envoys included. Not candidates: nothing here has been pooled. */
@@ -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; and the
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; and the
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
@@ -331,6 +331,15 @@ export declare const S: {
331
331
  * @ruling §4.1
332
332
  */
333
333
  readonly turnOrderChanged: string;
334
+ /**
335
+ * 🚧 A **turn order asked**: the payload of
336
+ * `core:event/turn-order-asked@1` — `{ sessionId, at, asked, cause }`
337
+ * (`TurnOrderAskedPayload`, events.ts). `asked` is the id of the event
338
+ * that raised the ask, `cause` that event's cause. Its own id for the
339
+ * reason `session-change@1` has.
340
+ * @ruling programme 2.3, TC2 (owner 2026-11-18)
341
+ */
342
+ readonly turnOrderAsked: string;
334
343
  /**
335
344
  * The session's **turn order** as state: `TurnOrderV1` —
336
345
  * `{ v, order, candidates, basedOnAt, computedAt, runId, event,
@@ -359,7 +368,12 @@ export declare const S: {
359
368
  readonly turnEntries: string;
360
369
  /**
361
370
  * **Sprite choices**: what a line's speaker can show
362
- * — `{ characterId, set, defaultSet, labels, last, recent, decidedBy }`.
371
+ * — `{ castMemberId, characterId, set, defaultSet, labels, last, recent, decidedBy }`.
372
+ * 🚧 `castMemberId` (the speaker's cast member) is the identity; the card
373
+ * the art comes from **cascades**: the member's own sprite sets per its
374
+ * configuration, else the card active on the timeline (the dated card at
375
+ * the reading). ⏳ `characterId` (removed in S5) is that card, null when
376
+ * the member's own sets draw.
363
377
  * `set` is the sprite set in force for the line (a session override, the
364
378
  * cast member's amendment, or the card's default — `decidedBy` says
365
379
  * which); `labels` are that set's sprite labels with an image; `last` is
package/dist/shapes.js CHANGED
@@ -367,6 +367,15 @@ export const S = {
367
367
  * @ruling §4.1
368
368
  */
369
369
  turnOrderChanged: defineShape({ id: 'core:shape/turn-order-changed@1' }),
370
+ /**
371
+ * 🚧 A **turn order asked**: the payload of
372
+ * `core:event/turn-order-asked@1` — `{ sessionId, at, asked, cause }`
373
+ * (`TurnOrderAskedPayload`, events.ts). `asked` is the id of the event
374
+ * that raised the ask, `cause` that event's cause. Its own id for the
375
+ * reason `session-change@1` has.
376
+ * @ruling programme 2.3, TC2 (owner 2026-11-18)
377
+ */
378
+ turnOrderAsked: defineShape({ id: 'core:shape/turn-order-asked@1' }),
370
379
  /**
371
380
  * The session's **turn order** as state: `TurnOrderV1` —
372
381
  * `{ v, order, candidates, basedOnAt, computedAt, runId, event,
@@ -395,7 +404,12 @@ export const S = {
395
404
  turnEntries: defineShape({ id: 'core:shape/turn-entries@1' }),
396
405
  /**
397
406
  * **Sprite choices**: what a line's speaker can show
398
- * — `{ characterId, set, defaultSet, labels, last, recent, decidedBy }`.
407
+ * — `{ castMemberId, characterId, set, defaultSet, labels, last, recent, decidedBy }`.
408
+ * 🚧 `castMemberId` (the speaker's cast member) is the identity; the card
409
+ * the art comes from **cascades**: the member's own sprite sets per its
410
+ * configuration, else the card active on the timeline (the dated card at
411
+ * the reading). ⏳ `characterId` (removed in S5) is that card, null when
412
+ * the member's own sets draw.
399
413
  * `set` is the sprite set in force for the line (a session override, the
400
414
  * cast member's amendment, or the card's default — `decidedBy` says
401
415
  * 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/speech.d.ts CHANGED
@@ -111,16 +111,21 @@ export type AsteriskReading = (typeof ASTERISK_READINGS)[number];
111
111
  * @experimental
112
112
  */
113
113
  export declare const DEFAULT_QUOTE_STYLES: readonly string[];
114
- /** 🚧 One cue's place in the spoken audio. `cue` indexes the `Cue[]` spoken. @experimental */
114
+ /** 🚧 One cue's place in the spoken audio (one file of the line). `cue` indexes the `Cue[]` spoken. @experimental */
115
115
  export interface CueSpan {
116
116
  readonly cue: number;
117
117
  readonly startMs: number;
118
118
  readonly endMs: number;
119
119
  /** The cue's words, kept so the spoken line can caption the cue that is playing (additive; older records lack it). */
120
120
  readonly text?: string;
121
+ /**
122
+ * 🚧 Which entry of `SpokenMeta.assetIds` the span is in; `startMs`/`endMs` are inside that file.
123
+ * Absent: the first.
124
+ */
125
+ readonly assetIndex?: number;
121
126
  }
122
127
  /**
123
- * 🚧 **The cue map** — where each cue sits in the audio, for highlighting as it
128
+ * 🚧 **The cue map** — where each cue sits in the line's audio files, for highlighting as it
124
129
  * plays. `concatenated`: the host joined per-group audio and knows the group
125
130
  * edges; `service`: the service returned timings; `none`: nothing is known
126
131
  * (`spans` empty).
@@ -158,7 +163,7 @@ export interface SpokenAs {
158
163
  }
159
164
  /**
160
165
  * 🚧 **Spoken metadata** — the record a spoken line keeps per swipe beside its
161
- * audio part (seam S6: `metadata.spoken`). What `core:oracle/speak@1` publishes
166
+ * audio parts (seam S6: `metadata.spoken`). What `core:oracle/speak@1` publishes
162
167
  * on `meta` and `core:outlet/attach-audio@1` records.
163
168
  * @experimental
164
169
  */
@@ -171,6 +176,12 @@ export interface SpokenMeta {
171
176
  readonly template: string | null;
172
177
  /** ISO 8601, when it was spoken. */
173
178
  readonly at: string;
179
+ /**
180
+ * 🚧 The line's spoken files in play order — `files.id`, as each `core:audio` part's `data.assetId`.
181
+ * Written by `attach-audio@1` at commit. Absent (a record written before the list existed): the newest
182
+ * `core:audio` part is the line's audio. A person's voice note is never in it.
183
+ */
184
+ readonly assetIds?: readonly number[];
174
185
  }
175
186
  /**
176
187
  * 🚧 The Jinja filters a speech template may use. Their bodies are the host's