@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
@@ -0,0 +1,137 @@
1
+ /**
2
+ * 🚧 The **character profile** (plan §32 §2, §33.1; owner ruling 2026-11-05
3
+ * late, _"Character profile?"_): the one shape a character version holds,
4
+ * card and cast alike. A card version holds a whole profile; a cast version
5
+ * holds its own values and names in `follows` the fields it reads from its
6
+ * parent card version.
7
+ *
8
+ * Always qualified (R3): a bare _profile_ stays the export, docs,
9
+ * image-generation and evidence profiles.
10
+ *
11
+ * Owner: "Reconcile what we have for character cards. API should start with
12
+ * the same shape, can update both with what's best. We should also make sure
13
+ * we merge together any fields where there's an arbitrary duplicate like
14
+ * greeting and additional greetings." — so the opener, the alternate
15
+ * greetings and the group-only greetings are ONE list (`greetings`), and the
16
+ * creator notes and their translations are one field (`creatorNotes`).
17
+ *
18
+ * Mirrors the app's `shared/characters/profile.ts` field for field — an edit
19
+ * to one is an edit to both. Types and the field list only: the host fills
20
+ * them; nothing here reads or writes a character.
21
+ */
22
+ import type { Stroke } from './strokes.js';
23
+ /**
24
+ * 🚧 One greeting. `groupOnly` marks one a group session uses.
25
+ * @experimental
26
+ */
27
+ export interface CharacterGreeting {
28
+ text: string;
29
+ groupOnly?: boolean;
30
+ }
31
+ /**
32
+ * 🚧 The creator's notes: the main text, its language when known, and other languages' texts.
33
+ * @experimental
34
+ */
35
+ export interface CharacterCreatorNotes {
36
+ text: string;
37
+ /** ISO 639-1 code of `text`, when known. */
38
+ lang?: string;
39
+ /** Other languages' notes by ISO 639-1 code; never one identical to `text`. */
40
+ variants: Record<string, string>;
41
+ }
42
+ /**
43
+ * 🚧 The character profile. Nullable fields hold no value; lists are never null.
44
+ * @experimental
45
+ */
46
+ export interface CharacterProfileV1 {
47
+ name: string | null;
48
+ nickname: string | null;
49
+ aliases: string[];
50
+ /** A separate optional one-liner; readers fall back to the description's first sentence (§33.1). */
51
+ summary: string | null;
52
+ description: string | null;
53
+ personality: string | null;
54
+ scenario: string | null;
55
+ /** Merged: the opener first, then the alternates (empty ones kept: today's swipes), the group-only ones marked. */
56
+ greetings: CharacterGreeting[];
57
+ exampleDialogues: string[];
58
+ postHistoryInstructions: string | null;
59
+ creatorNotes: CharacterCreatorNotes | null;
60
+ strokes: Stroke[];
61
+ /** The face (a card's avatar, a member's face): a `files` row. */
62
+ faceMediaId: number | null;
63
+ /** The likeness for image generation; every part optional. */
64
+ likeness: {
65
+ /** The likeness image's `files` row; absent means "use the avatar". */
66
+ imageMediaId?: number;
67
+ /** The likeness prompt — a tag line of the character's look. */
68
+ prompt?: string;
69
+ /** The likeness negative — what to keep out of the picture. */
70
+ negative?: string;
71
+ } | null;
72
+ /** How the character sounds when its lines are spoken; every part optional. */
73
+ timbre: {
74
+ /** "a warm low alto, slight Irish lilt, unhurried" — portable prose. */
75
+ description?: string;
76
+ /** A voicebank entry's slug on THIS pub. Dropped on card export. */
77
+ voice?: string;
78
+ /** The voicebank slug that reads the prose AROUND this character's lines. Pub-local; dropped on card export. */
79
+ narrationVoice?: string;
80
+ /** ISO 639-1 code the character speaks (`en`, `ja`). */
81
+ language?: string;
82
+ settings?: {
83
+ /** Speaking rate multiplier, 1 = the voice's own pace. */
84
+ speed?: number;
85
+ /** 0–1, ElevenLabs-style. */
86
+ stability?: number;
87
+ /** 0–1, ElevenLabs-style. */
88
+ similarity?: number;
89
+ /** 0–1, ElevenLabs-style. */
90
+ style?: number;
91
+ /** The voice seed: on a voice-designing model it picks which person the description becomes. */
92
+ seed?: number;
93
+ /** ElevenLabs-style speaker boost: on emphasises the original speaker. */
94
+ speakerBoost?: boolean;
95
+ };
96
+ /** `true`: this character's lines are never spoken. Absent is spoken. */
97
+ silent?: boolean;
98
+ } | null;
99
+ /** A sprite set's name; null = the default set. */
100
+ spriteSet: string | null;
101
+ /** The card's remaining extension keys (likeness and timbre lifted out). */
102
+ extensions: Record<string, unknown>;
103
+ }
104
+ /**
105
+ * 🚧 Every character profile field, in display order. A cast version's `follows` holds only these.
106
+ * @experimental
107
+ */
108
+ export declare const CHARACTER_PROFILE_FIELDS: readonly ["name", "nickname", "aliases", "summary", "description", "personality", "scenario", "greetings", "exampleDialogues", "postHistoryInstructions", "creatorNotes", "strokes", "faceMediaId", "likeness", "timbre", "spriteSet", "extensions"];
109
+ /**
110
+ * 🚧 One character profile field name.
111
+ * @experimental
112
+ */
113
+ export type CharacterProfileField = (typeof CHARACTER_PROFILE_FIELDS)[number];
114
+ /**
115
+ * 🚧 One cast member as a session reads them (`core:query/cast-member@1`'s `main`).
116
+ * @experimental
117
+ */
118
+ export interface CastMemberV1 {
119
+ /** The member (the host's `lorebook_bindings.id`). */
120
+ castMemberId: number;
121
+ /** The card the member is drawn with on this reading (its version in force's parent card); null when card-less. */
122
+ cardId: number | null;
123
+ /** That parent card version; null when card-less. */
124
+ cardVersion: {
125
+ id: number;
126
+ number: number;
127
+ label: string | null;
128
+ } | null;
129
+ cardless: boolean;
130
+ /** The parent card version is below the card's current (highest) version: the card has moved on since. */
131
+ behindCard: boolean;
132
+ /** The profile fields read from the parent card version; [] when card-less. */
133
+ follows: CharacterProfileField[];
134
+ /** The profile as the session reads it, followed fields already filled from the card. */
135
+ profile: CharacterProfileV1;
136
+ }
137
+ //# sourceMappingURL=characterProfile.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 🚧 Every character profile field, in display order. A cast version's `follows` holds only these.
3
+ * @experimental
4
+ */
5
+ export const CHARACTER_PROFILE_FIELDS = [
6
+ 'name',
7
+ 'nickname',
8
+ 'aliases',
9
+ 'summary',
10
+ 'description',
11
+ 'personality',
12
+ 'scenario',
13
+ 'greetings',
14
+ 'exampleDialogues',
15
+ 'postHistoryInstructions',
16
+ 'creatorNotes',
17
+ 'strokes',
18
+ 'faceMediaId',
19
+ 'likeness',
20
+ 'timbre',
21
+ 'spriteSet',
22
+ 'extensions',
23
+ ];
24
+ //# sourceMappingURL=characterProfile.js.map
@@ -39,7 +39,7 @@ export type { RequestDeclined } from './componentWire.js';
39
39
  export type { RequestDeclineCode } from './surfaces.js';
40
40
  export type { HostKeyEventDetail } from './hostElements.js';
41
41
  export type { StatusText, WidgetActionReason } from './status.js';
42
- export type { AttendanceV1, AttendeeV1, AuthorsNoteV1, AuthorsNoteValueV1, HistoryEntriesV1, HistoryEntryV1, HistorySceneV1, FoldedSectionPartDataV1, FoldedSectionV1, LayoutV1, MessageErrorConnectionV1, MessageErrorV1, MessageMetadataV1, MessagePartV1, MessageSwipesV1, MessageV1, PlaceLinkV1, PlaceV1, RoutineLogEntryV1, RoutineLogV1, SessionCharactersV1, SessionEntryV1, SessionPersonaV1, SessionPlacesV1, SessionStateV1, StatTrailChangeV1, StoryClockV1, WayV1, ViewerV1, WidgetAction, WidgetEvent, WidgetEventKind, WidgetRequestKind, WidgetRequests, } from './widgets.js';
42
+ export type { AttendanceV1, AttendeeV1, AuthorsNoteV1, AuthorsNoteValueV1, HistoryEntriesV1, HistoryEntryV1, HistorySceneV1, FoldedSectionPartDataV1, FoldedSectionV1, LayoutV1, MessageErrorConnectionV1, MessageErrorV1, MessageMetadataV1, MessagePartV1, MessageSwipesV1, MessageV1, PlaceLinkV1, PlaceV1, RoutineLogEntryV1, RoutineLogV1, SessionCharactersV1, SessionEntryV1, SessionPersonaV1, SessionPlacesV1, SessionRunStepV1, SessionRunStepsV1, SessionRunV1, SessionRunsV1, SessionStateV1, StatTrailChangeV1, StoryClockV1, WayV1, ViewerV1, WidgetAction, WidgetEvent, WidgetEventKind, WidgetRequestKind, WidgetRequests, } from './widgets.js';
43
43
  /**
44
44
  * 🚧 A story time and what a story clock steps by (Chronicle).
45
45
  * @ruling W3
@@ -34,7 +34,7 @@
34
34
  * @experimental
35
35
  * @ruling C6 P1, owner ruling 2026-09-25 Q4
36
36
  */
37
- export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note', '@serene-pub/core-catalog/turn-order', '@serene-pub/core-catalog/actions', '@serene-pub/core-catalog/annex', '@serene-pub/core-catalog/album', '@serene-pub/core-catalog/chronicle', '@serene-pub/core-catalog/places', '@serene-pub/core-catalog/attendance', '@serene-pub/core-catalog/backdrop'];
37
+ export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note', '@serene-pub/core-catalog/turn-order', '@serene-pub/core-catalog/actions', '@serene-pub/core-catalog/annex', '@serene-pub/core-catalog/album', '@serene-pub/core-catalog/chronicle', '@serene-pub/core-catalog/places', '@serene-pub/core-catalog/attendance', '@serene-pub/core-catalog/backdrop', '@serene-pub/core-catalog/session-runs'];
38
38
  /**
39
39
  * Specifiers no component may import, however it is built — the renderer is
40
40
  * the host's, and so is the worker runtime that installs it.
@@ -65,6 +65,8 @@ export const COMPONENT_IMPORTS = [
65
65
  '@serene-pub/core-catalog/attendance',
66
66
  // 🚧 2026-10-12 (DESIGN-image-generation §6.4): the backdrop widget's plain half — appended.
67
67
  '@serene-pub/core-catalog/backdrop',
68
+ // 🚧 2026-11-06 (lay-R): the Runs widget's plain half — appended.
69
+ '@serene-pub/core-catalog/session-runs',
68
70
  ];
69
71
  /**
70
72
  * Specifiers no component may import, however it is built — the renderer is
@@ -21,6 +21,7 @@
21
21
  * @ruling D-1
22
22
  */
23
23
  import { coreWidgetIds, widgetReadsFindings } from './widgetDecls.js';
24
+ import { presetVariableLayoutFindings } from './announce.js';
24
25
  import { COMPONENT_FRAMEWORKS } from './extension.js';
25
26
  import { CONVERSATION_WIDGET_ID, TURN_ORDER_CHANGED_IS_INTERNAL, sessionEvents } from './genres.js';
26
27
  import { drawnWidgetIds, validateSessionLayout, widgetOfInstance } from './sessionLayout.js';
@@ -418,6 +419,9 @@ export function presetFindings(presets, declaredGenres, declaredSpecs, configs,
418
419
  const coverage = [];
419
420
  for (const p of presets) {
420
421
  errors.push(...labelFindings(`preset '${p.slug}'`, p));
422
+ // The preset's variable layouts: the same rule `preset()` throws, for a
423
+ // manifest written by hand.
424
+ errors.push(...presetVariableLayoutFindings(p));
421
425
  const g = declaredGenres.get(p.genre);
422
426
  if (!g)
423
427
  requires.add(p.genre);
@@ -695,6 +695,14 @@ export type SessionCreationMode = (typeof SESSION_CREATION_MODES)[number];
695
695
  * @ruling 19 §1
696
696
  */
697
697
  export interface SessionShape {
698
+ /**
699
+ * 🚧 Forms (owner 2026-11-04, playtest item 21): `modelAnswers` — the AI answers a form put to a
700
+ * participant it portrays. Absent = off in core (P1): the form waits for a person, and a routed
701
+ * answer spec gets a halted receipt saying the genre does not opt in.
702
+ */
703
+ forms?: {
704
+ modelAnswers?: boolean;
705
+ };
698
706
  /**
699
707
  * The character system: toggles, ordering, pickers, cast rows.
700
708
  *
@@ -735,6 +743,41 @@ export interface SessionShape {
735
743
  * (`lorebookShapeFindings`, `lorebook-required-retired`).
736
744
  */
737
745
  lorebook?: 'optional' | 'required';
746
+ /**
747
+ * 🚧 **Cast from lorebook** — at session create, the lorebook attached to
748
+ * the new session seats the book's own people, card or not, as the
749
+ * session's characters (character seats), in the book's order (never
750
+ * someone drawn with a persona card; for a provided book, all of its
751
+ * people). `field` names a declared
752
+ * `boolean` field of this shape that switches it per session; absent =
753
+ * always for this genre. At create only — never on a later attach or
754
+ * update. Off unless a genre declares it (P1); the person still sees who
755
+ * is in it on the start form's confirm.
756
+ *
757
+ * Not `characters: { min }` (a bound on how many the person picks), not a
758
+ * cast binding (the book's member ↔ card link), and not the start form's
759
+ * character picker. Needs `lorebook` and a `characters` capability that
760
+ * allows seats, or `genre()` refuses it.
761
+ *
762
+ * ⚠ With `characters: { min: N > 0 }` the start form's shape check runs
763
+ * before seating and counts only the person's own picks, so a person who
764
+ * picks nobody is refused even when the book would fill the seats
765
+ * (★m3b-D-2; owner 2026-11-05: left as is). Declare `min: 0` when the
766
+ * book is meant to fill the seats.
767
+ * @experimental
768
+ */
769
+ castFromLorebook?: {
770
+ field?: string;
771
+ };
772
+ /**
773
+ * 🚧 **Seat changes on each turn** (owner 2026-11-09, "Yes, a read genres opt into"): `true`
774
+ * puts `turnSeatChanges` (`TurnSeatChange[]`) on `turn-ended` and on a routine's `cause` — the
775
+ * seats added, removed or changed since the previous turn of that lane. Absent = off in core
776
+ * (P1): the payload carries nothing. A pass over them is an ordinary registration, e.g.
777
+ * `register(afterEachTurn(), pass, { allowStacking: true })`.
778
+ * @experimental
779
+ */
780
+ turnSeatChanges?: boolean;
738
781
  /** What the send surface is. `none` for purely trigger-driven modes. */
739
782
  composer?: 'text' | 'none';
740
783
  /** Whose name the seed line carries (16's seedName rule, declared). */
@@ -859,9 +902,17 @@ export interface SessionShape {
859
902
  lore?: boolean;
860
903
  /** May a session of this genre open scenes? */
861
904
  scenes?: boolean;
905
+ /**
906
+ * 🚧 May this genre's pipelines bench a seat or bring one back
907
+ * (`core:outlet/set-seat-bench@1`)? **Absent = off**, unlike `lore` and
908
+ * `scenes`: seat status is something a genre asks to manage. A person's
909
+ * own bench and drag are never gated by it.
910
+ * @experimental
911
+ */
912
+ seats?: boolean;
862
913
  /**
863
914
  * The library writes a genre opts into — making or changing characters,
864
- * making lorebooks and reading them into sessions. **Absent = all off**
915
+ * making lorebooks. **Absent = all off**
865
916
  * (unlike `lore` and `scenes`): a library write is something a genre
866
917
  * asks for. Declaring it only lets the genre's pipelines try: the
867
918
  * person's rights and their library write mode (Full, Review, Off)
@@ -870,9 +921,12 @@ export interface SessionShape {
870
921
  library?: {
871
922
  /** May a pipeline of this genre make or change characters? */
872
923
  characters?: boolean;
873
- /** May a pipeline of this genre make lorebooks, or read one into the session? */
924
+ /** May a pipeline of this genre make lorebooks? */
874
925
  lorebooks?: boolean;
875
- /** May a pipeline of this genre read a lorebook into a session other than its own? */
926
+ /**
927
+ * ⏳ Read by nothing since `attach-lorebook@1` was removed in 0.6;
928
+ * it stays declared because it is a published name.
929
+ */
876
930
  sessions?: boolean;
877
931
  };
878
932
  };
@@ -1826,6 +1880,17 @@ export declare function eventsLockFindings(inlet: Pick<Descriptor, 'id' | 'paylo
1826
1880
  * @ruling R-20
1827
1881
  */
1828
1882
  export declare function widgetDeclsFindings(raw: unknown, where: string): string[];
1883
+ /**
1884
+ * 🚧 Node definitions that were published and are now removed, by id without
1885
+ * the `@N` pin, each with the sentence a stored pipeline naming one fails with.
1886
+ * @internal
1887
+ */
1888
+ export declare const REMOVED_NODE_DEFINITIONS: Readonly<Record<string, string>>;
1889
+ /**
1890
+ * 🚧 The sentence for a removed node definition (id with or without `@N`), or null when it is not removed.
1891
+ * @internal
1892
+ */
1893
+ export declare function removedNodeDefinitionSentence(definitionId: string): string | null;
1829
1894
  /** @experimental */
1830
1895
  export declare function getDefinition(id: string): Descriptor | undefined;
1831
1896
  /** @experimental */
@@ -365,6 +365,10 @@ export function assertSessionWrites(shape, who) {
365
365
  `Each library write is a boolean or absent — absent means off, and only an ` +
366
366
  `explicit true allows the write.`);
367
367
  }
368
+ if (writes.seats !== undefined && typeof writes.seats !== 'boolean')
369
+ throw new Error(`${who} declares writes.seats ${JSON.stringify(writes.seats)}. ` +
370
+ `It is a boolean or absent — absent means off, and only an explicit true ` +
371
+ `allows a pipeline to bench a seat or bring one back.`);
368
372
  const bad = SESSION_WRITES.filter((w) => writes[w] !== undefined && typeof writes[w] !== 'boolean');
369
373
  if (!bad.length)
370
374
  return;
@@ -1310,6 +1314,25 @@ export function widgetDeclsFindings(raw, where) {
1310
1314
  });
1311
1315
  return out;
1312
1316
  }
1317
+ /**
1318
+ * 🚧 Node definitions that were published and are now removed, by id without
1319
+ * the `@N` pin, each with the sentence a stored pipeline naming one fails with.
1320
+ * @internal
1321
+ */
1322
+ export const REMOVED_NODE_DEFINITIONS = {
1323
+ 'core:outlet/attach-lorebook': "Reading a lorebook into a session was removed in 0.6: a session keeps the lorebook it started with. Write into the session's lorebook instead, or start a new session with that lorebook.",
1324
+ };
1325
+ /**
1326
+ * 🚧 The sentence for a removed node definition (id with or without `@N`), or null when it is not removed.
1327
+ * @internal
1328
+ */
1329
+ export function removedNodeDefinitionSentence(definitionId) {
1330
+ const at = definitionId.indexOf('@');
1331
+ const bare = at < 0 ? definitionId : definitionId.slice(0, at);
1332
+ return Object.prototype.hasOwnProperty.call(REMOVED_NODE_DEFINITIONS, bare)
1333
+ ? REMOVED_NODE_DEFINITIONS[bare]
1334
+ : null;
1335
+ }
1313
1336
  /** @experimental */
1314
1337
  export function getDefinition(id) {
1315
1338
  return types.get(id);
@@ -210,6 +210,14 @@ export type CompiledSpec<A extends string = string> = SpecDocument & {
210
210
  * @ruling F25, 15 §1.3
211
211
  */
212
212
  export declare function resolveDownstreamOracle(built: BuiltSpec, fromKey: string): string;
213
+ /**
214
+ * 🚧 The param values a document declares for one node: the node's own `config.params`, with
215
+ * every **default** preset's `params` row for it laid over them, in order. What the packager's
216
+ * `W_WRITES_HISTORY` and conformance C39 read a lore write's `entryType` from — one copy for
217
+ * both. Pure.
218
+ * @experimental
219
+ */
220
+ export declare function declaredNodeParams(doc: Pick<SpecDocument, 'nodes' | 'presets'>, nodeKey: string): Record<string, unknown>;
213
221
  /**
214
222
  * Canonical form — stable key order, for hashing and round-trip identity.
215
223
  *
package/dist/document.js CHANGED
@@ -87,6 +87,30 @@ function withActionHandles(doc) {
87
87
  });
88
88
  return doc;
89
89
  }
90
+ /**
91
+ * A clause's chains: the member-holding ones in position order (the position
92
+ * of each chain's first member, node or nested clause), then the member-less
93
+ * ones sorted by name (code-unit order). The app's store rebuilds chains from
94
+ * the members that sit in them and from the stored `branches` keys, and jsonb
95
+ * does not keep key order while a document's hash keeps array order, so the
96
+ * compiler writes the order the store can rebuild. The app's store `chainsOf`
97
+ * follows the same rule.
98
+ */
99
+ function orderedChains(clause, nodes, clauses) {
100
+ const first = new Map();
101
+ for (const m of [...nodes, ...clauses]) {
102
+ if (m.clauseId !== clause.id || m.clauseChain === undefined)
103
+ continue;
104
+ const at = first.get(m.clauseChain);
105
+ if (at === undefined || m.position < at)
106
+ first.set(m.clauseChain, m.position);
107
+ }
108
+ const held = clause.chains
109
+ .filter((c) => first.has(c))
110
+ .sort((a, b) => first.get(a) - first.get(b));
111
+ const empty = clause.chains.filter((c) => !first.has(c)).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
112
+ return [...held, ...empty];
113
+ }
90
114
  function compileBuilt(built) {
91
115
  const nodes = built.nodes.map((n) => ({
92
116
  key: n.key,
@@ -236,7 +260,7 @@ function compileBuilt(built) {
236
260
  presets: built.presets,
237
261
  nodes,
238
262
  edges,
239
- clauses: built.clauses,
263
+ clauses: built.clauses.map((c) => ({ ...c, chains: orderedChains(c, built.nodes, built.clauses) })),
240
264
  };
241
265
  }
242
266
  /**
@@ -261,6 +285,25 @@ export function resolveDownstreamOracle(built, fromKey) {
261
285
  }
262
286
  return spineOracles[0].key;
263
287
  }
288
+ /**
289
+ * 🚧 The param values a document declares for one node: the node's own `config.params`, with
290
+ * every **default** preset's `params` row for it laid over them, in order. What the packager's
291
+ * `W_WRITES_HISTORY` and conformance C39 read a lore write's `entryType` from — one copy for
292
+ * both. Pure.
293
+ * @experimental
294
+ */
295
+ export function declaredNodeParams(doc, nodeKey) {
296
+ const out = {};
297
+ const own = doc.nodes.find((n) => n.key === nodeKey)?.config?.params;
298
+ if (own && typeof own === 'object')
299
+ Object.assign(out, own);
300
+ for (const p of doc.presets ?? [])
301
+ if (p.default)
302
+ for (const v of p.values)
303
+ if (v.nodeKey === nodeKey && v.slot === 'params' && v.value && typeof v.value === 'object')
304
+ Object.assign(out, v.value);
305
+ return out;
306
+ }
264
307
  /**
265
308
  * Canonical form — stable key order, for hashing and round-trip identity.
266
309
  *
package/dist/events.d.ts CHANGED
@@ -356,7 +356,9 @@ export declare const CORE_EVENTS: {
356
356
  * `core:outlet/attach-sprite@1` (the Sprite set fill). About a CARD, not a session: no session row is written, and the
357
357
  * payload names the character, the sprite set, each sprite label with the
358
358
  * sprite row it gained (`attached: [{ label, spriteId }]`) and the labels
359
- * that came back with no picture (`missing`).
359
+ * that came back with no picture (`missing`). The payload also carries
360
+ * 🚧 `castMemberId` — set when the pictures went to a cast member, and
361
+ * then `characterId` is null.
360
362
  * @ruling DESIGN-image-generation §6.3
361
363
  */
362
364
  readonly spritesAttached: EventDef;
@@ -366,6 +368,8 @@ export declare const CORE_EVENTS: {
366
368
  * About a CARD, not a session: no session row is written, and the payload
367
369
  * names the character and each picture placed (`offered: [{ mediaId,
368
370
  * key }]`). Nothing was chosen: the avatar and likeness are untouched.
371
+ * The payload also carries 🚧 `castMemberId` — set when the pictures went
372
+ * to a cast member, and then `characterId` is null.
369
373
  * @ruling DESIGN-image-generation §6.2
370
374
  */
371
375
  readonly mediaOffered: EventDef;
@@ -721,7 +725,9 @@ export declare const coreEvents: {
721
725
  * `core:outlet/attach-sprite@1` (the Sprite set fill). About a CARD, not a session: no session row is written, and the
722
726
  * payload names the character, the sprite set, each sprite label with the
723
727
  * sprite row it gained (`attached: [{ label, spriteId }]`) and the labels
724
- * that came back with no picture (`missing`).
728
+ * that came back with no picture (`missing`). The payload also carries
729
+ * 🚧 `castMemberId` — set when the pictures went to a cast member, and
730
+ * then `characterId` is null.
725
731
  * @ruling DESIGN-image-generation §6.3
726
732
  */
727
733
  readonly spritesAttached: EventDef;
@@ -731,6 +737,8 @@ export declare const coreEvents: {
731
737
  * About a CARD, not a session: no session row is written, and the payload
732
738
  * names the character and each picture placed (`offered: [{ mediaId,
733
739
  * key }]`). Nothing was chosen: the avatar and likeness are untouched.
740
+ * The payload also carries 🚧 `castMemberId` — set when the pictures went
741
+ * to a cast member, and then `characterId` is null.
734
742
  * @ruling DESIGN-image-generation §6.2
735
743
  */
736
744
  readonly mediaOffered: EventDef;
@@ -1091,6 +1099,8 @@ export interface SessionChangePayload {
1091
1099
  turnsBy?: Record<string, number>;
1092
1100
  /** 🚧 `round-ended`: who spoke in the round, in order of first turn — `narrator` for the pipeline's own voice (R52). */
1093
1101
  speakers?: string[];
1102
+ /** 🚧 `turn-ended`, when the genre declares `shape.turnSeatChanges: true`: the seats added, removed or changed since the previous turn of this lane; empty when none. */
1103
+ turnSeatChanges?: TurnSeatChange[];
1094
1104
  /** 🚧 `scene-opened` · `scene-closed`: the scene. */
1095
1105
  sceneId?: number;
1096
1106
  /** 🚧 `story-clock-moved`: where the story clock stood and where it stands now (`StoryTime`). */
@@ -1108,10 +1118,31 @@ export interface SessionChangePayload {
1108
1118
  /** 🚧 `history-settled`: where the line stood before (`messageId` is where it stands now); null when unset. */
1109
1119
  previousSettledMessageId?: number | null;
1110
1120
  }
1121
+ /**
1122
+ * 🚧 One seat that changed since the previous turn of its lane, as `turn-ended` carries it in
1123
+ * `turnSeatChanges` when the session's genre declares `shape.turnSeatChanges: true` (owner 2026-11-09).
1124
+ * The host builds it from the seat writer's announcements (`member-added`, `member-removed`,
1125
+ * `cast-changed`), netted per seat: a seat that joined and left inside the turn is absent.
1126
+ * ⚠ Not `CastChangePayload` (one event as it happened), and not the host's own `SeatChange`
1127
+ * (what one seat-writer call did).
1128
+ * @experimental
1129
+ */
1130
+ export interface TurnSeatChange {
1131
+ /** The seat as a participant reference in member form (`seated-member:<id>`, `player-seat:<id>`): pass it on, never parse it. */
1132
+ ref: string;
1133
+ /** Which kind of seat it is: a character seat or a player seat. */
1134
+ seatKind: 'character' | 'player';
1135
+ /** The cast member in the seat; null when the seat names none. */
1136
+ castMemberId: number | null;
1137
+ /** `added`: the seat joined; `removed`: it left; `changed`: it stayed but was switched on or off, or who portrays it moved (a reorder is not a change). */
1138
+ change: 'added' | 'removed' | 'changed';
1139
+ }
1111
1140
  /**
1112
1141
  * The payload of `core:event/cast-changed@1` (`core:shape/cast-change@1`):
1113
1142
  * one seated participant's row moved. `ref` is the participant reference
1114
- * (`character:<id>` · `persona:<id>` · `envoy:<slug>`); `change` says which
1143
+ * of the seat: ⏳ `character:<id>` (a seat by its card, until the flip),
1144
+ * 🚧 `seated-member:<id>` (by its cast member), `player-seat:<id>` or
1145
+ * `envoy:<slug>`; `change` says which
1115
1146
  * column, open so a host may name one this release does not. `'enabled'` is
1116
1147
  * the seat switched on or off (`value` is the new boolean; renamed from
1117
1148
  * `'active'` 2026-09-28).
@@ -1128,7 +1159,7 @@ export interface CastChangePayload {
1128
1159
  at: number;
1129
1160
  cause?: EventCause;
1130
1161
  lineage?: RunLineage;
1131
- /** character:<id> | persona:<id> | envoy:<slug> */
1162
+ /** The seat's participant reference: ⏳ character:<id> | 🚧 seated-member:<id> | player-seat:<id> | envoy:<slug> */
1132
1163
  ref: string;
1133
1164
  change: 'enabled' | 'position' | 'portrayal' | 'added' | 'removed' | (string & {});
1134
1165
  value?: unknown;
package/dist/events.js CHANGED
@@ -549,7 +549,9 @@ export const CORE_EVENTS = {
549
549
  * `core:outlet/attach-sprite@1` (the Sprite set fill). About a CARD, not a session: no session row is written, and the
550
550
  * payload names the character, the sprite set, each sprite label with the
551
551
  * sprite row it gained (`attached: [{ label, spriteId }]`) and the labels
552
- * that came back with no picture (`missing`).
552
+ * that came back with no picture (`missing`). The payload also carries
553
+ * 🚧 `castMemberId` — set when the pictures went to a cast member, and
554
+ * then `characterId` is null.
553
555
  * @ruling DESIGN-image-generation §6.3
554
556
  */
555
557
  spritesAttached: defineEvent({
@@ -561,7 +563,7 @@ export const CORE_EVENTS = {
561
563
  affectsUser: true,
562
564
  causedBy: ['core:outlet/attach-sprite'],
563
565
  payload: S.json,
564
- description: "Pictures were filed as a card's sprites. The payload carries the character, the sprite set, each sprite label with the sprite it gained, and the labels that came back empty.",
566
+ description: "Pictures were filed as a card's sprites. The payload carries the character, the sprite set, each sprite label with the sprite it gained, and the labels that came back empty. When the pictures went to a cast member, `castMemberId` names it and `characterId` is null.",
565
567
  }),
566
568
  /**
567
569
  * 🚧 Pictures were offered to a card's **gallery** by
@@ -569,6 +571,8 @@ export const CORE_EVENTS = {
569
571
  * About a CARD, not a session: no session row is written, and the payload
570
572
  * names the character and each picture placed (`offered: [{ mediaId,
571
573
  * key }]`). Nothing was chosen: the avatar and likeness are untouched.
574
+ * The payload also carries 🚧 `castMemberId` — set when the pictures went
575
+ * to a cast member, and then `characterId` is null.
572
576
  * @ruling DESIGN-image-generation §6.2
573
577
  */
574
578
  mediaOffered: defineEvent({
@@ -580,7 +584,7 @@ export const CORE_EVENTS = {
580
584
  affectsUser: true,
581
585
  causedBy: ['core:outlet/offer-media'],
582
586
  payload: S.json,
583
- description: "Pictures were added to a card's gallery to choose from. The payload carries the character and each picture placed, with the series key it was drawn for.",
587
+ description: "Pictures were added to a card's gallery to choose from. The payload carries the character and each picture placed, with the series key it was drawn for. When the pictures went to a cast member, `castMemberId` names it and `characterId` is null.",
584
588
  }),
585
589
  /**
586
590
  * Not a write's event: the marker the `sessionChanges` list ends with when
package/dist/executor.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * but never waiting, consumption budgets, per-kind injection, and core-emitted events.
7
7
  */
8
8
  import { JUNCTION_CLAUSE_PORTS, envoyConfigKeysOf } from './document.js';
9
- import { AMBIENT_SCRIPT_EXTRAS, getDefinition, opensLiveRow, seamsOf } from './descriptors.js';
9
+ import { AMBIENT_SCRIPT_EXTRAS, getDefinition, opensLiveRow, removedNodeDefinitionSentence, seamsOf } from './descriptors.js';
10
10
  import { packageEventById } from './events.js';
11
11
  import { collectDataRefs, isSlotRef } from './refs.js';
12
12
  import { resolveConfigSources, slotConnectionId, slotConnectionModelId, SLOT_VALUE, } from './config.js';
@@ -674,8 +674,12 @@ export async function run(doc, opts) {
674
674
  };
675
675
  const invokeInner = async (node, scope, blockMode, iteration, iterationCount) => {
676
676
  const d = getDefinition(`${node.definitionId}@${node.definitionVersion}`);
677
- if (!d)
678
- return err(`unknown type ${node.definitionId}@${node.definitionVersion}`);
677
+ if (!d) {
678
+ const removed = removedNodeDefinitionSentence(node.definitionId);
679
+ return err(removed
680
+ ? `${node.key}: ${removed}`
681
+ : `unknown type ${node.definitionId}@${node.definitionVersion}`);
682
+ }
679
683
  // Declared, not bound (plans/29 R-2). `validate()` refuses the document;
680
684
  // this is the same refusal for a document that reached the executor by
681
685
  // another door — a stored version older than the flag — so it halts on
@@ -1093,8 +1097,25 @@ export async function run(doc, opts) {
1093
1097
  throw new Error(`'${point}' is not a script point '${nr.definitionId}' declares. ` +
1094
1098
  `Declared: ${declared.map((sp) => sp.at).join(', ')}. ` +
1095
1099
  `Points are part of the hashed contract — declare it on the descriptor.`);
1096
- // No try/catch: an applier throw reaches the binding that asked.
1097
- const outcome = await applyAtSeam(known, value, 'binding');
1100
+ // An applier throw is absorbed and recorded, as at a port seam (18 S2;
1101
+ // the `ScriptChainApplier` contract); only a halt reaches the binding.
1102
+ let outcome;
1103
+ try {
1104
+ outcome = await applyAtSeam(known, value, 'binding');
1105
+ }
1106
+ catch (e) {
1107
+ ;
1108
+ (nr.scripts ??= []).push({
1109
+ scriptId: -1,
1110
+ name: '(engine)',
1111
+ scriptKind: '',
1112
+ phase: 'before',
1113
+ appliedBy: 'binding',
1114
+ result: 'err',
1115
+ reason: e.message,
1116
+ });
1117
+ return value;
1118
+ }
1098
1119
  if (outcome.halt) {
1099
1120
  interiorHalt ??= outcome.halt.reason;
1100
1121
  throw new ScriptSeamHalt(outcome.halt.reason);
@@ -556,6 +556,23 @@ export interface ExtensionDecl {
556
556
  provides?: {
557
557
  lorebooks?: readonly string[];
558
558
  };
559
+ /**
560
+ * 🚧 The applet card the Apps view, Home and the launcher show for this package (M2d).
561
+ * `poster` is the picture, shown 16:9 and cropped (1280×720 recommended; no aspect
562
+ * check); `logo` an optional small square mark over the poster's lower-left; `blurb`
563
+ * one short descriptive line, at most 160 characters. `poster` and `logo` are
564
+ * package-relative paths under the declared `assets.dir` (as `provides.lorebooks`),
565
+ * served at `/plugin-assets/<id>/<version>/<path>`. `serene-pub check` refuses a path
566
+ * outside `assets.dir` (`E_APPLET_CARD_OUTSIDE_ASSETS`), a missing file
567
+ * (`E_APPLET_CARD_MISSING`), a blurb over 160 characters (`E_APPLET_CARD_BLURB_LONG`)
568
+ * and a card on a package with no applet genre (`E_APPLET_CARD_WITHOUT_APPLET`).
569
+ * @experimental (M2d)
570
+ */
571
+ appletCard?: {
572
+ poster?: string;
573
+ logo?: string;
574
+ blurb?: I18n;
575
+ };
559
576
  /**
560
577
  * 🚧 Rulesets shipped in the package, as ruleset documents (M0,
561
578
  * SHAPES L4 Declaration): install and upgrade publish each as a `rulesets`