@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,5 +1,5 @@
1
1
  /**
2
- * What an import has to wire before it can run — the ruling on 13 §10a.
2
+ * What an import has to wire before it can run — the ruling on connection bindings.
3
3
  *
4
4
  * The question was whether connection bindings deserve their own table, so that an
5
5
  * export could state *structurally* that connections were excluded rather than relying
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * **Ruled: no table.** A second table implies a second lifecycle — its own ids, its own
9
9
  * ownership rules, its own migration — and there isn't one. A connection binding is a
10
- * config value at instance scope, which 12's five-layer chain already owns.
10
+ * config value at instance scope, which the config chain already owns.
11
11
  *
12
12
  * The guarantee people wanted from the table is available without it, and stronger. A
13
13
  * table could only ever report the connections the exporting instance had *filled in*,
@@ -15,11 +15,12 @@
15
15
  * importer would find out at the first run. Slots are declared on the **type**, so
16
16
  * deriving the requirement from descriptors is complete by construction — independent of
17
17
  * what the exporter did, and independent of whether the exporter was even configured.
18
+ * @ruling 13 §10a, 12
18
19
  */
19
20
  import { getDefinition } from './descriptors.js';
20
21
  import { capabilityLabel, satisfies, } from './capabilities.js';
21
22
  /**
22
- * A slot this node reads from ANOTHER node's config (16 §5b-i).
23
+ * A slot this node reads from ANOTHER node's config.
23
24
  *
24
25
  * `resolvedRefs` is what publish leaves behind for `slot.connectionOf('x')`, and
25
26
  * the executor honours it: `resolveSlot` reads the TARGET's stored value, so a
@@ -31,6 +32,7 @@ import { capabilityLabel, satisfies, } from './capabilities.js';
31
32
  * `core:task/assemble@2` is the first core type to share a CONNECTION reference:
32
33
  * it renders the prompt for whatever the sending Provider is bound to, and has
33
34
  * nothing of its own for an importer to bind.
35
+ * @ruling 16 §5b-i
34
36
  */
35
37
  const sharedWithAnotherNode = (n, slot) => {
36
38
  const target = n.resolvedRefs?.[slot];
@@ -72,10 +74,11 @@ export function requiredConnections(doc) {
72
74
  /**
73
75
  * What is still unwired, given what the importing instance has bound so far.
74
76
  *
75
- * Feeds `needs-configuration` (12 §6), which is deliberately not `broken`. A spec nobody
77
+ * Feeds `needs-configuration`, which is deliberately not `broken`. A spec nobody
76
78
  * has given a connection is not damaged, it is unfinished — and the difference decides
77
79
  * whether a user files a bug or opens settings.
78
80
  * @experimental
81
+ * @ruling 12 §6
79
82
  */
80
83
  export function unwiredConnections(doc, bound) {
81
84
  const has = new Set(bound.map((b) => `${b.nodeKey} ${b.slot}`));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The checks a package's declarations get, whichever surface declared them (D-1).
2
+ * The checks a package's declarations get, whichever surface declared them.
3
3
  *
4
4
  * A package says the same things in two places. `announce()` collects them as a
5
5
  * builder and compiles the announcement document; `defineExtension()` carries
@@ -18,6 +18,7 @@
18
18
  * callers already enforce in their own words (one names the package namespace,
19
19
  * the other the plugin slug), and the identity display text, which only an
20
20
  * announcement has.
21
+ * @ruling D-1
21
22
  */
22
23
  import type { WidgetDecl } from './layout.js';
23
24
  import type { AnnouncedSpec, ExternalRef, StoredEventDeclaration, ConfigDecl, CoverageReport, PresetDecl, PromptDecl } from './announce.js';
@@ -41,9 +42,15 @@ export interface DeclaredPackage {
41
42
  presets?: readonly PresetDecl[];
42
43
  surfaces?: SurfacesDecl;
43
44
  components?: readonly ComponentDecl[];
44
- /** The widgets this package declares (R71). */
45
+ /**
46
+ * The widgets this package declares.
47
+ * @ruling R71
48
+ */
45
49
  widgets?: readonly WidgetDecl[];
46
- /** Definitions this package offers on another package's swappable nodes (R29). */
50
+ /**
51
+ * Definitions this package offers on another package's swappable nodes.
52
+ * @ruling R29
53
+ */
47
54
  swaps?: readonly (SwapContribution | StoredSwapContribution)[];
48
55
  /** Events this package declares, with who may record them. */
49
56
  events?: readonly StoredEventDeclaration[];
@@ -56,13 +63,14 @@ export interface DeclaredPackage {
56
63
  annexFields?: readonly AnnexFieldDecl[];
57
64
  }
58
65
  /**
59
- * One swap a package contributes (R29): its own definition, offered on a node
66
+ * One swap a package contributes: its own definition, offered on a node
60
67
  * another package (usually core) exposes — `{ spec: chatTurnOrder, node:
61
68
  * 'decide.rules.strategy', definition: myStrategy }`. The spec is a value
62
69
  * — the spec you imported, or `use('<id>')` for one you cannot import.
63
70
  * With a value, the node key is checked here; the instance checks exposure and
64
71
  * port fit at install. Stored with ids (`StoredSwapContribution`).
65
72
  * @experimental
73
+ * @ruling R29
66
74
  */
67
75
  export interface SwapContribution {
68
76
  /** The spec whose node this is offered on — never this package's own. */
@@ -91,10 +99,11 @@ export declare const storedSwap: (c: SwapContribution | StoredSwapContribution)
91
99
  */
92
100
  export declare function swapInputFindings(swaps: readonly SwapContribution[]): string[];
93
101
  /**
94
- * Swap contributions (R29): a package offers only its own definitions, never
102
+ * Swap contributions: a package offers only its own definitions, never
95
103
  * on its own specs (those list swaps on the node with `expose.swaps` — one
96
- * way to do each thing, R26), and each once.
104
+ * way to do each thing), and each once.
97
105
  * @experimental
106
+ * @ruling R29, R26
98
107
  */
99
108
  export declare function swapContributionFindings(swaps: readonly (SwapContribution | StoredSwapContribution)[], ns: string, declaredSpecs: ReadonlyMap<string, unknown>): string[];
100
109
  /** What one pass over a package's declarations produces. @experimental */
@@ -108,10 +117,11 @@ export interface DeclarationFindings {
108
117
  requires: string[];
109
118
  }
110
119
  /**
111
- * The display text of one labelled declaration (R-20): `label` is required
120
+ * The display text of one labelled declaration: `label` is required
112
121
  * — a config, a preset and a prompt are all listed by it — `description` is
113
122
  * not.
114
123
  * @experimental
124
+ * @ruling R-20
115
125
  */
116
126
  export declare function labelFindings(at: string, meta: {
117
127
  label?: unknown;
@@ -124,24 +134,27 @@ export declare function labelFindings(at: string, meta: {
124
134
  */
125
135
  export declare function genreOwnershipFindings(genres: readonly GenreDecl[], ns: string): string[];
126
136
  /**
127
- * A compiled document's `expose.swaps` (R28), checked as the builder checks
137
+ * A compiled document's `expose.swaps`, checked as the builder checks
128
138
  * them: known ids that do not fit are refused; ids this SDK does not know are
129
139
  * the instance's to check at install.
130
140
  * @experimental
141
+ * @ruling R28
131
142
  */
132
143
  export declare function exposeSwapFindings(pipelines: readonly AnnouncedSpec[]): string[];
133
144
  /**
134
- * The input lock (24 §4): a spec that answers a session event names the genre it
145
+ * The input lock: a spec that answers a session event names the genre it
135
146
  * serves, and the event is one core declares or one this package namespaced.
136
147
  * A genre the package does not declare is recorded as a requirement.
137
148
  * @experimental
149
+ * @ruling 24 §4
138
150
  */
139
151
  export declare function inputLockFindings(pipelines: readonly AnnouncedSpec[], declaredGenres: ReadonlySet<string>, ns: string, requires: Set<string>): string[];
140
152
  /**
141
153
  * The events an inlet lock answers: the one `event`, or the `events` list
142
- * (PLAN-turn-order §4.1) — as one list, so every reader of the lock asks
154
+ * — as one list, so every reader of the lock asks
143
155
  * one question. Empty for a spec with no lock.
144
156
  * @experimental
157
+ * @ruling PLAN-turn-order §4.1
145
158
  */
146
159
  export declare function lockedEvents(input: {
147
160
  event?: string;
@@ -152,7 +165,11 @@ export declare const lockAnswers: (input: {
152
165
  event?: string;
153
166
  events?: string[];
154
167
  } | undefined, event: string) => boolean;
155
- /** Exactly one create pipeline per declared genre (24 §3). @experimental */
168
+ /**
169
+ * Exactly one create pipeline per declared genre.
170
+ * @experimental
171
+ * @ruling 24 §3
172
+ */
156
173
  export declare function createPipelineFindings(genres: readonly GenreDecl[], pipelines: readonly AnnouncedSpec[]): string[];
157
174
  /**
158
175
  * **A custom pipeline must include a default preset** (owner ruling,
@@ -167,12 +184,13 @@ export declare function createPipelineFindings(genres: readonly GenreDecl[], pip
167
184
  */
168
185
  export declare function genrePresetFindings(genres: readonly GenreDecl[], presets: readonly PresetDecl[]): string[];
169
186
  /**
170
- * Contributed actions (R-15, U5c): each declaration sound, and one slash name
187
+ * Contributed actions: each declaration sound, and one slash name
171
188
  * meaning one function across the whole package — the per-document check cannot
172
189
  * see two specs of one package claiming `/acme.roll` for two different things,
173
190
  * so the package is the first place the collision rule runs across documents;
174
191
  * the install is the second.
175
192
  * @experimental
193
+ * @ruling R-15, U5c
176
194
  */
177
195
  export declare function contributedActionFindings(pipelines: readonly AnnouncedSpec[]): string[];
178
196
  /**
@@ -194,7 +212,11 @@ export declare function contributedActionFindings(pipelines: readonly AnnouncedS
194
212
  export declare function promptFindings(prompts: readonly PromptDecl[]): string[];
195
213
  /** Configs: node keys verified for declared specs; slugs unique per spec. @experimental */
196
214
  export declare function configFindings(configs: readonly ConfigDecl[], declaredSpecs: ReadonlyMap<string, AnnouncedSpec>, requires: Set<string>): string[];
197
- /** Presets: validated against the genre's event surface, with the coverage (24 §7). @experimental */
215
+ /**
216
+ * Presets: validated against the genre's event surface, with the coverage.
217
+ * @experimental
218
+ * @ruling 24 §7
219
+ */
198
220
  export declare function presetFindings(presets: readonly PresetDecl[], declaredGenres: ReadonlyMap<string, GenreDecl>, declaredSpecs: ReadonlyMap<string, AnnouncedSpec>, configs: readonly ConfigDecl[], requires: Set<string>): {
199
221
  errors: string[];
200
222
  coverage: CoverageReport['presets'];
@@ -209,25 +231,28 @@ export declare function surfaceFindings(surfaces: SurfacesDecl | undefined): str
209
231
  /** A component's slug: it names the built module (`components/<slug>.js`), so never a path. @experimental */
210
232
  export declare const COMPONENT_SLUG: RegExp;
211
233
  /**
212
- * Components (§3.5, R25): one slug, a label, a servable entry and a
234
+ * Components: one slug, a label, a servable entry and a
213
235
  * framework SDK 1.0 ships. There is no mount point on the declaration — a
214
236
  * widget names the component, and that is where it mounts.
215
237
  * @experimental
238
+ * @ruling §3.5, R25
216
239
  */
217
240
  export declare function componentFindings(components: readonly ComponentDecl[]): string[];
218
241
  /**
219
- * A package's widgets name its own components (R25): every genre panel with
242
+ * A package's widgets name its own components: every genre panel with
220
243
  * a `component` must name a `ComponentDecl` this package declares — a plugin
221
244
  * cannot mount core's or another plugin's component by slug.
222
245
  * @experimental
246
+ * @ruling R25
223
247
  */
224
248
  export declare function widgetComponentFindings(genres: readonly GenreDecl[], components: readonly ComponentDecl[]): string[];
225
249
  /**
226
- * A package's widgets (R71): each names a component the package declares
250
+ * A package's widgets: each names a component the package declares
227
251
  * (core's own widgets name core components — a plugin's cannot), and each id
228
252
  * is unique in the package, because the package's namespace plus the id is
229
253
  * the id every layout row keys on.
230
254
  * @experimental
255
+ * @ruling R71
231
256
  */
232
257
  export declare function packageWidgetFindings(widgets: readonly WidgetDecl[], components: readonly ComponentDecl[]): string[];
233
258
  /**
@@ -252,7 +277,11 @@ export declare function genreLayoutFindings(genres: readonly GenreDecl[], widget
252
277
  errors: string[];
253
278
  warnings: string[];
254
279
  };
255
- /** Deliberate holes: `todo()` sentinels found in config values, with their paths (24 §7). @experimental */
280
+ /**
281
+ * Deliberate holes: `todo()` sentinels found in config values, with their paths.
282
+ * @experimental
283
+ * @ruling 24 §7
284
+ */
256
285
  export declare function todoHoles(configs: readonly ConfigDecl[]): CoverageReport['todos'];
257
286
  /**
258
287
  * Every check above, over one package's declarations — what both authoring
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The checks a package's declarations get, whichever surface declared them (D-1).
2
+ * The checks a package's declarations get, whichever surface declared them.
3
3
  *
4
4
  * A package says the same things in two places. `announce()` collects them as a
5
5
  * builder and compiles the announcement document; `defineExtension()` carries
@@ -18,6 +18,7 @@
18
18
  * callers already enforce in their own words (one names the package namespace,
19
19
  * the other the plugin slug), and the identity display text, which only an
20
20
  * announcement has.
21
+ * @ruling D-1
21
22
  */
22
23
  import { coreWidgetIds, widgetReadsFindings } from './widgetDecls.js';
23
24
  import { COMPONENT_FRAMEWORKS } from './extension.js';
@@ -72,10 +73,11 @@ export function swapInputFindings(swaps) {
72
73
  /** A definition id as a swap must name one: `ns:kind/name@N`. */
73
74
  const DEFINITION_ID = /^[a-z0-9]+(?:[.-][a-z0-9]+)*:[a-z]+\/[a-z0-9]+(?:-[a-z0-9]+)*@\d+$/;
74
75
  /**
75
- * Swap contributions (R29): a package offers only its own definitions, never
76
+ * Swap contributions: a package offers only its own definitions, never
76
77
  * on its own specs (those list swaps on the node with `expose.swaps` — one
77
- * way to do each thing, R26), and each once.
78
+ * way to do each thing), and each once.
78
79
  * @experimental
80
+ * @ruling R29, R26
79
81
  */
80
82
  export function swapContributionFindings(swaps, ns, declaredSpecs) {
81
83
  const out = [];
@@ -103,10 +105,11 @@ export function swapContributionFindings(swaps, ns, declaredSpecs) {
103
105
  return out;
104
106
  }
105
107
  /**
106
- * The display text of one labelled declaration (R-20): `label` is required
108
+ * The display text of one labelled declaration: `label` is required
107
109
  * — a config, a preset and a prompt are all listed by it — `description` is
108
110
  * not.
109
111
  * @experimental
112
+ * @ruling R-20
110
113
  */
111
114
  export function labelFindings(at, meta) {
112
115
  return [
@@ -134,10 +137,11 @@ const nodesOf = (s) => s.nodes;
134
137
  /** The registered definition a node seats, when this SDK knows it. */
135
138
  const definitionOfNode = (n) => n ? getDefinition(`${n.definitionId}@${n.definitionVersion}`) : undefined;
136
139
  /**
137
- * A compiled document's `expose.swaps` (R28), checked as the builder checks
140
+ * A compiled document's `expose.swaps`, checked as the builder checks
138
141
  * them: known ids that do not fit are refused; ids this SDK does not know are
139
142
  * the instance's to check at install.
140
143
  * @experimental
144
+ * @ruling R28
141
145
  */
142
146
  export function exposeSwapFindings(pipelines) {
143
147
  const out = [];
@@ -156,10 +160,11 @@ export function exposeSwapFindings(pipelines) {
156
160
  return out;
157
161
  }
158
162
  /**
159
- * The input lock (24 §4): a spec that answers a session event names the genre it
163
+ * The input lock: a spec that answers a session event names the genre it
160
164
  * serves, and the event is one core declares or one this package namespaced.
161
165
  * A genre the package does not declare is recorded as a requirement.
162
166
  * @experimental
167
+ * @ruling 24 §4
163
168
  */
164
169
  export function inputLockFindings(pipelines, declaredGenres, ns, requires) {
165
170
  const out = [];
@@ -184,6 +189,11 @@ export function inputLockFindings(pipelines, declaredGenres, ns, requires) {
184
189
  out.push(`pipeline '${s.id}': ${notADeclaredEvent(event)}`);
185
190
  else if (event === sessionEvents.turnOrderChanged)
186
191
  out.push(`pipeline '${s.id}': ${TURN_ORDER_CHANGED_IS_INTERNAL}`);
192
+ // A core event is a requirement on the host's version: an older
193
+ // Serene Pub that lacks it refuses the install and says so, rather
194
+ // than installing a pipeline nothing can ever trigger.
195
+ else if (event.startsWith('core:event/'))
196
+ requires.add(event);
187
197
  }
188
198
  // The builder checks an `events` lock against its inlet (R33); a
189
199
  // compiled document handed in directly gets the same sentence here,
@@ -199,9 +209,10 @@ export function inputLockFindings(pipelines, declaredGenres, ns, requires) {
199
209
  }
200
210
  /**
201
211
  * The events an inlet lock answers: the one `event`, or the `events` list
202
- * (PLAN-turn-order §4.1) — as one list, so every reader of the lock asks
212
+ * — as one list, so every reader of the lock asks
203
213
  * one question. Empty for a spec with no lock.
204
214
  * @experimental
215
+ * @ruling PLAN-turn-order §4.1
205
216
  */
206
217
  export function lockedEvents(input) {
207
218
  if (!input)
@@ -212,7 +223,11 @@ export function lockedEvents(input) {
212
223
  }
213
224
  /** Does this lock answer `event` — as its one `event`, or one of its `events`? @experimental */
214
225
  export const lockAnswers = (input, event) => lockedEvents(input).includes(event);
215
- /** Exactly one create pipeline per declared genre (24 §3). @experimental */
226
+ /**
227
+ * Exactly one create pipeline per declared genre.
228
+ * @experimental
229
+ * @ruling 24 §3
230
+ */
216
231
  export function createPipelineFindings(genres, pipelines) {
217
232
  const out = [];
218
233
  for (const g of genres) {
@@ -249,12 +264,13 @@ export function genrePresetFindings(genres, presets) {
249
264
  return out;
250
265
  }
251
266
  /**
252
- * Contributed actions (R-15, U5c): each declaration sound, and one slash name
267
+ * Contributed actions: each declaration sound, and one slash name
253
268
  * meaning one function across the whole package — the per-document check cannot
254
269
  * see two specs of one package claiming `/acme.roll` for two different things,
255
270
  * so the package is the first place the collision rule runs across documents;
256
271
  * the install is the second.
257
272
  * @experimental
273
+ * @ruling R-15, U5c
258
274
  */
259
275
  export function contributedActionFindings(pipelines) {
260
276
  const out = [];
@@ -320,7 +336,11 @@ export function configFindings(configs, declaredSpecs, requires) {
320
336
  }
321
337
  return out;
322
338
  }
323
- /** Presets: validated against the genre's event surface, with the coverage (24 §7). @experimental */
339
+ /**
340
+ * Presets: validated against the genre's event surface, with the coverage.
341
+ * @experimental
342
+ * @ruling 24 §7
343
+ */
324
344
  export function presetFindings(presets, declaredGenres, declaredSpecs, configs, requires) {
325
345
  const errors = [];
326
346
  const coverage = [];
@@ -373,6 +393,8 @@ export function presetFindings(presets, declaredGenres, declaredSpecs, configs,
373
393
  const bound = declaredSpecs.get(binding.spec);
374
394
  if (!bound) {
375
395
  requires.add(binding.spec);
396
+ if (event.startsWith('core:event/'))
397
+ requires.add(event);
376
398
  slots.push({
377
399
  event,
378
400
  required: !!declared?.required,
@@ -471,10 +493,11 @@ export const COMPONENT_SLUG = /^[a-z][a-z0-9-]*$/;
471
493
  /** A component source hash: SHA-256, lowercase hex. */
472
494
  const SOURCE_HASH = /^[0-9a-f]{64}$/;
473
495
  /**
474
- * Components (§3.5, R25): one slug, a label, a servable entry and a
496
+ * Components: one slug, a label, a servable entry and a
475
497
  * framework SDK 1.0 ships. There is no mount point on the declaration — a
476
498
  * widget names the component, and that is where it mounts.
477
499
  * @experimental
500
+ * @ruling §3.5, R25
478
501
  */
479
502
  export function componentFindings(components) {
480
503
  const out = [];
@@ -514,10 +537,11 @@ export function componentFindings(components) {
514
537
  return out;
515
538
  }
516
539
  /**
517
- * A package's widgets name its own components (R25): every genre panel with
540
+ * A package's widgets name its own components: every genre panel with
518
541
  * a `component` must name a `ComponentDecl` this package declares — a plugin
519
542
  * cannot mount core's or another plugin's component by slug.
520
543
  * @experimental
544
+ * @ruling R25
521
545
  */
522
546
  export function widgetComponentFindings(genres, components) {
523
547
  const declared = new Set(components.map((c) => c?.slug).filter(Boolean));
@@ -533,11 +557,12 @@ export function widgetComponentFindings(genres, components) {
533
557
  return out;
534
558
  }
535
559
  /**
536
- * A package's widgets (R71): each names a component the package declares
560
+ * A package's widgets: each names a component the package declares
537
561
  * (core's own widgets name core components — a plugin's cannot), and each id
538
562
  * is unique in the package, because the package's namespace plus the id is
539
563
  * the id every layout row keys on.
540
564
  * @experimental
565
+ * @ruling R71
541
566
  */
542
567
  export function packageWidgetFindings(widgets, components) {
543
568
  const declared = new Set(components.map((c) => c?.slug).filter(Boolean));
@@ -613,7 +638,11 @@ export function genreLayoutFindings(genres, widgets, ns) {
613
638
  }
614
639
  return { errors, warnings };
615
640
  }
616
- /** Deliberate holes: `todo()` sentinels found in config values, with their paths (24 §7). @experimental */
641
+ /**
642
+ * Deliberate holes: `todo()` sentinels found in config values, with their paths.
643
+ * @experimental
644
+ * @ruling 24 §7
645
+ */
617
646
  export function todoHoles(configs) {
618
647
  const out = [];
619
648
  for (const c of configs)
@@ -666,7 +695,9 @@ export function declarationFindings(p) {
666
695
  errors,
667
696
  warnings: layouts.warnings,
668
697
  coverage: { presets: presets.coverage, todos: todoHoles(configs) },
669
- requires: [...requires].sort(),
698
+ // Never the package's own ids: core locks on its own events and
699
+ // requires nothing of itself.
700
+ requires: [...requires].filter((id) => !id.startsWith(`${p.ns}:`)).sort(),
670
701
  };
671
702
  }
672
703
  /**