@serene-pub/sdk 0.6.0-pr-4 → 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 +23 -19
  2. package/dist/actions.d.ts +149 -67
  3. package/dist/actions.js +89 -35
  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 +188 -95
  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 +4 -3
  74. package/dist/identity.js +4 -3
  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 +99 -36
  136. package/dist/shapes.js +101 -35
  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/widgets.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The widget data contract — ONE envelope every session widget receives,
3
- * native and frame alike (PLAN 25, ruled 2026-08-30).
3
+ * native and frame alike.
4
4
  *
5
5
  * A native widget reads these sections through the host's in-document context
6
6
  * (live, reactive); a frame receives the same sections snapshotted over its
@@ -17,7 +17,7 @@
17
17
  * ## Two version clocks
18
18
  *
19
19
  * - `WIDGET_PROTOCOL` versions the TRANSPORT — the verbs (`action` / `invoke`
20
- * / `request` / `menu` / `on`) and the message kinds. Rev only when the wire
20
+ * / `request` / `on`, and the retired ⏳ `menu`) and the message kinds. Rev only when the wire
21
21
  * itself changes.
22
22
  * - Each DATA section is a bag of versioned shapes (`layout: { v1 }`, …). When
23
23
  * a pre-existing key inside a section changes meaning, emit `v2` alongside
@@ -28,9 +28,9 @@
28
28
  *
29
29
  * Base sections ({@link WIDGET_BASE_SECTIONS}: layout / session / channels /
30
30
  * messages / props / actions / settings / annex / locale / viewer /
31
- * turnOrder) are delivered to every widget that READS them (R75,
32
- * `WidgetDecl.reads`; a declaration without `reads` reads all of them, which
33
- * is every widget written before R75). Scoped sections
31
+ * turnOrder / attendance) are delivered to every widget that READS them
32
+ * (`WidgetDecl.reads`; a declaration without `reads` reads all of them, which
33
+ * is every widget written before `reads` existed). Scoped sections
34
34
  * ({@link WidgetScopedSections}, the one table) appear ONLY when the widget
35
35
  * declared the scope AND it was granted — the same deny-by-default a frame
36
36
  * gets, applied at projection so a native widget is no more privileged.
@@ -38,6 +38,7 @@
38
38
  * which of the two, the host says with `grants` (the scopes the widget
39
39
  * holds, on mount and on every change), so a widget draws "not granted"
40
40
  * rather than loading forever.
41
+ * @ruling PLAN 25 (ruled 2026-08-30), R75
41
42
  */
42
43
  /**
43
44
  * @experimental The message-row columns a host never posts to a widget — the
@@ -71,6 +72,15 @@ export function projectMessageRow(row) {
71
72
  out[key] = row[key];
72
73
  return out;
73
74
  }
75
+ /**
76
+ * The attendance before the host's first push — and what a reader answers
77
+ * for a section it was not sent. Frozen.
78
+ * @experimental
79
+ */
80
+ export const EMPTY_ATTENDANCE = Object.freeze({
81
+ v: 1,
82
+ people: Object.freeze([]),
83
+ });
74
84
  /**
75
85
  * {@link WidgetScopedSections} at runtime: scope → the name its section is
76
86
  * posted under. Typed off the table, so a scope missing here, or a name that
@@ -101,11 +111,13 @@ const BASE_SECTIONS = {
101
111
  locale: true,
102
112
  viewer: true,
103
113
  turnOrder: true,
114
+ attendance: true,
104
115
  };
105
116
  /**
106
- * The base sections, in the order the envelope declares them (R75): what
117
+ * The base sections, in the order the envelope declares them: what
107
118
  * `WidgetDecl.reads` may name, and what a widget reads when it names none.
108
119
  * @experimental
120
+ * @ruling R75
109
121
  */
110
122
  export const WIDGET_BASE_SECTIONS = Object.freeze(Object.keys(BASE_SECTIONS));
111
123
  /**
@@ -126,22 +138,55 @@ export const WIDGET_REQUEST_ASKERS = Object.freeze({
126
138
  'change-sprite': 'any',
127
139
  'actions-seen': 'core',
128
140
  summarize: 'core',
129
- send: 'core',
141
+ // 🚧 Live scenes (PROPOSAL-live-scenes §14 C): every scene boundary is a
142
+ // write into the session's lorebook, as the viewer — core's only.
143
+ 'scene-open': 'core',
144
+ 'scene-close': 'core',
145
+ 'scene-move': 'core',
146
+ 'scene-rename': 'core',
147
+ 'scene-remove': 'core',
148
+ // 🚧 A dice tray, a vote, a card draw: the result goes in as the viewer's line,
149
+ // on a channel the widget declares and holds the write grant on.
150
+ send: Object.freeze({ scope: 'channel', write: true }),
130
151
  'attach-files': 'core',
131
152
  'remove-tray-item': 'core',
132
153
  'remove-attachment': 'core',
133
- draft: 'core',
154
+ // 🚧 The gentler send: prefill the composer, on a channel the widget may write.
155
+ draft: Object.freeze({ scope: 'channel', write: true }),
134
156
  'switch-persona': 'core',
135
157
  'add-persona': 'core',
136
158
  'fire-turn': 'core',
137
159
  'decide-proposal': 'core',
138
- 'set-attribute-value': 'core',
160
+ // 🚧 A stat panel that edits: the write beside the `session:state` read.
161
+ 'set-attribute-value': Object.freeze({ scope: 'session:state', write: true }),
139
162
  'set-sprite-set': 'core',
140
163
  'clear-scene-image': 'core',
164
+ // 🚧 Scene Portraits (W6): a member's gallery is part of the cast it was granted.
165
+ 'character-images': Object.freeze({ scope: 'characters' }),
141
166
  'session-entries': Object.freeze({ scope: 'lore' }),
142
167
  'set-entry-marks': 'core',
143
168
  'authors-note': 'core',
144
169
  'set-authors-note': 'core',
170
+ // 🚧 Chronicle (W3): reading the session's history is reading its lore;
171
+ // moving its clock, starting an entry and the graph review act as the viewer.
172
+ 'history-entries': Object.freeze({ scope: 'lore' }),
173
+ 'set-story-clock': 'core',
174
+ 'start-history-entry': 'core',
175
+ 'extend-graph': 'core',
176
+ 'summarize-scenes': 'core',
177
+ 'decide-scene-cue': 'core',
178
+ // 🚧 Places (W4): reading the session's places is reading its lore.
179
+ 'session-places': Object.freeze({ scope: 'lore' }),
180
+ // 🚧 Channel lanes (2026-10-12): what the log shows of a channel; held to a plugin widget's declared channels by the page.
181
+ 'channel-lanes': 'any',
182
+ // 🚧 Stats (F2): a stat's trail is the session's state, read.
183
+ 'stat-trail': Object.freeze({ scope: 'session:state' }),
184
+ // 🚧 Scene Portraits (F2): writes the asking widget's own settings — core's only.
185
+ 'set-chosen-image': 'core',
186
+ // 🚧 Backdrop (2026-10-12): writes session state — core's only.
187
+ 'set-backdrop': 'core',
188
+ // 🚧 Backdrop (D3, 2026-10-12): the session's generated pictures, for its chooser — core's only.
189
+ 'session-images': 'core',
145
190
  });
146
191
  /** Every request kind — what a host checks an incoming `request` against. @experimental */
147
192
  export const WIDGET_REQUEST_KINDS = Object.freeze(Object.keys(WIDGET_REQUEST_ASKERS));
@@ -149,14 +194,22 @@ export const WIDGET_REQUEST_KINDS = Object.freeze(Object.keys(WIDGET_REQUEST_ASK
149
194
  * Why a host must decline this request from this widget, as a sentence — or
150
195
  * null when {@link WIDGET_REQUEST_ASKERS} lets it ask. `owner` is `'core'` or
151
196
  * the widget's plugin id; `grants` the scopes that widget was granted, as
152
- * BARE scopes (`'lore'`, `'session:state'`) — never the permission keys they
153
- * are reviewed as (`'widget:lore'`), which match nothing here. Core's widgets
154
- * hold every scope. A request is still not a grant: null means the host MAY
155
- * answer, never that it must. Grants that are not a list — a stored string,
156
- * whose `includes` would match a substring — grant nothing.
197
+ * BARE scopes (`'lore'`, `'session:state'`, a write grant
198
+ * `'session:state:write'`) — never the permission keys they are reviewed as
199
+ * (`'widget:lore'`), which match nothing here. Core's widgets hold every
200
+ * scope. A request is still not a grant: null means the host MAY answer,
201
+ * never that it must. Grants that are not a list — a stored string, whose
202
+ * `includes` would match a substring — grant nothing.
203
+ *
204
+ * A channel write (`send`, `draft`) is judged against `channels`, the
205
+ * widget's declared channels, and `params.channel` when the request names
206
+ * one: a channel the widget did not declare is refused whatever it holds.
207
+ * A request naming none passes when the widget may write one of its
208
+ * channels, and the HOST holds it to one of those (the composer's channel,
209
+ * for a draft). A host also holds a plugin's write to a person's press.
157
210
  * @experimental
158
211
  */
159
- export function widgetRequestRefusal(kind, from) {
212
+ export function widgetRequestRefusal(kind, from, params) {
160
213
  if (!Object.hasOwn(WIDGET_REQUEST_ASKERS, kind))
161
214
  return `'${kind}' is not something a host answers`;
162
215
  const askers = WIDGET_REQUEST_ASKERS[kind];
@@ -164,21 +217,43 @@ export function widgetRequestRefusal(kind, from) {
164
217
  return null;
165
218
  if (askers === 'core')
166
219
  return `only core's own widgets ask '${kind}'`;
167
- return Array.isArray(from.grants) && from.grants.includes(askers.scope)
220
+ const holds = (grant) => Array.isArray(from.grants) && from.grants.includes(grant);
221
+ if (askers.write !== true)
222
+ return holds(askers.scope)
223
+ ? null
224
+ : `'${kind}' reads what the '${askers.scope}' scope covers, and this widget was not granted it`;
225
+ if (askers.scope !== 'channel') {
226
+ const grant = `${askers.scope}:write`;
227
+ return holds(grant)
228
+ ? null
229
+ : `'${kind}' changes what the '${askers.scope}' scope covers, and this widget was not granted the write grant '${grant}'`;
230
+ }
231
+ const declared = Array.isArray(from.channels) ? from.channels.filter((c) => typeof c === 'string') : [];
232
+ const named = params?.channel;
233
+ if (named !== undefined) {
234
+ if (typeof named !== 'string' || !declared.includes(named))
235
+ return `'${kind}' writes to '${String(named)}', which is not one of this widget's channels`;
236
+ return holds(`channel:${named}:write`)
237
+ ? null
238
+ : `'${kind}' writes to the '${named}' channel, and this widget was not granted the write grant 'channel:${named}:write'`;
239
+ }
240
+ return declared.some((c) => holds(`channel:${c}:write`))
168
241
  ? null
169
- : `'${kind}' reads what the '${askers.scope}' scope covers, and this widget was not granted it`;
242
+ : `'${kind}' writes to a channel, and this widget was not granted the write grant 'channel:<slug>:write' on any channel it declares`;
170
243
  }
171
244
  /**
172
- * 🚧 The scope a widget must hold to HEAR an event kind (R81) — a kind not
245
+ * 🚧 The scope a widget must hold to HEAR an event kind — a kind not
173
246
  * listed is heard by every widget its channel reaches. An event about scoped
174
247
  * data is scoped data: a widget that may not read the lore is not told when
175
248
  * it moved. Read by {@link widgetEventHeard}, which every host delivery of
176
249
  * widget events asks.
177
250
  * @experimental
251
+ * @ruling R81
178
252
  */
179
253
  export const WIDGET_EVENT_SCOPES = Object.freeze({
180
254
  'lore:ranked': 'lore',
181
255
  'lore:marked': 'lore',
256
+ 'story:moved': 'lore',
182
257
  });
183
258
  /**
184
259
  * Is this widget told of an event of this kind? Core's widgets hold every
package/dist/wire.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Allocation and wire formatting are two jobs, and only one of them is modality-agnostic
3
- * (16 §7).
2
+ * Allocation and wire formatting are two jobs, and only one of them is modality-agnostic.
4
3
  *
5
4
  * The earlier draft fused them: Assemble owned a Jinja template and published
6
5
  * `assembled-context@1`, which forced that shape to mean *"a rendered string."* That is
@@ -18,9 +17,10 @@
18
17
  * - **The Provider formats**, through a declared `wire` slot whose default comes from the
19
18
  * connection's adapter metadata. Swapping Ollama for OpenAI does not re-author a spec.
20
19
  *
21
- * A slot rather than adapter-internal logic, for the reason 16 §2 already gives about the
20
+ * A slot rather than adapter-internal logic, for the reason already given about the
22
21
  * retrieval-strategy switch: **a declared field is visible in config, rendered in a lens
23
22
  * and resolved in the receipt; logic inside a leaf is none of those.**
23
+ * @ruling 16 §7, 16 §2
24
24
  */
25
25
  /** @experimental */
26
26
  export type BlockRole = 'system' | 'user' | 'assistant' | 'tool' | 'note';
@@ -30,14 +30,20 @@ export interface ContextBlock {
30
30
  /** Which retrieval source produced it — the axis the weights lens groups by. */
31
31
  sourceKey: string;
32
32
  role: BlockRole;
33
- /** Already text by the time it reaches Assemble (16 §3b, enforced by port shapes). */
33
+ /**
34
+ * Already text by the time it reaches Assemble (enforced by port shapes).
35
+ * @ruling 16 §3b
36
+ */
34
37
  rendered: string;
35
38
  /** Counted once, at render time. Allocation is then arithmetic over integers. */
36
39
  tokens: number;
37
40
  weight?: number;
38
41
  priority?: 'low' | 'normal' | 'high' | 'always';
39
42
  order?: number;
40
- /** Position inside the history, for depth insertion (16 §5e). */
43
+ /**
44
+ * Position inside the history, for depth insertion.
45
+ * @ruling 16 §5e
46
+ */
41
47
  depth?: number;
42
48
  included: boolean;
43
49
  /**
@@ -75,7 +81,8 @@ export interface WireFormat {
75
81
  /**
76
82
  * Tokens the scaffolding adds — role markers, instruct sequences, JSON overhead.
77
83
  * Declared rather than measured after the fact, so Assemble can allocate against a
78
- * **ceiling** and the answer to "will this overspend" is provable (16 §7).
84
+ * **ceiling** and the answer to "will this overspend" is provable.
85
+ * @ruling 16 §7
79
86
  */
80
87
  overhead(ctx: AllocatedContext, count: (s: string) => number): number;
81
88
  }
package/dist/wire.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Allocation and wire formatting are two jobs, and only one of them is modality-agnostic
3
- * (16 §7).
2
+ * Allocation and wire formatting are two jobs, and only one of them is modality-agnostic.
4
3
  *
5
4
  * The earlier draft fused them: Assemble owned a Jinja template and published
6
5
  * `assembled-context@1`, which forced that shape to mean *"a rendered string."* That is
@@ -18,9 +17,10 @@
18
17
  * - **The Provider formats**, through a declared `wire` slot whose default comes from the
19
18
  * connection's adapter metadata. Swapping Ollama for OpenAI does not re-author a spec.
20
19
  *
21
- * A slot rather than adapter-internal logic, for the reason 16 §2 already gives about the
20
+ * A slot rather than adapter-internal logic, for the reason already given about the
22
21
  * retrieval-strategy switch: **a declared field is visible in config, rendered in a lens
23
22
  * and resolved in the receipt; logic inside a leaf is none of those.**
23
+ * @ruling 16 §7, 16 §2
24
24
  */
25
25
  import { refuseUnlessIdentical } from './hash.js';
26
26
  /** @experimental */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * World Info parity — testing the claim in 13 §7i.
2
+ * World Info parity — testing the parity claim.
3
3
  *
4
4
  * The competitive assessment asserts that every SillyTavern World Info feature "maps into
5
5
  * the existing model as params or template logic, not as new mechanisms." That was an
@@ -8,6 +8,7 @@
8
8
  *
9
9
  * Verdict, recorded honestly at the bottom of this file.
10
10
  * @experimental
11
+ * @ruling 13 §7i
11
12
  */
12
13
  export interface LoreEntry {
13
14
  id: string;
@@ -34,13 +35,14 @@ export interface LoreEntry {
34
35
  atDepth: number;
35
36
  };
36
37
  /**
37
- * ⚠ **The one real parity gap** (13 §7i). Depth positioning is expressed in the
38
+ * ⚠ **The one real parity gap**. Depth positioning is expressed in the
38
39
  * assembly template, not by a node or a shape — but the template has to have
39
40
  * something to compare against, and **SP lorebook entries carry no `depth` today.**
40
41
  *
41
42
  * This field is the whole fix: an entry-schema addition in the lorebook model, not
42
43
  * architecture. "Feature missing" and "architecture can't express it" are different
43
- * sizes of problem and only the first was ever true. See 16 §5e and use case 41.
44
+ * sizes of problem and only the first was ever true.
45
+ * @ruling 13 §7i, 16 §5e, use case 41
44
46
  */
45
47
  depth?: number;
46
48
  /** May this entry activate others by mentioning their keys? */
@@ -57,10 +59,11 @@ export interface ScanParams {
57
59
  /**
58
60
  * Activation, including bounded recursion.
59
61
  *
60
- * Recursion lives *inside* the Query hook's opaque interior (01 §12.3) and is bounded by a
62
+ * Recursion lives *inside* the Query hook's opaque interior and is bounded by a
61
63
  * declared param — so it needs no pipeline-level construct and cannot become an unbounded
62
64
  * loop. This is the part of the parity claim that held cleanly.
63
65
  * @experimental
66
+ * @ruling 01 §12.3
64
67
  */
65
68
  export declare function activate(entries: LoreEntry[], scanText: string[], p: ScanParams): {
66
69
  entry: LoreEntry;
@@ -78,8 +81,9 @@ export declare function rollProbability(hits: {
78
81
  * Inclusion groups: competing entries share a label, and one wins by group weight, with
79
82
  * insertion order as the deterministic tiebreak.
80
83
  *
81
- * This is ranking, so it belongs in the rank Task (16 §5c) — no new mechanism.
84
+ * This is ranking, so it belongs in the rank Task — no new mechanism.
82
85
  * @experimental
86
+ * @ruling 16 §5c
83
87
  */
84
88
  export declare function resolveGroups(entries: LoreEntry[], random: () => number): {
85
89
  kept: LoreEntry[];
@@ -123,7 +127,7 @@ export declare function assembleWithPositions(history: PositionedItem[], lore: P
123
127
  dropped: string[];
124
128
  };
125
129
  /**
126
- * ── Verdict on 13 §7i's claim ──────────────────────────────────────────────
130
+ * ── Verdict on the parity claim ──────────────────────────────────────────────
127
131
  *
128
132
  * **Seven of seven mapped with no new mechanism.**
129
133
  *
@@ -146,5 +150,6 @@ export declare function assembleWithPositions(history: PositionedItem[], lore: P
146
150
  * model, not anything in the pipeline architecture. Worth stating precisely, because
147
151
  * "positional insertion is missing" and "the architecture can't express it" are very
148
152
  * different problems and only the first one is true.
153
+ * @ruling 13 §7i
149
154
  */
150
155
  //# sourceMappingURL=worldinfo.d.ts.map
package/dist/worldinfo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * World Info parity — testing the claim in 13 §7i.
2
+ * World Info parity — testing the parity claim.
3
3
  *
4
4
  * The competitive assessment asserts that every SillyTavern World Info feature "maps into
5
5
  * the existing model as params or template logic, not as new mechanisms." That was an
@@ -8,6 +8,7 @@
8
8
  *
9
9
  * Verdict, recorded honestly at the bottom of this file.
10
10
  * @experimental
11
+ * @ruling 13 §7i
11
12
  */
12
13
  const matches = (text, key, useRegex, caseSensitive) => {
13
14
  if (useRegex) {
@@ -41,10 +42,11 @@ const secondaryOk = (e, text, p) => {
41
42
  /**
42
43
  * Activation, including bounded recursion.
43
44
  *
44
- * Recursion lives *inside* the Query hook's opaque interior (01 §12.3) and is bounded by a
45
+ * Recursion lives *inside* the Query hook's opaque interior and is bounded by a
45
46
  * declared param — so it needs no pipeline-level construct and cannot become an unbounded
46
47
  * loop. This is the part of the parity claim that held cleanly.
47
48
  * @experimental
49
+ * @ruling 01 §12.3
48
50
  */
49
51
  export function activate(entries, scanText, p) {
50
52
  const scanned = scanText.slice(0, Math.max(0, p.scanDepth)).join('\n');
@@ -93,8 +95,9 @@ export function rollProbability(hits, random) {
93
95
  * Inclusion groups: competing entries share a label, and one wins by group weight, with
94
96
  * insertion order as the deterministic tiebreak.
95
97
  *
96
- * This is ranking, so it belongs in the rank Task (16 §5c) — no new mechanism.
98
+ * This is ranking, so it belongs in the rank Task — no new mechanism.
97
99
  * @experimental
100
+ * @ruling 16 §5c
98
101
  */
99
102
  export function resolveGroups(entries, random) {
100
103
  const groups = new Map();
@@ -185,7 +188,7 @@ export function assembleWithPositions(history, lore, budget, costOf) {
185
188
  return { text: out.join('\n'), included, dropped };
186
189
  }
187
190
  /**
188
- * ── Verdict on 13 §7i's claim ──────────────────────────────────────────────
191
+ * ── Verdict on the parity claim ──────────────────────────────────────────────
189
192
  *
190
193
  * **Seven of seven mapped with no new mechanism.**
191
194
  *
@@ -208,5 +211,6 @@ export function assembleWithPositions(history, lore, budget, costOf) {
208
211
  * model, not anything in the pipeline architecture. Worth stating precisely, because
209
212
  * "positional insertion is missing" and "the architecture can't express it" are very
210
213
  * different problems and only the first one is true.
214
+ * @ruling 13 §7i
211
215
  */
212
216
  //# sourceMappingURL=worldinfo.js.map
@@ -852,6 +852,18 @@ export interface SpHostElements {
852
852
  'class'?: SpAttr
853
853
  slot?: string
854
854
  }
855
+ /**
856
+ * 🚧 A handle a person drags along a list to move a boundary between its items (1.4) — a scene divider's start. Its body is the grip (`sp-drag-handle-grip`), drawn by the widget. `along` names the items, by one widget part (`messages.message-row`); each item carries its key as `data-drag-key`, and an item drawn `hidden` is passed over. While dragged, a line (`sp-drag-handle-line`) shows the gap between items the handle would land in, snapping to the nearest; Escape cancels. On release `move` carries `{ prev, next }` — the keys of the items before and after that gap, in document order (null at either end). Pointer only: the widget offers the same move another way (a menu row), and the grip is hidden from assistive technology.
857
+ * Parts: `.sp-drag-handle`, `.sp-drag-handle-grip`, `.sp-drag-handle-line`.
858
+ * Events: `move`.
859
+ */
860
+ 'sp-drag-handle': {
861
+ 'along'?: SpAttr
862
+ 'label'?: SpAttr
863
+ 'disabled'?: SpAttr
864
+ 'class'?: SpAttr
865
+ slot?: string
866
+ }
855
867
  /**
856
868
  * A scroll region. `stick="bottom"` keeps it anchored to the end as content grows, as a log does (`stick="top"` for a newest-first log); scrolled away from that end, what is on screen stays put as rows arrive above or below. `reach-start` fires when the far end from `stick` is reached (load older).
857
869
  * Parts: `.sp-scroll`.
@@ -909,6 +921,7 @@ export interface SpHostEvents {
909
921
  'sp-composer-field': 'input' | 'change' | 'submit' | 'key' | 'focus'
910
922
  'sp-file-picker': 'files'
911
923
  'sp-drop-zone': 'files'
924
+ 'sp-drag-handle': 'move'
912
925
  'sp-scroll': 'reach-start'
913
926
  'sp-frame': 'action' | 'error' | 'invoke'
914
927
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serene-pub/sdk",
3
- "version": "0.6.0-pr-4",
3
+ "version": "0.6.0-pr-5",
4
4
  "description": "Author Serene Pub pipelines and plugins: nodes, specs, the executor, and the author-side test harness.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/SerenePub/serene-pub-sdk/tree/main/sdk#readme",