@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
package/dist/builder.d.ts CHANGED
@@ -1,29 +1,32 @@
1
1
  /**
2
- * The builder (04 §4). Kind-named methods — `.inlet() .query() .task() .oracle()
2
+ * The builder. Kind-named methods — `.inlet() .query() .task() .oracle()
3
3
  * .outlet()` — so reading a spec top to bottom shows the effect taxonomy, and so
4
4
  * the type system can enforce laws that a generic .step() could only find at
5
- * validation time (04 §4a). Clauses are `.gather() .each() .loop() .junction()`
6
- * (R-14, ruled 2026-09-15).
5
+ * validation time. Clauses are `.gather() .each() .loop() .junction()`.
7
6
  *
8
7
  * The chain is a *value*. It compiles to a document; SP imports the document and
9
- * never this code (F6).
8
+ * never this code.
10
9
  *
11
10
  * Every node method takes either a pinned constructor or a **callback that receives the
12
11
  * scope** — `$ => C.assemble({ messages: $.history.messages })`. The callback form is
13
12
  * preferred: it types the node key and the port, and it makes a forward reference
14
13
  * impossible to write rather than a finding to read (src/scope.ts). Both forms compile
15
14
  * to the same rows.
15
+ * @ruling 04 §4, 04 §4a, R-14 (2026-09-15), F6
16
16
  */
17
17
  import { type NodeSpec, type Kind, type PortDecl, type OutPortsOf, type Descriptor } from './descriptors.js';
18
18
  import { ITEM, type Scope } from './scope.js';
19
19
  import { type DataRef } from './refs.js';
20
+ import type { LoadoutId, LoadoutRef, Prefers } from './loadouts.js';
20
21
  import type { SessionShape } from './descriptors.js';
21
22
  import type { TemplateValue } from './engines.js';
22
23
  import { type EnvoyDecl, type GenreDecl } from './genres.js';
23
24
  import type { ExternalRef } from './announce.js';
24
25
  import { type SessionEventDecl } from './events.js';
25
26
  import { type I18n } from './i18n.js';
27
+ import type { VariableDecl, VariableId } from './variables.js';
26
28
  import { type ActionDecl } from './actions.js';
29
+ import { type BoundaryTriggerDecl } from './sceneSettings.js';
27
30
  /** @experimental */
28
31
  export interface SpecMeta {
29
32
  /**
@@ -41,10 +44,11 @@ export interface SpecMeta {
41
44
  */
42
45
  owner?: string;
43
46
  /**
44
- * For the genre's create pipeline this carries the genre's declaration
45
- * (24 §3): display name, family, standing `SessionShape`, event surface.
47
+ * For the genre's create pipeline this carries the genre's declaration:
48
+ * display name, family, standing `SessionShape`, event surface.
46
49
  * Stored on the version row so shape checks stay SELECTs, never document
47
50
  * loads.
51
+ * @ruling 24 §3
48
52
  */
49
53
  genre?: {
50
54
  name: unknown;
@@ -53,32 +57,36 @@ export interface SpecMeta {
53
57
  description?: unknown;
54
58
  shape?: SessionShape;
55
59
  /**
56
- * The genre's event surface (24 §5), persisted with the declaration
60
+ * The genre's event surface, persisted with the declaration
57
61
  * so "which events exist and which are required" stays a SELECT —
58
62
  * the genre dashboard and the preset editor read it off the row.
63
+ * @ruling 24 §5
59
64
  */
60
65
  events?: Record<string, {
61
66
  required?: boolean;
62
67
  open?: boolean;
63
68
  }>;
64
69
  /**
65
- * The genre's envoys (R-18), persisted with the declaration for the
70
+ * The genre's envoys, persisted with the declaration for the
66
71
  * same reason the events are: a host reads "which speakers does this
67
72
  * genre bring" off the create spec's row, never from the running
68
73
  * registry — which is also what makes them part of the spec's hash.
74
+ * @ruling R-18
69
75
  */
70
76
  envoys?: readonly EnvoyDecl[];
71
77
  /**
72
- * What a person's persona-less line is called (R4), persisted with the
78
+ * What a person's persona-less line is called, persisted with the
73
79
  * declaration on the same terms as the envoys: the host names those
74
80
  * lines off the create spec's row. See `GenreDecl.playerLabel`.
81
+ * @ruling R4
75
82
  */
76
83
  playerLabel?: unknown;
77
84
  /**
78
- * The genre's pinned settings (PLAN-turn-order §4.13), persisted
85
+ * The genre's pinned settings, persisted
79
86
  * with the declaration on the same terms as the envoys: the host
80
87
  * resolves the settings cascade off the create spec's row, never
81
88
  * from the running registry. See `GenreDecl.settings`.
89
+ * @ruling PLAN-turn-order §4.13
82
90
  */
83
91
  settings?: Readonly<Record<string, unknown>>;
84
92
  };
@@ -94,17 +102,18 @@ export interface SpecMeta {
94
102
  */
95
103
  taxonomy?: SpecTaxonomy;
96
104
  /**
97
- * What this spec contributes to *other* surfaces (19 §3–§4). **Actions**
105
+ * What this spec contributes to *other* surfaces. **Actions**
98
106
  * are the first kind: "I offer this function on sessions of that genre,
99
107
  * at these venues" — the narrate spec contributes the narrator button to
100
108
  * the standard genre, and the genre never has to know. Rides the document
101
109
  * (hashed with it, stored with it, exported with it), so contribution is
102
110
  * content, not registration.
103
111
  *
104
- * The action model (plans/29 R-15, 30 §U5c): every action declares a
112
+ * The action model: every action declares a
105
113
  * **venue** (where, per channel), an **audience** (who sees, who acts),
106
114
  * `quick` (primary set or overflow), a **slash name** and a localised
107
115
  * `label` — see `actions.ts`.
116
+ * @ruling 19 §3–§4, plans/29 R-15, 30 §U5c
108
117
  */
109
118
  contributes?: {
110
119
  /**
@@ -114,6 +123,14 @@ export interface SpecMeta {
114
123
  actions?: Array<Omit<ActionDecl, 'genre'> & {
115
124
  genre?: never;
116
125
  }>;
126
+ /**
127
+ * 🚧 The genre's own **boundary triggers** (live scenes ★9, ruled
128
+ * 2026-10-13) — a summarize-scene spec's, written by
129
+ * `summarizeScene(…, { boundaries })`: deterministic predicates the
130
+ * host's boundary watcher reads beside core's, each a session switch.
131
+ * Refused here when one does not read (`boundaryTriggerFindings`).
132
+ */
133
+ boundaryTriggers?: BoundaryTriggerDecl[];
117
134
  };
118
135
  }
119
136
  /**
@@ -125,16 +142,18 @@ export interface SpecMeta {
125
142
  export interface SpecTaxonomy {
126
143
  /**
127
144
  * What the pipeline is to its genre: `create` instantiates sessions of its
128
- * type (23 §7 — the required one; the spec IS the session type), `primary`
145
+ * type (the required one; the spec IS the session type), `primary`
129
146
  * carries the main turn, `action` is invoked by a person or trigger,
130
147
  * `maintenance` runs off the critical path (summaries, graph builds).
148
+ * @ruling 23 §7
131
149
  */
132
150
  role?: 'create' | 'primary' | 'action' | 'maintenance';
133
151
  /**
134
- * The one session genre this spec serves — a genre id (24 §3), e.g.
152
+ * The one session genre this spec serves — a genre id, e.g.
135
153
  * `core:genre/chat`. **Never written by an author**: `.inlet()`
136
154
  * copies it from the lock, so the catalogue and the lock cannot
137
155
  * disagree. A document read back carries it.
156
+ * @ruling 24 §3
138
157
  */
139
158
  genre?: never;
140
159
  }
@@ -152,32 +171,32 @@ export interface BuiltNode {
152
171
  position: number;
153
172
  /**
154
173
  * Where this node's controls may be shown beyond the admin's pipeline
155
- * panel (PLAN-turn-order §4.11, R12). `session: true` marks the node's
174
+ * panel. `session: true` marks the node's
156
175
  * rebind (on a strategy node) or its params as a **declared session
157
176
  * setting**: the session settings form renders a card for the spec with
158
177
  * exactly the marked keys, and nothing else. Stored in the document, so
159
178
  * the form reads it off the registry. Absent = admin panel only.
160
179
  *
161
- * `swaps` (R28, the modder pass): the definition ids a session may seat
180
+ * `swaps`: the definition ids a session may seat
162
181
  * here instead of the pin, in the order a picker lists them. The pin is
163
182
  * the default and is always offered first, so it is never listed. Present
164
183
  * only when non-empty; a node with swaps is always `session: true`.
165
184
  *
166
- * `stream` and `status` (lair pass B3/B18, ruled 2026-09-27, D6/D5) are
185
+ * `stream` and `status` are
167
186
  * what the node shows **while it runs**:
168
187
  *
169
188
  * · `stream: true` — **the streaming step**: this oracle's tokens are
170
189
  * the reply's prose, routed into the run's live row as they arrive.
171
- * Declared, never inferred (D6): a spec that marks nothing streams
190
+ * Declared, never inferred: a spec that marks nothing streams
172
191
  * nothing and shows its status until the write lands. At most one on
173
192
  * any single execution path — steps in mutually exclusive branches of
174
- * one junction may each stream, and the one that runs does (W2) — an
193
+ * one junction may each stream, and the one that runs does — an
175
194
  * oracle with a streaming out-port — a JSON step never
176
195
  * streams — and never inside an `each` or a `loop`; `validate()`
177
196
  * refuses the rest (law `streaming step`).
178
197
  * · `status` — **the step status**: the sentence the row and the
179
198
  * progress card show while this node runs (*Planning the turn*), a
180
- * string or a locale map (R-20), `{speaker}` filled by the host. It
199
+ * string or a locale map, `{speaker}` filled by the host. It
181
200
  * wins over any status the node's own handler sets, for this node
182
201
  * only.
183
202
  *
@@ -194,8 +213,9 @@ export interface BuiltNode {
194
213
  * (`isModelCall`); no other step heads a group, so a purpose anywhere
195
214
  * else would never be read.
196
215
  *
197
- * Display text (R-20), hashed with the document like `status`: a spec that
216
+ * Display text, hashed with the document like `status`: a spec that
198
217
  * sets neither hashes as it always did.
218
+ * @ruling PLAN-turn-order §4.11, R12, R28, lair pass B3/B18 (2026-09-27), D6/D5, W2, R-20
199
219
  */
200
220
  expose?: {
201
221
  session?: boolean;
@@ -205,9 +225,22 @@ export interface BuiltNode {
205
225
  label?: I18n;
206
226
  purpose?: I18n;
207
227
  };
228
+ /** The placement's `prefers`, when stated — see `NodeOpts.prefers`. */
229
+ prefers?: Prefers;
230
+ /**
231
+ * What this placement's rendered keys **mean** (owner ruling 2026-10-13):
232
+ * a key its definition's `variables` slot renders, re-pointed at another
233
+ * registered variable — `{ characterLore: 'acme:var/ranked-lore@1' }`.
234
+ * The key stays the template's word; the variable decides which layouts
235
+ * the picker offers, the default row, the floor and the absence rule.
236
+ * Stated by the spec's author, hashed with the document, never by a
237
+ * config or a session. Present only when stated.
238
+ * @ruling PROPOSAL-variable-layout-accounting ★2, ★5
239
+ */
240
+ renders?: Record<string, VariableId>;
208
241
  }
209
242
  /**
210
- * One branch's condition (20 §10). Exactly one of `equals` / `equalsPath` /
243
+ * One branch's condition. Exactly one of `equals` / `equalsPath` /
211
244
  * `truthy` / `default` per predicate; `path` narrows what the condition reads
212
245
  * off the junction's value (dot path, e.g. `call.tool`). Deliberately not a
213
246
  * rules engine — a decision too rich for this table belongs in a Task that
@@ -217,6 +250,7 @@ export interface BuiltNode {
217
250
  * so a branch and a greyed button can never mean two different things by the
218
251
  * same words.
219
252
  * @experimental
253
+ * @ruling 20 §10
220
254
  */
221
255
  export interface JunctionPredicate {
222
256
  /** Dot path read off the junction's value first. Absent = the value itself. */
@@ -225,7 +259,7 @@ export interface JunctionPredicate {
225
259
  equals?: unknown;
226
260
  /**
227
261
  * Fires when the value strictly equals the value at **another path on the
228
- * same junction value** (D-4a, 2026-09-17) — `{ path: 'accused',
262
+ * same junction value** — `{ path: 'accused',
229
263
  * equalsPath: 'culprit' }` over a task publishing both.
230
264
  *
231
265
  * `equals` takes a literal, so without this a branch could ask *is the
@@ -233,6 +267,7 @@ export interface JunctionPredicate {
233
267
  * question a genre that DERIVES its hidden fact has to ask. ⚠ Either side
234
268
  * absent fires nothing: two unwired ports must not compare equal and route
235
269
  * the branch that means *you got it right*.
270
+ * @ruling D-4a (2026-09-17)
236
271
  */
237
272
  equalsPath?: string;
238
273
  /** Fires when the value is truthy. */
@@ -241,7 +276,7 @@ export interface JunctionPredicate {
241
276
  default?: boolean;
242
277
  }
243
278
  /**
244
- * The four clause rules (R-14, ruled 2026-09-15). A **clause** is a container of
279
+ * The four clause rules. A **clause** is a container of
245
280
  * nodes with a repetition or branching rule of its own: **gather** collects
246
281
  * several chains (was `async`; `mode` is a setting and, by the equivalence law,
247
282
  * unobservable), **each** runs once per item (was `map`), **loop** repeats
@@ -249,6 +284,7 @@ export interface JunctionPredicate {
249
284
  * fired (was `route`). Stored documents say these words; the content hash
250
285
  * moved once, with the kinds.
251
286
  * @experimental
287
+ * @ruling R-14 (2026-09-15)
252
288
  */
253
289
  export type ClauseKind = 'gather' | 'each' | 'loop' | 'junction';
254
290
  /** @experimental */
@@ -278,7 +314,8 @@ export interface BuiltClause {
278
314
  * junction only. The value the branches are chosen on — a port reference
279
315
  * resolved when the clause runs. A reference for the same reason
280
316
  * `repeatWhile` is one: the construct stays renderable ("junction on
281
- * parse.call") and no second expression language enters the design (20 §10).
317
+ * parse.call") and no second expression language enters the design.
318
+ * @ruling 20 §10
282
319
  */
283
320
  on?: unknown;
284
321
  /**
@@ -297,28 +334,34 @@ export interface BuiltClause {
297
334
  position: number;
298
335
  }
299
336
  /**
300
- * A preset the **spec author** ships — "Balanced", "Lore-heavy", "Fast" (12 §3).
337
+ * A preset the **spec author** ships — "Balanced", "Lore-heavy", "Fast".
301
338
  *
302
339
  * The scope chain's layer 5 is a single author default per slot, which is enough for one
303
340
  * opinion and no help at all for "here are three coherent ways to run this." Named author
304
341
  * presets fill that, and they need no schema: they seed `config_presets` and
305
342
  * `node_overrides` rows at `scope_kind='config'` on install, which both already exist.
306
343
  *
307
- * Two rulings ride on this — see 12 §3a.
344
+ * Two rules ride on this: the `slug` is the identity, and the `owner` decides
345
+ * what an uninstall removes.
308
346
  * @experimental
347
+ * @ruling 12 §3, 12 §3a
309
348
  */
310
349
  export interface BuiltPreset {
311
350
  /**
312
351
  * **The identity.** Stable, PK-agnostic, and the reference an update or a defaults
313
- * sync matches on — same convention as the events registry (13 §7g), now applied to
352
+ * sync matches on — same convention as the events registry, now applied to
314
353
  * every seeded row rather than to events alone.
315
354
  *
316
355
  * The consequence worth knowing: the slug is the identity and the label is the
317
356
  * display, so renaming "Lore-heavy" to "World-focused" is free and keeps every
318
357
  * user's selection intact. Changing the *slug* is a delete plus a create.
358
+ * @ruling 13 §7g
319
359
  */
320
360
  slug: string;
321
- /** The name a picker lists it by — a string or a locale map with `en` (R-20). */
361
+ /**
362
+ * The name a picker lists it by — a string or a locale map with `en`.
363
+ * @ruling R-20
364
+ */
322
365
  label: I18n;
323
366
  description?: I18n;
324
367
  /** At most one author preset may be the shipped default. */
@@ -328,7 +371,8 @@ export interface BuiltPreset {
328
371
  * stated explicitly only in the case that justifies the field existing: a **preset
329
372
  * pack** — a plugin shipping presets for a pipeline someone else ships. Uninstalling
330
373
  * the pack must remove its presets and leave the pipeline alone, which is only
331
- * decidable if the preset says who it belongs to (12 §3b).
374
+ * decidable if the preset says who it belongs to.
375
+ * @ruling 12 §3b
332
376
  */
333
377
  owner?: string;
334
378
  /** Flat override rows, exactly the shape `node_overrides` stores. */
@@ -344,23 +388,30 @@ export interface BuiltSpec {
344
388
  meta: SpecMeta;
345
389
  nodes: BuiltNode[];
346
390
  clauses: BuiltClause[];
347
- /** Fragments included, recorded for provenance after expansion (16 §3a). */
391
+ /**
392
+ * Fragments included, recorded for provenance after expansion.
393
+ * @ruling 16 §3a
394
+ */
348
395
  includes: Array<{
349
396
  key: string;
350
397
  fragmentId: string;
351
398
  }>;
352
- /** Author-shipped named configurations (12 §3a). Round-trips with the document (F4). */
399
+ /**
400
+ * Author-shipped named configurations. Round-trips with the document.
401
+ * @ruling 12 §3a, F4
402
+ */
353
403
  presets: BuiltPreset[];
354
404
  /**
355
- * The usage lock (24 §4): the session event this spec's input answers,
405
+ * The usage lock: the session event this spec's input answers,
356
406
  * and the genre it serves. Declared on `.input()`, serialized with the
357
407
  * document, hashed with it, enforced at compile, publish and dispatch.
358
408
  *
359
- * `events` (PLAN-turn-order §4.1, 2026-09-21): the alternative to one
409
+ * `events`: the alternative to one
360
410
  * `event` — a spec that answers several session events (the turn-order
361
411
  * spec answers nine). A dispatched event is accepted when it is the
362
412
  * locked `event` or is in `events`. Preset bindings are unchanged: a
363
413
  * spec bound to N events has N binding rows.
414
+ * @ruling 24 §4, PLAN-turn-order §4.1 (2026-09-21)
364
415
  */
365
416
  input?: {
366
417
  genre?: string;
@@ -371,16 +422,17 @@ export interface BuiltSpec {
371
422
  /** What a node method accepts: the value, or a function of the scope that returns it. @experimental */
372
423
  export type NodeArg<N, Nodes extends Record<string, PortDecl>> = N | (($: Scope<Nodes>) => N);
373
424
  /**
374
- * The optional third argument of a node method (PLAN-turn-order §4.11):
425
+ * The optional third argument of a node method:
375
426
  * `{ expose: { session: true } }` marks the node's controls as a declared
376
427
  * session setting — see `BuiltNode.expose`. Additive: every existing call
377
428
  * passes nothing and lands exactly the row it landed before.
378
429
  *
379
- * `swaps` (R28) lists the pins a session may seat instead of this node's —
430
+ * `swaps` lists the pins a session may seat instead of this node's —
380
431
  * pins, not strings, so a typo is a compile error and the fit is checked
381
432
  * here: each must be the same kind with the same in- and out-ports, by name
382
433
  * and shape. Listing swaps implies `session: true`.
383
434
  * @experimental
435
+ * @ruling PLAN-turn-order §4.11, R28
384
436
  */
385
437
  export interface NodeOpts {
386
438
  expose?: {
@@ -389,15 +441,37 @@ export interface NodeOpts {
389
441
  readonly id: string;
390
442
  readonly descriptor: Descriptor<any, any, any>;
391
443
  }[];
392
- /** This oracle is the streaming step — see `BuiltNode.expose` (B3, D6). */
444
+ /**
445
+ * This oracle is the streaming step — see `BuiltNode.expose`.
446
+ * @ruling B3, D6
447
+ */
393
448
  stream?: true;
394
- /** The step status shown while this node runs — see `BuiltNode.expose` (B18, D5). */
449
+ /**
450
+ * The step status shown while this node runs — see `BuiltNode.expose`.
451
+ * @ruling B18, D5
452
+ */
395
453
  status?: I18n;
396
454
  /** The step label: this step's name in settings — see `BuiltNode.expose`. */
397
455
  label?: I18n;
398
456
  /** The step purpose: what this model call is for, under its settings heading — see `BuiltNode.expose`. */
399
457
  purpose?: I18n;
400
458
  };
459
+ /**
460
+ * What this step runs best on — overrides the definition's own
461
+ * `Descriptor.prefers` for this placement. A suggestion, never a gate.
462
+ */
463
+ prefers?: Prefers;
464
+ /**
465
+ * What this placement's rendered keys mean — see `BuiltNode.renders`. A
466
+ * declaration or its id; each key must be one the definition's
467
+ * `variables` slot renders, and the variable must be registered with the
468
+ * key in its scope. Refused here, naming the fix.
469
+ *
470
+ * ```ts
471
+ * .task('prompt', ($) => C.assemble.v2({ … }), { renders: { characterLore: varRankedLore } })
472
+ * ```
473
+ */
474
+ renders?: Readonly<Record<string, VariableDecl | VariableId>>;
401
475
  }
402
476
  /**
403
477
  * Whether a definition is a **model call**: an oracle that declares a
@@ -416,10 +490,11 @@ export declare function isModelCall(def: {
416
490
  export declare const stepPurposeRefusal: (key: string, definitionId: string) => string;
417
491
  /**
418
492
  * A pinned constructor of a given kind. Constraining each method to its own kind makes
419
- * `.query('x', C.generateText())` a **compile** error rather than a throw — 04 §4a said
420
- * the method names the kind, and this is that claim actually enforced by the type system
493
+ * `.query('x', C.generateText())` a **compile** error rather than a throw — the method
494
+ * names the kind, and this is that claim actually enforced by the type system
421
495
  * instead of by a message at authoring time.
422
496
  * @experimental
497
+ * @ruling 04 §4a
423
498
  */
424
499
  export type NodeOf<K extends Kind> = NodeSpec<Descriptor<any, any> & {
425
500
  kind: K;
@@ -432,9 +507,10 @@ export type NodeOf<K extends Kind> = NodeSpec<Descriptor<any, any> & {
432
507
  */
433
508
  export type EachOver<Nodes extends Record<string, PortDecl>> = (($: Scope<Nodes>) => DataRef) | DataRef | readonly unknown[];
434
509
  /**
435
- * Node keys accumulate **fully qualified**, exactly as they land in the rows (F21) — so
510
+ * Node keys accumulate **fully qualified**, exactly as they land in the rows — so
436
511
  * a node declared inside a clause enters the scope as `gather.semantic.embed`, and the
437
512
  * scope type expands the dots back into a path (src/scope.ts).
513
+ * @ruling F21
438
514
  */
439
515
  type Qualify<Prefix extends string, K extends string> = Prefix extends '' ? K : `${Prefix}.${K}`;
440
516
  type Add<Nodes extends Record<string, PortDecl>, K extends string, N> = Nodes & {
@@ -459,16 +535,20 @@ export type BranchPorts = {
459
535
  ok: string;
460
536
  };
461
537
  /**
462
- * What a junction publishes (M4, PLAN-turn-order §4.14): the clause ports,
538
+ * What a junction publishes: the clause ports,
463
539
  * and the fired branch's own ports beside them — `$.decide.order`. Open at
464
540
  * the type level (any port name reads); `validate()` holds the document to
465
541
  * ports every branch's last node actually publishes, with one shape.
466
542
  * @experimental
543
+ * @ruling M4, PLAN-turn-order §4.14
467
544
  */
468
545
  export type JunctionPorts = BranchPorts & {
469
546
  [port: string]: string;
470
547
  };
471
- /** Namespace a fragment's nodes under the include key, at publish and in the type (16 §3a). */
548
+ /**
549
+ * Namespace a fragment's nodes under the include key, at publish and in the type.
550
+ * @ruling 16 §3a
551
+ */
472
552
  type Prefixed<K extends string, M> = {
473
553
  [P in keyof M & string as `${K}.${P}`]: M[P];
474
554
  };
@@ -490,15 +570,19 @@ declare class ChainBuilder<Nodes extends Record<string, PortDecl> = {}, Prefix e
490
570
  /** Where a clause declared here sits, so clauses nest exactly as nodes do. */
491
571
  protected declareClause(b: Omit<BuiltClause, 'clauseId' | 'clauseChain' | 'position'>): BuiltClause;
492
572
  /**
493
- * A **gather** clause: several chains collected and awaited together (01 §4).
494
- * `mode` is a setting — by the equivalence law (C8) parallel and sequential
573
+ * A **gather** clause: several chains collected and awaited together.
574
+ * `mode` is a setting — by the equivalence law parallel and sequential
495
575
  * are unobservable, which is why the construct is named for what it does
496
576
  * (gather) and not for how (was `.async()`).
577
+ * @ruling 01 §4, C8
497
578
  */
498
579
  gather<Id extends string, R extends GatherBuilder<any, any>>(id: Id, opts: {
499
580
  mode?: 'sequential' | 'parallel';
500
581
  }, fn: (b: GatherBuilder<Nodes, Qualify<Prefix, Id>>) => R): ChainBuilder<AddPorts<NodesOf<R>, Qualify<Prefix, Id>, BranchPorts>, Prefix>;
501
- /** An **each** clause: one contained chain, once per item of a list (01 §4). Was `.map()`. */
582
+ /**
583
+ * An **each** clause: one contained chain, once per item of a list. Was `.map()`.
584
+ * @ruling 01 §4
585
+ */
502
586
  each<Id extends string, R extends ChainBuilder<any, any>>(id: Id, opts: {
503
587
  over: EachOver<Nodes>;
504
588
  max: number;
@@ -508,7 +592,7 @@ declare class ChainBuilder<Nodes extends Record<string, PortDecl> = {}, Prefix e
508
592
  }, `${Qualify<Prefix, Id>}.item`>) => R): ChainBuilder<AddPorts<NodesOf<R>, Qualify<Prefix, Id>, BranchPorts>, Prefix>;
509
593
  /**
510
594
  * One contained chain, repeated while a declared port stays truthy — bounded by a
511
- * mandatory `max` (01 §4a).
595
+ * mandatory `max`.
512
596
  *
513
597
  * This is the construct that makes tool-calling expressible on the spine. It is **not
514
598
  * a back-edge**: like `each`, the repetition lives in the clause's declaration rather
@@ -517,6 +601,7 @@ declare class ChainBuilder<Nodes extends Record<string, PortDecl> = {}, Prefix e
517
601
  * instead of a list length.
518
602
  *
519
603
  * Always sequential — each iteration depends on the last, so `mode` would be a lie.
604
+ * @ruling 01 §4a
520
605
  */
521
606
  loop<Id extends string, R extends ChainBuilder<any, any>>(id: Id, opts: {
522
607
  repeatWhile: (($: Scope<any>) => DataRef) | DataRef;
@@ -526,18 +611,19 @@ declare class ChainBuilder<Nodes extends Record<string, PortDecl> = {}, Prefix e
526
611
  resolvePublic<N>(arg: NodeArg<N, any>): N;
527
612
  /**
528
613
  * A **junction** clause (was `.route()`): branches selected by declared
529
- * predicates over a value on the spine (20 §10). Any subset fires — one,
614
+ * predicates over a value on the spine. Any subset fires — one,
530
615
  * several, or none — plus an optional `otherwise` that fires exactly when
531
616
  * nothing else did. The decision is *data a task computed* (the value the
532
617
  * junction is `on`); the branching is declaration; the receipt records
533
618
  * every predicate's evaluation, fired and skipped alike. Not a back-edge
534
619
  * and not code in the executor — the loop clause's whole argument, applied
535
- * to fan-out. 01 §4 amended: branching exists as a declared junction; no
620
+ * to fan-out. Branching exists as a declared junction; there are no
536
621
  * back-edges.
537
622
  *
538
623
  * Skipped branches publish `halt('not selected')` results marked
539
624
  * `fired: false`; the union's `ok`/`values` read the *fired* branches, so
540
- * downstream folds see what ran, in declaration order (13 §1).
625
+ * downstream folds see what ran, in declaration order.
626
+ * @ruling 20 §10, 01 §4 amended, 13 §1
541
627
  */
542
628
  junction<Id extends string, R extends JunctionBuilder<any, any>>(id: Id, opts: {
543
629
  on: (($: Scope<any>) => DataRef) | DataRef;
@@ -576,16 +662,20 @@ export declare class JunctionBuilder<Nodes extends Record<string, PortDecl> = {}
576
662
  otherwise<Name extends string, R extends ChainBuilder<any, any>>(name: Name, fn: (c: ChainBuilder<Nodes, Qualify<Id, Name>>) => R): JunctionBuilder<NodesOf<R>, Id>;
577
663
  }
578
664
  /**
579
- * Slot-named methods, for the same reason the chain has kind-named ones (04 §4a): the
665
+ * Slot-named methods, for the same reason the chain has kind-named ones: the
580
666
  * method names the slot, so setting a slot a node never declared is caught by name rather
581
667
  * than becoming an override row that silently matches nothing.
582
668
  * @experimental
669
+ * @ruling 04 §4a
583
670
  */
584
671
  export declare class PresetBuilder<Nodes extends Record<string, PortDecl> = {}> {
585
672
  private preset;
586
673
  constructor(preset: BuiltPreset);
587
674
  private set;
588
- /** Node behaviour knobs — retrieval `weight`, `minInclude`, `topK` (12 §2). */
675
+ /**
676
+ * Node behaviour knobs — retrieval `weight`, `minInclude`, `topK`.
677
+ * @ruling 12 §2
678
+ */
589
679
  params(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
590
680
  /** Authored text fields the node declares. */
591
681
  prompts(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
@@ -595,6 +685,13 @@ export declare class PresetBuilder<Nodes extends Record<string, PortDecl> = {}>
595
685
  sampling(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
596
686
  /** Node toggles and the review position. */
597
687
  settings(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
688
+ /**
689
+ * The **loadout** this model call runs on — `slot.loadout(id)` or the
690
+ * id itself. Unlike a connection this is allowed in an author preset: a
691
+ * loadout names no compute of the user's (a shipped one has no pair), it
692
+ * names the *kind* of engine, and the admin fills or merges it.
693
+ */
694
+ loadout(nodeKey: keyof Nodes & string, value: LoadoutRef | LoadoutId): this;
598
695
  }
599
696
  /** @experimental */
600
697
  export declare class SpecBuilder<Nodes extends Record<string, PortDecl> = {}> extends ChainBuilder<Nodes> {
@@ -605,7 +702,7 @@ export declare class SpecBuilder<Nodes extends Record<string, PortDecl> = {}> ex
605
702
  oracle<K extends string, N extends NodeOf<'oracle'>>(key: K, node: NodeArg<N, Nodes>, opts?: NodeOpts): SpecBuilder<Add<Nodes, K, N>>;
606
703
  outlet<K extends string, N extends NodeOf<'outlet'>>(key: K, node: NodeArg<N, Nodes>, opts?: NodeOpts): SpecBuilder<Add<Nodes, K, N>>;
607
704
  /**
608
- * A named configuration the spec ships with (12 §3a). Declared **after** the nodes,
705
+ * A named configuration the spec ships with. Declared **after** the nodes,
609
706
  * so the node keys it addresses are the ones that exist — same accumulation the
610
707
  * scope uses, so a typo is a compile error rather than a dead override row.
611
708
  *
@@ -615,6 +712,7 @@ export declare class SpecBuilder<Nodes extends Record<string, PortDecl> = {}> ex
615
712
  * .prompts ('generate', { system: LORE_SYSTEM })
616
713
  * .template('prompt', jinja(LORE_ASSEMBLY)))
617
714
  * ```
715
+ * @ruling 12 §3a
618
716
  */
619
717
  preset(slug: string, meta: {
620
718
  label: I18n;
@@ -623,15 +721,16 @@ export declare class SpecBuilder<Nodes extends Record<string, PortDecl> = {}> ex
623
721
  owner?: string;
624
722
  }, fn: (p: PresetBuilder<Nodes>) => unknown): this;
625
723
  /**
626
- * Exactly one **inlet**, positionally first (01 §2). Enforced here rather than
724
+ * Exactly one **inlet**, positionally first. Enforced here rather than
627
725
  * by the validator, so it is a throw at authoring time.
628
726
  *
629
- * The optional third argument is the **usage lock** (24 §4): the session
727
+ * The optional third argument is the **usage lock**: the session
630
728
  * event this inlet answers and the genre it serves. A session-event spec
631
729
  * without it does not compile — required for now, and relaxing later
632
730
  * (`genre: string[]`, `"*"`) is additive, never breaking. **The lock is the
633
- * only subscription** (R-4, 09-B B5): `.on()` and `subscribes` were deleted
731
+ * only subscription**: `.on()` and `subscribes` were deleted
634
732
  * 2026-09-16 — nothing read them at dispatch.
733
+ * @ruling 01 §2, 24 §4, R-4, 09-B B5
635
734
  */
636
735
  inlet<K extends string, N extends NodeOf<'inlet'>>(key: K, node: N, binding?: {
637
736
  genre: GenreDecl | ExternalRef;
@@ -658,7 +757,10 @@ export declare class SpecBuilder<Nodes extends Record<string, PortDecl> = {}> ex
658
757
  on: (($: Scope<any>) => DataRef) | DataRef;
659
758
  mode?: 'sequential' | 'parallel';
660
759
  }, fn: (r: JunctionBuilder<Nodes, Id>) => R): SpecBuilder<AddPorts<NodesOf<R>, Id, JunctionPorts>>;
661
- /** Compile-time include — expanded here, so rows hold the flat chain (16 §3a). */
760
+ /**
761
+ * Compile-time include — expanded here, so rows hold the flat chain.
762
+ * @ruling 16 §3a
763
+ */
662
764
  include<K extends string, F extends Fragment<any>>(key: K, fragment: F): SpecBuilder<Nodes & Prefixed<K, F extends Fragment<infer M> ? M : {}>>;
663
765
  build(): BuiltSpec;
664
766
  }
@@ -667,8 +769,9 @@ export declare function spec(id: string, meta: SpecMeta): SpecBuilder<{}>;
667
769
  /**
668
770
  * A fragment carries its node map in its type, so `.include('ctx', contextInfill)` puts
669
771
  * `ctx.embed`, `ctx.search`, `ctx.merge` into the including spec's scope — namespaced by
670
- * the include key in the type exactly as they are namespaced in the rows (16 §3a).
772
+ * the include key in the type exactly as they are namespaced in the rows.
671
773
  * @experimental
774
+ * @ruling 16 §3a
672
775
  */
673
776
  export interface Fragment<Nodes extends Record<string, PortDecl> = {}> {
674
777
  id: string;