@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
@@ -16,7 +16,8 @@
16
16
  * | `admin` | Any administrator acting in the session. |
17
17
  * | `participant` | Any member of the session — owner or guest. |
18
18
  * | `user:<id>` | One person, by user id. |
19
- * | `character:<id>` | One library character, by row id — a cast member, or a member's own persona. |
19
+ * | `character:<id>` | One library character, by row id — a cast member, or a member's own persona. ⏳ A seat by its card; removed in S5 of the seat-cast programme. |
20
+ * | `seated-member:<id>` | 🚧 One seated **cast member**, by cast member id (the host's `lorebook_bindings.id`) — the seat-cast programme's reference for a seat. |
20
21
  * | `player-seat:<id>` | 🚧 A player seat that voices **no card**, by seat id — a player character made up in the session. |
21
22
  * | `envoy:<slug>` | A speaker the genre (or a contributed action) brings with it — `envoy:mascot`, `envoy:chariot.dice-tray.master`. |
22
23
  * | `item` | The **per-message ownership rule**: whoever the message belongs to, decided at the venue, never resolvable ahead of a message. |
@@ -54,6 +55,7 @@
54
55
  * the venue says *where*; the resolver says *whether they are here*.
55
56
  * @ruling plans/29 R-15 *audience*, R-18 (3), R-21 (4) (ruled 2026-09-15), U5a (2026-09-16), R-18 (3), R-21 (4), ruled 2026-09-16, §6
56
57
  */
58
+ import type { StoryCalendar, StoryTime } from './storyTime.js';
57
59
  /**
58
60
  * The role-shaped references — no id, resolved against the session and the run.
59
61
  *
@@ -76,9 +78,14 @@ export type ParticipantRole = (typeof PARTICIPANT_ROLES)[number];
76
78
  * the id half is a string here and the host reads it at its seam. A
77
79
  * `player-seat:` id is the host's player seat row (`session_personas.id`). An envoy
78
80
  * slug is `[A-Za-z0-9]` followed by any of `[A-Za-z0-9._-]`.
81
+ *
82
+ * 🚧 `seated-member:<id>` is a seated **cast member**, by its cast member id
83
+ * (the host's `lorebook_bindings.id`) — the seat-cast programme's reference
84
+ * for a seat. ⏳ `character:<id>` (a seat by its card) is removed in S5 of the
85
+ * seat-cast programme.
79
86
  * @experimental
80
87
  */
81
- export type ParticipantRef = ParticipantRole | `user:${string}` | `character:${string}` | `player-seat:${string}` | `envoy:${string}`;
88
+ export type ParticipantRef = ParticipantRole | `user:${string}` | `character:${string}` | `seated-member:${string}` | `player-seat:${string}` | `envoy:${string}`;
82
89
  /** A reference taken apart. @experimental */
83
90
  export type ParsedParticipantRef = {
84
91
  kind: ParticipantRole;
@@ -88,6 +95,9 @@ export type ParsedParticipantRef = {
88
95
  } | {
89
96
  kind: 'character';
90
97
  id: string;
98
+ } | {
99
+ kind: 'seated-member';
100
+ id: string;
91
101
  } | {
92
102
  kind: 'player-seat';
93
103
  id: string;
@@ -146,8 +156,8 @@ export declare function audienceHolds(refs: ReadonlyArray<ParticipantRef>, portr
146
156
  }, item?: boolean): boolean;
147
157
  /**
148
158
  * Does the model's context hold any of these references? The prompt
149
- * built for `speaker` — a `character:` or `envoy:` reference, when there is
150
- * one — may carry what everyone may see (`participant`), what the model may
159
+ * built for `speaker` — a `character:`, `seated-member:` or `envoy:` reference,
160
+ * when there is one — may carry what everyone may see (`participant`), what the model may
151
161
  * (`ai`), and what that speaker may. `[]` holds for nobody.
152
162
  * @internal
153
163
  * @ruling R57
@@ -225,9 +235,12 @@ export declare function envoySlugOfRef(ref: unknown): string | null;
225
235
  * settings document (`SessionSettingsV1`, sessionSettings.ts) and the
226
236
  * `cast` in-port of `core:task/turn-pool@1`.
227
237
  *
228
- * Declared from the existing read and **adding no fields**: the character
238
+ * Declared from the existing read: the character
229
239
  * and persona rows go out raw with the seat's `position`, `removedAt` and
230
- * `enabled` riding along (the host retrieves, it does not choose), `envoys` is the
240
+ * `enabled` riding along (the host retrieves, it does not choose). 🚧 S3 of the
241
+ * seat-cast programme adds the host-filled identity (`ref`, `castMemberId`,
242
+ * `cardId`) on each seat row; a reader matches on it and never builds it.
243
+ * `envoys` is the
231
244
  * seated envoys `entities/envoys.ts seatedEnvoys` returns (each with `slug`,
232
245
  * `position`, `speaks`, `removedAt`), and the rest is what the prompt path
233
246
  * already reads. Every row is open: the host's character row has more
@@ -238,7 +251,12 @@ export declare function envoySlugOfRef(ref: unknown): string | null;
238
251
  * @experimental
239
252
  */
240
253
  export interface SessionCastV1 {
241
- /** Character seats: the library row under `character`, plus the seat's own columns. */
254
+ /**
255
+ * Character seats: the library row under `character`, plus the seat's own columns.
256
+ * `character` is card-shaped but has no `id` or `userId` for a card-less
257
+ * seat; read `ref` and `castMemberId`. `seatedByUserId` is the person who
258
+ * seated it and acts for it.
259
+ */
242
260
  sessionCharacters: Array<{
243
261
  character: {
244
262
  id: number;
@@ -260,6 +278,20 @@ export interface SessionCastV1 {
260
278
  removedAt: Date | string | null;
261
279
  /** Attached by the host from `lorebook_bindings`, not a cast column. */
262
280
  absorbedAliases: string[];
281
+ /**
282
+ * 🚧 The seat's participant reference, as the host fills it: from the flip
283
+ * a character seat is `seated-member:<castMemberId>` (⏳ `character:<cardId>`
284
+ * while it stores no member) and a player seat, carded or not,
285
+ * `player-seat:<seatId>`; before it the card form. A reader matches on it
286
+ * and never builds it.
287
+ */
288
+ ref?: ParticipantRef;
289
+ /** 🚧 The seat's cast member (the host's `lorebook_bindings.id`); null while the seat has none. */
290
+ castMemberId?: number | null;
291
+ /** 🚧 The member's active card on the timeline; null when card-less. */
292
+ cardId?: number | null;
293
+ /** 🚧 The person who seated this member and acts for it; null on a row from before it. */
294
+ seatedByUserId?: number | null;
263
295
  [k: string]: unknown;
264
296
  }>;
265
297
  /**
@@ -283,11 +315,23 @@ export interface SessionCastV1 {
283
315
  seatName: string | null;
284
316
  /** 🚧 Who sits in the seat; null on a row from before it (read the card's owner). */
285
317
  seatUserId: number | null;
286
- /** Always true — a persona seat has no switch — said so one filter serves both lists. */
318
+ /** 🚧 The seat is in play: false = benched (owner 2026-11-10). Every seat is here, benched or not; a reader that must not see a benched one — a turn pool, a names list — filters on this (the table's column is `is_active`). */
287
319
  enabled: boolean;
288
320
  position: number | null;
289
321
  removedAt: Date | string | null;
290
322
  absorbedAliases: string[];
323
+ /**
324
+ * 🚧 The seat's participant reference, as the host fills it: from the flip
325
+ * a character seat is `seated-member:<castMemberId>` (⏳ `character:<cardId>`
326
+ * while it stores no member) and a player seat, carded or not,
327
+ * `player-seat:<seatId>`; before it the card form. A reader matches on it
328
+ * and never builds it.
329
+ */
330
+ ref?: ParticipantRef;
331
+ /** 🚧 The seat's cast member (the host's `lorebook_bindings.id`); null while the seat has none. */
332
+ castMemberId?: number | null;
333
+ /** 🚧 The member's active card on the timeline; null when card-less. */
334
+ cardId?: number | null;
291
335
  [k: string]: unknown;
292
336
  }>;
293
337
  /** The seated envoys, live and departed, in seat order — each its declaration joined to the seat. */
@@ -307,6 +351,8 @@ export interface SessionCastV1 {
307
351
  isGroup: boolean;
308
352
  /** Whose turn this run is, from the scope; null when the trigger named nobody. */
309
353
  currentCharacterId: number | null;
354
+ /** 🚧 The member speaking a card-less seat's turn, from the scope; set only when `currentCharacterId` is null. */
355
+ currentCastMemberId?: number | null;
310
356
  /** The declared voice of the turn's channel, when the trigger named one and the genre shapes channels. */
311
357
  turnChannelVoice?: 'character' | 'narrator' | 'none';
312
358
  /**
@@ -316,6 +362,35 @@ export interface SessionCastV1 {
316
362
  * reads as `full`.
317
363
  */
318
364
  characterDetail?: 'full' | 'brief' | 'speaker-only';
365
+ /**
366
+ * 🚧 The session's story present and the lorebook's declared calendar.
367
+ * Always an object. On a lorebook that keeps no timeline, every value in it
368
+ * is `null`, whatever is stored; on one that keeps a timeline, `null` only
369
+ * where there is truly none.
370
+ *
371
+ * - `timeline`: the Timeline switch of the lorebook that governs the
372
+ * session (its attached lorebook's, else its own notes'); agrees with
373
+ * `SessionSettingsV1.timeline`.
374
+ * - `now`: the session's clock, else its line's clock, else its newest
375
+ * history entry (`from` says which).
376
+ * - `calendar`: the declared calendar, `null` for a free-form book.
377
+ * - `sessionStart`: the day of the session's first live stamped message;
378
+ * `null` when none.
379
+ * @experimental
380
+ */
381
+ storyTime: {
382
+ timeline: boolean;
383
+ now: (StoryTime & {
384
+ from: 'clock' | 'history' | 'session';
385
+ label?: string;
386
+ }) | null;
387
+ calendar: StoryCalendar | null;
388
+ sessionStart: {
389
+ year: number;
390
+ month: number;
391
+ day: number;
392
+ } | null;
393
+ };
319
394
  [k: string]: unknown;
320
395
  }
321
396
  //# sourceMappingURL=participants.d.ts.map
@@ -16,7 +16,8 @@
16
16
  * | `admin` | Any administrator acting in the session. |
17
17
  * | `participant` | Any member of the session — owner or guest. |
18
18
  * | `user:<id>` | One person, by user id. |
19
- * | `character:<id>` | One library character, by row id — a cast member, or a member's own persona. |
19
+ * | `character:<id>` | One library character, by row id — a cast member, or a member's own persona. ⏳ A seat by its card; removed in S5 of the seat-cast programme. |
20
+ * | `seated-member:<id>` | 🚧 One seated **cast member**, by cast member id (the host's `lorebook_bindings.id`) — the seat-cast programme's reference for a seat. |
20
21
  * | `player-seat:<id>` | 🚧 A player seat that voices **no card**, by seat id — a player character made up in the session. |
21
22
  * | `envoy:<slug>` | A speaker the genre (or a contributed action) brings with it — `envoy:mascot`, `envoy:chariot.dice-tray.master`. |
22
23
  * | `item` | The **per-message ownership rule**: whoever the message belongs to, decided at the venue, never resolvable ahead of a message. |
@@ -94,8 +95,8 @@ export function audienceHolds(refs, portrayals, viewer, item) {
94
95
  }
95
96
  /**
96
97
  * Does the model's context hold any of these references? The prompt
97
- * built for `speaker` — a `character:` or `envoy:` reference, when there is
98
- * one — may carry what everyone may see (`participant`), what the model may
98
+ * built for `speaker` — a `character:`, `seated-member:` or `envoy:` reference,
99
+ * when there is one — may carry what everyone may see (`participant`), what the model may
99
100
  * (`ai`), and what that speaker may. `[]` holds for nobody.
100
101
  * @internal
101
102
  * @ruling R57
@@ -179,12 +180,13 @@ export function parseParticipantRef(raw) {
179
180
  const cut = text.indexOf(':');
180
181
  if (cut === -1)
181
182
  throw new Error(`'${raw}' is not a participant reference — expected one of ${PARTICIPANT_ROLES.join(', ')}, ` +
182
- `or user:<id>, character:<id>, player-seat:<id>, envoy:<slug>`);
183
+ `or user:<id>, character:<id>, seated-member:<id>, player-seat:<id>, envoy:<slug>`);
183
184
  const kind = text.slice(0, cut);
184
185
  const rest = text.slice(cut + 1);
185
186
  switch (kind) {
186
187
  case 'user':
187
188
  case 'character':
189
+ case 'seated-member':
188
190
  case 'player-seat':
189
191
  if (!ID.test(rest))
190
192
  throw new Error(`'${raw}' names a ${kind} with no readable id — a ${kind} reference is '${kind}:<id>'`);
@@ -195,7 +197,7 @@ export function parseParticipantRef(raw) {
195
197
  `the slug a letter or digit followed by letters, digits, '.', '_' or '-'`);
196
198
  return { kind, slug: rest };
197
199
  default:
198
- throw new Error(`'${raw}' is not a participant reference — '${kind}:' is not a kind (user, character, player-seat, envoy)`);
200
+ throw new Error(`'${raw}' is not a participant reference — '${kind}:' is not a kind (user, character, seated-member, player-seat, envoy)`);
199
201
  }
200
202
  }
201
203
  /** The one spelling a parsed reference has. `parse(format(x))` is `x`. @internal */
@@ -205,6 +207,8 @@ export function formatParticipantRef(parsed) {
205
207
  return `user:${parsed.id}`;
206
208
  case 'character':
207
209
  return `character:${parsed.id}`;
210
+ case 'seated-member':
211
+ return `seated-member:${parsed.id}`;
208
212
  case 'player-seat':
209
213
  return `player-seat:${parsed.id}`;
210
214
  case 'envoy':
@@ -121,7 +121,7 @@ export function renderPluginPermissionsGuide() {
121
121
  const keys = hookCtxKeysFor(k);
122
122
  lines.push(
123
123
  // GitHub's slug of "Kind: oracle" is `kind-oracle`, the anchor.
124
- `## Kind: ${k}`, '', KIND_ROLE[k], '', `- Handed: ${code(keys).join(', ')}.`, `- ${keys.includes('storage') ? "Storage: your plugin's own files, when it asks for storage (`permissions.storage`)." : 'No storage.'}`, `- ${keys.includes('package') ? "Package files: read-only, the files your plugin ships under `assets: { dir }` (`ctx.package.read`)." : 'No package files.'}`, `- ${keys.includes('annex') ? "The person's saved data: `ctx.annex('user')`, when your plugin holds `applet:annex:user` and a person is acting for the call; otherwise its methods reject." : "No saved data (`ctx.annex`) — a task is pure."}`, `- ${keys.includes('fetch') ? 'Network: only the hosts your plugin declares (`permissions.network.hosts`) and an admin left allowed.' : 'No network.'}`, '');
124
+ `## Kind: ${k}`, '', KIND_ROLE[k], '', `- Handed: ${code(keys).join(', ')}.`, `- ${keys.includes('storage') ? "Storage: your plugin's own files, when it asks for storage (`permissions.storage`)." : 'No storage.'}`, `- ${keys.includes('package') ? "Package files: read-only, the files your plugin ships under `assets: { dir }` (`ctx.package.read`)." : 'No package files.'}`, `- ${keys.includes('annex') ? "The person's saved data: `ctx.annex('user')`, when your plugin holds `applet:annex:user` and your own applet is open (a person's request or press in its mounted frame caused the call); an event or lifecycle hook, the schedule tick and a routine run find it closed, and its methods reject." : "No saved data (`ctx.annex`) — a task is pure."}`, `- ${keys.includes('fetch') ? 'Network: only the hosts your plugin declares (`permissions.network.hosts`) and an admin left allowed.' : 'No network.'}`, '');
125
125
  }
126
126
  lines.push('## Permission groups', '', 'A package asks for permissions in three groups, and the admin reviews and grants each group on its own. ' +
127
127
  'A grant is always bounded by the person acting.', '', '- **In a session** (`permissions.session`, or a widget\'s `scopes`): what a frame may do in the session it is mounted in.', '- **Outside a session, its applet** (`permissions.applet`, `permissions.storage.perUser`): what the package\'s applet may do with the person\'s library. A widget declaration may never ask for these, and `applet.sessions.genres` may name only the package\'s own genres.', '- **On this pub** (`permissions.storage`, `network`, `media`): the sandbox\'s own reach.', '', '| Key | Group | What it grants | Declared as |', '|---|---|---|---|', ...PERMISSION_KEY_ROWS.map((r) => `| \`${r.key}\` | ${r.group} | ${r.grants} | ${r.declaredAs} |`), '');
@@ -60,10 +60,14 @@ export interface PromptBlockEntry {
60
60
  * the one system-block value that changes on its own. Do not tidy it: every
61
61
  * entry's position is a byte in every prompt on every install that has
62
62
  * changed nothing.
63
+ *
64
+ * 🚧 `earlierScenes` sits after `history` and before the relationships, for
65
+ * comprehension: the compiled history, then the later scenes' summaries, then
66
+ * the lines.
63
67
  * @internal
64
68
  * @ruling B2 (2026-10-03)
65
69
  */
66
- export declare const SHIPPED_PROMPT_BLOCK_IDS: readonly ['instructions', 'characters', 'personas', 'characterLore', 'scenario', 'worldLore', 'history', 'relationshipsPerspectives', 'relationshipsKnown', 'currentDate'];
70
+ export declare const SHIPPED_PROMPT_BLOCK_IDS: readonly ['instructions', 'characters', 'personas', 'characterLore', 'scenario', 'worldLore', 'history', 'earlierScenes', 'relationshipsPerspectives', 'relationshipsKnown', 'currentDate'];
67
71
  /** @experimental */
68
72
  export type ShippedPromptBlockId = (typeof SHIPPED_PROMPT_BLOCK_IDS)[number];
69
73
  /**
@@ -44,6 +44,10 @@
44
44
  * the one system-block value that changes on its own. Do not tidy it: every
45
45
  * entry's position is a byte in every prompt on every install that has
46
46
  * changed nothing.
47
+ *
48
+ * 🚧 `earlierScenes` sits after `history` and before the relationships, for
49
+ * comprehension: the compiled history, then the later scenes' summaries, then
50
+ * the lines.
47
51
  * @internal
48
52
  * @ruling B2 (2026-10-03)
49
53
  */
@@ -55,6 +59,7 @@ export const SHIPPED_PROMPT_BLOCK_IDS = [
55
59
  'scenario',
56
60
  'worldLore',
57
61
  'history',
62
+ 'earlierScenes',
58
63
  'relationshipsPerspectives',
59
64
  'relationshipsKnown',
60
65
  'currentDate',
@@ -69,6 +74,7 @@ const BLOCK_LABELS = {
69
74
  scenario: 'Scenario',
70
75
  worldLore: 'World lore',
71
76
  history: 'History',
77
+ earlierScenes: 'Earlier in the story',
72
78
  relationshipsPerspectives: 'Relationships — their view',
73
79
  relationshipsKnown: 'Relationships — how others see them',
74
80
  };
@@ -122,6 +128,15 @@ export const PROMPT_BLOCKS_DECL = {
122
128
  },
123
129
  },
124
130
  };
131
+ /**
132
+ * 🚧 The shipped ids as they were before `earlierScenes` was added. A stored
133
+ * list from before the block existed means "leave the template alone", so the
134
+ * shipped template renders the block in its place; a list a person reordered or
135
+ * switched a block off in is not "shipped" and does not get the block by itself
136
+ * (the docs say how to add it).
137
+ * @internal
138
+ */
139
+ const PREVIOUS_SHIPPED_PROMPT_BLOCK_IDS = SHIPPED_PROMPT_BLOCK_IDS.filter((id) => id !== 'earlierScenes');
125
140
  /**
126
141
  * Is this value the shipped pack, entry for entry?
127
142
  *
@@ -136,14 +151,14 @@ export const PROMPT_BLOCKS_DECL = {
136
151
  export function isShippedPromptBlocks(value) {
137
152
  if (!Array.isArray(value))
138
153
  return false;
139
- if (value.length !== SHIPPED_PROMPT_BLOCKS.length)
140
- return false;
141
- return value.every((entry, i) => {
142
- const e = entry;
143
- if (!e || typeof e !== 'object')
144
- return false;
145
- return e.id === SHIPPED_PROMPT_BLOCKS[i].id && e.enabled !== false;
146
- });
154
+ const matches = (ids) => value.length === ids.length &&
155
+ value.every((entry, i) => {
156
+ const e = entry;
157
+ if (!e || typeof e !== 'object')
158
+ return false;
159
+ return e.id === ids[i] && e.enabled !== false;
160
+ });
161
+ return matches(SHIPPED_PROMPT_BLOCK_IDS) || matches(PREVIOUS_SHIPPED_PROMPT_BLOCK_IDS);
147
162
  }
148
163
  /**
149
164
  * The pack, applied to what a template actually produces.
@@ -0,0 +1,92 @@
1
+ /**
2
+ * 🚧 The rules core enforces from a genre's own fields, by the name a genre uses to point at
3
+ * one. The names differ from the field keys deliberately: the proviso is the rule, the field is
4
+ * the genre's.
5
+ * @experimental
6
+ */
7
+ export declare const GENRE_PROVISOS: readonly ["turnKeeping", "sheetLatitude", "itemMoveLatitude", "toolKinds"];
8
+ /** @experimental */
9
+ export type GenreProviso = (typeof GENRE_PROVISOS)[number];
10
+ /**
11
+ * 🚧 The side a per-side proviso speaks for: the session owner or a player.
12
+ * @experimental
13
+ */
14
+ export type ProvisoSide = 'owner' | 'player';
15
+ /**
16
+ * 🚧 `SessionShape.provisos`: for each rule core enforces, the key of the genre's own field in
17
+ * `shape.fields` (or of a value the genre pins in `settings`) that carries it. A genre that
18
+ * names none of a rule has none of it.
19
+ * @experimental
20
+ */
21
+ export interface GenreProvisos {
22
+ /** A boolean field (or a pinned boolean): on = nobody deletes the latest turn (Keep every turn). */
23
+ turnKeeping?: string;
24
+ /** Per side role, an enum field over `SHEET_LATITUDES` (or a pinned level). */
25
+ sheetLatitude?: {
26
+ owner?: string;
27
+ player?: string;
28
+ };
29
+ /** Per side role, an enum field over `ITEM_MOVE_LATITUDES` (or a pinned level). */
30
+ itemMoveLatitude?: {
31
+ owner?: string;
32
+ player?: string;
33
+ };
34
+ /** A string[] field of tool kinds (or a pinned string[]). */
35
+ toolKinds?: string;
36
+ }
37
+ /**
38
+ * 🚧 The key of the genre's own field (or pinned setting) that carries a proviso, or `null` when
39
+ * the genre names none.
40
+ *
41
+ * A genre that declares `shape.provisos` is read from it alone: a proviso it does not name is
42
+ * `null`. ⏳ A genre with no `shape.provisos` (an undeclared or stored genre written before
43
+ * provisos) answers the core spelling — `keepEveryTurn`, `ownerSheetLatitude` /
44
+ * `playerSheetLatitude`, `ownerItemMoves` / `playerItemMoves`, `tools` — whether or not it holds
45
+ * that key: the value is then whatever the session's cascade carries under it (its fields, its
46
+ * settings, a preset's pin), absent when nothing does. `sheetLatitude` and `itemMoveLatitude`
47
+ * need a `side`; without one the answer is `null`. Pure, never throws.
48
+ * @experimental
49
+ */
50
+ export declare function provisoFieldOf(genre: {
51
+ shape?: unknown;
52
+ settings?: unknown;
53
+ } | null | undefined, proviso: GenreProviso, side?: ProvisoSide): string | null;
54
+ /**
55
+ * 🚧 A `provisos` declaration's faults, refused at the declaration: not an object, a name that
56
+ * is no proviso, a side that is not owner or player, a value that is not the key of one of the
57
+ * genre's fields or settings, a field of the wrong kind or offering a level outside the
58
+ * levels, a pinned setting of the wrong value. Throws one error, one sentence a fault, each
59
+ * prefixed with `who`. `settings` is the genre's `settings`.
60
+ * @experimental
61
+ */
62
+ export declare function assertProvisos(shape: unknown, settings: unknown, who: string): void;
63
+ /**
64
+ * 🚧 What a genre leaves unsaid about the rules core enforces: for each proviso (and side) whose
65
+ * core spelling is a key of the genre's `shape.fields` or `settings`, a warning when `provisos`
66
+ * is absent (core reads the spelling for now) or when `provisos` is present and does not name
67
+ * that key (core does not enforce the rule from that field). Never a refusal: a genre expects,
68
+ * it never locks. Pure, never throws.
69
+ * @experimental
70
+ */
71
+ export declare function provisoWarnings(decl: {
72
+ readonly id: string;
73
+ readonly shape?: unknown;
74
+ readonly settings?: unknown;
75
+ }): string[];
76
+ /**
77
+ * 🚧 A preset's pins a genre does not read: for each setting the preset pins whose key is
78
+ * spelled like a core proviso key (`keepEveryTurn`, the sheet and item-move latitude keys,
79
+ * `tools`) while its genre declares `provisos` and names no such field, a warning — the value
80
+ * is not read. A genre with no `provisos` reads the spelling, so says nothing; an unknown genre
81
+ * (`null`) says nothing. Never a refusal. Pure, never throws.
82
+ * @experimental
83
+ */
84
+ export declare function presetProvisoWarnings(preset: {
85
+ readonly slug: string;
86
+ readonly genre: string;
87
+ readonly settings?: unknown;
88
+ }, genre: {
89
+ readonly shape?: unknown;
90
+ readonly settings?: unknown;
91
+ } | null | undefined): string[];
92
+ //# sourceMappingURL=provisos.d.ts.map