@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.
Files changed (79) hide show
  1. package/dist/annexFields.d.ts +14 -0
  2. package/dist/annexFields.js +7 -0
  3. package/dist/announce.d.ts +26 -13
  4. package/dist/announce.js +31 -0
  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 +23 -6
  10. package/dist/builder.js +57 -5
  11. package/dist/cadences.d.ts +11 -2
  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/declarations.js +4 -0
  19. package/dist/descriptors.d.ts +68 -3
  20. package/dist/descriptors.js +23 -0
  21. package/dist/document.d.ts +8 -0
  22. package/dist/document.js +44 -1
  23. package/dist/events.d.ts +35 -4
  24. package/dist/events.js +7 -3
  25. package/dist/executor.js +26 -5
  26. package/dist/extension.d.ts +17 -0
  27. package/dist/fit.d.ts +4 -1
  28. package/dist/fit.js +43 -1
  29. package/dist/functions.d.ts +7 -1
  30. package/dist/functions.js +3 -1
  31. package/dist/genres.d.ts +7 -0
  32. package/dist/genres.js +32 -1
  33. package/dist/hookGrants.js +10 -0
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.js +9 -0
  36. package/dist/layout.d.ts +18 -0
  37. package/dist/libraryDraft.d.ts +2 -0
  38. package/dist/libraryDraft.js +5 -1
  39. package/dist/lorebookFile.d.ts +8 -0
  40. package/dist/lorebookFile.js +21 -0
  41. package/dist/participants.d.ts +53 -8
  42. package/dist/participants.js +9 -5
  43. package/dist/pluginPermissions.js +1 -1
  44. package/dist/promptBlocks.d.ts +5 -1
  45. package/dist/promptBlocks.js +23 -8
  46. package/dist/registry.js +6 -3
  47. package/dist/sceneSettings.d.ts +4 -0
  48. package/dist/sceneSettings.js +7 -4
  49. package/dist/sessionDossier.d.ts +57 -0
  50. package/dist/sessionLayout.d.ts +296 -85
  51. package/dist/sessionLayout.js +397 -133
  52. package/dist/settings.d.ts +28 -1
  53. package/dist/settings.js +50 -2
  54. package/dist/shapes.d.ts +6 -1
  55. package/dist/shapes.js +6 -1
  56. package/dist/sheetLatitude.d.ts +148 -0
  57. package/dist/sheetLatitude.js +161 -0
  58. package/dist/storyTime.js +6 -4
  59. package/dist/surfaces.d.ts +11 -1
  60. package/dist/template.d.ts +26 -1
  61. package/dist/templateCheck.d.ts +24 -0
  62. package/dist/templateCheck.js +299 -7
  63. package/dist/templateFit.js +4 -0
  64. package/dist/templateIds.d.ts +6 -0
  65. package/dist/templateIds.js +9 -0
  66. package/dist/turnLock.d.ts +10 -1
  67. package/dist/turnLock.js +6 -1
  68. package/dist/turnOrder.d.ts +37 -4
  69. package/dist/turnOrder.js +49 -11
  70. package/dist/validate.d.ts +4 -2
  71. package/dist/validate.js +15 -11
  72. package/dist/variableLayouts.d.ts +141 -0
  73. package/dist/variableLayouts.js +183 -0
  74. package/dist/variables.d.ts +35 -7
  75. package/dist/variables.js +34 -1
  76. package/dist/widgetDecls.js +12 -0
  77. package/dist/widgets.d.ts +384 -41
  78. package/dist/widgets.js +23 -0
  79. package/package.json +1 -1
@@ -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.
package/dist/registry.js CHANGED
@@ -30,6 +30,7 @@
30
30
  * @ruling 13 Β§10c, 04 Β§2, F6
31
31
  */
32
32
  import { pluginRuleRef } from './pluginRuleRef.js';
33
+ import { removedNodeDefinitionSentence } from './descriptors.js';
33
34
  import { definitionPolicy, scriptPointsOf, } from './descriptors.js';
34
35
  import { isScriptKindId } from './scripts.js';
35
36
  import { settingsSlotFor } from './settingsSlot.js';
@@ -171,14 +172,16 @@ export function checkInstall(input) {
171
172
  // 2. A pin that resolves to nothing.
172
173
  if (!entry && !declared.has(pin)) {
173
174
  const known = latest.get(n.definitionId);
175
+ const removed = removedNodeDefinitionSentence(n.definitionId);
174
176
  findings.push({
175
177
  severity: 'error',
176
178
  code: 'E_UNKNOWN_TYPE',
177
179
  where: `${doc.id} Β· ${n.key}`,
178
180
  message: `pins ${pin}, which this pub does not have`,
179
- fix: known
180
- ? `this pub has ${n.definitionId}@${known}. Pins are frozen on purpose, so the plugin has to be rebuilt against this release rather than silently re-pinned here.`
181
- : `no version of ${n.definitionId} is registered. It comes from another plugin β€” install that one first, or the pipeline has a dependency its manifest does not declare.`,
181
+ fix: removed ??
182
+ (known
183
+ ? `this pub has ${n.definitionId}@${known}. Pins are frozen on purpose, so the plugin has to be rebuilt against this release rather than silently re-pinned here.`
184
+ : `no version of ${n.definitionId} is registered. It comes from another plugin β€” install that one first, or the pipeline has a dependency its manifest does not declare.`),
182
185
  });
183
186
  continue;
184
187
  }
@@ -124,6 +124,10 @@ export interface SceneSettingsDecl {
124
124
  summary?: SceneSummaryMode;
125
125
  /** 🚧 The genre's alone (`ScenePlaceDecl`): refused on a session's override. */
126
126
  place?: ScenePlaceDecl;
127
+ /** 🚧 The genre's alone (owner 2026-11-04, playtest item 2): a first scene opens at a new session's first story line β€” a cue under Suggested, a placement under Automatic, nothing under Manual. Absent = off (P1). */
128
+ first?: boolean;
129
+ /** 🚧 The genre's alone (owner 2026-11-04, playtest item 21): the open scene's cast follows its lines while it is open; the line names its cause; Scenes β€Ί Manual stops it. Absent = off (P1). */
130
+ castRefresh?: boolean;
127
131
  }
128
132
  /** Scene settings resolved: every key stated. `length` and `pause` are null when off. @experimental */
129
133
  export interface SceneSettings {
@@ -108,10 +108,13 @@ export function sceneSettingsFindings(raw, at = 'scenes', options = {}) {
108
108
  ];
109
109
  const out = [];
110
110
  for (const key of Object.keys(raw))
111
- if (key === 'place' && layer === 'session')
112
- out.push(`${at}.place: the place is the genre's to name (its shape.scenes.place) β€” a session cannot set it`);
113
- else if (key !== 'mode' && key !== 'triggers' && key !== 'summary' && key !== 'place')
114
- out.push(`${at}.${key}: not a scene setting β€” the keys are mode, triggers, summary${layer === 'genre' ? ' and place' : ''}`);
111
+ if ((key === 'place' || key === 'first' || key === 'castRefresh') && layer === 'session')
112
+ out.push(`${at}.${key}: the ${key === 'place' ? 'place' : key} is the genre's to name (its shape.scenes.${key}) β€” a session cannot set it`);
113
+ else if (key !== 'mode' && key !== 'triggers' && key !== 'summary' && key !== 'place' && key !== 'first' && key !== 'castRefresh')
114
+ out.push(`${at}.${key}: not a scene setting β€” the keys are mode, triggers, summary${layer === 'genre' ? ', place, first and castRefresh' : ''}`);
115
+ for (const key of ['first', 'castRefresh'])
116
+ if (raw[key] !== undefined && typeof raw[key] !== 'boolean')
117
+ out.push(`${at}.${key}: true or false β€” not ${JSON.stringify(raw[key])}`);
115
118
  if (raw.mode !== undefined && !SCENE_MODES.includes(raw.mode))
116
119
  out.push(`${at}.mode: one of ${SCENE_MODES.join(', ')} β€” not ${JSON.stringify(raw.mode)}`);
117
120
  if (raw.summary !== undefined && !SCENE_SUMMARY_MODES.includes(raw.summary))
@@ -31,6 +31,7 @@
31
31
  */
32
32
  import type { StoryCalendar, StoryTime } from './storyTime.js';
33
33
  import type { SceneSummaryMode } from './sceneSettings.js';
34
+ import type { ParticipantRef } from './participants.js';
34
35
  /** A participant as a line names them: display name, reference, face. @experimental */
35
36
  export interface ConversationSpeakerV1 {
36
37
  name: string;
@@ -146,6 +147,10 @@ export interface ConversationSceneV1 {
146
147
  * back to who spoke in its loaded lines (lane E).
147
148
  */
148
149
  cast?: ConversationSceneCastV1[];
150
+ /** 🚧 Why the scene began by itself, in its scene cue's words (`the day changed`); absent for a scene a person started. */
151
+ openedBecause?: string;
152
+ /** 🚧 While it is open and its genre keeps its cast up to date from its lines: what does it and how to stop it, as one sentence. Absent otherwise. */
153
+ castCause?: string;
149
154
  }
150
155
  /**
151
156
  * 🚧 One member of a scene's cast, as a scene divider draws it.
@@ -182,14 +187,24 @@ export interface ConversationSceneCueV1 {
182
187
  }
183
188
  /** The cast, as far as answering a form needs it (`canAnswerForm`). @experimental */
184
189
  export interface ConversationCastV1 {
190
+ /**
191
+ * Each row also carries 🚧 `ref` (the seat's participant reference, as the
192
+ * host fills it) and 🚧 `castMemberId` (the seat's cast member). Both
193
+ * host-filled, absent from a host that predates them.
194
+ */
185
195
  sessionPersonas: Array<{
186
196
  personaId: number | null;
187
197
  persona: {
188
198
  userId: number | null;
189
199
  } | null;
200
+ ref?: ParticipantRef;
201
+ castMemberId?: number | null;
190
202
  }>;
203
+ /** Each row also carries 🚧 `ref` and 🚧 `castMemberId`, as `sessionPersonas` rows do. */
191
204
  sessionCharacters: Array<{
192
205
  characterId: number | null;
206
+ ref?: ParticipantRef;
207
+ castMemberId?: number | null;
193
208
  }>;
194
209
  }
195
210
  /**
@@ -363,6 +378,14 @@ export interface SessionDossierV1 {
363
378
  * @ruling pr-6 R-a, R-b; pass 13
364
379
  */
365
380
  settledThrough?: number | null;
381
+ /**
382
+ * 🚧 The id of the newest loaded row the viewing user wrote; names only the viewer's own row.
383
+ * Null: the viewer has written none of the loaded rows. Absent: a host that predates it.
384
+ * A widget that holds its reader's place reads it to catch the reader up when they send
385
+ * (PLAN-visual-novel-layout Β§1.2). The Dialogue box jumps to it only when it is one of
386
+ * its own (main channel) rows.
387
+ */
388
+ ownNewestMessageId?: number | null;
366
389
  /**
367
390
  * The session's mode is not installed: the log is read-only.
368
391
  * @ruling 19 Β§6
@@ -391,6 +414,19 @@ export interface ConversationRewindV1 {
391
414
  back: string | null;
392
415
  /** Why Forward is refused now, or null when it may be pressed. */
393
416
  forward: string | null;
417
+ /** 🚧 What Back would take now (playtest item 6): the rows besides the person's line, and the names on them, each once. Absent: the host did not say, or the count went stale. */
418
+ backTakes?: {
419
+ count: number;
420
+ names: string[];
421
+ /** 🚧 The person lines the turn holds; present only at a table (2 or more). */
422
+ personLines?: number;
423
+ /** 🚧 The one message Back takes, present only when the genre takes one message per press: its author, whether it is the owner's own line, and how many lines are filed on it. */
424
+ newestMessage?: {
425
+ author: string | null;
426
+ yours: boolean;
427
+ filed: number;
428
+ };
429
+ };
394
430
  }
395
431
  /** One proposed change, described. @experimental */
396
432
  export interface ConversationProposalV1 {
@@ -490,6 +526,27 @@ export interface ConversationComposerV1 {
490
526
  playerLabel?: string;
491
527
  /** A guest with no persona: the composer offers to add one instead. */
492
528
  addPersona: boolean;
529
+ /**
530
+ * 🚧 The Messages copy this composer (or turn line) follows, resolved by the
531
+ * host (PLAN-session-layout-simplify D7): the nearest panel above in its
532
+ * zone whose open tab is a Messages copy, else the nearest in its zone, else
533
+ * the layout's first. Absent: the first writable channel. @experimental
534
+ */
535
+ target?: {
536
+ instance: string;
537
+ channel: string;
538
+ label: string;
539
+ lineWidth?: 'column' | 'full' | 'comfortable';
540
+ presentation?: 'rows' | 'folio';
541
+ };
542
+ /**
543
+ * 🚧 Set while the target's panel shows a non-Messages tab: the composer
544
+ * keeps writing to this channel and says *Writing to β€Ήlabelβ€Ί*. @experimental
545
+ */
546
+ writingTo?: {
547
+ channel: string;
548
+ label: string;
549
+ };
493
550
  /**
494
551
  * 🚧 A guest who plays, in a genre of player seats (one with a player
495
552
  * label: the Lair), with no seat yet: the story's composer offers a