@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.
- package/README.md +23 -19
- package/dist/actions.d.ts +149 -67
- package/dist/actions.js +89 -35
- package/dist/annexFields.d.ts +8 -4
- package/dist/annexFields.js +5 -2
- package/dist/announce.d.ts +78 -28
- package/dist/announce.js +14 -5
- package/dist/attributes.d.ts +9 -6
- package/dist/attributes.js +9 -5
- package/dist/bands.d.ts +41 -6
- package/dist/bands.js +83 -33
- package/dist/builder.d.ts +161 -58
- package/dist/builder.js +128 -22
- package/dist/candidates.d.ts +5 -3
- package/dist/candidates.js +3 -2
- package/dist/clauses.d.ts +2 -1
- package/dist/clauses.js +2 -1
- package/dist/component.d.ts +24 -7
- package/dist/component.js +16 -6
- package/dist/componentBuild.d.ts +16 -5
- package/dist/componentBuild.js +14 -5
- package/dist/componentClient.d.ts +61 -30
- package/dist/componentClient.js +11 -1
- package/dist/componentImports.d.ts +8 -5
- package/dist/componentImports.js +23 -4
- package/dist/componentModule.js +2 -1
- package/dist/componentWire.d.ts +2 -1
- package/dist/componentWire.js +34 -2
- package/dist/config.d.ts +28 -14
- package/dist/config.js +20 -10
- package/dist/connections.d.ts +9 -4
- package/dist/connections.js +7 -4
- package/dist/declarations.d.ts +46 -17
- package/dist/declarations.js +46 -15
- package/dist/descriptors.d.ts +242 -97
- package/dist/descriptors.js +145 -41
- package/dist/dev.d.ts +6 -5
- package/dist/dev.js +6 -5
- package/dist/document.d.ts +74 -25
- package/dist/document.js +32 -11
- package/dist/dowry.d.ts +241 -0
- package/dist/dowry.js +315 -0
- package/dist/engines.d.ts +16 -7
- package/dist/engines.js +6 -4
- package/dist/eventMapLaws.d.ts +19 -8
- package/dist/eventMapLaws.js +9 -6
- package/dist/events.d.ts +101 -39
- package/dist/events.js +106 -33
- package/dist/executor.d.ts +122 -41
- package/dist/executor.js +188 -95
- package/dist/extension.d.ts +99 -35
- package/dist/extension.js +43 -9
- package/dist/facets.d.ts +2 -1
- package/dist/facets.js +4 -2
- package/dist/foldedSections.d.ts +4 -2
- package/dist/foldedSections.js +2 -1
- package/dist/genres.d.ts +123 -41
- package/dist/genres.js +127 -22
- package/dist/guardedConnection.d.ts +4 -3
- package/dist/guardedConnection.js +4 -3
- package/dist/handlebarsReach.d.ts +1 -1
- package/dist/handlebarsReach.js +1 -1
- package/dist/hash.d.ts +16 -5
- package/dist/hash.js +14 -4
- package/dist/hookGrants.d.ts +3 -2
- package/dist/hookGrants.js +6 -4
- package/dist/hooks.d.ts +21 -16
- package/dist/hooks.js +12 -10
- package/dist/hostElements.d.ts +41 -17
- package/dist/hostElements.js +49 -17
- package/dist/i18n.d.ts +5 -3
- package/dist/i18n.js +5 -3
- package/dist/identity.d.ts +4 -3
- package/dist/identity.js +4 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +15 -0
- package/dist/layout.d.ts +36 -15
- package/dist/layout.js +2 -2
- package/dist/loadouts.d.ts +97 -0
- package/dist/loadouts.js +81 -0
- package/dist/media.d.ts +26 -4
- package/dist/media.js +2 -1
- package/dist/messageBlocks.d.ts +44 -32
- package/dist/messageBlocks.js +23 -18
- package/dist/migration.d.ts +16 -8
- package/dist/migration.js +14 -8
- package/dist/names.d.ts +2 -1
- package/dist/names.js +2 -1
- package/dist/nodeInput.d.ts +2 -1
- package/dist/nodeInput.js +2 -1
- package/dist/participants.d.ts +22 -15
- package/dist/participants.js +14 -12
- package/dist/personGate.d.ts +2 -1
- package/dist/personGate.js +2 -1
- package/dist/pluginHarness.d.ts +8 -3
- package/dist/pluginHarness.js +4 -2
- package/dist/pluginPermissions.d.ts +2 -1
- package/dist/pluginPermissions.js +12 -1
- package/dist/pluginRuleRef.d.ts +2 -2
- package/dist/pluginRuleRef.js +1 -1
- package/dist/predicates.d.ts +16 -11
- package/dist/predicates.js +7 -6
- package/dist/preview.d.ts +8 -3
- package/dist/preview.js +2 -1
- package/dist/promptBlocks.d.ts +5 -3
- package/dist/promptBlocks.js +5 -3
- package/dist/rankingDecisions.d.ts +2 -1
- package/dist/rankingDecisions.js +2 -1
- package/dist/receipt.d.ts +65 -29
- package/dist/receipt.js +9 -4
- package/dist/receiverRules.js +3 -2
- package/dist/refs.d.ts +34 -9
- package/dist/refs.js +33 -13
- package/dist/registry.d.ts +42 -23
- package/dist/registry.js +7 -5
- package/dist/review.d.ts +16 -5
- package/dist/review.js +11 -4
- package/dist/sampling.d.ts +54 -0
- package/dist/sampling.js +95 -3
- package/dist/sceneSettings.d.ts +312 -0
- package/dist/sceneSettings.js +425 -0
- package/dist/scope.d.ts +6 -4
- package/dist/scope.js +4 -3
- package/dist/scripts.d.ts +81 -14
- package/dist/scripts.js +90 -11
- package/dist/sessionDossier.d.ts +521 -0
- package/dist/sessionDossier.js +33 -0
- package/dist/sessionLayout.d.ts +303 -19
- package/dist/sessionLayout.js +354 -40
- package/dist/sessionSettings.d.ts +8 -5
- package/dist/settings.d.ts +45 -20
- package/dist/settings.js +19 -12
- package/dist/settingsSlot.d.ts +11 -8
- package/dist/settingsSlot.js +11 -8
- package/dist/shapes.d.ts +99 -36
- package/dist/shapes.js +101 -35
- package/dist/sheets.d.ts +4 -2
- package/dist/sheets.js +6 -3
- package/dist/statShapes.d.ts +2 -1
- package/dist/statShapes.js +2 -1
- package/dist/status.d.ts +13 -9
- package/dist/status.js +8 -6
- package/dist/storage.d.ts +2 -1
- package/dist/storage.js +2 -1
- package/dist/storyTime.d.ts +13 -7
- package/dist/storyTime.js +11 -6
- package/dist/strokes.d.ts +176 -0
- package/dist/strokes.js +281 -0
- package/dist/surfaces.d.ts +54 -25
- package/dist/surfaces.js +3 -3
- package/dist/template.d.ts +9 -5
- package/dist/template.js +5 -3
- package/dist/templateCheck.d.ts +2 -2
- package/dist/templateCheck.js +2 -2
- package/dist/templateFit.d.ts +37 -8
- package/dist/templateFit.js +92 -8
- package/dist/templateIds.d.ts +3 -3
- package/dist/templateIds.js +3 -3
- package/dist/templateScopeAt.d.ts +21 -11
- package/dist/templateScopeAt.js +21 -11
- package/dist/testing.d.ts +11 -4
- package/dist/testing.js +13 -5
- package/dist/tokenizers.d.ts +2 -2
- package/dist/tokenizers.js +2 -2
- package/dist/turnLock.d.ts +4 -2
- package/dist/turnLock.js +2 -1
- package/dist/turnOrder.d.ts +17 -11
- package/dist/turnOrder.js +9 -5
- package/dist/validate.d.ts +11 -8
- package/dist/validate.js +81 -10
- package/dist/values.d.ts +17 -8
- package/dist/values.js +11 -6
- package/dist/variables.d.ts +46 -7
- package/dist/variables.js +87 -6
- package/dist/verdicts.d.ts +20 -13
- package/dist/verdicts.js +17 -11
- package/dist/widgetDecls.d.ts +8 -4
- package/dist/widgetDecls.js +4 -2
- package/dist/widgets.d.ts +987 -94
- package/dist/widgets.js +93 -18
- package/dist/wire.d.ts +13 -6
- package/dist/wire.js +3 -3
- package/dist/worldinfo.d.ts +11 -6
- package/dist/worldinfo.js +8 -4
- package/host-elements.d.ts +13 -0
- 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
|
|
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` / `
|
|
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
|
|
32
|
-
* `WidgetDecl.reads`; a declaration without `reads` reads all of them, which
|
|
33
|
-
* is every widget written before
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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'
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
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
|
-
|
|
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}'
|
|
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
|
|
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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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
|
|
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 */
|
package/dist/worldinfo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* World Info parity — testing the claim
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
package/host-elements.d.ts
CHANGED
|
@@ -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-
|
|
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",
|