@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,6 +1,5 @@
1
1
  /**
2
- * What a template can reference at one node of one document, typed (typed
3
- * templates P3, 2026-09-27).
2
+ * What a template can reference at one node of one document, typed.
4
3
  *
5
4
  * ```ts
6
5
  * const scope = templateScopeAt(doc, 'prompt', { genre: 'showcase.twenty-questions:genre/game' })
@@ -17,7 +16,7 @@
17
16
  * | the `prompts` slot's fields | `slotToVarField`, followed through a slot reference (`slot.prompts({ node })`, an envoy's) |
18
17
  * | the context builder's keys | the declared out-port schema (`Descriptor.portSchemas`) of whatever feeds a template-context in-port |
19
18
  * | one per declared band | `rendersAt` over the node's `variables` slot — the laid-out string |
20
- * | `annex` | every declared annex key of every owner in scope (`annexVarFieldOf`), as `annex.<owner>.<key>` — only where the node's `annex` in-port is wired (P6) |
19
+ * | `annex` | every declared annex key of every owner in scope (`annexVarFieldOf`), as `annex.<owner>.<key>` — only where the node's `annex` in-port is wired |
21
20
  * | `state` | the builder's `state`, re-typed from the genre's attribute slots |
22
21
  *
23
22
  * **Order is `render()`'s.** The node's own names are the last word — Assemble
@@ -27,17 +26,18 @@
27
26
  * (`BandCollisionError`), because a template reading it would get one or the
28
27
  * other depending on spread order.
29
28
  *
30
- * **Safe (owner ruling Q1, 2026-09-27).** Everything rendered into the context
29
+ * **Safe.** Everything rendered into the context
31
30
  * may be in scope, and nothing dangerous is ever declared: annex declarations
32
- * refuse secrets at write time (R61). What this refuses on top is the
31
+ * refuse secrets at write time. What this refuses on top is the
33
32
  * *kinds* no template may reach by any door — a secret, connection / sampling
34
- * / endpoint / model identity (R53), debug metadata, embeddings — by name,
33
+ * / endpoint / model identity, debug metadata, embeddings — by name,
35
34
  * anywhere in the tree (`ForbiddenTemplateFieldError`).
36
35
  *
37
36
  * The runtime value of `annex` arrives on the node's `annex` in-port, from
38
- * `core:query/session-annex@1` with `view: 'template'` (P6, law T2); the
37
+ * `core:query/session-annex@1` with `view: 'template'`; the
39
38
  * scope carries it only where that port is wired.
40
39
  * @experimental
40
+ * @ruling typed templates P3 (2026-09-27), P6, owner ruling Q1 (2026-09-27), R61, R53, P6, law T2
41
41
  */
42
42
  import { type AttributeSlotDecl } from './attributes.js';
43
43
  import { type BandSource } from './bands.js';
@@ -49,8 +49,9 @@ import { type VariableDecl } from './variables.js';
49
49
  * What `templateScopeAt` needs from a node's definition. A `Descriptor`
50
50
  * satisfies it, and so does a registry row read as `{ slots, ports, bands:
51
51
  * policy.bands, portSchemas: policy.portSchemas }` — so a host answers from
52
- * rows without loading a plugin (F6).
52
+ * rows without loading a plugin.
53
53
  * @experimental
54
+ * @ruling F6
54
55
  */
55
56
  export interface ScopeSource extends BandSource {
56
57
  slots?: Record<string, SlotDecl>;
@@ -90,15 +91,20 @@ export interface TemplateScopeReport {
90
91
  /** What is wrong but not fatal — each names the fix. */
91
92
  findings: string[];
92
93
  }
93
- /** A kind no template may reach by any door (typed templates §1 "safe" iv, R53). @experimental */
94
+ /**
95
+ * A kind no template may reach by any door.
96
+ * @experimental
97
+ * @ruling typed templates §1 "safe" iv, R53
98
+ */
94
99
  export declare class ForbiddenTemplateFieldError extends Error {
95
100
  }
96
101
  /**
97
102
  * Names that ARE a forbidden kind, compared case-blind: a connection, sampling,
98
- * endpoint or model identity (R53), debug metadata, embeddings, a secret value.
103
+ * endpoint or model identity, debug metadata, embeddings, a secret value.
99
104
  * Deliberately names rather than shapes — a `VarField` has no kind for any of
100
105
  * these, which is exactly why one would arrive disguised as a `string`.
101
106
  * @experimental
107
+ * @ruling R53
102
108
  */
103
109
  export declare const FORBIDDEN_TEMPLATE_NAMES: readonly string[];
104
110
  /**
@@ -114,7 +120,11 @@ export declare function templateScopeReport(doc: {
114
120
  genre?: string;
115
121
  };
116
122
  }, nodeKey: string, env?: TemplateScopeEnv): TemplateScopeReport;
117
- /** The in-port a template node reads the annex on (P6). @experimental */
123
+ /**
124
+ * The in-port a template node reads the annex on.
125
+ * @experimental
126
+ * @ruling P6
127
+ */
118
128
  export declare const TEMPLATE_ANNEX_PORT = "annex";
119
129
  /**
120
130
  * The typed scope of a template slot at `nodeKey` — see the module note.
@@ -1,6 +1,5 @@
1
1
  /**
2
- * What a template can reference at one node of one document, typed (typed
3
- * templates P3, 2026-09-27).
2
+ * What a template can reference at one node of one document, typed.
4
3
  *
5
4
  * ```ts
6
5
  * const scope = templateScopeAt(doc, 'prompt', { genre: 'showcase.twenty-questions:genre/game' })
@@ -17,7 +16,7 @@
17
16
  * | the `prompts` slot's fields | `slotToVarField`, followed through a slot reference (`slot.prompts({ node })`, an envoy's) |
18
17
  * | the context builder's keys | the declared out-port schema (`Descriptor.portSchemas`) of whatever feeds a template-context in-port |
19
18
  * | one per declared band | `rendersAt` over the node's `variables` slot — the laid-out string |
20
- * | `annex` | every declared annex key of every owner in scope (`annexVarFieldOf`), as `annex.<owner>.<key>` — only where the node's `annex` in-port is wired (P6) |
19
+ * | `annex` | every declared annex key of every owner in scope (`annexVarFieldOf`), as `annex.<owner>.<key>` — only where the node's `annex` in-port is wired |
21
20
  * | `state` | the builder's `state`, re-typed from the genre's attribute slots |
22
21
  *
23
22
  * **Order is `render()`'s.** The node's own names are the last word — Assemble
@@ -27,17 +26,18 @@
27
26
  * (`BandCollisionError`), because a template reading it would get one or the
28
27
  * other depending on spread order.
29
28
  *
30
- * **Safe (owner ruling Q1, 2026-09-27).** Everything rendered into the context
29
+ * **Safe.** Everything rendered into the context
31
30
  * may be in scope, and nothing dangerous is ever declared: annex declarations
32
- * refuse secrets at write time (R61). What this refuses on top is the
31
+ * refuse secrets at write time. What this refuses on top is the
33
32
  * *kinds* no template may reach by any door — a secret, connection / sampling
34
- * / endpoint / model identity (R53), debug metadata, embeddings — by name,
33
+ * / endpoint / model identity, debug metadata, embeddings — by name,
35
34
  * anywhere in the tree (`ForbiddenTemplateFieldError`).
36
35
  *
37
36
  * The runtime value of `annex` arrives on the node's `annex` in-port, from
38
- * `core:query/session-annex@1` with `view: 'template'` (P6, law T2); the
37
+ * `core:query/session-annex@1` with `view: 'template'`; the
39
38
  * scope carries it only where that port is wired.
40
39
  * @experimental
40
+ * @ruling typed templates P3 (2026-09-27), P6, owner ruling Q1 (2026-09-27), R61, R53, P6, law T2
41
41
  */
42
42
  import { annexOwners, annexVarFieldOf } from './annexFields.js';
43
43
  import { slotField } from './attributes.js';
@@ -48,15 +48,20 @@ import { fieldToVarField, slotToVarField } from './template.js';
48
48
  import { getVariable } from './variables.js';
49
49
  /** The shape a context builder's payload travels as. Written out, as `bands.ts` writes its own. */
50
50
  const TEMPLATE_CONTEXT_SHAPE = 'core:shape/template-context@1';
51
- /** A kind no template may reach by any door (typed templates §1 "safe" iv, R53). @experimental */
51
+ /**
52
+ * A kind no template may reach by any door.
53
+ * @experimental
54
+ * @ruling typed templates §1 "safe" iv, R53
55
+ */
52
56
  export class ForbiddenTemplateFieldError extends Error {
53
57
  }
54
58
  /**
55
59
  * Names that ARE a forbidden kind, compared case-blind: a connection, sampling,
56
- * endpoint or model identity (R53), debug metadata, embeddings, a secret value.
60
+ * endpoint or model identity, debug metadata, embeddings, a secret value.
57
61
  * Deliberately names rather than shapes — a `VarField` has no kind for any of
58
62
  * these, which is exactly why one would arrive disguised as a `string`.
59
63
  * @experimental
64
+ * @ruling R53
60
65
  */
61
66
  export const FORBIDDEN_TEMPLATE_NAMES = [
62
67
  'apiKey',
@@ -133,11 +138,12 @@ const slotKeys = (id) => {
133
138
  /**
134
139
  * `state`, typed from attribute slots: `state.world.<slot>`,
135
140
  * `state.cast.<member>.<slot>` beside the member's `id`, `key` and `name`,
136
- * and `state.locations.<place>.<slot>` likewise (P6 — what the host renders:
141
+ * and `state.locations.<place>.<slot>` likewise (what the host renders:
137
142
  * slug-keyed holders only, never the `byId` index).
138
143
  * A genre that lets sessions add attributes of their own (`customAttributes:
139
144
  * 'allow'`) — or no known genre at all — leaves the bags open: the honest
140
145
  * answer for a set nobody can list.
146
+ * @ruling P6
141
147
  */
142
148
  function stateVarField(slots, open, base) {
143
149
  const bag = (applies) => {
@@ -335,7 +341,11 @@ export function templateScopeReport(doc, nodeKey, env = {}) {
335
341
  refuseForbidden(root, decl, declarers[root]);
336
342
  return { scope, declarers, untyped, findings };
337
343
  }
338
- /** The in-port a template node reads the annex on (P6). @experimental */
344
+ /**
345
+ * The in-port a template node reads the annex on.
346
+ * @experimental
347
+ * @ruling P6
348
+ */
339
349
  export const TEMPLATE_ANNEX_PORT = 'annex';
340
350
  /** Whether `node` declares the annex in-port and something feeds it. */
341
351
  function annexWired(doc, node, d) {
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@serene-pub/sdk/testing` — the harness a **plugin author** runs (03 §9, U11).
2
+ * `@serene-pub/sdk/testing` — the harness a **plugin author** runs.
3
3
  *
4
4
  * Distinct from `src/conformance.ts`, which is what **SP Core** runs against its own
5
5
  * executor. Two different audiences and two different questions:
@@ -11,16 +11,18 @@
11
11
  * is answered by goldens: record a receipt now, compare later, and see the diff rather
12
12
  * than a pass/fail. **"It still runs" is not the assertion anyone needs** — a plugin that
13
13
  * runs and quietly changes the prompt is the failure mode that reaches users.
14
+ * @ruling 03 §9, U11
14
15
  */
15
16
  import type { Receipt } from './receipt.js';
16
17
  import type { SpecDocument } from './document.js';
17
18
  import type { Bindings, RunOptions } from './executor.js';
18
19
  import type { Descriptor } from './descriptors.js';
19
20
  /**
20
- * The plugin sandbox's context, in this harness (plans 29 §14 D-3) — the half
21
+ * The plugin sandbox's context, in this harness — the half
21
22
  * the executor cannot supply, because a plugin's node handlers never run
22
23
  * against the executor's context at install. Re-exported here so an author's
23
24
  * one import is `@serene-pub/sdk/testing`.
25
+ * @ruling plans 29 §14 D-3
24
26
  */
25
27
  export * from './pluginHarness.js';
26
28
  /** @experimental */
@@ -161,13 +163,18 @@ export declare function makeExampleRunCtx(doc: SpecDocument, opts?: {
161
163
  */
162
164
  export declare function renderRunSummary(r: Receipt): string;
163
165
  /**
164
- * F26 as a one-liner an author can run: parallel and forced-sequential must produce the
166
+ * A one-liner an author can run: parallel and forced-sequential must produce the
165
167
  * same result. If your hook has a hidden ordering dependency, this is where it shows up
166
168
  * — not in a user's chat at 2am under load.
167
169
  * @experimental
170
+ * @ruling F26
168
171
  */
169
172
  export declare function assertEquivalent(doc: SpecDocument, opts: RunOptions): Promise<void>;
170
- /** Run the same spec twice on one seed and assert nothing moved (F11). @experimental */
173
+ /**
174
+ * Run the same spec twice on one seed and assert nothing moved.
175
+ * @experimental
176
+ * @ruling F11
177
+ */
171
178
  export declare function assertDeterministic(doc: SpecDocument, opts: RunOptions & {
172
179
  seed: string;
173
180
  }): Promise<void>;
package/dist/testing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@serene-pub/sdk/testing` — the harness a **plugin author** runs (03 §9, U11).
2
+ * `@serene-pub/sdk/testing` — the harness a **plugin author** runs.
3
3
  *
4
4
  * Distinct from `src/conformance.ts`, which is what **SP Core** runs against its own
5
5
  * executor. Two different audiences and two different questions:
@@ -11,13 +11,15 @@
11
11
  * is answered by goldens: record a receipt now, compare later, and see the diff rather
12
12
  * than a pass/fail. **"It still runs" is not the assertion anyone needs** — a plugin that
13
13
  * runs and quietly changes the prompt is the failure mode that reaches users.
14
+ * @ruling 03 §9, U11
14
15
  */
15
16
  import { run } from './executor.js';
16
17
  /**
17
- * The plugin sandbox's context, in this harness (plans 29 §14 D-3) — the half
18
+ * The plugin sandbox's context, in this harness — the half
18
19
  * the executor cannot supply, because a plugin's node handlers never run
19
20
  * against the executor's context at install. Re-exported here so an author's
20
21
  * one import is `@serene-pub/sdk/testing`.
22
+ * @ruling plans 29 §14 D-3
21
23
  */
22
24
  export * from './pluginHarness.js';
23
25
  /**
@@ -265,12 +267,13 @@ const plural = (n, noun) => `${n} ${noun}${n === 1 ? '' : 's'}`;
265
267
  /** How much of a written text a summary line shows before it stops. */
266
268
  const WROTE_LIMIT = 100;
267
269
  /**
268
- * Whether this outlet's published result is a write the host took (13 §7j-b).
270
+ * Whether this outlet's published result is a write the host took.
269
271
  *
270
272
  * The verb on the line below is `wrote`, so it has to be earned. A write-effect
271
273
  * outlet publishes a discriminated `WriteResult` and the executor stamps
272
274
  * `committed` on it; an emit-class outlet publishes whatever its binding
273
275
  * returned, and `pending` is a write still sitting in review.
276
+ * @ruling 13 §7j-b
274
277
  */
275
278
  const committed = (output) => !!output &&
276
279
  typeof output === 'object' &&
@@ -347,10 +350,11 @@ export function renderRunSummary(r) {
347
350
  }
348
351
  // ── Equivalence ─────────────────────────────────────────────────────────────
349
352
  /**
350
- * F26 as a one-liner an author can run: parallel and forced-sequential must produce the
353
+ * A one-liner an author can run: parallel and forced-sequential must produce the
351
354
  * same result. If your hook has a hidden ordering dependency, this is where it shows up
352
355
  * — not in a user's chat at 2am under load.
353
356
  * @experimental
357
+ * @ruling F26
354
358
  */
355
359
  export async function assertEquivalent(doc, opts) {
356
360
  const norm = (r) => r.nodes
@@ -364,7 +368,11 @@ export async function assertEquivalent(doc, opts) {
364
368
  'depends on completion order — usually a hook mutating shared state rather than returning it.');
365
369
  }
366
370
  }
367
- /** Run the same spec twice on one seed and assert nothing moved (F11). @experimental */
371
+ /**
372
+ * Run the same spec twice on one seed and assert nothing moved.
373
+ * @experimental
374
+ * @ruling F11
375
+ */
368
376
  export async function assertDeterministic(doc, opts) {
369
377
  const a = await run(doc, opts);
370
378
  const b = await run(doc, opts);
@@ -22,8 +22,8 @@
22
22
  *
23
23
  * The SDK barrel has **no dependencies**, deliberately — nothing it reaches
24
24
  * imports anything outside `src/`. (The one exception is its own entry point:
25
- * `/template-check` parses with `handlebars` and `liquidjs`, typed templates
26
- * Q5, and nothing on the barrel imports it.) Real tokenizers are the opposite of that: the four
25
+ * `/template-check` parses with `handlebars` and `liquidjs`, and
26
+ * nothing on the barrel imports it.) Real tokenizers are the opposite of that: the four
27
27
  * packages a host needs for the twelve ids below are ~69 MB on disk, and an
28
28
  * author who installed `@serene-pub/sdk` to write one node type has no business
29
29
  * downloading a BPE merge table. There is also a hard mechanical reason: this
@@ -22,8 +22,8 @@
22
22
  *
23
23
  * The SDK barrel has **no dependencies**, deliberately — nothing it reaches
24
24
  * imports anything outside `src/`. (The one exception is its own entry point:
25
- * `/template-check` parses with `handlebars` and `liquidjs`, typed templates
26
- * Q5, and nothing on the barrel imports it.) Real tokenizers are the opposite of that: the four
25
+ * `/template-check` parses with `handlebars` and `liquidjs`, and
26
+ * nothing on the barrel imports it.) Real tokenizers are the opposite of that: the four
27
27
  * packages a host needs for the twelve ids below are ~69 MB on disk, and an
28
28
  * author who installed `@serene-pub/sdk` to write one node type has no business
29
29
  * downloading a BPE merge table. There is also a hard mechanical reason: this
@@ -44,11 +44,12 @@ export interface TurnMessage {
44
44
  speakerId: number | null;
45
45
  /**
46
46
  * The **turn** the message belongs to — the run that created it — when
47
- * the asker knows (lair pass R8, 2026-09-28). Optional: absent, the
47
+ * the asker knows. Optional: absent, the
48
48
  * world's rule is the newest message alone, exactly as before. Present,
49
49
  * every row of the newest turn is open for the world (see
50
50
  * `isAnchorOpen`). A person's own line belongs to no run, so it carries
51
51
  * none.
52
+ * @ruling lair pass R8 (2026-09-28)
52
53
  */
53
54
  turn?: string | number | null;
54
55
  }
@@ -82,7 +83,7 @@ export declare function openAnchorFor(messages: readonly TurnMessage[], owner: T
82
83
  * character who has not spoken has no anchor, and a change filed against no
83
84
  * anchor is open until they do.
84
85
  *
85
- * **The world's newest turn, whole** (lair pass R8, 2026-09-28): a turn may
86
+ * **The world's newest turn, whole**: a turn may
86
87
  * write several rows — the Lair's Castellan posts its beats in the Sanctum
87
88
  * and then the party speak — and the world's changes are anchored to the
88
89
  * row that planned them, not to whichever delver happened to speak last. So
@@ -91,6 +92,7 @@ export declare function openAnchorFor(messages: readonly TurnMessage[], owner: T
91
92
  * Nothing written after that turn by anybody else is sealed any later than
92
93
  * before; a caller that supplies no `turn` gets the newest-message rule.
93
94
  * @experimental
95
+ * @ruling lair pass R8 (2026-09-28)
94
96
  */
95
97
  export declare function isAnchorOpen(messages: readonly TurnMessage[], owner: TurnOwner, anchorId: number | null): boolean;
96
98
  //# sourceMappingURL=turnLock.d.ts.map
package/dist/turnLock.js CHANGED
@@ -56,7 +56,7 @@ export function openAnchorFor(messages, owner) {
56
56
  * character who has not spoken has no anchor, and a change filed against no
57
57
  * anchor is open until they do.
58
58
  *
59
- * **The world's newest turn, whole** (lair pass R8, 2026-09-28): a turn may
59
+ * **The world's newest turn, whole**: a turn may
60
60
  * write several rows — the Lair's Castellan posts its beats in the Sanctum
61
61
  * and then the party speak — and the world's changes are anchored to the
62
62
  * row that planned them, not to whichever delver happened to speak last. So
@@ -65,6 +65,7 @@ export function openAnchorFor(messages, owner) {
65
65
  * Nothing written after that turn by anybody else is sealed any later than
66
66
  * before; a caller that supplies no `turn` gets the newest-message rule.
67
67
  * @experimental
68
+ * @ruling lair pass R8 (2026-09-28)
68
69
  */
69
70
  export function isAnchorOpen(messages, owner, anchorId) {
70
71
  if (anchorId === openAnchorFor(messages, owner))
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Turn order as state (PLAN-turn-order §4.2, ruled 2026-09-21).
2
+ * Turn order as state.
3
3
  *
4
4
  * The session's ordered list of prepared turns is a **document**, not a
5
5
  * decision a run makes on the way to a reply. It lives at
6
6
  * `sessions.metadata.turnOrder`, is written by `core:outlet/set-turn-order@1`
7
- * and nothing else, and survives refresh and reboot (R5). A page renders it;
7
+ * and nothing else, and survives refresh and reboot. A page renders it;
8
8
  * a socket fires an entry from it; the recompute is a pipeline
9
9
  * (`core:spec/<genre>-turn-order`, one per genre) that answers a session event and reads only.
10
10
  *
@@ -17,10 +17,11 @@
17
17
  *
18
18
  * ⚠ `TurnCandidateV1.ref` is a `ParticipantRef`, whose grammar today admits
19
19
  * `character:` · `envoy:` · `user:` and the roles — not `persona:`. A
20
- * persona is a character row flagged `is_persona` (NOMENCLATURE §23), so its
20
+ * persona is a character row flagged `is_persona`, so its
21
21
  * reference is `character:<id>` and `kind: 'persona'` is what says which;
22
- * whether the grammar grows a `persona:` form is an open question the plan
23
- * records (§8), not one this file answers.
22
+ * whether the grammar grows a `persona:` form is an open question still
23
+ * recorded, not one this file answers.
24
+ * @ruling PLAN-turn-order §4.2 (ruled 2026-09-21), R5, NOMENCLATURE §23, PLAN-turn-order §8
24
25
  */
25
26
  import type { ParticipantRef } from './participants.js';
26
27
  /** @experimental */
@@ -78,10 +79,11 @@ export declare const EMPTY_TURN_ORDER: TurnOrderV1;
78
79
  * The turn order a session's `metadata` holds — `EMPTY_TURN_ORDER` when the
79
80
  * key is missing or the value is not a `TurnOrderV1`. Never throws: a
80
81
  * session that predates this build, or one whose metadata a hand edit
81
- * broke, has an empty order until its next event recomputes it (§4.1,
82
- * "no backfill"). The document is returned as stored, extra keys included;
82
+ * broke, has an empty order until its next event recomputes it (no
83
+ * backfill). The document is returned as stored, extra keys included;
83
84
  * only its shape is judged.
84
85
  * @experimental
86
+ * @ruling PLAN-turn-order §4.1
85
87
  */
86
88
  export declare function readTurnOrder(metadata: unknown): TurnOrderV1;
87
89
  /**
@@ -89,7 +91,8 @@ export declare function readTurnOrder(metadata: unknown): TurnOrderV1;
89
91
  * `core:shape/messages@1` carries (the host's `session-history` projection),
90
92
  * reduced to what the rule needs. Rows may carry more; the rule ignores it.
91
93
  *
92
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
94
+ * @experimental 🚧 provisional with the turn-order vocabulary.
95
+ * @ruling PLAN-turn-order §4.4
93
96
  */
94
97
  export interface TurnHistoryMessage {
95
98
  role: string;
@@ -110,7 +113,8 @@ export interface TurnHistoryMessage {
110
113
  * or `undefined` — a sparse or partially loaded history) is skipped, never a
111
114
  * throw: every reader of turn order goes through here, so it tolerates them once.
112
115
  *
113
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
116
+ * @experimental 🚧 provisional with the turn-order vocabulary.
117
+ * @ruling PLAN-turn-order §4.4
114
118
  */
115
119
  export declare function countedTurns<M extends TurnHistoryMessage>(messages: readonly (M | null | undefined)[]): M[];
116
120
  /**
@@ -124,7 +128,8 @@ export declare function countedTurns<M extends TurnHistoryMessage>(messages: rea
124
128
  * envoy's reply marks no character. Before any user row the whole history is
125
129
  * one round, so a greeting counts as its character's turn.
126
130
  *
127
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
131
+ * @experimental 🚧 provisional with the turn-order vocabulary.
132
+ * @ruling PLAN-turn-order §4.4
128
133
  */
129
134
  export declare function spokenRefsSince(messages: readonly (TurnHistoryMessage | null | undefined)[]): Set<string>;
130
135
  /**
@@ -137,7 +142,8 @@ export declare function spokenRefsSince(messages: readonly (TurnHistoryMessage |
137
142
  * This is the rule `core:task/turn-round-robin@1` runs, and the fallback a
138
143
  * plugin's own strategy should use rather than carry a copy of it.
139
144
  *
140
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
145
+ * @experimental 🚧 provisional with the turn-order vocabulary.
146
+ * @ruling PLAN-turn-order §4.4
141
147
  */
142
148
  export declare function roundRobinOrder(candidates: readonly TurnCandidateV1[], messages: readonly (TurnHistoryMessage | null | undefined)[]): TurnEntryV1[];
143
149
  //# sourceMappingURL=turnOrder.d.ts.map
package/dist/turnOrder.js CHANGED
@@ -29,10 +29,11 @@ const isCandidate = (v) => isRecord(v) &&
29
29
  * The turn order a session's `metadata` holds — `EMPTY_TURN_ORDER` when the
30
30
  * key is missing or the value is not a `TurnOrderV1`. Never throws: a
31
31
  * session that predates this build, or one whose metadata a hand edit
32
- * broke, has an empty order until its next event recomputes it (§4.1,
33
- * "no backfill"). The document is returned as stored, extra keys included;
32
+ * broke, has an empty order until its next event recomputes it (no
33
+ * backfill). The document is returned as stored, extra keys included;
34
34
  * only its shape is judged.
35
35
  * @experimental
36
+ * @ruling PLAN-turn-order §4.1
36
37
  */
37
38
  export function readTurnOrder(metadata) {
38
39
  if (!isRecord(metadata))
@@ -64,7 +65,8 @@ const speakerRefOf = (m) => m.speaker ?? m.metadata?.speaker;
64
65
  * or `undefined` — a sparse or partially loaded history) is skipped, never a
65
66
  * throw: every reader of turn order goes through here, so it tolerates them once.
66
67
  *
67
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
68
+ * @experimental 🚧 provisional with the turn-order vocabulary.
69
+ * @ruling PLAN-turn-order §4.4
68
70
  */
69
71
  export function countedTurns(messages) {
70
72
  return messages.filter((m) => !!m && !m.isHidden && !m.isNarratorResponse);
@@ -86,7 +88,8 @@ const lastUserIndex = (turns) => {
86
88
  * envoy's reply marks no character. Before any user row the whole history is
87
89
  * one round, so a greeting counts as its character's turn.
88
90
  *
89
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
91
+ * @experimental 🚧 provisional with the turn-order vocabulary.
92
+ * @ruling PLAN-turn-order §4.4
90
93
  */
91
94
  export function spokenRefsSince(messages) {
92
95
  const turns = countedTurns(messages);
@@ -119,7 +122,8 @@ export function spokenRefsSince(messages) {
119
122
  * This is the rule `core:task/turn-round-robin@1` runs, and the fallback a
120
123
  * plugin's own strategy should use rather than carry a copy of it.
121
124
  *
122
- * @experimental 🚧 provisional with the turn-order vocabulary (PLAN-turn-order §4.4).
125
+ * @experimental 🚧 provisional with the turn-order vocabulary.
126
+ * @ruling PLAN-turn-order §4.4
123
127
  */
124
128
  export function roundRobinOrder(candidates, messages) {
125
129
  const spoken = spokenRefsSince(messages);
@@ -1,8 +1,9 @@
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 { type SpecDocument } from './document.js';
8
9
  import { type TemplateChecking } from './templateFit.js';
@@ -20,20 +21,20 @@ export interface Finding {
20
21
  */
21
22
  export interface ValidateOptions {
22
23
  /**
23
- * The template checker, for law T1's name check (typed templates P5):
24
+ * The template checker, for the template-fit law's name check:
24
25
  * `{ check: checkTemplateSourceReport }` from `@serene-pub/sdk/template-check`,
25
26
  * plus the host's vocabulary. A value rather than an import because the
26
27
  * checker carries the engines and this module is on the dependency-free
27
- * barrel. Absent, T1 still refuses scope collisions, forbidden kinds and a
28
+ * barrel. Absent, the law still refuses scope collisions, forbidden kinds and a
28
29
  * band with no variable; it does not read template sources.
30
+ * @ruling law T1, typed templates P5, T1
29
31
  */
30
32
  templates?: TemplateChecking;
31
33
  }
32
34
  /** @experimental */
33
35
  export declare function validate(doc: SpecDocument, options?: ValidateOptions): Finding[];
34
36
  /**
35
- * The streaming step and the step status, as declared on `expose` (lair
36
- * pass B3/B18; owner D6 and D5, 2026-09-27).
37
+ * The streaming step and the step status, as declared on `expose`.
37
38
  *
38
39
  * Which oracle streams into the reply is **declared**, never inferred: the
39
40
  * inference it replaced skipped every oracle inside a clause and streamed the
@@ -45,7 +46,7 @@ export declare function validate(doc: SpecDocument, options?: ValidateOptions):
45
46
  * would write its document into the row a person is reading;
46
47
  * · **one per execution path** — a run has one live row, and two streams
47
48
  * interleave or concatenate into it. Two steps that can never run in the
48
- * same execution may each stream (W2, 2026-09-27): they sit in different
49
+ * same execution may each stream: they sit in different
49
50
  * branches of one junction whose predicates are mutually exclusive — one
50
51
  * is the `otherwise`, or both are `equals` on the same path with different
51
52
  * literals. The runtime streams whichever one runs. Anything weaker (a
@@ -55,20 +56,22 @@ export declare function validate(doc: SpecDocument, options?: ValidateOptions):
55
56
  * into the same row;
56
57
  * · **an oracle** — only an oracle has a model's tokens to stream.
57
58
  *
58
- * A step status, step label and step purpose are display text (R-20), and a
59
+ * A step status, step label and step purpose are display text, and a
59
60
  * step purpose sits only on a model call — an oracle whose definition declares
60
61
  * a `connection` slot (`isModelCall`; law `step purpose`, 2026-09-30).
61
62
  * @internal
63
+ * @ruling lair pass B3/B18, owner D6 and D5 (2026-09-27), W2 (2026-09-27), R-20
62
64
  */
63
65
  export declare function streamingStepFindings(doc: SpecDocument): Finding[];
64
66
  /** @experimental */
65
67
  export declare function assertValid(doc: SpecDocument, options?: ValidateOptions): void;
66
68
  /**
67
- * The R-20 findings over one stored document: presets, and the genre
69
+ * The display-text findings over one stored document: presets, and the genre
68
70
  * declaration a create pipeline carries. Read as `unknown` throughout — a
69
71
  * document may have come from anywhere — so a wrong shape is a sentence,
70
72
  * never a throw.
71
73
  * @experimental
74
+ * @ruling R-20
72
75
  */
73
76
  export declare function documentDisplayTextFindings(doc: SpecDocument): string[];
74
77
  //# sourceMappingURL=validate.d.ts.map