@serene-pub/sdk 0.6.0-pr-4 → 0.6.0-pr-6

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 (230) hide show
  1. package/README.md +23 -19
  2. package/dist/actions.d.ts +178 -69
  3. package/dist/actions.js +109 -40
  4. package/dist/annexFields.d.ts +12 -5
  5. package/dist/annexFields.js +6 -2
  6. package/dist/announce.d.ts +220 -30
  7. package/dist/announce.js +212 -7
  8. package/dist/attributes.d.ts +290 -11
  9. package/dist/attributes.js +317 -32
  10. package/dist/bands.d.ts +41 -6
  11. package/dist/bands.js +83 -33
  12. package/dist/bridges.d.ts +61 -0
  13. package/dist/bridges.js +112 -0
  14. package/dist/builder.d.ts +436 -106
  15. package/dist/builder.js +389 -46
  16. package/dist/cadences.d.ts +578 -0
  17. package/dist/cadences.js +1111 -0
  18. package/dist/candidates.d.ts +5 -3
  19. package/dist/candidates.js +3 -2
  20. package/dist/capabilities.d.ts +93 -15
  21. package/dist/capabilities.js +57 -6
  22. package/dist/checkMethods.d.ts +240 -0
  23. package/dist/checkMethods.js +362 -0
  24. package/dist/clauses.d.ts +2 -1
  25. package/dist/clauses.js +2 -1
  26. package/dist/component.d.ts +24 -7
  27. package/dist/component.js +16 -6
  28. package/dist/componentBuild.d.ts +16 -5
  29. package/dist/componentBuild.js +14 -5
  30. package/dist/componentClient.d.ts +61 -30
  31. package/dist/componentClient.js +11 -1
  32. package/dist/componentImports.d.ts +8 -5
  33. package/dist/componentImports.js +23 -4
  34. package/dist/componentModule.js +2 -1
  35. package/dist/componentWire.d.ts +2 -1
  36. package/dist/componentWire.js +34 -2
  37. package/dist/composerStates.d.ts +96 -0
  38. package/dist/composerStates.js +190 -0
  39. package/dist/conditions.d.ts +424 -0
  40. package/dist/conditions.js +521 -0
  41. package/dist/config.d.ts +69 -19
  42. package/dist/config.js +64 -26
  43. package/dist/connections.d.ts +9 -4
  44. package/dist/connections.js +7 -4
  45. package/dist/conversions.d.ts +41 -0
  46. package/dist/conversions.js +50 -0
  47. package/dist/declarations.d.ts +70 -18
  48. package/dist/declarations.js +194 -24
  49. package/dist/descriptors.d.ts +427 -100
  50. package/dist/descriptors.js +344 -59
  51. package/dist/dev.d.ts +6 -5
  52. package/dist/dev.js +6 -5
  53. package/dist/document.d.ts +121 -27
  54. package/dist/document.js +77 -24
  55. package/dist/dowry.d.ts +241 -0
  56. package/dist/dowry.js +315 -0
  57. package/dist/engines.d.ts +16 -7
  58. package/dist/engines.js +6 -4
  59. package/dist/entities.d.ts +156 -0
  60. package/dist/entities.js +259 -0
  61. package/dist/eventMapLaws.d.ts +19 -8
  62. package/dist/eventMapLaws.js +9 -6
  63. package/dist/events.d.ts +648 -40
  64. package/dist/events.js +451 -34
  65. package/dist/executor.d.ts +123 -41
  66. package/dist/executor.js +210 -103
  67. package/dist/exposure.d.ts +128 -0
  68. package/dist/exposure.js +168 -0
  69. package/dist/extension.d.ts +99 -35
  70. package/dist/extension.js +43 -9
  71. package/dist/facets.d.ts +2 -1
  72. package/dist/facets.js +4 -2
  73. package/dist/fit.d.ts +198 -0
  74. package/dist/fit.js +351 -0
  75. package/dist/foldedSections.d.ts +4 -2
  76. package/dist/foldedSections.js +2 -1
  77. package/dist/functions.d.ts +554 -0
  78. package/dist/functions.js +712 -0
  79. package/dist/genres.d.ts +408 -130
  80. package/dist/genres.js +412 -108
  81. package/dist/guardedConnection.d.ts +4 -3
  82. package/dist/guardedConnection.js +4 -3
  83. package/dist/handlebarsReach.d.ts +1 -1
  84. package/dist/handlebarsReach.js +1 -1
  85. package/dist/hash.d.ts +16 -5
  86. package/dist/hash.js +14 -4
  87. package/dist/hookGrants.d.ts +4 -3
  88. package/dist/hookGrants.js +7 -5
  89. package/dist/hooks.d.ts +42 -21
  90. package/dist/hooks.js +17 -12
  91. package/dist/hostElements.d.ts +47 -17
  92. package/dist/hostElements.js +62 -17
  93. package/dist/hostState.d.ts +110 -0
  94. package/dist/hostState.js +140 -0
  95. package/dist/i18n.d.ts +5 -3
  96. package/dist/i18n.js +5 -3
  97. package/dist/identity.d.ts +5 -4
  98. package/dist/identity.js +5 -4
  99. package/dist/index.d.ts +26 -0
  100. package/dist/index.js +55 -0
  101. package/dist/jsonSchema.d.ts +178 -0
  102. package/dist/jsonSchema.js +558 -0
  103. package/dist/layout.d.ts +36 -15
  104. package/dist/layout.js +2 -2
  105. package/dist/loadouts.d.ts +97 -0
  106. package/dist/loadouts.js +81 -0
  107. package/dist/media.d.ts +153 -16
  108. package/dist/media.js +47 -2
  109. package/dist/messageBlocks.d.ts +223 -37
  110. package/dist/messageBlocks.js +231 -24
  111. package/dist/migration.d.ts +16 -8
  112. package/dist/migration.js +14 -8
  113. package/dist/names.d.ts +2 -1
  114. package/dist/names.js +2 -1
  115. package/dist/nodeInput.d.ts +2 -1
  116. package/dist/nodeInput.js +2 -1
  117. package/dist/participants.d.ts +54 -24
  118. package/dist/participants.js +27 -14
  119. package/dist/personGate.d.ts +2 -1
  120. package/dist/personGate.js +2 -1
  121. package/dist/pluginHarness.d.ts +22 -35
  122. package/dist/pluginHarness.js +18 -143
  123. package/dist/pluginPermissions.d.ts +2 -1
  124. package/dist/pluginPermissions.js +13 -2
  125. package/dist/pluginRuleRef.d.ts +2 -2
  126. package/dist/pluginRuleRef.js +1 -1
  127. package/dist/predicates.d.ts +16 -11
  128. package/dist/predicates.js +7 -6
  129. package/dist/preview.d.ts +53 -7
  130. package/dist/preview.js +54 -13
  131. package/dist/primers.d.ts +177 -0
  132. package/dist/primers.js +265 -0
  133. package/dist/promptBlocks.d.ts +5 -3
  134. package/dist/promptBlocks.js +5 -3
  135. package/dist/rankingDecisions.d.ts +2 -1
  136. package/dist/rankingDecisions.js +2 -1
  137. package/dist/receipt.d.ts +76 -29
  138. package/dist/receipt.js +9 -4
  139. package/dist/receiverRules.js +3 -2
  140. package/dist/refs.d.ts +42 -9
  141. package/dist/refs.js +45 -13
  142. package/dist/registrations.d.ts +384 -0
  143. package/dist/registrations.js +625 -0
  144. package/dist/registry.d.ts +42 -23
  145. package/dist/registry.js +7 -5
  146. package/dist/repertoires.d.ts +502 -0
  147. package/dist/repertoires.js +666 -0
  148. package/dist/review.d.ts +16 -5
  149. package/dist/review.js +11 -4
  150. package/dist/rulesetDocument.d.ts +95 -0
  151. package/dist/rulesetDocument.js +190 -0
  152. package/dist/rulesetSections.d.ts +597 -0
  153. package/dist/rulesetSections.js +1249 -0
  154. package/dist/rulesetTemplates.d.ts +161 -0
  155. package/dist/rulesetTemplates.js +242 -0
  156. package/dist/rulesets.d.ts +899 -0
  157. package/dist/rulesets.js +1378 -0
  158. package/dist/sampling.d.ts +54 -0
  159. package/dist/sampling.js +95 -3
  160. package/dist/sceneSettings.d.ts +320 -0
  161. package/dist/sceneSettings.js +433 -0
  162. package/dist/scope.d.ts +50 -7
  163. package/dist/scope.js +22 -3
  164. package/dist/scripts.d.ts +112 -22
  165. package/dist/scripts.js +135 -19
  166. package/dist/sessionDossier.d.ts +638 -0
  167. package/dist/sessionDossier.js +33 -0
  168. package/dist/sessionLayout.d.ts +492 -55
  169. package/dist/sessionLayout.js +697 -90
  170. package/dist/sessionSettings.d.ts +32 -5
  171. package/dist/settings.d.ts +66 -20
  172. package/dist/settings.js +19 -12
  173. package/dist/settingsSlot.d.ts +11 -8
  174. package/dist/settingsSlot.js +11 -8
  175. package/dist/shapes.d.ts +139 -37
  176. package/dist/shapes.js +152 -38
  177. package/dist/sheets.d.ts +4 -2
  178. package/dist/sheets.js +6 -3
  179. package/dist/statShapes.d.ts +10 -2
  180. package/dist/statShapes.js +10 -2
  181. package/dist/status.d.ts +27 -9
  182. package/dist/status.js +20 -6
  183. package/dist/storage.d.ts +11 -67
  184. package/dist/storage.js +9 -13
  185. package/dist/storyTime.d.ts +13 -7
  186. package/dist/storyTime.js +11 -6
  187. package/dist/strokes.d.ts +176 -0
  188. package/dist/strokes.js +281 -0
  189. package/dist/surfaces.d.ts +54 -25
  190. package/dist/surfaces.js +3 -3
  191. package/dist/template.d.ts +9 -5
  192. package/dist/template.js +5 -3
  193. package/dist/templateCheck.d.ts +2 -2
  194. package/dist/templateCheck.js +2 -2
  195. package/dist/templateFit.d.ts +37 -8
  196. package/dist/templateFit.js +92 -8
  197. package/dist/templateIds.d.ts +3 -3
  198. package/dist/templateIds.js +3 -3
  199. package/dist/templateScopeAt.d.ts +22 -12
  200. package/dist/templateScopeAt.js +32 -19
  201. package/dist/testing.d.ts +11 -4
  202. package/dist/testing.js +13 -5
  203. package/dist/ties.d.ts +210 -0
  204. package/dist/ties.js +300 -0
  205. package/dist/tokenizers.d.ts +2 -2
  206. package/dist/tokenizers.js +2 -2
  207. package/dist/turnLock.d.ts +4 -2
  208. package/dist/turnLock.js +2 -1
  209. package/dist/turnOrder.d.ts +39 -22
  210. package/dist/turnOrder.js +30 -13
  211. package/dist/validate.d.ts +11 -8
  212. package/dist/validate.js +195 -29
  213. package/dist/values.d.ts +17 -8
  214. package/dist/values.js +11 -6
  215. package/dist/variables.d.ts +46 -7
  216. package/dist/variables.js +87 -6
  217. package/dist/verdicts.d.ts +20 -13
  218. package/dist/verdicts.js +17 -11
  219. package/dist/vocabularies.d.ts +192 -0
  220. package/dist/vocabularies.js +326 -0
  221. package/dist/widgetDecls.d.ts +20 -4
  222. package/dist/widgetDecls.js +6 -2
  223. package/dist/widgets.d.ts +1580 -111
  224. package/dist/widgets.js +113 -18
  225. package/dist/wire.d.ts +13 -6
  226. package/dist/wire.js +3 -3
  227. package/dist/worldinfo.d.ts +11 -6
  228. package/dist/worldinfo.js +8 -4
  229. package/host-elements.d.ts +101 -0
  230. package/package.json +1 -1
package/dist/validate.js CHANGED
@@ -1,26 +1,28 @@
1
1
  /**
2
2
  * Validation — the Fixed Ledger laws that can be checked statically.
3
3
  *
4
- * Every finding names what to do instead (15 §1.3). A prohibition without a stated
4
+ * Every finding names what to do instead. A prohibition without a stated
5
5
  * alternative is a bug, and there is a test asserting exactly that.
6
+ * @ruling 15 §1.3
6
7
  */
7
8
  import { pluginRuleRef } from './pluginRuleRef.js';
8
- import { JUNCTION_CLAUSE_PORTS, junctionBranchEnds } from './document.js';
9
+ import { agreedShape, JUNCTION_CLAUSE_PORTS, junctionBranchEnds } from './document.js';
9
10
  import { notADeclaredEvent, packageEventById } from './events.js';
10
11
  import { annexDeclarationOf, annexStepFindings } from './annexFields.js';
11
12
  import { settingsSlotFor } from './settingsSlot.js';
12
- import { ANSWER_FORM_OUTLET_ID, FORM_ADDRESSED_INLET_ID, getDefinition, isBuiltInOutlet, isBuiltInSpec, LIVE_ROW_PORTS, reviewFieldsFinding, widgetDeclsFindings, } from './descriptors.js';
13
+ import { ANSWER_FORM_OUTLET_ID, DELETION_ASKED_INLET_ID, deletionPipelinePlaces, FORM_ADDRESSED_INLET_ID, getDefinition, isBuiltInOutlet, isBuiltInSpec, LIVE_ROW_PORTS, reviewFieldsFinding, widgetDeclsFindings, } from './descriptors.js';
13
14
  import { i18nFindings, i18nText } from './i18n.js';
14
15
  import { formatChannel, parseChannel } from './channels.js';
15
16
  import { PREDICATE_CONDITION_KEYS } from './predicates.js';
16
17
  import { provisionalVerdict, settingsTravelVerdict } from './verdicts.js';
17
18
  import { settingsSchemaFindings } from './settings.js';
18
19
  import { actionDocumentFindingsByLaw } from './actions.js';
20
+ import { boundaryTriggerFindings } from './sceneSettings.js';
19
21
  import { templateLawFindings } from './templateFit.js';
20
22
  import { isSlotRef } from './refs.js';
21
23
  import { assignable, isStreaming, JSON_SHAPE } from './shapes.js';
22
24
  import { isModelCall, stepPurposeRefusal } from './builder.js';
23
- import { capabilityLabel, FEATURES, IO_KINDS, isTransformId, parseTransform, transformId, } from './capabilities.js';
25
+ import { capabilityLabel, FEATURES, IO_KINDS, IO_KIND_TOKEN, isKnownIoKind, isTransformId, parseTransform, transformId, } from './capabilities.js';
24
26
  /**
25
27
  * The port shapes a spec may assemble field by field (`templateContext: {
26
28
  * advertisement: …, results: … }`): the permissive sink, and the object a
@@ -33,9 +35,10 @@ const FIELD_ASSEMBLED_SHAPES = new Set([
33
35
  'core:shape/template-context@1',
34
36
  ]);
35
37
  /**
36
- * A verdict's sentence or fix as a finding's string (01 §13): findings are
38
+ * A verdict's sentence or fix as a finding's string: findings are
37
39
  * `en`, the locale every map carries. An absent fix is the empty string —
38
40
  * every verdict this file quotes declares one.
41
+ * @ruling 01 §13
39
42
  */
40
43
  const en = (v) => (v === undefined ? '' : (i18nText(v) ?? ''));
41
44
  /** @experimental */
@@ -160,6 +163,11 @@ export function validate(doc, options = {}) {
160
163
  continue;
161
164
  if (!desc(w.key)?.ports.in?.channel)
162
165
  continue;
166
+ // A MESSAGE write: a `channel` port alone is not one — opening a
167
+ // composer names a lane and writes no row (`set-composer-state@1`,
168
+ // 2026-10-15).
169
+ if (desc(w.key)?.causesEvent !== 'core:event/message-created@1')
170
+ continue;
163
171
  if (channelOf(w) !== liveChannel)
164
172
  continue;
165
173
  if (exclusiveSteps(pathClauses, live, w))
@@ -372,11 +380,50 @@ export function validate(doc, options = {}) {
372
380
  // was handed. Refused here at publish, and again by the host at the write
373
381
  // (defence in depth, U5b review W8). A manifest permission letting a plugin
374
382
  // spec place one is the future this leaves room for; nothing grants it yet.
383
+ //
384
+ // 🚧 One exception (RF fix 5, owner ruling 2026-10-23): a **deletion
385
+ // pipeline** — a document entered through
386
+ // `core:inlet/message-deletion-asked@1` — places `delete-message@1`
387
+ // (`deletionPipelinePlaces`). The host judged the door before it
388
+ // dispatched the event, so the delete takes the deletion the event
389
+ // carried, whole, on its `asked` port — one edge from the inlet's `main`,
390
+ // never a literal, a part or another step's value — and leaves `target`,
391
+ // the built-in's own port, unset. The message it deletes is then the
392
+ // judged one by construction; the host reads it off `asked`.
375
393
  if (!isBuiltInSpec(doc.id)) {
394
+ const firstInlet = inlets[0];
395
+ const inletId = firstInlet ? `${firstInlet.definitionId}@${firstInlet.definitionVersion}` : undefined;
376
396
  for (const n of doc.nodes) {
377
397
  const id = `${n.definitionId}@${n.definitionVersion}`;
378
398
  if (n.kind !== 'outlet' || !isBuiltInOutlet(id))
379
399
  continue;
400
+ if (deletionPipelinePlaces(id, inletId)) {
401
+ const into = (port) => doc.edges.filter((e) => e.to === n.key && e.toPort.split('.')[0] === port);
402
+ const asked = into('asked');
403
+ const fromInlet = asked.length === 1 &&
404
+ !asked[0].implicit &&
405
+ asked[0].from === firstInlet.key &&
406
+ asked[0].fromPort === 'main' &&
407
+ asked[0].toPort === 'asked';
408
+ const config = (n.config ?? {});
409
+ const targetSet = config.target !== undefined || into('target').length > 0;
410
+ if (!fromInlet || targetSet)
411
+ f.push({
412
+ law: 'R-15',
413
+ severity: 'error',
414
+ nodeKey: n.key,
415
+ message: targetSet
416
+ ? `'${n.key}' names its message on 'target' in a deletion pipeline — a deletion pipeline ` +
417
+ `deletes the message its event carried, which arrives whole on 'asked'; 'target' is ` +
418
+ `the built-in's own spec's port`
419
+ : `'${n.key}' takes 'asked' from somewhere other than ${DELETION_ASKED_INLET_ID}'s ` +
420
+ `'main' — a deletion pipeline deletes the message its event carried, and only the ` +
421
+ `inlet's 'main' carries it`,
422
+ fix: `wire the deletion whole from the inlet — C.deleteMessage.v1({ asked: $.${firstInlet.key}.main }) ` +
423
+ `— and leave 'target' unset`,
424
+ });
425
+ continue;
426
+ }
380
427
  f.push({
381
428
  law: 'R-15',
382
429
  severity: 'error',
@@ -452,6 +499,26 @@ export function validate(doc, options = {}) {
452
499
  fix: fix ?? 'declare the action as `contributes.actions[]` describes — see the SDK\'s actions.ts',
453
500
  });
454
501
  }
502
+ // ── 🚧 Boundary triggers (★9; live scenes §15 G18, 2026-10-13) ────────────
503
+ //
504
+ // A genre's declared boundary triggers ride its summarize-scene spec as
505
+ // `contributes.boundaryTriggers`. `spec()` refuses a malformed one where
506
+ // the author is (`boundaryTriggerFindings`, the builder's own sentences);
507
+ // a document from any other source — a hand-written JSON, an import, a
508
+ // patched row — gets the same sentences here, and a host's publish runs
509
+ // this. The channels against the genre are the builder's to check
510
+ // (`summarizeScene`, where a genre is at hand): a stored document names
511
+ // none to check against. A host reading one still takes only the
512
+ // triggers that read (`boundaryTriggersOf`).
513
+ for (const message of boundaryTriggerFindings(doc.contributes?.boundaryTriggers, 'contributes.boundaryTriggers'))
514
+ f.push({
515
+ law: 'boundary triggers',
516
+ severity: 'error',
517
+ message,
518
+ fix: "declare each as { key, label, when } — a camelCase key that is not core's, display text " +
519
+ "for the chip, and at least one of channel, narration, speaker, actionKey, stateKey — as " +
520
+ "summarizeScene(…, { boundaries }) writes them (see the SDK's sceneSettings.ts)",
521
+ });
455
522
  // ── R-20 — every author-facing string the document carries is display text
456
523
  // (a string or a locale map with `en`, never blank; U5i, ruled 2026-09-17):
457
524
  // each author preset's label and description; the genre a create pipeline
@@ -496,7 +563,7 @@ export function validate(doc, options = {}) {
496
563
  return false;
497
564
  };
498
565
  /**
499
- * What a branch may state, counted off ONE list (D-4a, 2026-09-17).
566
+ * What a branch may state, counted off ONE list.
500
567
  *
501
568
  * This read the three words out of a literal, so the night `equalsPath`
502
569
  * joined the grammar it was legal in an action's enabled-when and refused
@@ -504,6 +571,7 @@ export function validate(doc, options = {}) {
504
571
  * two doors, which is the one thing a shared shape exists to prevent.
505
572
  * `default` is the junction's own fourth: only a branch can fire because
506
573
  * nothing else did.
574
+ * @ruling D-4a (2026-09-17)
507
575
  */
508
576
  const BRANCH_CONDITIONS = [...PREDICATE_CONDITION_KEYS, 'default'];
509
577
  for (const b of doc.clauses) {
@@ -635,16 +703,19 @@ export function validate(doc, options = {}) {
635
703
  else
636
704
  shapes.add(shape);
637
705
  }
638
- if (shapes.size > 1)
706
+ // 🚧 Shapes agree when one of them takes them all (`agreedShape`, RF fix 3):
707
+ // a text-stream and a text hand on a text.
708
+ const agreed = shapes.size ? agreedShape([...shapes]) : undefined;
709
+ if (shapes.size > 1 && !agreed)
639
710
  f.push({
640
711
  law: '20 §10',
641
712
  severity: 'error',
642
713
  nodeKey: e.to,
643
714
  message: `the branches of junction '${e.from}' publish '${e.fromPort}' as different shapes (${[...shapes].join(', ')})`,
644
- fix: 'end every branch in nodes whose port shapes agree',
715
+ fix: 'end every branch in nodes whose port shapes agree: one shape that every branch’s is assignable to',
645
716
  });
646
- else if (shapes.size === 1) {
647
- const outShape = [...shapes][0];
717
+ else if (agreed) {
718
+ const outShape = agreed;
648
719
  const inShape = desc(e.to)?.ports.in?.[e.toPort.split('.')[0]];
649
720
  if (inShape && !e.toPort.includes('.') && !assignable(outShape, inShape))
650
721
  f.push({
@@ -942,7 +1013,30 @@ export function validate(doc, options = {}) {
942
1013
  // the user sees the preset "not working" with no error anywhere. The
943
1014
  // substrate's `settings` counts as declared where the substrate declares
944
1015
  // it (R-9): on an optional or gated node, and nowhere else.
945
- const declared = !!d?.slots?.[v.slot] || (v.slot === 'settings' && d && !!settingsSlotFor(d));
1016
+ // 🚧 `scripts` on a node with interior points: the chains live under
1017
+ // the `scripts` facet keyed by point (`PresetBuilder.scripts`), so a
1018
+ // node declaring points accepts the slot though no `scripts` slot
1019
+ // is declared — but only at points it declares.
1020
+ const points = (d?.scriptPoints ?? []).map((sp) => sp.key);
1021
+ const pointChains = v.slot === 'scripts' &&
1022
+ !d?.slots?.scripts &&
1023
+ points.length > 0 &&
1024
+ !!v.value &&
1025
+ typeof v.value === 'object' &&
1026
+ !Array.isArray(v.value);
1027
+ if (pointChains)
1028
+ for (const key of Object.keys(v.value))
1029
+ if (!points.includes(key))
1030
+ f.push({
1031
+ law: '12 §3a',
1032
+ severity: 'error',
1033
+ nodeKey: v.nodeKey,
1034
+ message: `preset '${p.slug}' sets scripts at '${key}' on '${v.nodeKey}', which declares the points ${points.join(', ')}`,
1035
+ fix: `name a script point the node declares`,
1036
+ });
1037
+ const declared = !!d?.slots?.[v.slot] ||
1038
+ (v.slot === 'settings' && d && !!settingsSlotFor(d)) ||
1039
+ pointChains;
946
1040
  if (d && !declared && v.slot !== 'connection') {
947
1041
  f.push({
948
1042
  law: '12 §3a',
@@ -1033,8 +1127,21 @@ export function validate(doc, options = {}) {
1033
1127
  continue;
1034
1128
  }
1035
1129
  for (const id of [...requires, ...optional]) {
1036
- if (isKnownCapability(id))
1130
+ if (isKnownCapability(id)) {
1131
+ // O1: a well-formed transform naming a kind this build does
1132
+ // not know is ALLOWED (a plugin or a later release may bring
1133
+ // it) — said once as a warning, so a typo is still seen.
1134
+ const unknown = isTransformId(id) ? unknownKindsOf(id) : [];
1135
+ if (unknown.length)
1136
+ f.push({
1137
+ law: 'capabilities',
1138
+ severity: 'warning',
1139
+ nodeKey: n.key,
1140
+ message: `'${n.key}.${slotName}' names ${unknown.length === 1 ? 'a kind' : 'kinds'} this build does not know: ${unknown.map((k) => `'${k}'`).join(', ')}`,
1141
+ fix: `fine if a plugin or a later release brings ${unknown.length === 1 ? 'it' : 'them'}; otherwise check the spelling — the known kinds are ${IO_KINDS_TEXT}`,
1142
+ });
1037
1143
  continue;
1144
+ }
1038
1145
  // A transform built from known kinds but written in the wrong
1039
1146
  // ORDER is a different mistake from a typo, and telling them
1040
1147
  // apart is the difference between a one-word fix and a hunt.
@@ -1052,7 +1159,7 @@ export function validate(doc, options = {}) {
1052
1159
  ? `'${n.key}.${slotName}' spells the capability '${id}' non-canonically`
1053
1160
  : `'${n.key}.${slotName}' names an unknown capability '${id}'`,
1054
1161
  fix: canonical
1055
- ? `write it as '${canonical}' — kinds are ordered by IO_KINDS (text, image, audio, video, document, embedding), and only that spelling is ever matched`
1162
+ ? `write it as '${canonical}' — kinds are ordered by IO_KINDS (${IO_KINDS_TEXT}), then any other kind alphabetically, and only that spelling is ever matched`
1056
1163
  : `use a declared transform (e.g. 'text->image') or feature (${FEATURES.join(', ')})`,
1057
1164
  });
1058
1165
  }
@@ -1071,6 +1178,50 @@ export function validate(doc, options = {}) {
1071
1178
  }
1072
1179
  }
1073
1180
  }
1181
+ // ── assemble wiring — a prompt is assembled for the model call it feeds ───
1182
+ // `assemble@2` reads its `template` slot and the connection it renders for
1183
+ // only when the spec wires them: unwired, the run halts on a real instance
1184
+ // ("assemble has no template"), and once the template is wired a chat
1185
+ // wire-mode connection is handed a prompt with no messages. Neither shows
1186
+ // on a fixture host, so it is said here, where the author is (F3 docs
1187
+ // gate, stalls 12 and 14). A warning, not an error: a host saves documents
1188
+ // its own tests and older plugins built bare, and the run's own halt is
1189
+ // the error.
1190
+ for (const n of doc.nodes) {
1191
+ if (n.definitionId !== 'core:task/assemble' || n.definitionVersion !== 2)
1192
+ continue;
1193
+ // A wired port, not the spine's implicit `main` hand-off.
1194
+ const generate = doc.edges
1195
+ .filter((e) => e.from === n.key && !e.implicit)
1196
+ .map((e) => byKey.get(e.to))
1197
+ .find((t) => {
1198
+ if (t?.kind !== 'oracle')
1199
+ return false;
1200
+ const d = desc(t.key);
1201
+ return d !== undefined && isModelCall(d);
1202
+ });
1203
+ if (!generate)
1204
+ continue;
1205
+ const wired = (port) => n.config[port] !== undefined || doc.edges.some((e) => e.to === n.key && e.toPort.split('.')[0] === port);
1206
+ if (!wired('template'))
1207
+ f.push({
1208
+ law: 'assemble wiring',
1209
+ severity: 'warning',
1210
+ nodeKey: n.key,
1211
+ message: `'${n.key}' assembles the prompt '${generate.key}' sends, but its template is not wired — ` +
1212
+ `the run halts with "assemble has no template", whatever configuration an administrator picks`,
1213
+ fix: `add template: slot.template() to '${n.key}' (C.assemble.v2({ …, template: slot.template() }))`,
1214
+ });
1215
+ if (!wired('connection'))
1216
+ f.push({
1217
+ law: 'assemble wiring',
1218
+ severity: 'warning',
1219
+ nodeKey: n.key,
1220
+ message: `'${n.key}' assembles the prompt '${generate.key}' sends, but does not know that connection — ` +
1221
+ `a chat wire-mode connection is handed a prompt with no messages`,
1222
+ fix: `add connection: slot.connectionOf('${generate.key}') to '${n.key}', so the prompt is written for the connection that sends it`,
1223
+ });
1224
+ }
1074
1225
  // ── T1 — a template fits where it is rendered (typed templates P5) ─────────
1075
1226
  // Collisions and forbidden kinds in a template node's scope, a band with
1076
1227
  // no variable, and — given the checker — every template source the
@@ -1081,8 +1232,7 @@ export function validate(doc, options = {}) {
1081
1232
  return f;
1082
1233
  }
1083
1234
  /**
1084
- * The streaming step and the step status, as declared on `expose` (lair
1085
- * pass B3/B18; owner D6 and D5, 2026-09-27).
1235
+ * The streaming step and the step status, as declared on `expose`.
1086
1236
  *
1087
1237
  * Which oracle streams into the reply is **declared**, never inferred: the
1088
1238
  * inference it replaced skipped every oracle inside a clause and streamed the
@@ -1094,7 +1244,7 @@ export function validate(doc, options = {}) {
1094
1244
  * would write its document into the row a person is reading;
1095
1245
  * · **one per execution path** — a run has one live row, and two streams
1096
1246
  * interleave or concatenate into it. Two steps that can never run in the
1097
- * same execution may each stream (W2, 2026-09-27): they sit in different
1247
+ * same execution may each stream: they sit in different
1098
1248
  * branches of one junction whose predicates are mutually exclusive — one
1099
1249
  * is the `otherwise`, or both are `equals` on the same path with different
1100
1250
  * literals. The runtime streams whichever one runs. Anything weaker (a
@@ -1104,10 +1254,11 @@ export function validate(doc, options = {}) {
1104
1254
  * into the same row;
1105
1255
  * · **an oracle** — only an oracle has a model's tokens to stream.
1106
1256
  *
1107
- * A step status, step label and step purpose are display text (R-20), and a
1257
+ * A step status, step label and step purpose are display text, and a
1108
1258
  * step purpose sits only on a model call — an oracle whose definition declares
1109
1259
  * a `connection` slot (`isModelCall`; law `step purpose`, 2026-09-30).
1110
1260
  * @internal
1261
+ * @ruling lair pass B3/B18, owner D6 and D5 (2026-09-27), W2 (2026-09-27), R-20
1111
1262
  */
1112
1263
  export function streamingStepFindings(doc) {
1113
1264
  const f = [];
@@ -1214,13 +1365,14 @@ export function streamingStepFindings(doc) {
1214
1365
  return f;
1215
1366
  }
1216
1367
  /**
1217
- * Whether `a` always runs after `b` has finished (F7's "after, not beside").
1368
+ * Whether `a` always runs after `b` has finished ("after, not beside").
1218
1369
  *
1219
1370
  * A level — the spine, or one chain of one clause — runs its items one at a
1220
1371
  * time in position order; only a clause's chains may run side by side. So
1221
1372
  * `a` follows `b` exactly when, at the innermost level both sit in, the item
1222
1373
  * holding `a` is positioned after the item holding `b`. Two branches of one
1223
1374
  * clause meet at that clause's own position, and are never ordered.
1375
+ * @ruling F7
1224
1376
  */
1225
1377
  function runsStrictlyAfter(doc, a, b) {
1226
1378
  const clauseById = new Map(doc.clauses.map((c) => [c.id, c]));
@@ -1248,9 +1400,10 @@ function runsStrictlyAfter(doc, a, b) {
1248
1400
  return false;
1249
1401
  }
1250
1402
  /**
1251
- * Whether two nodes can never run in the same execution (W2): they diverge
1403
+ * Whether two nodes can never run in the same execution: they diverge
1252
1404
  * in two branches of one junction whose predicates cannot both fire.
1253
1405
  * Conservative — anything not provably exclusive is the same path.
1406
+ * @ruling W2
1254
1407
  */
1255
1408
  function exclusiveSteps(clauseById, a, b) {
1256
1409
  // Each node's ancestry, innermost first, as (clause, chain) pairs.
@@ -1309,12 +1462,15 @@ function exclusivePredicates(p, q) {
1309
1462
  * ⚠ "Structurally" used to mean `!!lhs && !!rhs`, which passed `'text->tex'`,
1310
1463
  * `'txet->text'` and `'->'` — every typo this check exists to catch, since the
1311
1464
  * ones it did catch were already impossible to write. The real structure is
1312
- * that both sides are non-empty lists of KNOWN kinds in CANONICAL order, which
1313
- * is exactly "the id round-trips through `parseTransform` and back". That
1314
- * rejects an unknown kind, a misspelled one, an empty side and `image+text->text`
1315
- * (whose canonical spelling is `text+image->text`, so two ids would name one
1465
+ * that both sides are non-empty lists of well-formed kinds in CANONICAL order,
1466
+ * which is exactly "the id round-trips through `parseTransform` and back". That
1467
+ * rejects an empty side, a malformed kind and `image+text->text` (whose
1468
+ * canonical spelling is `text+image->text`, so two ids would name one
1316
1469
  * capability and only one of them would ever match) — while still admitting
1317
1470
  * `image+audio->video`, because the plugin escape hatch above is the point.
1471
+ * Since O1 (2026-10-20) kinds are open: an UNKNOWN kind is well-formed and
1472
+ * sorts after the known ones, alphabetically; the law warns about it (a typo
1473
+ * still shows) and never refuses it (R30).
1318
1474
  *
1319
1475
  * There is no registry of plugin-declared transforms to consult here: `validate`
1320
1476
  * reads a spec document, not an instance, so a set-membership test would have to
@@ -1330,20 +1486,29 @@ function isKnownCapability(id) {
1330
1486
  /**
1331
1487
  * The canonical spelling of a transform id, or `undefined` if it is not one.
1332
1488
  *
1333
- * `undefined` covers an empty side and any kind this build does not know —
1334
- * neither of which has a canonical form to suggest, because there is nothing to
1335
- * reorder. A mis-ORDERED id, by contrast, round-trips to a different string,
1489
+ * `undefined` covers an empty side and a malformed kind (not one lowercase
1490
+ * token, `IO_KIND_TOKEN`) — neither of which has a canonical form to suggest,
1491
+ * because there is nothing to reorder. An unknown but well-formed kind has
1492
+ * one (O1): after the known kinds, alphabetically. A mis-ORDERED id, by contrast, round-trips to a different string,
1336
1493
  * and that string is the fix.
1337
1494
  */
1338
1495
  function canonicalise(id) {
1339
1496
  const t = parseTransform(id);
1340
1497
  if (!t.in.length || !t.out.length)
1341
1498
  return undefined;
1342
- const known = (k) => IO_KINDS.includes(k);
1343
- if (!t.in.every(known) || !t.out.every(known))
1499
+ // O1: kinds are open — any well-formed token is a kind; the known ones
1500
+ // keep their order and the others follow alphabetically (`transformId`).
1501
+ const wellFormed = (k) => IO_KIND_TOKEN.test(k);
1502
+ if (!t.in.every(wellFormed) || !t.out.every(wellFormed))
1344
1503
  return undefined;
1345
1504
  return transformId(t);
1346
1505
  }
1506
+ /** The kinds of a transform id that `IO_KINDS` does not name (O1). */
1507
+ function unknownKindsOf(id) {
1508
+ const t = parseTransform(id);
1509
+ return [...new Set([...t.in, ...t.out])].filter((k) => !isKnownIoKind(k));
1510
+ }
1511
+ const IO_KINDS_TEXT = IO_KINDS.join(', ');
1347
1512
  function reaches(doc, from, to, seen = new Set()) {
1348
1513
  if (from === to)
1349
1514
  return true;
@@ -1361,11 +1526,12 @@ export function assertValid(doc, options) {
1361
1526
  }
1362
1527
  }
1363
1528
  /**
1364
- * The R-20 findings over one stored document: presets, and the genre
1529
+ * The display-text findings over one stored document: presets, and the genre
1365
1530
  * declaration a create pipeline carries. Read as `unknown` throughout — a
1366
1531
  * document may have come from anywhere — so a wrong shape is a sentence,
1367
1532
  * never a throw.
1368
1533
  * @experimental
1534
+ * @ruling R-20
1369
1535
  */
1370
1536
  export function documentDisplayTextFindings(doc) {
1371
1537
  const out = [];
package/dist/values.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The value-type system (24 §8).
2
+ * The value-type system.
3
3
  *
4
4
  * Authoring goes through a toolkit facade — `v.integer({})`, `v.weights({})`,
5
5
  * `v.stackedBar({})` — for ergonomics and dot-discoverability; the output is
@@ -14,7 +14,7 @@
14
14
  * Unknown keys degrade safely: consumers render a read-only fallback and
15
15
  * refuse writes to types they cannot validate.
16
16
  *
17
- * Constraints come in two tiers, both pure data (24 §8):
17
+ * Constraints come in two tiers, both pure data:
18
18
  * - T1 declarative: min/max/step/pattern/options; group: sumTo/normalize.
19
19
  * - T2 predicates: `requiredWhen`/`visibleWhen`/`enabledWhen`, reusing the
20
20
  * route-predicate shape ({path, equals, truthy}) — declarations that read
@@ -24,14 +24,16 @@
24
24
  * Four consumers key off the same id — factory (here), validator (here),
25
25
  * control renderer (@serene-pub/controls), scaffold printer (cli) — and a
26
26
  * conformance canary asserts no shipped type is missing any of the four.
27
+ * @ruling 24 §8, 24 §8
27
28
  */
28
29
  import { type I18n } from './i18n.js';
29
30
  /**
30
- * One condition over sibling values — the route-predicate shape (20 §10).
31
+ * One condition over sibling values — the route-predicate shape.
31
32
  * A settings-form field's gate, not the action-level **enabled-when** of
32
33
  * `predicates.ts` (which reads the session's published values and carries a
33
34
  * `reason`); the two share the shape, not the document.
34
35
  * @experimental
36
+ * @ruling 20 §10
35
37
  */
36
38
  export interface ValuePredicate {
37
39
  /** Dot path into the sibling value map. */
@@ -43,12 +45,16 @@ export interface ValuePredicate {
43
45
  }
44
46
  /** Fields every declaration may carry, regardless of kind. @experimental */
45
47
  export interface ValueCommon {
46
- /** What a person reads beside the control — a string or a locale map with `en` (R-20). */
48
+ /**
49
+ * What a person reads beside the control — a string or a locale map with `en`.
50
+ * @ruling R-20
51
+ */
47
52
  label?: I18n;
48
53
  description?: I18n;
49
54
  /**
50
55
  * No shipped default — a config MUST supply this value. Requiredness is
51
- * what makes "missing" a fact the coverage report can state (24 §7).
56
+ * what makes "missing" a fact the coverage report can state.
57
+ * @ruling 24 §7
52
58
  */
53
59
  required?: boolean;
54
60
  requiredWhen?: ValuePredicate;
@@ -175,15 +181,17 @@ type Validator = (schema: Record<string, unknown>, value: unknown) => string[];
175
181
  export declare const valueValidators: Record<string, Validator>;
176
182
  /**
177
183
  * Validate one value against its declaration. Unknown type ids refuse —
178
- * a consumer must never accept a write it cannot check (24 §8).
184
+ * a consumer must never accept a write it cannot check.
179
185
  * @experimental
186
+ * @ruling 24 §8
180
187
  */
181
188
  export declare function validateValue(declaration: ValueDecl, value: unknown): string[];
182
189
  /**
183
- * A deliberate hole (24 §7): type-checks wherever a value goes, so authoring
190
+ * A deliberate hole: type-checks wherever a value goes, so authoring
184
191
  * can continue — but the coverage report lists it as a named gap, and
185
192
  * validation refuses it like any other unknown.
186
193
  * @experimental
194
+ * @ruling 24 §7
187
195
  */
188
196
  export declare function todo(note: string): {
189
197
  'todo@1': {
@@ -200,12 +208,13 @@ export declare const isTodo: (value: unknown) => value is {
200
208
  export declare const shippedValueKinds: readonly string[];
201
209
  /**
202
210
  * The bridge from the settings-schema vocabulary (`{type:'integer', …}` on
203
- * node-type slots) to value declarations (24 T6c). Derived at read, never
211
+ * node-type slots) to value declarations. Derived at read, never
204
212
  * stored — no document or hash changes — so panels and controls can speak
205
213
  * the value-decl contract while the schemas migrate underneath at their own
206
214
  * pace. Unknown entry types map to nothing, and the caller keeps its
207
215
  * legacy rendering for them.
208
216
  * @experimental
217
+ * @ruling 24 T6c
209
218
  */
210
219
  export declare function valueDeclOf(entry: unknown): ValueDecl | null;
211
220
  export {};
package/dist/values.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The value-type system (24 §8).
2
+ * The value-type system.
3
3
  *
4
4
  * Authoring goes through a toolkit facade — `v.integer({})`, `v.weights({})`,
5
5
  * `v.stackedBar({})` — for ergonomics and dot-discoverability; the output is
@@ -14,7 +14,7 @@
14
14
  * Unknown keys degrade safely: consumers render a read-only fallback and
15
15
  * refuse writes to types they cannot validate.
16
16
  *
17
- * Constraints come in two tiers, both pure data (24 §8):
17
+ * Constraints come in two tiers, both pure data:
18
18
  * - T1 declarative: min/max/step/pattern/options; group: sumTo/normalize.
19
19
  * - T2 predicates: `requiredWhen`/`visibleWhen`/`enabledWhen`, reusing the
20
20
  * route-predicate shape ({path, equals, truthy}) — declarations that read
@@ -24,6 +24,7 @@
24
24
  * Four consumers key off the same id — factory (here), validator (here),
25
25
  * control renderer (@serene-pub/controls), scaffold printer (cli) — and a
26
26
  * conformance canary asserts no shipped type is missing any of the four.
27
+ * @ruling 24 §8, 24 §8
27
28
  */
28
29
  import { i18nFindings } from './i18n.js';
29
30
  /** The one key of a declaration — its type id. Throws on malformed decls. @experimental */
@@ -53,11 +54,12 @@ function decl(definitionId, props) {
53
54
  return freeze({ [definitionId]: freeze(clean) });
54
55
  }
55
56
  /**
56
- * The authoring door's half of R-20: a declaration's `label` and
57
+ * The authoring door's half of the display-text rule: a declaration's `label` and
57
58
  * `description`, and each select option's, are display text — a string or a
58
59
  * locale map with `en` — refused at the author's line otherwise. `decl()`
59
60
  * itself stays unchecked because `valueDeclOf` bridges stored schemas through
60
61
  * it at read time, and a panel is not the place to refuse a row.
62
+ * @ruling R-20
61
63
  */
62
64
  function declared(definitionId, props) {
63
65
  const findings = [
@@ -236,8 +238,9 @@ export const valueValidators = {
236
238
  };
237
239
  /**
238
240
  * Validate one value against its declaration. Unknown type ids refuse —
239
- * a consumer must never accept a write it cannot check (24 §8).
241
+ * a consumer must never accept a write it cannot check.
240
242
  * @experimental
243
+ * @ruling 24 §8
241
244
  */
242
245
  export function validateValue(declaration, value) {
243
246
  const kind = valueKind(declaration);
@@ -247,10 +250,11 @@ export function validateValue(declaration, value) {
247
250
  return validator(declaration[kind], value);
248
251
  }
249
252
  /**
250
- * A deliberate hole (24 §7): type-checks wherever a value goes, so authoring
253
+ * A deliberate hole: type-checks wherever a value goes, so authoring
251
254
  * can continue — but the coverage report lists it as a named gap, and
252
255
  * validation refuses it like any other unknown.
253
256
  * @experimental
257
+ * @ruling 24 §7
254
258
  */
255
259
  export function todo(note) {
256
260
  return freeze({ 'todo@1': freeze({ note }) });
@@ -264,12 +268,13 @@ export const isTodo = (value) => typeof value === 'object' &&
264
268
  export const shippedValueKinds = Object.freeze(Object.keys(valueValidators));
265
269
  /**
266
270
  * The bridge from the settings-schema vocabulary (`{type:'integer', …}` on
267
- * node-type slots) to value declarations (24 T6c). Derived at read, never
271
+ * node-type slots) to value declarations. Derived at read, never
268
272
  * stored — no document or hash changes — so panels and controls can speak
269
273
  * the value-decl contract while the schemas migrate underneath at their own
270
274
  * pace. Unknown entry types map to nothing, and the caller keeps its
271
275
  * legacy rendering for them.
272
276
  * @experimental
277
+ * @ruling 24 T6c
273
278
  */
274
279
  export function valueDeclOf(entry) {
275
280
  const e = entry;