@serene-pub/sdk 0.6.0-pr-2 → 0.6.0-pr-5

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 (186) hide show
  1. package/README.md +24 -20
  2. package/dist/actions.d.ts +150 -68
  3. package/dist/actions.js +90 -36
  4. package/dist/annexFields.d.ts +8 -4
  5. package/dist/annexFields.js +5 -2
  6. package/dist/announce.d.ts +78 -28
  7. package/dist/announce.js +14 -5
  8. package/dist/attributes.d.ts +9 -6
  9. package/dist/attributes.js +9 -5
  10. package/dist/bands.d.ts +41 -6
  11. package/dist/bands.js +83 -33
  12. package/dist/builder.d.ts +161 -58
  13. package/dist/builder.js +128 -22
  14. package/dist/candidates.d.ts +5 -3
  15. package/dist/candidates.js +3 -2
  16. package/dist/clauses.d.ts +2 -1
  17. package/dist/clauses.js +2 -1
  18. package/dist/component.d.ts +24 -7
  19. package/dist/component.js +16 -6
  20. package/dist/componentBuild.d.ts +16 -5
  21. package/dist/componentBuild.js +14 -5
  22. package/dist/componentClient.d.ts +61 -30
  23. package/dist/componentClient.js +11 -1
  24. package/dist/componentImports.d.ts +8 -5
  25. package/dist/componentImports.js +23 -4
  26. package/dist/componentModule.js +2 -1
  27. package/dist/componentWire.d.ts +2 -1
  28. package/dist/componentWire.js +34 -2
  29. package/dist/config.d.ts +28 -14
  30. package/dist/config.js +20 -10
  31. package/dist/connections.d.ts +9 -4
  32. package/dist/connections.js +7 -4
  33. package/dist/declarations.d.ts +46 -17
  34. package/dist/declarations.js +46 -15
  35. package/dist/descriptors.d.ts +242 -97
  36. package/dist/descriptors.js +145 -41
  37. package/dist/dev.d.ts +6 -5
  38. package/dist/dev.js +6 -5
  39. package/dist/document.d.ts +74 -25
  40. package/dist/document.js +32 -11
  41. package/dist/dowry.d.ts +241 -0
  42. package/dist/dowry.js +315 -0
  43. package/dist/engines.d.ts +16 -7
  44. package/dist/engines.js +6 -4
  45. package/dist/eventMapLaws.d.ts +19 -8
  46. package/dist/eventMapLaws.js +9 -6
  47. package/dist/events.d.ts +101 -39
  48. package/dist/events.js +106 -33
  49. package/dist/executor.d.ts +122 -41
  50. package/dist/executor.js +195 -96
  51. package/dist/extension.d.ts +99 -35
  52. package/dist/extension.js +43 -9
  53. package/dist/facets.d.ts +2 -1
  54. package/dist/facets.js +4 -2
  55. package/dist/foldedSections.d.ts +4 -2
  56. package/dist/foldedSections.js +2 -1
  57. package/dist/genres.d.ts +123 -41
  58. package/dist/genres.js +127 -22
  59. package/dist/guardedConnection.d.ts +4 -3
  60. package/dist/guardedConnection.js +4 -3
  61. package/dist/handlebarsReach.d.ts +1 -1
  62. package/dist/handlebarsReach.js +1 -1
  63. package/dist/hash.d.ts +16 -5
  64. package/dist/hash.js +14 -4
  65. package/dist/hookGrants.d.ts +3 -2
  66. package/dist/hookGrants.js +6 -4
  67. package/dist/hooks.d.ts +21 -16
  68. package/dist/hooks.js +12 -10
  69. package/dist/hostElements.d.ts +41 -17
  70. package/dist/hostElements.js +49 -17
  71. package/dist/i18n.d.ts +5 -3
  72. package/dist/i18n.js +5 -3
  73. package/dist/identity.d.ts +5 -4
  74. package/dist/identity.js +5 -4
  75. package/dist/index.d.ts +5 -0
  76. package/dist/index.js +15 -0
  77. package/dist/layout.d.ts +36 -15
  78. package/dist/layout.js +2 -2
  79. package/dist/loadouts.d.ts +97 -0
  80. package/dist/loadouts.js +81 -0
  81. package/dist/media.d.ts +26 -4
  82. package/dist/media.js +2 -1
  83. package/dist/messageBlocks.d.ts +44 -32
  84. package/dist/messageBlocks.js +23 -18
  85. package/dist/migration.d.ts +16 -8
  86. package/dist/migration.js +14 -8
  87. package/dist/names.d.ts +2 -1
  88. package/dist/names.js +2 -1
  89. package/dist/nodeInput.d.ts +2 -1
  90. package/dist/nodeInput.js +2 -1
  91. package/dist/participants.d.ts +22 -15
  92. package/dist/participants.js +14 -12
  93. package/dist/personGate.d.ts +2 -1
  94. package/dist/personGate.js +2 -1
  95. package/dist/pluginHarness.d.ts +8 -3
  96. package/dist/pluginHarness.js +4 -2
  97. package/dist/pluginPermissions.d.ts +2 -1
  98. package/dist/pluginPermissions.js +12 -1
  99. package/dist/pluginRuleRef.d.ts +2 -2
  100. package/dist/pluginRuleRef.js +1 -1
  101. package/dist/predicates.d.ts +16 -11
  102. package/dist/predicates.js +7 -6
  103. package/dist/preview.d.ts +8 -3
  104. package/dist/preview.js +2 -1
  105. package/dist/promptBlocks.d.ts +5 -3
  106. package/dist/promptBlocks.js +5 -3
  107. package/dist/rankingDecisions.d.ts +2 -1
  108. package/dist/rankingDecisions.js +2 -1
  109. package/dist/receipt.d.ts +65 -29
  110. package/dist/receipt.js +9 -4
  111. package/dist/receiverRules.js +3 -2
  112. package/dist/refs.d.ts +34 -9
  113. package/dist/refs.js +33 -13
  114. package/dist/registry.d.ts +42 -23
  115. package/dist/registry.js +7 -5
  116. package/dist/review.d.ts +16 -5
  117. package/dist/review.js +11 -4
  118. package/dist/sampling.d.ts +54 -0
  119. package/dist/sampling.js +95 -3
  120. package/dist/sceneSettings.d.ts +312 -0
  121. package/dist/sceneSettings.js +425 -0
  122. package/dist/scope.d.ts +6 -4
  123. package/dist/scope.js +4 -3
  124. package/dist/scripts.d.ts +81 -14
  125. package/dist/scripts.js +90 -11
  126. package/dist/sessionDossier.d.ts +521 -0
  127. package/dist/sessionDossier.js +33 -0
  128. package/dist/sessionLayout.d.ts +303 -19
  129. package/dist/sessionLayout.js +354 -40
  130. package/dist/sessionSettings.d.ts +8 -5
  131. package/dist/settings.d.ts +45 -20
  132. package/dist/settings.js +19 -12
  133. package/dist/settingsSlot.d.ts +11 -8
  134. package/dist/settingsSlot.js +11 -8
  135. package/dist/shapes.d.ts +103 -41
  136. package/dist/shapes.js +105 -40
  137. package/dist/sheets.d.ts +4 -2
  138. package/dist/sheets.js +6 -3
  139. package/dist/statShapes.d.ts +2 -1
  140. package/dist/statShapes.js +2 -1
  141. package/dist/status.d.ts +13 -9
  142. package/dist/status.js +8 -6
  143. package/dist/storage.d.ts +2 -1
  144. package/dist/storage.js +2 -1
  145. package/dist/storyTime.d.ts +13 -7
  146. package/dist/storyTime.js +11 -6
  147. package/dist/strokes.d.ts +176 -0
  148. package/dist/strokes.js +281 -0
  149. package/dist/surfaces.d.ts +54 -25
  150. package/dist/surfaces.js +3 -3
  151. package/dist/template.d.ts +9 -5
  152. package/dist/template.js +5 -3
  153. package/dist/templateCheck.d.ts +2 -2
  154. package/dist/templateCheck.js +2 -2
  155. package/dist/templateFit.d.ts +37 -8
  156. package/dist/templateFit.js +92 -8
  157. package/dist/templateIds.d.ts +3 -3
  158. package/dist/templateIds.js +3 -3
  159. package/dist/templateScopeAt.d.ts +21 -11
  160. package/dist/templateScopeAt.js +21 -11
  161. package/dist/testing.d.ts +11 -4
  162. package/dist/testing.js +13 -5
  163. package/dist/tokenizers.d.ts +2 -2
  164. package/dist/tokenizers.js +2 -2
  165. package/dist/turnLock.d.ts +4 -2
  166. package/dist/turnLock.js +2 -1
  167. package/dist/turnOrder.d.ts +17 -11
  168. package/dist/turnOrder.js +9 -5
  169. package/dist/validate.d.ts +11 -8
  170. package/dist/validate.js +81 -10
  171. package/dist/values.d.ts +17 -8
  172. package/dist/values.js +11 -6
  173. package/dist/variables.d.ts +46 -7
  174. package/dist/variables.js +87 -6
  175. package/dist/verdicts.d.ts +20 -13
  176. package/dist/verdicts.js +17 -11
  177. package/dist/widgetDecls.d.ts +8 -4
  178. package/dist/widgetDecls.js +4 -2
  179. package/dist/widgets.d.ts +987 -94
  180. package/dist/widgets.js +93 -18
  181. package/dist/wire.d.ts +13 -6
  182. package/dist/wire.js +3 -3
  183. package/dist/worldinfo.d.ts +11 -6
  184. package/dist/worldinfo.js +8 -4
  185. package/host-elements.d.ts +13 -0
  186. package/package.json +1 -1
@@ -1,13 +1,14 @@
1
1
  /**
2
- * Descriptors — the shared-scope declaration of a **node definition** (01 §1, 04 §3;
3
- * NOMENCLATURE §5 — *node type* is retired, ruled 2026-09-14).
2
+ * Descriptors — the shared-scope declaration of a **node definition**
3
+ * (*node type* is retired, ruled 2026-09-14).
4
4
  *
5
5
  * A descriptor is data: it can be listed, rendered and validated without loading
6
6
  * the handler that implements it. That is what lets the plugin manager and the
7
- * editor work from rows (10 §10.2).
7
+ * editor work from rows.
8
+ * @ruling 01 §1, 04 §3, NOMENCLATURE §5, 10 §10.2
8
9
  */
9
10
  import { pluginRuleRef } from './pluginRuleRef.js';
10
- import { checkBandDeclarations } from './bands.js';
11
+ import { checkBandDeclarations, checkRendersDeclarations } from './bands.js';
11
12
  import { settingsSchemaFindings } from './settings.js';
12
13
  import { i18nFindings, isI18n, localeMapOf } from './i18n.js';
13
14
  import { eventById, notADeclaredEvent } from './events.js';
@@ -18,7 +19,10 @@ import { contentHash, declarationData, refuseUnlessSameHash } from './hash.js';
18
19
  // author's; the contract material leaves it out by name (`authoredSlots`).
19
20
  // `settingsSlot.ts` imports nothing from here at runtime, so no cycle.
20
21
  import { authoredSlots } from './settingsSlot.js';
22
+ // `scripts.ts` imports only types from here, so this runtime import starts no cycle.
23
+ import { isScriptKindId, seamAddressOf } from './scripts.js';
21
24
  import { DEFAULT_CHANNEL, parseChannel } from './channels.js';
25
+ import { assertSceneSettings } from './sceneSettings.js';
22
26
  // F39's registry door: `register()` hears `core:verdict/settings-travel` for
23
27
  // every declared out-port (01 §13). `verdicts.ts` reads only leaf
24
28
  // vocabulary, so this import starts no cycle.
@@ -38,11 +42,48 @@ export function scriptPointsOf(d) {
38
42
  }));
39
43
  }
40
44
  /**
41
- * The message verbs no genre may remove (R-15, ruled 2026-09-15): a person
45
+ * A definition's seams, in run order — the one place that order is computed:
46
+ * `in:` seams in slot declaration order, then interior points in declaration
47
+ * order, then `out:` seams in slot declaration order. Reads `scripts`-kind
48
+ * slots and `scriptPointsOf`; works on a registry row as well as a
49
+ * descriptor, since rows carry slot declarations verbatim.
50
+ * @experimental
51
+ */
52
+ export function seamsOf(d) {
53
+ const ins = [];
54
+ const outs = [];
55
+ for (const [slot, raw] of Object.entries(d.slots ?? {})) {
56
+ const sd = raw;
57
+ if (sd?.kind !== 'scripts')
58
+ continue;
59
+ const at = seamAddressOf({ port: sd.port, phase: sd.phase });
60
+ const seam = {
61
+ at,
62
+ kind: (sd.phase ?? 'before') === 'after' ? 'out' : 'in',
63
+ slot,
64
+ port: sd.port ?? 'main',
65
+ accepts: [...(sd.accepts ?? [])],
66
+ extras: [...(sd.extras ?? [])],
67
+ ...(sd.description !== undefined ? { description: sd.description } : {}),
68
+ };
69
+ (seam.kind === 'in' ? ins : outs).push(seam);
70
+ }
71
+ const points = scriptPointsOf(d).map((p) => ({
72
+ at: seamAddressOf({ key: p.key }),
73
+ kind: 'point',
74
+ accepts: p.accepts,
75
+ extras: [],
76
+ ...(p.description !== undefined ? { description: p.description } : {}),
77
+ }));
78
+ return [...ins, ...points, ...outs];
79
+ }
80
+ /**
81
+ * The message verbs no genre may remove (ruled 2026-09-15): a person
42
82
  * can always stop a reply, branch a session and rewrite a line. Not keys of
43
83
  * `SessionShape.messageVerbs`; a declaration naming one `false` is refused
44
84
  * at registration (`assertMessageVerbFloors`).
45
85
  * @experimental
86
+ * @ruling R-15
46
87
  */
47
88
  export const MESSAGE_VERB_FLOORS = ['stop', 'branch', 'edit'];
48
89
  /**
@@ -56,7 +97,7 @@ export const MESSAGE_VERB_CONTENT = ['retry', 'extend', 'stepBack'];
56
97
  /** Every forbiddable verb, in the order the availability map reads them. @experimental */
57
98
  export const MESSAGE_VERBS = [...MESSAGE_VERB_CONTENT, ...MESSAGE_VERB_BUILT_INS];
58
99
  /**
59
- * The turn controls (lair pass B7 + B8, 2026-09-27) — the composer's presses
100
+ * The turn controls — the composer's presses
60
101
  * that move the story on, as opposed to the message verbs, which act on one
61
102
  * row. Keys of `SessionShape.turnControls`, in the order the extra venue
62
103
  * draws them.
@@ -70,8 +111,8 @@ export const MESSAGE_VERBS = [...MESSAGE_VERB_CONTENT, ...MESSAGE_VERB_BUILT_INS
70
111
  * - `narrate` fires a **narrator turn** (`sessions:fireTurn` with a `null`
71
112
  * ref the order does not hold) — only a `voice: 'narrator'` genre has a
72
113
  * narrator to fire (`turnControlDefault`).
73
- * - `retake` is **Regenerate the last turn, as a whole** (lair pass R2,
74
- * owner 2026-09-28; label _Regenerate_, `sessions:retakeTurn`): it
114
+ * - `retake` is **Regenerate the last turn, as a whole** (label
115
+ * _Regenerate_, `sessions:retakeTurn`): it
75
116
  * deletes the newest turn's **turn yield** — every row that turn's run
76
117
  * created, on every channel, never a person's own line — and takes the
77
118
  * same turn again. ⚠ Not `retry`, the message verb that rewrites ONE
@@ -79,12 +120,13 @@ export const MESSAGE_VERBS = [...MESSAGE_VERB_CONTENT, ...MESSAGE_VERB_BUILT_INS
79
120
  * declares it (`turnControlDefault`): a genre whose turn writes one row
80
121
  * keeps `retry`.
81
122
  * @experimental
123
+ * @ruling lair pass B7 + B8 (2026-09-27), lair pass R2 (owner 2026-09-28)
82
124
  */
83
125
  export const TURN_CONTROLS = ['advance', 'pick', 'narrate', 'retake'];
84
126
  /**
85
127
  * What an undeclared turn control resolves to — read off the shape's own
86
128
  * declarations, so a genre that says nothing keeps what its shape already
87
- * means (R42: turn controls only where there is somebody to take a turn):
129
+ * means (turn controls only where there is somebody to take a turn):
88
130
  *
89
131
  * - `advance` and `pick` are on where the shape has a **character system**
90
132
  * (`characters` declared with a `max` other than 0; an unreadable shape
@@ -94,6 +136,7 @@ export const TURN_CONTROLS = ['advance', 'pick', 'narrate', 'retake'];
94
136
  * - `retake` is never on by default: nothing in a shape says a turn writes
95
137
  * more than one row, so a genre opts in (`turnControls.retake: true`).
96
138
  * @experimental
139
+ * @ruling R42
97
140
  */
98
141
  export function turnControlDefault(shape, control) {
99
142
  const s = shape && typeof shape === 'object' ? shape : null;
@@ -112,11 +155,12 @@ export function turnControlDefault(shape, control) {
112
155
  * (`turnControlDefault`), `false` takes it away, `true` or an object offers it. Pure, and
113
156
  * takes `unknown` for a stored shape.
114
157
  *
115
- * With a `channel` (a slug or `slug:lane`; lair re-plan R6), that channel's
158
+ * With a `channel` (a slug or `slug:lane`), that channel's
116
159
  * declared `ChannelDecl.turnControls` win over the genre's, key by key — the
117
160
  * `messageVerbs` merge. A channel the shape does not declare in the long
118
161
  * form answers the genre's policy.
119
162
  * @experimental
163
+ * @ruling lair re-plan R6
120
164
  */
121
165
  export function resolveTurnControls(shape, channel) {
122
166
  const declared = shape && typeof shape === 'object'
@@ -212,10 +256,11 @@ export function assertTurnControls(shape, who) {
212
256
  throw new Error(`${who}: ${problems.join('\n')}`);
213
257
  }
214
258
  /**
215
- * The writes a genre may switch off (R-B, 2026-09-17) — what a session does
259
+ * The writes a genre may switch off — what a session does
216
260
  * *beyond messages*. Keys of `SessionShape.writes`, in the order a policy
217
261
  * reads them.
218
262
  * @experimental
263
+ * @ruling R-B (2026-09-17)
219
264
  */
220
265
  export const SESSION_WRITES = ['lore', 'scenes'];
221
266
  /**
@@ -261,11 +306,11 @@ export function assertSessionWrites(shape, who) {
261
306
  `false takes the write away (R-B).`);
262
307
  }
263
308
  /**
264
- * The five built-in writes (R-15), by the verb a person knows them as: the
309
+ * The five built-in writes, by the verb a person knows them as: the
265
310
  * one-node spec core runs for each, and the outlet that spec ends in.
266
311
  *
267
312
  * Here rather than only in the core catalog because the **validator** needs
268
- * them (U5b review W8): a built-in outlet performs the item rule's write —
313
+ * them: a built-in outlet performs the item rule's write —
269
314
  * the handler judged who may act on which row before the run began — so a
270
315
  * spec that is not the built-in's own placing one would perform that write
271
316
  * with nobody having judged anything. `validate()` refuses the placement
@@ -274,6 +319,7 @@ export function assertSessionWrites(shape, who) {
274
319
  * permission letting a plugin spec place one is the future this leaves room
275
320
  * for; it is not granted today.
276
321
  * @internal
322
+ * @ruling R-15, U5b review W8
277
323
  */
278
324
  export const BUILTIN_SPEC_IDS = Object.freeze({
279
325
  delete: 'core:spec/builtin-delete',
@@ -295,7 +341,7 @@ export const isBuiltInOutlet = (definitionId) => Object.values(BUILTIN_OUTLET_ID
295
341
  /** Is this spec id one of the five built-in specs — the only documents that may place a built-in outlet? @internal */
296
342
  export const isBuiltInSpec = (specId) => Object.values(BUILTIN_SPEC_IDS).includes(specId);
297
343
  /**
298
- * The form-answer pair (plans/29 R-15 *Forms*; 30 §U5d, built 2026-09-17):
344
+ * The form-answer pair (built 2026-09-17):
299
345
  * the inlet `core:event/form-addressed@1` lands on, and the outlet that
300
346
  * commits an oracle's answer exactly as a click would. The outlet may be
301
347
  * placed only in a document whose inlet is the form-addressed one
@@ -304,12 +350,13 @@ export const isBuiltInSpec = (specId) => Object.values(BUILTIN_SPEC_IDS).include
304
350
  * form to answer — a spec placing it elsewhere would fire an action as
305
351
  * somebody nobody asked.
306
352
  * @internal
353
+ * @ruling plans/29 R-15 *Forms*, 30 §U5d
307
354
  */
308
355
  export const FORM_ADDRESSED_INLET_ID = 'core:inlet/form-addressed@1';
309
356
  /** @experimental */
310
357
  export const ANSWER_FORM_OUTLET_ID = 'core:outlet/answer-form@1';
311
358
  /**
312
- * The review-fields rule (R-15 *The review gate*; 30 §U5d): a definition
359
+ * The review-fields rule: a definition
313
360
  * with `effects: 'write' | 'external'` declares `review: { fields }` — what a
314
361
  * reviewer may edit at the gate, `[]` when nothing (approve or refuse). A
315
362
  * definition that declares none still registers and still gates — the form
@@ -319,6 +366,7 @@ export const ANSWER_FORM_OUTLET_ID = 'core:outlet/answer-form@1';
319
366
  * to such a definition, so a shipped effectful definition without one is
320
367
  * visible rather than silent. Every core definition declares one.
321
368
  * @experimental
369
+ * @ruling R-15 *The review gate*, 30 §U5d
322
370
  */
323
371
  export function reviewFieldsFinding(d) {
324
372
  if (d.effects !== 'write' && d.effects !== 'external')
@@ -507,7 +555,7 @@ const types = new Map();
507
555
  */
508
556
  export const DESCRIPTOR_DISPLAY_KEYS = { display: ['label'] };
509
557
  /**
510
- * The two halves of a `Descriptor` (plans/31 V6, ruled 2026-09-17).
558
+ * The two halves of a `Descriptor` (ruled 2026-09-17).
511
559
  *
512
560
  * **Contract** is what a pinned spec runs against: the ports and shapes a
513
561
  * document was compiled against, the slots it configures and their schema,
@@ -530,6 +578,7 @@ export const DESCRIPTOR_DISPLAY_KEYS = { display: ['label'] };
530
578
  * is classified before it exists; `sdk-tests/contract.test.ts` gives the
531
579
  * one-line reason per field.
532
580
  * @experimental
581
+ * @ruling plans/31 V6
533
582
  */
534
583
  export const DESCRIPTOR_CONTRACT_KEYS = [
535
584
  'id',
@@ -564,6 +613,7 @@ export const DESCRIPTOR_POLICY_KEYS = [
564
613
  'timeoutMs',
565
614
  'timeoutKind',
566
615
  'usage',
616
+ 'prefers',
567
617
  ];
568
618
  /** @experimental */
569
619
  export const DESCRIPTOR_FIELDS_CLASSIFIED = true;
@@ -591,6 +641,8 @@ export function definitionPolicy(d) {
591
641
  policy.bandPorts = bandPorts;
592
642
  if (d.portSchemas !== undefined)
593
643
  policy.portSchemas = d.portSchemas;
644
+ if (d.prefers && Object.keys(d.prefers).length)
645
+ policy.prefers = { ...d.prefers };
594
646
  return policy;
595
647
  }
596
648
  /** `{ key: variableId }`, sorted by key; none and `{}` are one contract (absent). */
@@ -683,18 +735,23 @@ function register(d) {
683
735
  checkNoAuthoredSettings(d);
684
736
  checkNoSettingsPort(d);
685
737
  checkScriptPointsAccept(d);
738
+ checkScriptsSlots(d);
686
739
  checkCausesEvent(d);
687
740
  checkNoAmbientExtras(d);
688
741
  // Before the id is claimed, so a refused declaration can be fixed and retried.
689
742
  checkModeTitled(d);
690
743
  checkDisplayText(d);
691
- // Bands (typed templates P2): identifier keys, a registered variable whose
692
- // scope names the key, and one meaning per key across every definition.
693
- checkBandDeclarations(d, types.values());
744
+ // Bands (typed templates P2) and static `renders` (2026-10-13): identifier
745
+ // keys, a registered variable whose scope names the key, never one of
746
+ // Assemble's own names. One meaning per key is a per-document rule
747
+ // (`rendersAt`, law T1), not a global one — owner ruling 2026-10-13, ★1.
748
+ checkBandDeclarations(d);
749
+ checkRendersDeclarations(d);
694
750
  assertMessageVerbFloors(d.sessionShape, d.id);
695
751
  assertSessionWrites(d.sessionShape, d.id);
696
752
  assertTurnControls(d.sessionShape, d.id);
697
753
  assertChannelDecls(d.sessionShape, d.id);
754
+ assertSceneSettings(d.sessionShape, d.id);
698
755
  // A finding, not a refusal: the fallback is documented (inference), the
699
756
  // omission is recorded, and `validate()` says it on every placement.
700
757
  const reviewFinding = reviewFieldsFinding(d);
@@ -706,12 +763,13 @@ function register(d) {
706
763
  return d;
707
764
  }
708
765
  /**
709
- * The extras every script site is offered, whatever its slot lists (R32,
710
- * PLAN-turn-order §4.14): `session`, the run's settings document. The
766
+ * The extras every script site is offered, whatever its slot lists:
767
+ * `session`, the run's settings document. The
711
768
  * executor supplies them at every site — a slot's port hook and an interior
712
769
  * point alike — so a slot's `extras` names only what is particular to it,
713
- * and listing an ambient one is refused (one way to say it, R26).
770
+ * and listing an ambient one is refused (one way to say it).
714
771
  * @internal
772
+ * @ruling R32, PLAN-turn-order §4.14, R26
715
773
  */
716
774
  export const AMBIENT_SCRIPT_EXTRAS = ['session'];
717
775
  function checkNoAmbientExtras(d) {
@@ -732,7 +790,7 @@ const portLine = (ports) => Object.entries(ports ?? {})
732
790
  // every definition (R-9), which a raw declaration does not carry (M4).
733
791
  const slotLine = (slots) => Object.keys(authoredSlots(slots) ?? {}).sort().join(', ');
734
792
  /**
735
- * Can `swap` stand in for `pinned` at node `key` (R28)? A swap is seated with
793
+ * Can `swap` stand in for `pinned` at node `key`? A swap is seated with
736
794
  * the pin's node config, so it must be the same kind with the same in- and
737
795
  * out-ports (by name and shape) and the same slots — a slot the pin's node
738
796
  * does not wire would never reach the swap, and a person would pick an
@@ -740,6 +798,7 @@ const slotLine = (slots) => Object.keys(authoredSlots(slots) ?? {}).sort().join(
740
798
  * chain is configured on the node key, whatever sits there. One sentence
741
799
  * for the builder and the package pass alike.
742
800
  * @experimental
801
+ * @ruling R28
743
802
  */
744
803
  export function swapFitFinding(key, pinned, swap) {
745
804
  // A provisional definition has no handler (plans/29 R-2): offering it
@@ -760,11 +819,12 @@ export function swapFitFinding(key, pinned, swap) {
760
819
  : `'${swap.id}' cannot stand in for '${key}': a swap must match the pin's kind, ports and slots — ${want}; it is ${got}`;
761
820
  }
762
821
  /**
763
- * Can one inlet answer every event of an `events` lock (R33)? Each listed
822
+ * Can one inlet answer every event of an `events` lock? Each listed
764
823
  * event must carry a payload the inlet declares it reads; an inlet that
765
824
  * declares none answers one event only. One sentence for the builder and
766
825
  * the package pass alike.
767
826
  * @experimental
827
+ * @ruling R33
768
828
  */
769
829
  export function eventsLockFindings(inlet, events) {
770
830
  const reads = inlet.payloads ?? [];
@@ -787,11 +847,12 @@ export function eventsLockFindings(inlet, events) {
787
847
  return out;
788
848
  }
789
849
  /**
790
- * `causesEvent` agrees with the event's own `causedBy` (R33). The event side
850
+ * `causesEvent` agrees with the event's own `causedBy`. The event side
791
851
  * is the complete statement — `message-completed` is caused by three writes
792
852
  * whose own `causesEvent` names their primary event — so this field may only
793
853
  * name an event that already lists the definition. And only core defines
794
- * events (R30, F8): a package's outlet cannot cause one.
854
+ * events: a package's outlet cannot cause one.
855
+ * @ruling R33, R30, F8
795
856
  */
796
857
  function checkCausesEvent(d) {
797
858
  if (d.causesEventFrom !== undefined) {
@@ -814,7 +875,7 @@ function checkCausesEvent(d) {
814
875
  `causedBy is the one statement of what causes what — add '${base}' there, or drop causesEvent (R33)`);
815
876
  }
816
877
  /**
817
- * A gate-eligible write publishes `write-result@1`, never raw ids (13 §7j-b).
878
+ * A gate-eligible write publishes `write-result@1`, never raw ids.
818
879
  *
819
880
  * Checked at registration rather than reviewed by hand, because the hand-written version
820
881
  * was already wrong: three core Consumers declared `row-ids@1` out ports while declaring
@@ -822,6 +883,7 @@ function checkCausesEvent(d) {
822
883
  * row a reviewer had not approved yet — and under `async` review that row may never exist.
823
884
  * The failure lands long after the run that caused it, which is the worst kind to find by
824
885
  * reading.
886
+ * @ruling 13 §7j-b
825
887
  */
826
888
  function checkWritePublishes(d) {
827
889
  if (d.effects !== 'write')
@@ -836,7 +898,7 @@ function checkWritePublishes(d) {
836
898
  `that dangles when the reviewer rejects (13 §7j-b).`);
837
899
  }
838
900
  /**
839
- * `settings` is the substrate's slot, never an author's (R-9).
901
+ * `settings` is the substrate's slot, never an author's.
840
902
  *
841
903
  * Refused at registration rather than merged, because the two would collide
842
904
  * at one address: the executor reads `config[key].settings.enabled` to skip
@@ -844,6 +906,7 @@ function checkWritePublishes(d) {
844
906
  * the same name would be read as that switch. It is also what lets the
845
907
  * registry hash leave the projected slot out — a slot that is never authored
846
908
  * is never a change to what an author declared.
909
+ * @ruling R-9
847
910
  */
848
911
  function checkNoAuthoredSettings(d) {
849
912
  if (!d.slots)
@@ -864,17 +927,18 @@ function checkNoAuthoredSettings(d) {
864
927
  `'parameters' for tunables.`);
865
928
  }
866
929
  /**
867
- * Nor an out-port of the name (F39; U7 review, S2).
930
+ * Nor an out-port of the name.
868
931
  *
869
932
  * `<nodeKey>.settings` and `<nodeKey>.settings.*` are the address the
870
933
  * validator and the executor read as the substrate's switches: a data edge
871
- * drawn from it is refused as a setting travelling (F39), and a reference to
934
+ * drawn from it is refused as a setting travelling, and a reference to
872
935
  * it resolves to nothing. A definition publishing an out-port of that name
873
936
  * would have every edge from the port refused under a law about something
874
937
  * else — a port nobody could wire — so the name is refused where the author
875
- * is, and the F39 edge rule can never mistake a declared port for a switch.
876
- * `register()` is F39's registry door: `core:verdict/settings-travel` judges
877
- * each declared out-port and this quotes it (01 §13).
938
+ * is, and the settings-travel edge rule can never mistake a declared port for a switch.
939
+ * `register()` is that rule's registry door: `core:verdict/settings-travel` judges
940
+ * each declared out-port and this quotes it.
941
+ * @ruling F39, U7 review, S2, 01 §13
878
942
  */
879
943
  function checkNoSettingsPort(d) {
880
944
  for (const port of Object.keys(d.ports?.out ?? {})) {
@@ -884,10 +948,11 @@ function checkNoSettingsPort(d) {
884
948
  }
885
949
  }
886
950
  /**
887
- * A script point names the kinds it accepts (R-11; U4 residual 2026-09-16).
951
+ * A script point names the kinds it accepts.
888
952
  * A point nothing can attach to is a control with no effect wearing a
889
953
  * contract: the panel would offer the hook and every kind would be refused
890
954
  * at it.
955
+ * @ruling R-11, U4 residual (2026-09-16)
891
956
  */
892
957
  function checkScriptPointsAccept(d) {
893
958
  for (const p of d.scriptPoints ?? []) {
@@ -900,15 +965,49 @@ function checkScriptPointsAccept(d) {
900
965
  `a point that accepts nothing is a hook nothing can attach to.`);
901
966
  }
902
967
  }
968
+ /**
969
+ * A `scripts` slot is a seam the executor can actually reach. Its port
970
+ * must exist on the side its phase implies —
971
+ * `before` reads an in-port, `after` an out-port — or the chain is stored,
972
+ * shown and never run; and it accepts at least one well-formed script kind
973
+ * id. Kind *existence* is the conformance kit's to check: kinds may register
974
+ * after the definitions that name them.
975
+ * @ruling PLAN-script-placement D6
976
+ */
977
+ function checkScriptsSlots(d) {
978
+ for (const [name, raw] of Object.entries(d.slots ?? {})) {
979
+ const sd = raw;
980
+ if (sd?.kind !== 'scripts')
981
+ continue;
982
+ const phase = sd.phase ?? 'before';
983
+ const port = sd.port ?? 'main';
984
+ const side = phase === 'after' ? 'out' : 'in';
985
+ const ports = d.ports?.[side] ?? {};
986
+ if (!(port in ports))
987
+ throw new Error(`${d.id}: scripts slot '${name}' hooks ${side}-port '${port}' (phase '${phase}'), which the ` +
988
+ `definition does not declare — declared ${side}-ports: ${Object.keys(ports).join(', ') || '(none)'}; ` +
989
+ `name one of them in 'port', or set 'phase' to '${phase === 'after' ? 'before' : 'after'}' if the port is on the other side.`);
990
+ const accepts = sd.accepts;
991
+ if (!Array.isArray(accepts) || accepts.length === 0)
992
+ throw new Error(`${d.id}: scripts slot '${name}' accepts no script kind — list the kinds it takes in ` +
993
+ `'accepts' (e.g. ['core:script:text/transform@1']); a hook that accepts nothing is one nothing can attach to.`);
994
+ const bad = accepts.filter((id) => typeof id !== 'string' || !isScriptKindId(id));
995
+ if (bad.length)
996
+ throw new Error(`${d.id}: scripts slot '${name}' accepts ${bad.map((b) => `'${String(b)}'`).join(', ')}, which ` +
997
+ `${bad.length === 1 ? 'is not a script kind id' : 'are not script kind ids'} — spell each as ` +
998
+ `'<namespace>:script:<content>/<operation>@<major>', e.g. 'core:script:text/transform@1'.`);
999
+ }
1000
+ }
903
1001
  const shapeIdOf = (s) => typeof s === 'string' ? s : (s?.id ?? undefined);
904
1002
  /**
905
1003
  * Is there text a person reads — a non-blank string, or a map with a non-blank
906
1004
  * `en`? A map carrying only `fr` is not titled: `en` is the locale every other
907
- * falls back to (R-20), so a card with no `en` has no face on an English install.
1005
+ * falls back to, so a card with no `en` has no face on an English install.
1006
+ * @ruling R-20
908
1007
  */
909
1008
  const hasDisplayText = (v) => isI18n(v);
910
1009
  /**
911
- * A chat mode ships titled (19 §2).
1010
+ * A chat mode ships titled.
912
1011
  *
913
1012
  * A shape-bearing input type *is* a chat mode, and the New Chat picker renders one card
914
1013
  * per mode from rows — `i18n.name` is that card's face. An untitled mode could only
@@ -916,6 +1015,7 @@ const hasDisplayText = (v) => isI18n(v);
916
1015
  * where the author is, rather than at install, where the admin is. A missing
917
1016
  * `description` is a poorer card rather than a broken one, so the packager warns about
918
1017
  * that instead of this throwing (cli/src/compiler.ts, W_MODE_NO_DESCRIPTION).
1018
+ * @ruling 19 §2
919
1019
  */
920
1020
  function checkModeTitled(d) {
921
1021
  if (d.kind !== 'inlet' || !d.sessionShape)
@@ -928,7 +1028,7 @@ function checkModeTitled(d) {
928
1028
  `warns when a mode ships without one.`);
929
1029
  }
930
1030
  /**
931
- * Every display string a definition declares is `I18n` (R-20; U5i, ruled
1031
+ * Every display string a definition declares is `I18n` (ruled
932
1032
  * 2026-09-17): `i18n.name` and `i18n.description`; each slot's `description`,
933
1033
  * its prompt `fields[].i18n` and its `schema` (through `settingsSchemaFindings`);
934
1034
  * each script point's `label`, `description` and deprecated `i18n`; a session
@@ -936,6 +1036,7 @@ function checkModeTitled(d) {
936
1036
  * kinds, not only a mode-bearing inlet — `checkModeTitled` keeps the one
937
1037
  * strictness of its own (a mode must have a name); this refuses a blank or a
938
1038
  * mis-shaped value anywhere, with the field named and the fix stated.
1039
+ * @ruling R-20, U5i
939
1040
  */
940
1041
  function checkDisplayText(d) {
941
1042
  const findings = [];
@@ -965,11 +1066,12 @@ function checkDisplayText(d) {
965
1066
  throw new Error(`${d.id} declares display text a publish refuses (R-20):\n · ${findings.join('\n · ')}`);
966
1067
  }
967
1068
  /**
968
- * The display text of a list of widget declarations (R-20): each `title`
1069
+ * The display text of a list of widget declarations: each `title`
969
1070
  * (required — the chrome and the tray show it) and each `settings` schema.
970
1071
  * Shared by a session shape's `panels` and a genre's shape, which carry the
971
1072
  * same declarations.
972
1073
  * @experimental
1074
+ * @ruling R-20
973
1075
  */
974
1076
  export function widgetDeclsFindings(raw, where) {
975
1077
  if (raw === undefined)
@@ -1138,12 +1240,13 @@ export const ENTRY_SOURCE_KINDS = [
1138
1240
  *
1139
1241
  * Closed to the names the importer reads: the three every file has carried,
1140
1242
  * plus `location` and `item`, which the app's importer restores as a place and
1141
- * an item (lorebooks plan A26 — written as world lore, a place reads back
1243
+ * an item (written as world lore, a place reads back
1142
1244
  * without its links' meaning or its stats). A type outside them declares
1143
1245
  * nothing here: no marker is honest, where a marker no importer reads is a
1144
1246
  * file that round-trips into the wrong shape. Widening the list is a
1145
1247
  * deliberate act with an importer change beside it.
1146
1248
  * @experimental
1249
+ * @ruling lorebooks plan A26
1147
1250
  */
1148
1251
  export const ENTRY_EXPORT_KEYS = ['world', 'character', 'history', 'location', 'item'];
1149
1252
  /**
@@ -1312,11 +1415,12 @@ export function pin(descriptor) {
1312
1415
  return { [`v${version}`]: ctor, id: descriptor.id, descriptor };
1313
1416
  }
1314
1417
  /**
1315
- * The in-ports that make a `liveRow` outlet's write the run's live row (F7,
1316
- * W1): a placeholder (`generating`) or a claimed row (`row`). Anything else
1418
+ * The in-ports that make a `liveRow` outlet's write the run's live row: a
1419
+ * placeholder (`generating`) or a claimed row (`row`). Anything else
1317
1420
  * the outlet writes is a complete row — an ordinary write, as many as the
1318
1421
  * pipeline likes.
1319
1422
  * @experimental
1423
+ * @ruling F7, W1
1320
1424
  */
1321
1425
  export const LIVE_ROW_PORTS = ['generating', 'row'];
1322
1426
  /** Whether a `liveRow` outlet's resolved payload opens the live row (see `LIVE_ROW_PORTS`). @experimental */
package/dist/dev.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  /**
2
- * Dev mode: point at an entry file, load it in memory, hot reload (13 §11).
2
+ * Dev mode: point at an entry file, load it in memory, hot reload.
3
3
  *
4
4
  * ## The collision, stated before it is resolved
5
5
  *
6
- * F6 says **core imports documents, never authoring JS**, and 04 §5a says nothing is
7
- * discovered by executing. A dev loader that evaluates `src/index.ts` and pulls pipelines,
6
+ * The import rule is that **core imports documents, never authoring JS**, and the discovery rule
7
+ * is that nothing is discovered by executing. A dev loader that evaluates `src/index.ts` and pulls pipelines,
8
8
  * hooks and components out of memory looks exactly like the thing both rules forbid.
9
9
  *
10
10
  * It is not, and the distinction is worth being precise about rather than waving at.
11
11
  *
12
- * **What F6 protects is the *importer*.** The claim it makes is that no code path reachable
12
+ * **What the import rule protects is the *importer*.** The claim it makes is that no code path reachable
13
13
  * from installing or running a plugin evaluates authoring JavaScript — so a malicious
14
14
  * document cannot become a malicious program, and a plugin cannot announce capabilities at
15
15
  * runtime that its manifest did not declare. That claim survives here, because the dev
@@ -29,7 +29,7 @@
29
29
  * plugin whose rows outlived the session would leave a user's chats pinning types that no
30
30
  * longer exist — a broken install with no install to uninstall.
31
31
  * 2. **Permissions are compiled and enforced identically.** Dev mode changes the source of
32
- * the code, never the trust in it. The runtime double-check (F28) does not know or care
32
+ * the code, never the trust in it. The runtime double-check does not know or care
33
33
  * that a plugin came from a file path.
34
34
  * 3. **Provenance is recorded.** Every run from a dev-loaded plugin marks its receipt
35
35
  * `source: 'dev'`, because "it worked on my machine" needs to be distinguishable in the
@@ -43,6 +43,7 @@
43
43
  * anything a running pipeline is using is *deferred*, not applied — and `reloadPlan` says
44
44
  * which runs are holding it up, so the developer sees "waiting on 1 run" rather than
45
45
  * silence.
46
+ * @ruling 13 §11, F6, 04 §5a, F6, F28
46
47
  */
47
48
  import { type SpecDocument } from './document.js';
48
49
  import type { Extension } from './extension.js';
package/dist/dev.js CHANGED
@@ -1,15 +1,15 @@
1
1
  /**
2
- * Dev mode: point at an entry file, load it in memory, hot reload (13 §11).
2
+ * Dev mode: point at an entry file, load it in memory, hot reload.
3
3
  *
4
4
  * ## The collision, stated before it is resolved
5
5
  *
6
- * F6 says **core imports documents, never authoring JS**, and 04 §5a says nothing is
7
- * discovered by executing. A dev loader that evaluates `src/index.ts` and pulls pipelines,
6
+ * The import rule is that **core imports documents, never authoring JS**, and the discovery rule
7
+ * is that nothing is discovered by executing. A dev loader that evaluates `src/index.ts` and pulls pipelines,
8
8
  * hooks and components out of memory looks exactly like the thing both rules forbid.
9
9
  *
10
10
  * It is not, and the distinction is worth being precise about rather than waving at.
11
11
  *
12
- * **What F6 protects is the *importer*.** The claim it makes is that no code path reachable
12
+ * **What the import rule protects is the *importer*.** The claim it makes is that no code path reachable
13
13
  * from installing or running a plugin evaluates authoring JavaScript — so a malicious
14
14
  * document cannot become a malicious program, and a plugin cannot announce capabilities at
15
15
  * runtime that its manifest did not declare. That claim survives here, because the dev
@@ -29,7 +29,7 @@
29
29
  * plugin whose rows outlived the session would leave a user's chats pinning types that no
30
30
  * longer exist — a broken install with no install to uninstall.
31
31
  * 2. **Permissions are compiled and enforced identically.** Dev mode changes the source of
32
- * the code, never the trust in it. The runtime double-check (F28) does not know or care
32
+ * the code, never the trust in it. The runtime double-check does not know or care
33
33
  * that a plugin came from a file path.
34
34
  * 3. **Provenance is recorded.** Every run from a dev-loaded plugin marks its receipt
35
35
  * `source: 'dev'`, because "it worked on my machine" needs to be distinguishable in the
@@ -43,6 +43,7 @@
43
43
  * anything a running pipeline is using is *deferred*, not applied — and `reloadPlan` says
44
44
  * which runs are holding it up, so the developer sees "waiting on 1 run" rather than
45
45
  * silence.
46
+ * @ruling 13 §11, F6, 04 §5a, F6, F28
46
47
  */
47
48
  import { compile } from './document.js';
48
49
  import { bindingsOf, handlersOf } from './extension.js';