@serene-pub/contracts 0.6.0-pr-2 → 0.6.0-pr-4
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/dist/index.d.ts +9 -10588
- package/dist/index.js +9 -10233
- package/dist/inlets.d.ts +566 -0
- package/dist/inlets.js +679 -0
- package/dist/oracles.d.ts +1246 -0
- package/dist/oracles.js +1386 -0
- package/dist/outlets.d.ts +990 -0
- package/dist/outlets.js +1085 -0
- package/dist/queries.d.ts +3318 -0
- package/dist/queries.js +3175 -0
- package/dist/tasks.d.ts +4544 -0
- package/dist/tasks.js +4011 -0
- package/package.json +9 -4
package/dist/tasks.d.ts
ADDED
|
@@ -0,0 +1,4544 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's **task** node definitions — pure transforms.
|
|
3
|
+
*
|
|
4
|
+
* One file per node kind, with the helpers only that kind uses; `index.ts`
|
|
5
|
+
* re-exports them all.
|
|
6
|
+
*/
|
|
7
|
+
import type { SlotDecl } from '@serene-pub/sdk';
|
|
8
|
+
/** @public */
|
|
9
|
+
export declare const contextBudget: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
10
|
+
main: string;
|
|
11
|
+
available: string;
|
|
12
|
+
}, import("@serene-pub/sdk").PortDecl, "core:task/context-budget@1"> & {
|
|
13
|
+
kind: 'task';
|
|
14
|
+
slots?: {
|
|
15
|
+
/**
|
|
16
|
+
* Where the window comes from.
|
|
17
|
+
*
|
|
18
|
+
* The context window belongs to the sampling config, never to a knob
|
|
19
|
+
* on a node (17 §1a) — and the executor resolves a `sampling` slot to
|
|
20
|
+
* the config's switched-on *values*, so this stays a pure Task reading
|
|
21
|
+
* data it was handed rather than a Query looking one up.
|
|
22
|
+
*
|
|
23
|
+
* ⚠ Point this at the same config the generating step uses. A budget
|
|
24
|
+
* computed against one window and a prompt sent against another is
|
|
25
|
+
* wrong in the direction that truncates, silently.
|
|
26
|
+
*/
|
|
27
|
+
readonly sampling: {
|
|
28
|
+
readonly kind: "sampling";
|
|
29
|
+
readonly quick: true;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The connection the reply is sent on — for the model's own
|
|
33
|
+
* context window (0114), which caps the sampling config's when
|
|
34
|
+
* the model states one.
|
|
35
|
+
*
|
|
36
|
+
* Shared with the generating step in every shipped spec
|
|
37
|
+
* (`slot.connectionOf('generate')`), on the same terms as
|
|
38
|
+
* `sampling` above: the budget has to be sized to the window the
|
|
39
|
+
* request is actually sent against, and the ONE computation of
|
|
40
|
+
* that window (R-8) reads both halves off the same resolved pair.
|
|
41
|
+
*/
|
|
42
|
+
readonly connection: {
|
|
43
|
+
readonly kind: "connection";
|
|
44
|
+
};
|
|
45
|
+
readonly params: {
|
|
46
|
+
readonly kind: "parameters";
|
|
47
|
+
readonly schema: {
|
|
48
|
+
/**
|
|
49
|
+
* ⚠ There is no `reserveForReply` here, and there was: an
|
|
50
|
+
* integer defaulting to 512, sitting beside the sampling
|
|
51
|
+
* config's own `responseTokens` that also defaults to 512. The same mistake as the ranker's `budget: 4096` —
|
|
52
|
+
* re-entering a number the system already knows, free to
|
|
53
|
+
* drift from the model actually being called and warning
|
|
54
|
+
* nobody when it did. Context in, response out: the reserve
|
|
55
|
+
* *is* the response allowance, so it is read, not typed.
|
|
56
|
+
*/
|
|
57
|
+
readonly safetyMargin: {
|
|
58
|
+
readonly type: "number";
|
|
59
|
+
readonly default: 0.05;
|
|
60
|
+
readonly description: "Fraction of the window kept free as a buffer against token-count drift.";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Fuse two mechanisms that answered the same question into one ordering.
|
|
68
|
+
*
|
|
69
|
+
* Reciprocal-rank fusion, and it is only fusion when the inputs *overlap* —
|
|
70
|
+
* the keyword mechanism and the vector mechanism ranking the same pool, so an entry both
|
|
71
|
+
* found outranks one either found alone. Handed several **disjoint** lists it
|
|
72
|
+
* degrades into concatenation with a fabricated score: every item is unique, so
|
|
73
|
+
* its fused score collapses to its position in its own list, and the
|
|
74
|
+
* `presetScore` stamped on the way out then overrides every signal weight
|
|
75
|
+
* downstream. That is what `core:task/concat-candidates@1` is for, and the
|
|
76
|
+
* binding says so on the receipt when it sees it.
|
|
77
|
+
*
|
|
78
|
+
* ⚠ This declared `strategy` (auto/vector/keyword/hybrid) and `dedup`, and the
|
|
79
|
+
* binding read neither. `strategy` was the 0.5 engine choice, which pipelines
|
|
80
|
+
* replaced with wiring — the mechanisms a run uses are the nodes it has — and `dedup`
|
|
81
|
+
* described what rank fusion does unconditionally, since fusion is keyed by
|
|
82
|
+
* `source:id`. Two controls that rendered, validated and stored a value nothing
|
|
83
|
+
* would ever read; removed rather than wired, because there is no behaviour
|
|
84
|
+
* behind either one to turn on.
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export declare const mergeCandidates: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
88
|
+
main: string;
|
|
89
|
+
candidates: string;
|
|
90
|
+
/** What fused with what — and a complaint when nothing did. */
|
|
91
|
+
diagnostics: string;
|
|
92
|
+
}, {
|
|
93
|
+
sources: string;
|
|
94
|
+
}, "core:task/merge-candidates@1"> & {
|
|
95
|
+
kind: 'task';
|
|
96
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Put several candidate lists end to end, in the order they were wired.
|
|
100
|
+
*
|
|
101
|
+
* The counterpart to `core:task/merge-candidates@1`, and the distinction is not
|
|
102
|
+
* cosmetic: **concatenation is not fusion**. Lore lanes are disjoint by
|
|
103
|
+
* construction — a world-lore entry is never also a history entry — so there is
|
|
104
|
+
* no agreement between them to measure and nothing to fuse. Passing them
|
|
105
|
+
* through the merge stamped a reciprocal-rank `presetScore` on every candidate,
|
|
106
|
+
* which `select` prefers over the weighted signal sum, so each entry was ranked
|
|
107
|
+
* by its position in its own list and every signal weight was inert.
|
|
108
|
+
*
|
|
109
|
+
* This node deliberately stamps **no score at all**. Ranking is the ranker's
|
|
110
|
+
* job: `core:task/rank-hybrid@1` scores each candidate from its signals against
|
|
111
|
+
* its source's weights, and budgets across sources with the share bands — which
|
|
112
|
+
* is what the bands are for. Order within a source is preserved so a producer's
|
|
113
|
+
* own ordering survives to the tie-break.
|
|
114
|
+
*
|
|
115
|
+
* Repeats are dropped, first occurrence winning, keyed `source:id` the way
|
|
116
|
+
* every other candidate set in the ranker is: the same entry arriving from two
|
|
117
|
+
* lanes should occupy one slot, and the earlier lane is the one the author
|
|
118
|
+
* wired first.
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export declare const concatCandidates: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
122
|
+
main: string;
|
|
123
|
+
candidates: string;
|
|
124
|
+
/** How many arrived per list, and how many repeats were dropped. */
|
|
125
|
+
diagnostics: string;
|
|
126
|
+
}, {
|
|
127
|
+
sources: string;
|
|
128
|
+
}, "core:task/concat-candidates@1"> & {
|
|
129
|
+
kind: 'task';
|
|
130
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* **Eligibility** — the hard gates between the mechanisms and the ranker
|
|
134
|
+
* (C2; owner rulings R2 and R4, 2026-09-30; built 2026-10-02).
|
|
135
|
+
*
|
|
136
|
+
* Scoring and eligibility are separate on purpose: a hard rule must not compete
|
|
137
|
+
* numerically with a soft one and lose. This node scores nothing. It takes the
|
|
138
|
+
* concatenated pool and returns **the same array**, with `ineligible: { reason }`
|
|
139
|
+
* set on each candidate a rule rules out; it never deletes one, so the ranker
|
|
140
|
+
* turns each into an `excluded_ineligible` decision carrying the sentence, and
|
|
141
|
+
* the receipt says why rather than "it scored badly".
|
|
142
|
+
*
|
|
143
|
+
* Its rules, and nothing else:
|
|
144
|
+
*
|
|
145
|
+
* 1. **Exclusions.** A candidate one of the wired `exclusions` lists names
|
|
146
|
+
* (`{ source, id, reason }` — the keyword lanes publish the entries an
|
|
147
|
+
* author's own selective logic ruled out). The same entry brought in again
|
|
148
|
+
* by meaning or by name is the entry the author said *not here*.
|
|
149
|
+
* 2. **Secrecy.** A `relationships` candidate that is somebody's secret
|
|
150
|
+
* (`payload.secretOf`, the holder's participant reference) is ineligible for
|
|
151
|
+
* any other `speaker`. Unwired or null, the producers' own scope decided.
|
|
152
|
+
* 3. **Presence** (R4). A candidate about a cast member (`payload.lorebookBindingId`)
|
|
153
|
+
* whose member has presences on the line and none holding at `at` — the
|
|
154
|
+
* member is not in the world then. A member with no presences is always
|
|
155
|
+
* present.
|
|
156
|
+
*
|
|
157
|
+
* Wired between the final concatenation and `rank-hybrid`. A custom source
|
|
158
|
+
* passes through it like a core one: any candidate with a payload saying who it
|
|
159
|
+
* is about is gated the same way.
|
|
160
|
+
* @experimental
|
|
161
|
+
*/
|
|
162
|
+
export declare const eligibility: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
163
|
+
main: string;
|
|
164
|
+
candidates: string;
|
|
165
|
+
/** How many each rule ruled out. */
|
|
166
|
+
diagnostics: string;
|
|
167
|
+
}, {
|
|
168
|
+
candidates: string;
|
|
169
|
+
/**
|
|
170
|
+
* `{ source, id, reason }` verdicts — one list, or several as a
|
|
171
|
+
* nested literal (`[$.a.exclusions, $.b.exclusions]`), the
|
|
172
|
+
* construction `concat-candidates`' `sources` uses.
|
|
173
|
+
*/
|
|
174
|
+
exclusions: string;
|
|
175
|
+
/** Whose turn this pool is for. Null or unwired: no secrecy rule. */
|
|
176
|
+
speaker: string;
|
|
177
|
+
/** `core:query/cast-presences@1`'s rows. */
|
|
178
|
+
presences: string;
|
|
179
|
+
/** The moment they are judged at — `cast-presences`' `at`. */
|
|
180
|
+
at: string;
|
|
181
|
+
}, "core:task/eligibility@1"> & {
|
|
182
|
+
kind: 'task';
|
|
183
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
184
|
+
}>;
|
|
185
|
+
/** @experimental */
|
|
186
|
+
export declare const rankHybrid: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
187
|
+
main: string;
|
|
188
|
+
candidates: string;
|
|
189
|
+
/**
|
|
190
|
+
* The per-candidate trail: score, included, reason, and the signal
|
|
191
|
+
* breakdown behind it.
|
|
192
|
+
*
|
|
193
|
+
* A declared out-port rather than an implementation detail, because it is
|
|
194
|
+
* what Assemble allocates from — and because a ranker swapped in by a
|
|
195
|
+
* plugin has to produce it too, or the budget panel goes blank the moment
|
|
196
|
+
* anyone changes rankers (16 §5c).
|
|
197
|
+
*
|
|
198
|
+
* Shape `S.decisions` (R64): a node publishing it is recorded in the
|
|
199
|
+
* ranking store automatically — a plugin's ranker included.
|
|
200
|
+
*/
|
|
201
|
+
decisions: string;
|
|
202
|
+
/**
|
|
203
|
+
* What each band was allotted, what it spent, and how many
|
|
204
|
+
* entries it got there (D-H).
|
|
205
|
+
*
|
|
206
|
+
* ⚠ **Published by the binding since it was written, declared
|
|
207
|
+
* by nobody.** `select()` returns this beside the decisions and
|
|
208
|
+
* the binding has always returned it on this key — but an
|
|
209
|
+
* undeclared out-port is invisible: nothing downstream could
|
|
210
|
+
* learn it existed, `validate.ts` skipped the edge, and
|
|
211
|
+
* `core:task/assemble@2` ran its allocation on empty defaults
|
|
212
|
+
* while the numbers sat one node upstream.
|
|
213
|
+
*
|
|
214
|
+
* Spread onto this type alone rather than into `rankPorts` —
|
|
215
|
+
* the same reason the `scripts` hook above is, one construct up
|
|
216
|
+
* (S3). The `rank-recall` example computes no per-band usage;
|
|
217
|
+
* giving it a port it cannot fill would move a hash to declare
|
|
218
|
+
* a promise it does not keep.
|
|
219
|
+
*
|
|
220
|
+
* `json` rather than a shape of its own. It is
|
|
221
|
+
* `Record<band, {allocated, used, entries}>` and the band
|
|
222
|
+
* vocabulary is the ranker's `SOURCES` list, which a plugin may
|
|
223
|
+
* extend — a shape id pinned here would freeze the very list
|
|
224
|
+
* that is meant to grow.
|
|
225
|
+
*/
|
|
226
|
+
groups: string;
|
|
227
|
+
}, {
|
|
228
|
+
candidates: string;
|
|
229
|
+
budget: string;
|
|
230
|
+
/**
|
|
231
|
+
* **Entries the prompt already shows in a slot of their own**
|
|
232
|
+
* (lorebooks plan, the room rule, 2026-10-02) — lorebook entry
|
|
233
|
+
* ids, one or a list (nulls skipped). A lore candidate (world
|
|
234
|
+
* lore, character lore, history) with one of these ids is
|
|
235
|
+
* ruled out before ranking, as `excluded_ineligible` with the
|
|
236
|
+
* reason, so it spends no budget and the prompt never reads it
|
|
237
|
+
* twice. Adventure and the Lair wire the room their place slot
|
|
238
|
+
* (`{{locationEntry}}`) shows — the world's `location`,
|
|
239
|
+
* resolved by `undescribed-name@1`. Unwired, nothing changes.
|
|
240
|
+
*
|
|
241
|
+
* ⚠ Not `core:task/eligibility@1`'s `exclusions`: those are
|
|
242
|
+
* verdicts (a rule that fired, with its sentence); this is a
|
|
243
|
+
* fact about the prompt, and a bare id is all it needs. On
|
|
244
|
+
* `rank-hybrid` alone, like the parameters above: the
|
|
245
|
+
* `rank-recall` example builds no prompt with slots.
|
|
246
|
+
*/
|
|
247
|
+
shownElsewhere: string;
|
|
248
|
+
}, "core:task/rank-hybrid@1"> & {
|
|
249
|
+
kind: 'task';
|
|
250
|
+
slots?: {
|
|
251
|
+
readonly params: {
|
|
252
|
+
readonly kind: "parameters";
|
|
253
|
+
readonly facet: "weights";
|
|
254
|
+
readonly schema: {
|
|
255
|
+
readonly signalKeyword: {
|
|
256
|
+
readonly type: 'perMember';
|
|
257
|
+
readonly members: readonly [{
|
|
258
|
+
readonly key: 'messages';
|
|
259
|
+
readonly label: {
|
|
260
|
+
readonly en: 'Conversation';
|
|
261
|
+
};
|
|
262
|
+
readonly description: {
|
|
263
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
264
|
+
};
|
|
265
|
+
readonly tone: 0;
|
|
266
|
+
}, {
|
|
267
|
+
readonly key: 'worldLore';
|
|
268
|
+
readonly label: {
|
|
269
|
+
readonly en: 'World lore';
|
|
270
|
+
};
|
|
271
|
+
readonly description: {
|
|
272
|
+
readonly en: 'Lorebook entries about the world.';
|
|
273
|
+
};
|
|
274
|
+
readonly tone: 1;
|
|
275
|
+
}, {
|
|
276
|
+
readonly key: 'characterLore';
|
|
277
|
+
readonly label: {
|
|
278
|
+
readonly en: 'Character lore';
|
|
279
|
+
};
|
|
280
|
+
readonly description: {
|
|
281
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
282
|
+
};
|
|
283
|
+
readonly tone: 2;
|
|
284
|
+
}, {
|
|
285
|
+
readonly key: 'history';
|
|
286
|
+
readonly label: {
|
|
287
|
+
readonly en: 'History entries';
|
|
288
|
+
};
|
|
289
|
+
readonly description: {
|
|
290
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
291
|
+
};
|
|
292
|
+
readonly tone: 3;
|
|
293
|
+
}, {
|
|
294
|
+
readonly key: 'relationships';
|
|
295
|
+
readonly label: {
|
|
296
|
+
readonly en: 'Relationships';
|
|
297
|
+
};
|
|
298
|
+
readonly description: {
|
|
299
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
300
|
+
};
|
|
301
|
+
readonly tone: 4;
|
|
302
|
+
}];
|
|
303
|
+
readonly default: {
|
|
304
|
+
readonly messages: 0;
|
|
305
|
+
readonly worldLore: 0.35;
|
|
306
|
+
readonly characterLore: 0.35;
|
|
307
|
+
readonly history: 0.35;
|
|
308
|
+
readonly relationships: 0;
|
|
309
|
+
};
|
|
310
|
+
readonly label: {
|
|
311
|
+
readonly en: 'Keyword match';
|
|
312
|
+
};
|
|
313
|
+
readonly description: {
|
|
314
|
+
readonly en: "How much an entry's own trigger keywords appearing in recent messages counts toward its score.";
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
readonly signalNameMatch: {
|
|
318
|
+
readonly type: 'perMember';
|
|
319
|
+
readonly members: readonly [{
|
|
320
|
+
readonly key: 'messages';
|
|
321
|
+
readonly label: {
|
|
322
|
+
readonly en: 'Conversation';
|
|
323
|
+
};
|
|
324
|
+
readonly description: {
|
|
325
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
326
|
+
};
|
|
327
|
+
readonly tone: 0;
|
|
328
|
+
}, {
|
|
329
|
+
readonly key: 'worldLore';
|
|
330
|
+
readonly label: {
|
|
331
|
+
readonly en: 'World lore';
|
|
332
|
+
};
|
|
333
|
+
readonly description: {
|
|
334
|
+
readonly en: 'Lorebook entries about the world.';
|
|
335
|
+
};
|
|
336
|
+
readonly tone: 1;
|
|
337
|
+
}, {
|
|
338
|
+
readonly key: 'characterLore';
|
|
339
|
+
readonly label: {
|
|
340
|
+
readonly en: 'Character lore';
|
|
341
|
+
};
|
|
342
|
+
readonly description: {
|
|
343
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
344
|
+
};
|
|
345
|
+
readonly tone: 2;
|
|
346
|
+
}, {
|
|
347
|
+
readonly key: 'history';
|
|
348
|
+
readonly label: {
|
|
349
|
+
readonly en: 'History entries';
|
|
350
|
+
};
|
|
351
|
+
readonly description: {
|
|
352
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
353
|
+
};
|
|
354
|
+
readonly tone: 3;
|
|
355
|
+
}, {
|
|
356
|
+
readonly key: 'relationships';
|
|
357
|
+
readonly label: {
|
|
358
|
+
readonly en: 'Relationships';
|
|
359
|
+
};
|
|
360
|
+
readonly description: {
|
|
361
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
362
|
+
};
|
|
363
|
+
readonly tone: 4;
|
|
364
|
+
}];
|
|
365
|
+
readonly default: {
|
|
366
|
+
readonly messages: 0;
|
|
367
|
+
readonly worldLore: 0.25;
|
|
368
|
+
readonly characterLore: 0.25;
|
|
369
|
+
readonly history: 0;
|
|
370
|
+
readonly relationships: 0;
|
|
371
|
+
};
|
|
372
|
+
readonly label: {
|
|
373
|
+
readonly en: 'Name mentioned';
|
|
374
|
+
};
|
|
375
|
+
readonly description: {
|
|
376
|
+
readonly en: "How much a cast member's name appearing in the entry counts when that character is in the scene.";
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Two questions under one name, split by source — bug 16, and it stays split.
|
|
381
|
+
*
|
|
382
|
+
* World lore and history ask *how much of what the scene is naming does this
|
|
383
|
+
* entry name too*; character lore asks *did this entry's own character speak
|
|
384
|
+
* in the guaranteed window*. A character-lore entry names its own character
|
|
385
|
+
* by construction, so the first question scores every present character's
|
|
386
|
+
* private lore alike and distinguishes nothing.
|
|
387
|
+
*
|
|
388
|
+
* ⚠ **The world-lore half is graded now, and this weight moved with it**
|
|
389
|
+
* (design §13.10, retrieval plan phase 3). It used to be a binary substring
|
|
390
|
+
* test — does the entry's title or keys contain a cast name, `Al` firing on
|
|
391
|
+
* `Alchemy` — worth exactly `{0, 0.2}`. It is now the rarity-weighted,
|
|
392
|
+
* word-boundary, two-sided overlap the admission gate already used: what the
|
|
393
|
+
* conversation named, intersected with what this entry names, weighted so
|
|
394
|
+
* that a thing every entry mentions counts for nothing.
|
|
395
|
+
*
|
|
396
|
+
* That measure **saturates**: about 0.63 for one rare shared entity and 0.86
|
|
397
|
+
* for two, so at the old 0.2 its live range would have been ~[0.13, 0.17] —
|
|
398
|
+
* *narrower* than the crude signal it replaces. Grading without re-weighting
|
|
399
|
+
* makes a signal more correct and less influential at the same time, so the
|
|
400
|
+
* weight is sized for the measure that is actually running: 0.35, the same
|
|
401
|
+
* anchor `entity-search`'s own strength uses, which keeps one strongly
|
|
402
|
+
* shared name worth a little less than an entry whose every key fired.
|
|
403
|
+
*
|
|
404
|
+
* Character lore keeps **0.2**. Its measurement did not change, so its
|
|
405
|
+
* weight must not either.
|
|
406
|
+
*/
|
|
407
|
+
readonly signalEntityCooccurrence: {
|
|
408
|
+
readonly type: 'perMember';
|
|
409
|
+
readonly members: readonly [{
|
|
410
|
+
readonly key: 'messages';
|
|
411
|
+
readonly label: {
|
|
412
|
+
readonly en: 'Conversation';
|
|
413
|
+
};
|
|
414
|
+
readonly description: {
|
|
415
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
416
|
+
};
|
|
417
|
+
readonly tone: 0;
|
|
418
|
+
}, {
|
|
419
|
+
readonly key: 'worldLore';
|
|
420
|
+
readonly label: {
|
|
421
|
+
readonly en: 'World lore';
|
|
422
|
+
};
|
|
423
|
+
readonly description: {
|
|
424
|
+
readonly en: 'Lorebook entries about the world.';
|
|
425
|
+
};
|
|
426
|
+
readonly tone: 1;
|
|
427
|
+
}, {
|
|
428
|
+
readonly key: 'characterLore';
|
|
429
|
+
readonly label: {
|
|
430
|
+
readonly en: 'Character lore';
|
|
431
|
+
};
|
|
432
|
+
readonly description: {
|
|
433
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
434
|
+
};
|
|
435
|
+
readonly tone: 2;
|
|
436
|
+
}, {
|
|
437
|
+
readonly key: 'history';
|
|
438
|
+
readonly label: {
|
|
439
|
+
readonly en: 'History entries';
|
|
440
|
+
};
|
|
441
|
+
readonly description: {
|
|
442
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
443
|
+
};
|
|
444
|
+
readonly tone: 3;
|
|
445
|
+
}, {
|
|
446
|
+
readonly key: 'relationships';
|
|
447
|
+
readonly label: {
|
|
448
|
+
readonly en: 'Relationships';
|
|
449
|
+
};
|
|
450
|
+
readonly description: {
|
|
451
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
452
|
+
};
|
|
453
|
+
readonly tone: 4;
|
|
454
|
+
}];
|
|
455
|
+
readonly default: {
|
|
456
|
+
readonly messages: 0;
|
|
457
|
+
readonly worldLore: 0.35;
|
|
458
|
+
readonly characterLore: 0.2;
|
|
459
|
+
readonly history: 0;
|
|
460
|
+
readonly relationships: 0;
|
|
461
|
+
};
|
|
462
|
+
readonly label: {
|
|
463
|
+
readonly en: 'Shared entities';
|
|
464
|
+
};
|
|
465
|
+
readonly description: {
|
|
466
|
+
readonly en: 'How much an entry naming the same people and places as the recent conversation counts. For character lore it asks something else: whether that character has been speaking.';
|
|
467
|
+
};
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* How much *being about the same thing* counts, as an embedding measures it.
|
|
471
|
+
*
|
|
472
|
+
* The fourth mechanism and the only one that needs a model. It arrives on
|
|
473
|
+
* candidates the semantic mechanism found — `core:query/vector-search@1`, wired
|
|
474
|
+
* into the reply pipeline as a sibling of the lore lanes — and it is a
|
|
475
|
+
* **score component**, not a rival ordering: an entry both the keyword scan
|
|
476
|
+
* and the semantic mechanism found keeps its keyword signals and gains this one,
|
|
477
|
+
* so agreement between two independent mechanisms compounds by addition and
|
|
478
|
+
* there is no fusion step to reconcile two incomparable scales.
|
|
479
|
+
*
|
|
480
|
+
* ⚠ **Not zero, and that is deliberate.** The mechanism has one switch, one
|
|
481
|
+
* level up: `query-windows.searchByMeaning`, on the first node of its chain
|
|
482
|
+
* since 2026-09-29. It ships *Automatic* — on whenever an embedding model is
|
|
483
|
+
* set up, local or a service alike, and off when there is none — so nothing
|
|
484
|
+
* carries this signal on an install with no embedding model or with the
|
|
485
|
+
* switch Off. Making the weight zero as well would mean
|
|
486
|
+
* turning the switch on changed nothing, which is the trap a two-switch
|
|
487
|
+
* feature always sets. One switch, and it is the one named after what it
|
|
488
|
+
* does.
|
|
489
|
+
*
|
|
490
|
+
* Sized below a keyword hit on purpose. A cosine above the mechanism's own
|
|
491
|
+
* threshold is real evidence and weaker evidence than an authored key
|
|
492
|
+
* firing: keys still guarantee, meaning still only adds.
|
|
493
|
+
*/
|
|
494
|
+
readonly signalSemantic: {
|
|
495
|
+
readonly type: 'perMember';
|
|
496
|
+
readonly members: readonly [{
|
|
497
|
+
readonly key: 'messages';
|
|
498
|
+
readonly label: {
|
|
499
|
+
readonly en: 'Conversation';
|
|
500
|
+
};
|
|
501
|
+
readonly description: {
|
|
502
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
503
|
+
};
|
|
504
|
+
readonly tone: 0;
|
|
505
|
+
}, {
|
|
506
|
+
readonly key: 'worldLore';
|
|
507
|
+
readonly label: {
|
|
508
|
+
readonly en: 'World lore';
|
|
509
|
+
};
|
|
510
|
+
readonly description: {
|
|
511
|
+
readonly en: 'Lorebook entries about the world.';
|
|
512
|
+
};
|
|
513
|
+
readonly tone: 1;
|
|
514
|
+
}, {
|
|
515
|
+
readonly key: 'characterLore';
|
|
516
|
+
readonly label: {
|
|
517
|
+
readonly en: 'Character lore';
|
|
518
|
+
};
|
|
519
|
+
readonly description: {
|
|
520
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
521
|
+
};
|
|
522
|
+
readonly tone: 2;
|
|
523
|
+
}, {
|
|
524
|
+
readonly key: 'history';
|
|
525
|
+
readonly label: {
|
|
526
|
+
readonly en: 'History entries';
|
|
527
|
+
};
|
|
528
|
+
readonly description: {
|
|
529
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
530
|
+
};
|
|
531
|
+
readonly tone: 3;
|
|
532
|
+
}, {
|
|
533
|
+
readonly key: 'relationships';
|
|
534
|
+
readonly label: {
|
|
535
|
+
readonly en: 'Relationships';
|
|
536
|
+
};
|
|
537
|
+
readonly description: {
|
|
538
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
539
|
+
};
|
|
540
|
+
readonly tone: 4;
|
|
541
|
+
}];
|
|
542
|
+
readonly default: {
|
|
543
|
+
readonly messages: 0;
|
|
544
|
+
readonly worldLore: 0.3;
|
|
545
|
+
readonly characterLore: 0.3;
|
|
546
|
+
readonly history: 0.3;
|
|
547
|
+
readonly relationships: 0;
|
|
548
|
+
};
|
|
549
|
+
readonly label: {
|
|
550
|
+
readonly en: 'Similar meaning';
|
|
551
|
+
};
|
|
552
|
+
readonly description: {
|
|
553
|
+
readonly en: 'How much it counts that an entry is about what the conversation is about, even with no shared words. Needs an embedding model and the semantic arm switched on.';
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
/**
|
|
557
|
+
* How much *being called that* counts, as an embedding measures it.
|
|
558
|
+
*
|
|
559
|
+
* The fifth mechanism, and the one that catches the reference nothing else
|
|
560
|
+
* can. It arrives on candidates `core:query/entity-link@1` matched a
|
|
561
|
+
* **description** in the conversation to one of an entry's **names** —
|
|
562
|
+
* *"the captain"* → Captain Vell, *"the order"* → The Ashguard Riders.
|
|
563
|
+
* Neither reference shares a character with its target, so keywords,
|
|
564
|
+
* trigrams and the gazetteer all miss them.
|
|
565
|
+
*
|
|
566
|
+
* ⚠ **Sized to sit strictly below `signalNameMatch`, and that is a rule.**
|
|
567
|
+
* Invented proper nouns are where embeddings are least reliable — "Vell"
|
|
568
|
+
* has no learned meaning, so its vector comes from subword fragments and
|
|
569
|
+
* Vell, Vall and Vela cluster — so exact and trigram matching own invented
|
|
570
|
+
* names, entity vectors own descriptive references, and a vector link must
|
|
571
|
+
* never outrank an entry whose title literally occurred. A similarity
|
|
572
|
+
* cannot exceed 1, so 0.2 against `signalNameMatch`'s 0.25 keeps that true
|
|
573
|
+
* at every value the mechanism can produce.
|
|
574
|
+
*
|
|
575
|
+
* Not zero, for `signalSemantic`'s reason one field up: the mechanism's switch is
|
|
576
|
+
* `mention-spans.maxMentions` and it is 0, so nothing carries this signal
|
|
577
|
+
* until somebody raises it. One switch, not two.
|
|
578
|
+
*/
|
|
579
|
+
readonly signalEntityVector: {
|
|
580
|
+
readonly type: 'perMember';
|
|
581
|
+
readonly members: readonly [{
|
|
582
|
+
readonly key: 'messages';
|
|
583
|
+
readonly label: {
|
|
584
|
+
readonly en: 'Conversation';
|
|
585
|
+
};
|
|
586
|
+
readonly description: {
|
|
587
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
588
|
+
};
|
|
589
|
+
readonly tone: 0;
|
|
590
|
+
}, {
|
|
591
|
+
readonly key: 'worldLore';
|
|
592
|
+
readonly label: {
|
|
593
|
+
readonly en: 'World lore';
|
|
594
|
+
};
|
|
595
|
+
readonly description: {
|
|
596
|
+
readonly en: 'Lorebook entries about the world.';
|
|
597
|
+
};
|
|
598
|
+
readonly tone: 1;
|
|
599
|
+
}, {
|
|
600
|
+
readonly key: 'characterLore';
|
|
601
|
+
readonly label: {
|
|
602
|
+
readonly en: 'Character lore';
|
|
603
|
+
};
|
|
604
|
+
readonly description: {
|
|
605
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
606
|
+
};
|
|
607
|
+
readonly tone: 2;
|
|
608
|
+
}, {
|
|
609
|
+
readonly key: 'history';
|
|
610
|
+
readonly label: {
|
|
611
|
+
readonly en: 'History entries';
|
|
612
|
+
};
|
|
613
|
+
readonly description: {
|
|
614
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
615
|
+
};
|
|
616
|
+
readonly tone: 3;
|
|
617
|
+
}, {
|
|
618
|
+
readonly key: 'relationships';
|
|
619
|
+
readonly label: {
|
|
620
|
+
readonly en: 'Relationships';
|
|
621
|
+
};
|
|
622
|
+
readonly description: {
|
|
623
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
624
|
+
};
|
|
625
|
+
readonly tone: 4;
|
|
626
|
+
}];
|
|
627
|
+
readonly default: {
|
|
628
|
+
readonly messages: 0;
|
|
629
|
+
readonly worldLore: 0.2;
|
|
630
|
+
readonly characterLore: 0.2;
|
|
631
|
+
readonly history: 0.2;
|
|
632
|
+
readonly relationships: 0;
|
|
633
|
+
};
|
|
634
|
+
readonly label: {
|
|
635
|
+
readonly en: 'Called by a description';
|
|
636
|
+
};
|
|
637
|
+
readonly description: {
|
|
638
|
+
readonly en: 'How much it counts that the conversation described something — "the captain", "the order" — that matches what an entry is called. Needs an embedding model and the description arm switched on. Deliberately weaker than an entry whose name was actually said.';
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
readonly signalTfidf: {
|
|
642
|
+
readonly type: 'perMember';
|
|
643
|
+
readonly members: readonly [{
|
|
644
|
+
readonly key: 'messages';
|
|
645
|
+
readonly label: {
|
|
646
|
+
readonly en: 'Conversation';
|
|
647
|
+
};
|
|
648
|
+
readonly description: {
|
|
649
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
650
|
+
};
|
|
651
|
+
readonly tone: 0;
|
|
652
|
+
}, {
|
|
653
|
+
readonly key: 'worldLore';
|
|
654
|
+
readonly label: {
|
|
655
|
+
readonly en: 'World lore';
|
|
656
|
+
};
|
|
657
|
+
readonly description: {
|
|
658
|
+
readonly en: 'Lorebook entries about the world.';
|
|
659
|
+
};
|
|
660
|
+
readonly tone: 1;
|
|
661
|
+
}, {
|
|
662
|
+
readonly key: 'characterLore';
|
|
663
|
+
readonly label: {
|
|
664
|
+
readonly en: 'Character lore';
|
|
665
|
+
};
|
|
666
|
+
readonly description: {
|
|
667
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
668
|
+
};
|
|
669
|
+
readonly tone: 2;
|
|
670
|
+
}, {
|
|
671
|
+
readonly key: 'history';
|
|
672
|
+
readonly label: {
|
|
673
|
+
readonly en: 'History entries';
|
|
674
|
+
};
|
|
675
|
+
readonly description: {
|
|
676
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
677
|
+
};
|
|
678
|
+
readonly tone: 3;
|
|
679
|
+
}, {
|
|
680
|
+
readonly key: 'relationships';
|
|
681
|
+
readonly label: {
|
|
682
|
+
readonly en: 'Relationships';
|
|
683
|
+
};
|
|
684
|
+
readonly description: {
|
|
685
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
686
|
+
};
|
|
687
|
+
readonly tone: 4;
|
|
688
|
+
}];
|
|
689
|
+
readonly default: {
|
|
690
|
+
readonly messages: 0.1;
|
|
691
|
+
readonly worldLore: 0.1;
|
|
692
|
+
readonly characterLore: 0.1;
|
|
693
|
+
readonly history: 0.1;
|
|
694
|
+
readonly relationships: 0;
|
|
695
|
+
};
|
|
696
|
+
readonly label: {
|
|
697
|
+
readonly en: 'Distinctive words';
|
|
698
|
+
};
|
|
699
|
+
readonly description: {
|
|
700
|
+
readonly en: 'How much rare, distinctive vocabulary shared with the conversation counts — common words prove little.';
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
readonly signalLastRefRecency: {
|
|
704
|
+
readonly type: 'perMember';
|
|
705
|
+
readonly members: readonly [{
|
|
706
|
+
readonly key: 'messages';
|
|
707
|
+
readonly label: {
|
|
708
|
+
readonly en: 'Conversation';
|
|
709
|
+
};
|
|
710
|
+
readonly description: {
|
|
711
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
712
|
+
};
|
|
713
|
+
readonly tone: 0;
|
|
714
|
+
}, {
|
|
715
|
+
readonly key: 'worldLore';
|
|
716
|
+
readonly label: {
|
|
717
|
+
readonly en: 'World lore';
|
|
718
|
+
};
|
|
719
|
+
readonly description: {
|
|
720
|
+
readonly en: 'Lorebook entries about the world.';
|
|
721
|
+
};
|
|
722
|
+
readonly tone: 1;
|
|
723
|
+
}, {
|
|
724
|
+
readonly key: 'characterLore';
|
|
725
|
+
readonly label: {
|
|
726
|
+
readonly en: 'Character lore';
|
|
727
|
+
};
|
|
728
|
+
readonly description: {
|
|
729
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
730
|
+
};
|
|
731
|
+
readonly tone: 2;
|
|
732
|
+
}, {
|
|
733
|
+
readonly key: 'history';
|
|
734
|
+
readonly label: {
|
|
735
|
+
readonly en: 'History entries';
|
|
736
|
+
};
|
|
737
|
+
readonly description: {
|
|
738
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
739
|
+
};
|
|
740
|
+
readonly tone: 3;
|
|
741
|
+
}, {
|
|
742
|
+
readonly key: 'relationships';
|
|
743
|
+
readonly label: {
|
|
744
|
+
readonly en: 'Relationships';
|
|
745
|
+
};
|
|
746
|
+
readonly description: {
|
|
747
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
748
|
+
};
|
|
749
|
+
readonly tone: 4;
|
|
750
|
+
}];
|
|
751
|
+
readonly default: {
|
|
752
|
+
readonly messages: 0;
|
|
753
|
+
readonly worldLore: 0.1;
|
|
754
|
+
readonly characterLore: 0.1;
|
|
755
|
+
readonly history: 0.1;
|
|
756
|
+
readonly relationships: 0;
|
|
757
|
+
};
|
|
758
|
+
readonly label: {
|
|
759
|
+
readonly en: 'Recently referenced';
|
|
760
|
+
};
|
|
761
|
+
readonly description: {
|
|
762
|
+
readonly en: 'How much an entry the conversation touched a moment ago outranks one it has not mentioned in a while.';
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
/**
|
|
766
|
+
* ⚠ **`signalRecency` and `signalSceneAffinity` were declared here and are
|
|
767
|
+
* gone (migration 0099).** Neither had a producer — anywhere, ever. No
|
|
768
|
+
* mechanism wrote `signals.recency` and none wrote `signals.sceneAffinity`,
|
|
769
|
+
* so both weights multiplied a permanent zero: two controls that rendered,
|
|
770
|
+
* validated, saved, resolved through the whole scope chain, and could not
|
|
771
|
+
* move a single prompt at any value on any install.
|
|
772
|
+
*
|
|
773
|
+
* They are removed rather than wired because each needs a *design decision*
|
|
774
|
+
* this change is not entitled to make, and both are the kind that is
|
|
775
|
+
* cheaper to get right later than to guess at now:
|
|
776
|
+
*
|
|
777
|
+
* · **Recency** carried `history: 0.2`, on a band that really is
|
|
778
|
+
* populated, so building a producer for it would reorder every install's
|
|
779
|
+
* history entries — and the number it would rank on is genuinely
|
|
780
|
+
* ambiguous. A dated entry has an *in-world* date and an *authored*
|
|
781
|
+
* order, they disagree constantly (a flashback is old and new at once),
|
|
782
|
+
* and picking one silently is a worse answer than picking neither.
|
|
783
|
+
* · **Scene affinity** has no fact to read. `scenes` and
|
|
784
|
+
* `lorebook_bindings.scene_id` exist in the schema, but nothing in
|
|
785
|
+
* retrieval knows which scene a session is *in*, so the producer is a
|
|
786
|
+
* feature and not a wiring job.
|
|
787
|
+
*
|
|
788
|
+
* Both are welcome back the day something produces them — as a new field
|
|
789
|
+
* beside its producer, which is the order that keeps this from happening a
|
|
790
|
+
* third time. `runtime/signalWiring.test.ts` is what enforces that: a signal
|
|
791
|
+
* declared here and producible by nothing fails, and so does the reverse.
|
|
792
|
+
*
|
|
793
|
+
* `signalDensity` survives the same audit for the opposite reason — it now
|
|
794
|
+
* has one. `densitySignal` had existed in `ranking/signals.ts` with no
|
|
795
|
+
* caller for as long as this weight had existed with no producer; the scan
|
|
796
|
+
* writes it on every candidate now, exactly as it writes `proximity`.
|
|
797
|
+
*/
|
|
798
|
+
readonly signalDensity: {
|
|
799
|
+
readonly type: 'perMember';
|
|
800
|
+
readonly members: readonly [{
|
|
801
|
+
readonly key: 'messages';
|
|
802
|
+
readonly label: {
|
|
803
|
+
readonly en: 'Conversation';
|
|
804
|
+
};
|
|
805
|
+
readonly description: {
|
|
806
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
807
|
+
};
|
|
808
|
+
readonly tone: 0;
|
|
809
|
+
}, {
|
|
810
|
+
readonly key: 'worldLore';
|
|
811
|
+
readonly label: {
|
|
812
|
+
readonly en: 'World lore';
|
|
813
|
+
};
|
|
814
|
+
readonly description: {
|
|
815
|
+
readonly en: 'Lorebook entries about the world.';
|
|
816
|
+
};
|
|
817
|
+
readonly tone: 1;
|
|
818
|
+
}, {
|
|
819
|
+
readonly key: 'characterLore';
|
|
820
|
+
readonly label: {
|
|
821
|
+
readonly en: 'Character lore';
|
|
822
|
+
};
|
|
823
|
+
readonly description: {
|
|
824
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
825
|
+
};
|
|
826
|
+
readonly tone: 2;
|
|
827
|
+
}, {
|
|
828
|
+
readonly key: 'history';
|
|
829
|
+
readonly label: {
|
|
830
|
+
readonly en: 'History entries';
|
|
831
|
+
};
|
|
832
|
+
readonly description: {
|
|
833
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
834
|
+
};
|
|
835
|
+
readonly tone: 3;
|
|
836
|
+
}, {
|
|
837
|
+
readonly key: 'relationships';
|
|
838
|
+
readonly label: {
|
|
839
|
+
readonly en: 'Relationships';
|
|
840
|
+
};
|
|
841
|
+
readonly description: {
|
|
842
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
843
|
+
};
|
|
844
|
+
readonly tone: 4;
|
|
845
|
+
}];
|
|
846
|
+
/**
|
|
847
|
+
* ⚠ **Unmoved, and the lore bands' 0 is what makes wiring it safe.**
|
|
848
|
+
*
|
|
849
|
+
* `signalProximity`'s case exactly: the number falls out of the key walk
|
|
850
|
+
* that was already happening, so the only thing this weight decides is
|
|
851
|
+
* whether it counts — and turning it on reorders lore in an upgraded
|
|
852
|
+
* install that never asked. Every lore band therefore stays at 0 and the
|
|
853
|
+
* scan simply starts *reporting* the number, where a reader can see its
|
|
854
|
+
* value before deciding to weight it.
|
|
855
|
+
*
|
|
856
|
+
* `messages: 0.1` is left exactly as it was rather than tidied to 0.
|
|
857
|
+
* That band is not populated on the shipped path (the entity
|
|
858
|
+
* mechanism's `messages` out-port is deliberately unwired) and nothing
|
|
859
|
+
* writes `density` on a message candidate even when it is, so the number
|
|
860
|
+
* is inert either way — and moving a default that cannot change an
|
|
861
|
+
* outcome is a re-tune with no reason attached.
|
|
862
|
+
*/
|
|
863
|
+
readonly default: {
|
|
864
|
+
readonly messages: 0.1;
|
|
865
|
+
readonly worldLore: 0;
|
|
866
|
+
readonly characterLore: 0;
|
|
867
|
+
readonly history: 0;
|
|
868
|
+
readonly relationships: 0;
|
|
869
|
+
};
|
|
870
|
+
readonly label: {
|
|
871
|
+
readonly en: 'Length against the pool';
|
|
872
|
+
};
|
|
873
|
+
readonly description: {
|
|
874
|
+
readonly en: 'How much a longer-than-average entry outranks a short one. Length is a proxy for how much an entry has to say; raise it when your book mixes one-line stubs with real articles.';
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
/**
|
|
878
|
+
* How tightly an entry's matched keys clustered in the window.
|
|
879
|
+
*
|
|
880
|
+
* Two keys matching adjacent is stronger evidence than the same two
|
|
881
|
+
* matching twenty words apart: "the Ashguard rode" is about the Ashguard
|
|
882
|
+
* riding, and the same two words either side of a paragraph break are two
|
|
883
|
+
* unrelated sentences. `signalKeyword` cannot tell those apart — it counts
|
|
884
|
+
* *how many* of an entry's keys matched and never *where* — so this is the
|
|
885
|
+
* distinction that signal is missing rather than a second reading of it.
|
|
886
|
+
*
|
|
887
|
+
* ⚠ **0 everywhere, which is the one default it can have.** The number is
|
|
888
|
+
* computed on every scan (it falls out of the key walk that was already
|
|
889
|
+
* happening), so the only thing this weight decides is whether it counts —
|
|
890
|
+
* and turning it on reorders lore in an upgraded install that never asked.
|
|
891
|
+
* Same convention as `admitThreshold` and `scoreLedAllocation`.
|
|
892
|
+
*/
|
|
893
|
+
readonly signalProximity: {
|
|
894
|
+
readonly type: 'perMember';
|
|
895
|
+
readonly members: readonly [{
|
|
896
|
+
readonly key: 'messages';
|
|
897
|
+
readonly label: {
|
|
898
|
+
readonly en: 'Conversation';
|
|
899
|
+
};
|
|
900
|
+
readonly description: {
|
|
901
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
902
|
+
};
|
|
903
|
+
readonly tone: 0;
|
|
904
|
+
}, {
|
|
905
|
+
readonly key: 'worldLore';
|
|
906
|
+
readonly label: {
|
|
907
|
+
readonly en: 'World lore';
|
|
908
|
+
};
|
|
909
|
+
readonly description: {
|
|
910
|
+
readonly en: 'Lorebook entries about the world.';
|
|
911
|
+
};
|
|
912
|
+
readonly tone: 1;
|
|
913
|
+
}, {
|
|
914
|
+
readonly key: 'characterLore';
|
|
915
|
+
readonly label: {
|
|
916
|
+
readonly en: 'Character lore';
|
|
917
|
+
};
|
|
918
|
+
readonly description: {
|
|
919
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
920
|
+
};
|
|
921
|
+
readonly tone: 2;
|
|
922
|
+
}, {
|
|
923
|
+
readonly key: 'history';
|
|
924
|
+
readonly label: {
|
|
925
|
+
readonly en: 'History entries';
|
|
926
|
+
};
|
|
927
|
+
readonly description: {
|
|
928
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
929
|
+
};
|
|
930
|
+
readonly tone: 3;
|
|
931
|
+
}, {
|
|
932
|
+
readonly key: 'relationships';
|
|
933
|
+
readonly label: {
|
|
934
|
+
readonly en: 'Relationships';
|
|
935
|
+
};
|
|
936
|
+
readonly description: {
|
|
937
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
938
|
+
};
|
|
939
|
+
readonly tone: 4;
|
|
940
|
+
}];
|
|
941
|
+
readonly default: {
|
|
942
|
+
readonly messages: 0;
|
|
943
|
+
readonly worldLore: 0;
|
|
944
|
+
readonly characterLore: 0;
|
|
945
|
+
readonly history: 0;
|
|
946
|
+
readonly relationships: 0;
|
|
947
|
+
};
|
|
948
|
+
readonly label: {
|
|
949
|
+
readonly en: 'Keywords close together';
|
|
950
|
+
};
|
|
951
|
+
readonly description: {
|
|
952
|
+
readonly en: "How much it counts that an entry's keywords appeared near each other rather than scattered across the window.";
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
readonly signalPriorityBonus: {
|
|
956
|
+
readonly type: 'perMember';
|
|
957
|
+
readonly members: readonly [{
|
|
958
|
+
readonly key: 'messages';
|
|
959
|
+
readonly label: {
|
|
960
|
+
readonly en: 'Conversation';
|
|
961
|
+
};
|
|
962
|
+
readonly description: {
|
|
963
|
+
readonly en: 'The chat itself — what was actually said.';
|
|
964
|
+
};
|
|
965
|
+
readonly tone: 0;
|
|
966
|
+
}, {
|
|
967
|
+
readonly key: 'worldLore';
|
|
968
|
+
readonly label: {
|
|
969
|
+
readonly en: 'World lore';
|
|
970
|
+
};
|
|
971
|
+
readonly description: {
|
|
972
|
+
readonly en: 'Lorebook entries about the world.';
|
|
973
|
+
};
|
|
974
|
+
readonly tone: 1;
|
|
975
|
+
}, {
|
|
976
|
+
readonly key: 'characterLore';
|
|
977
|
+
readonly label: {
|
|
978
|
+
readonly en: 'Character lore';
|
|
979
|
+
};
|
|
980
|
+
readonly description: {
|
|
981
|
+
readonly en: 'Lorebook entries bound to a character.';
|
|
982
|
+
};
|
|
983
|
+
readonly tone: 2;
|
|
984
|
+
}, {
|
|
985
|
+
readonly key: 'history';
|
|
986
|
+
readonly label: {
|
|
987
|
+
readonly en: 'History entries';
|
|
988
|
+
};
|
|
989
|
+
readonly description: {
|
|
990
|
+
readonly en: 'Dated entries recording earlier events.';
|
|
991
|
+
};
|
|
992
|
+
readonly tone: 3;
|
|
993
|
+
}, {
|
|
994
|
+
readonly key: 'relationships';
|
|
995
|
+
readonly label: {
|
|
996
|
+
readonly en: 'Relationships';
|
|
997
|
+
};
|
|
998
|
+
readonly description: {
|
|
999
|
+
readonly en: 'The narrative graph. Off by default.';
|
|
1000
|
+
};
|
|
1001
|
+
readonly tone: 4;
|
|
1002
|
+
}];
|
|
1003
|
+
readonly default: {
|
|
1004
|
+
readonly messages: 0;
|
|
1005
|
+
readonly worldLore: 0.15;
|
|
1006
|
+
readonly characterLore: 0.15;
|
|
1007
|
+
readonly history: 0;
|
|
1008
|
+
readonly relationships: 0;
|
|
1009
|
+
};
|
|
1010
|
+
readonly label: {
|
|
1011
|
+
readonly en: 'Author priority';
|
|
1012
|
+
};
|
|
1013
|
+
readonly description: {
|
|
1014
|
+
readonly en: "Score added per step of an entry's own priority setting — the author's thumb on the scale.";
|
|
1015
|
+
};
|
|
1016
|
+
};
|
|
1017
|
+
readonly mechanismWeights: {
|
|
1018
|
+
readonly type: 'strengths';
|
|
1019
|
+
readonly min: 0;
|
|
1020
|
+
readonly max: 1;
|
|
1021
|
+
readonly quick: true;
|
|
1022
|
+
readonly members: readonly [{
|
|
1023
|
+
readonly key: 'keyword';
|
|
1024
|
+
readonly label: {
|
|
1025
|
+
readonly en: 'Keywords';
|
|
1026
|
+
};
|
|
1027
|
+
readonly description: {
|
|
1028
|
+
readonly en: "The author's own trigger words, how distinctive the shared vocabulary is, and how closely the matches clustered.";
|
|
1029
|
+
};
|
|
1030
|
+
readonly tone: 1;
|
|
1031
|
+
}, {
|
|
1032
|
+
readonly key: 'semantic';
|
|
1033
|
+
readonly label: {
|
|
1034
|
+
readonly en: 'Meaning';
|
|
1035
|
+
};
|
|
1036
|
+
readonly description: {
|
|
1037
|
+
readonly en: 'Similarity of meaning, with no shared words required. Needs an embedding model and the semantic arm switched on.';
|
|
1038
|
+
};
|
|
1039
|
+
readonly tone: 3;
|
|
1040
|
+
}, {
|
|
1041
|
+
readonly key: 'name';
|
|
1042
|
+
readonly label: {
|
|
1043
|
+
readonly en: 'Names';
|
|
1044
|
+
};
|
|
1045
|
+
readonly description: {
|
|
1046
|
+
readonly en: 'An entry called by its own name, and entries naming the same people and places as the scene.';
|
|
1047
|
+
};
|
|
1048
|
+
readonly tone: 2;
|
|
1049
|
+
}];
|
|
1050
|
+
readonly default: {
|
|
1051
|
+
readonly keyword: 1;
|
|
1052
|
+
readonly semantic: 1;
|
|
1053
|
+
readonly name: 1;
|
|
1054
|
+
};
|
|
1055
|
+
readonly label: {
|
|
1056
|
+
readonly en: 'How entries are found';
|
|
1057
|
+
};
|
|
1058
|
+
readonly description: {
|
|
1059
|
+
readonly en: 'How much each way of finding an entry counts toward its score. Turning one up takes nothing from the others — this is not the context split.';
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
readonly shareNormalisation: {
|
|
1063
|
+
readonly type: 'enum';
|
|
1064
|
+
readonly of: readonly ['relative', 'fixed'];
|
|
1065
|
+
readonly members: readonly [{
|
|
1066
|
+
readonly key: 'relative';
|
|
1067
|
+
readonly label: {
|
|
1068
|
+
readonly en: 'Relative';
|
|
1069
|
+
};
|
|
1070
|
+
readonly description: {
|
|
1071
|
+
readonly en: "Each source's share is a ratio against the others, so together they always fill the whole window.";
|
|
1072
|
+
};
|
|
1073
|
+
}, {
|
|
1074
|
+
readonly key: 'fixed';
|
|
1075
|
+
readonly label: {
|
|
1076
|
+
readonly en: 'Fixed';
|
|
1077
|
+
};
|
|
1078
|
+
readonly description: {
|
|
1079
|
+
readonly en: 'Each share is the fraction of the window it states, scaled down only when they add up to more than the whole.';
|
|
1080
|
+
};
|
|
1081
|
+
}];
|
|
1082
|
+
readonly default: 'relative';
|
|
1083
|
+
readonly label: {
|
|
1084
|
+
readonly en: 'How shares divide the window';
|
|
1085
|
+
};
|
|
1086
|
+
readonly description: {
|
|
1087
|
+
readonly en: "Whether each source's share is a ratio against the others or the fraction of the window it states.";
|
|
1088
|
+
};
|
|
1089
|
+
};
|
|
1090
|
+
readonly scoreLedAllocation: {
|
|
1091
|
+
readonly type: 'boolean';
|
|
1092
|
+
readonly default: false;
|
|
1093
|
+
readonly label: {
|
|
1094
|
+
readonly en: 'Let the best entries lead';
|
|
1095
|
+
};
|
|
1096
|
+
readonly description: {
|
|
1097
|
+
readonly en: 'Spend the whole context on whatever scored highest, wherever it came from, and treat each band as a ceiling rather than a reserved slice. Off divides the context into bands first and fills each one separately, which is how it has always worked.';
|
|
1098
|
+
};
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* The post-retrieval hook (18 §4a): user chains over the candidate
|
|
1104
|
+
* pool before ranking sees it. Spread onto this type alone rather
|
|
1105
|
+
* than into `rankSlots` — widening a sibling's accepted set is a
|
|
1106
|
+
* hash change on a type nobody meant to touch (S3).
|
|
1107
|
+
*/
|
|
1108
|
+
readonly scripts: {
|
|
1109
|
+
readonly kind: "scripts";
|
|
1110
|
+
readonly accepts: ["core:script:candidates/filter@1", "core:script:candidates/rescore@1"];
|
|
1111
|
+
readonly port: "candidates";
|
|
1112
|
+
readonly phase: "before";
|
|
1113
|
+
readonly description: "Scripts that drop or rescore retrieved entries before the ranker orders them. Dropping excludes with a reason; rescoring changes the order.";
|
|
1114
|
+
};
|
|
1115
|
+
} | undefined;
|
|
1116
|
+
}>;
|
|
1117
|
+
/**
|
|
1118
|
+
* The two retrieval query windows, as text.
|
|
1119
|
+
*
|
|
1120
|
+
* A Task because *how a message is written when it is a query* is a decision —
|
|
1121
|
+
* speaker attribution in brackets, emphasis stripped — and a different
|
|
1122
|
+
* embedding model might want a different shape. It is also where the two
|
|
1123
|
+
* windows are cut, which is the parameter a user with long posts will reach for
|
|
1124
|
+
* first.
|
|
1125
|
+
*
|
|
1126
|
+
* And it carries the **semantic mechanism's one switch**, `searchByMeaning`,
|
|
1127
|
+
* because it is the first node of the mechanism's chain (2026-09-29, genre
|
|
1128
|
+
* uplift C3) — `auto | on | off`, shipping `auto`, which searches whenever an
|
|
1129
|
+
* embedding model is set up, wherever it runs (owner, 2026-09-30).
|
|
1130
|
+
* @experimental
|
|
1131
|
+
*/
|
|
1132
|
+
export declare const queryWindows: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
1133
|
+
main: string;
|
|
1134
|
+
current: string;
|
|
1135
|
+
recent: string;
|
|
1136
|
+
}, {
|
|
1137
|
+
messages: string;
|
|
1138
|
+
cast: string;
|
|
1139
|
+
}, "core:task/query-windows@1"> & {
|
|
1140
|
+
kind: 'task';
|
|
1141
|
+
slots?: {
|
|
1142
|
+
/**
|
|
1143
|
+
* The **embedding** connection — the one the probes would be
|
|
1144
|
+
* embedded on, for *whether there is one*. Every shipped spec wires
|
|
1145
|
+
* it as this step's own (`slot.connection()`), resolving to the
|
|
1146
|
+
* install's active embedding connection: a pipeline never chooses
|
|
1147
|
+
* its embedding connection, so there is no pick to make here.
|
|
1148
|
+
*
|
|
1149
|
+
* Read for one fact, and only under `searchByMeaning: 'auto'`:
|
|
1150
|
+
* resolved to a connection, an embedding model is **set up** and
|
|
1151
|
+
* `auto` searches; unwired, or resolved to nothing, there is none and
|
|
1152
|
+
* `auto` does not. ⚠ Nothing else about the connection is read — not
|
|
1153
|
+
* where it runs, not whether it bills: a local model and an embedding
|
|
1154
|
+
* service search alike (owner, 2026-09-30). A host that embeds
|
|
1155
|
+
* through one fixed connection must hold this slot there (Serene Pub
|
|
1156
|
+
* offers no pick and drops a stored one), or this step decides about
|
|
1157
|
+
* a connection the embed never uses — INTEGRATING.md, Step 3. A pure
|
|
1158
|
+
* Task reading data it was handed, the `context-budget` shape: the
|
|
1159
|
+
* connection is resolved before the run.
|
|
1160
|
+
*
|
|
1161
|
+
* Until 2026-10-05 it was wired by reference to the embed step's
|
|
1162
|
+
* slot (`slot.connectionOf('semantic.arm.embed')`); `embed-text`
|
|
1163
|
+
* declares no connection now (owner ruling D-c), so the slot states
|
|
1164
|
+
* its own kind.
|
|
1165
|
+
*/
|
|
1166
|
+
readonly connection: {
|
|
1167
|
+
readonly kind: "connection";
|
|
1168
|
+
readonly shape: string;
|
|
1169
|
+
readonly requires: readonly ["text->embedding"];
|
|
1170
|
+
};
|
|
1171
|
+
readonly params: {
|
|
1172
|
+
readonly kind: "parameters";
|
|
1173
|
+
readonly facet: "weights";
|
|
1174
|
+
readonly schema: {
|
|
1175
|
+
/**
|
|
1176
|
+
* ⚠ **The semantic mechanism's one switch**, on the *first*
|
|
1177
|
+
* node of its chain on purpose — the shape
|
|
1178
|
+
* `mention-spans.maxMentions` gives the entity-vector
|
|
1179
|
+
* mechanism. Off, this cuts no probes: `embed-text` is handed
|
|
1180
|
+
* no texts and makes no model call, and `vector-search`
|
|
1181
|
+
* returns before its reads.
|
|
1182
|
+
*
|
|
1183
|
+
* **`auto`, the default, searches whenever an embedding model
|
|
1184
|
+
* is set up** — a local model, a runtime you run yourself or a
|
|
1185
|
+
* service billed per request, alike — and not when none is (an
|
|
1186
|
+
* optional mechanism that is unavailable is skipped). `on`
|
|
1187
|
+
* searches with whatever model is set up; `off` never
|
|
1188
|
+
* searches. "Set up" is the `connection` slot above resolving
|
|
1189
|
+
* to a connection.
|
|
1190
|
+
*
|
|
1191
|
+
* ⚠ **Where the model runs is not a question it asks.** For
|
|
1192
|
+
* one day (2026-09-29) `auto` searched only with a model on
|
|
1193
|
+
* this machine and skipped a service, read into a ruling about
|
|
1194
|
+
* one expensive call per turn; the owner, 2026-09-30: *"I
|
|
1195
|
+
* never said to skip paid services for retrieval, that's what
|
|
1196
|
+
* they are there for. Don't do that."*
|
|
1197
|
+
*
|
|
1198
|
+
* The vocabulary is `embed-text`'s `enabled` — `auto | on |
|
|
1199
|
+
* off`, labelled Automatic, On, Off — and the question is
|
|
1200
|
+
* not. ⚠ That one says what to do when no model is loaded;
|
|
1201
|
+
* this says whether to search at all. `auto` there calls
|
|
1202
|
+
* whatever is loaded; `auto` here asks whether one is set up.
|
|
1203
|
+
*
|
|
1204
|
+
* It was `vector-search.maxEntries = 0`, on the chain's
|
|
1205
|
+
* *last* node, until 2026-09-29. By then the probes had
|
|
1206
|
+
* been embedded, so every turn with an embedding model
|
|
1207
|
+
* ready paid for an embed it threw away — a provider call
|
|
1208
|
+
* per turn in API mode. `maxEntries` is a ceiling now, and
|
|
1209
|
+
* ships non-zero so that turning this on does something.
|
|
1210
|
+
* It was then a boolean defaulting to off for one day
|
|
1211
|
+
* (C3), which spent nothing and searched nothing.
|
|
1212
|
+
*/
|
|
1213
|
+
readonly searchByMeaning: {
|
|
1214
|
+
readonly type: "enum";
|
|
1215
|
+
readonly of: readonly ["auto", "on", "off"];
|
|
1216
|
+
readonly members: readonly [{
|
|
1217
|
+
readonly key: "auto";
|
|
1218
|
+
readonly label: {
|
|
1219
|
+
readonly en: "Automatic";
|
|
1220
|
+
};
|
|
1221
|
+
readonly description: {
|
|
1222
|
+
readonly en: "Searches whenever an embedding model is set up, on this machine or a service, and skips the search when none is.";
|
|
1223
|
+
};
|
|
1224
|
+
}, {
|
|
1225
|
+
readonly key: "on";
|
|
1226
|
+
readonly label: {
|
|
1227
|
+
readonly en: "On";
|
|
1228
|
+
};
|
|
1229
|
+
readonly description: {
|
|
1230
|
+
readonly en: "Searches on every turn with whatever embedding model is set up.";
|
|
1231
|
+
};
|
|
1232
|
+
}, {
|
|
1233
|
+
readonly key: "off";
|
|
1234
|
+
readonly label: {
|
|
1235
|
+
readonly en: "Off";
|
|
1236
|
+
};
|
|
1237
|
+
readonly description: {
|
|
1238
|
+
readonly en: "Never searches by meaning, and makes no embedding request for it.";
|
|
1239
|
+
};
|
|
1240
|
+
}];
|
|
1241
|
+
readonly default: "auto";
|
|
1242
|
+
readonly quick: true;
|
|
1243
|
+
readonly label: {
|
|
1244
|
+
readonly en: "Search by meaning";
|
|
1245
|
+
};
|
|
1246
|
+
readonly description: "Find lorebook entries that are about what the conversation is about, even with no keyword in common. Needs an embedding model, and embeds the latest messages on every turn. Automatic searches whenever one is set up.";
|
|
1247
|
+
};
|
|
1248
|
+
readonly currentWindow: {
|
|
1249
|
+
readonly type: "integer";
|
|
1250
|
+
readonly default: 2;
|
|
1251
|
+
readonly description: "How many of the latest messages form the 'current' retrieval query.";
|
|
1252
|
+
};
|
|
1253
|
+
readonly recentWindow: {
|
|
1254
|
+
readonly type: "integer";
|
|
1255
|
+
readonly default: 3;
|
|
1256
|
+
readonly description: "How many messages before those form the wider 'recent' retrieval query.";
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
};
|
|
1260
|
+
} | undefined;
|
|
1261
|
+
}>;
|
|
1262
|
+
/**
|
|
1263
|
+
* The semantic mechanism's ranking, as a Task.
|
|
1264
|
+
*
|
|
1265
|
+
* Nine stages the legacy engine runs inline: fuse the per-query lists, normalise
|
|
1266
|
+
* to the top, boost recency and author priority, cut on an adaptive threshold,
|
|
1267
|
+
* diversify with MMR, and cap each source. Every constant behind them is a
|
|
1268
|
+
* parameter here — one of them carries a `TODO: make configurable` in the
|
|
1269
|
+
* original.
|
|
1270
|
+
*
|
|
1271
|
+
* A Task rather than part of the vector Query because **it is policy**: which of
|
|
1272
|
+
* these stages run, and how hard, is exactly what an installation should be able
|
|
1273
|
+
* to replace. The Query retrieves and computes similarity; this decides.
|
|
1274
|
+
*
|
|
1275
|
+
* `similarity` is a port because MMR needs to compare candidates to each other
|
|
1276
|
+
* and a Task cannot ask the host for anything (F11). It is a matrix of cosines,
|
|
1277
|
+
* not the embeddings — derived, bounded, and not reversible into the vectors.
|
|
1278
|
+
* @experimental
|
|
1279
|
+
*/
|
|
1280
|
+
export declare const rankSemantic: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
1281
|
+
main: string;
|
|
1282
|
+
candidates: string;
|
|
1283
|
+
diagnostics: string;
|
|
1284
|
+
}, {
|
|
1285
|
+
/**
|
|
1286
|
+
* One entry per query window, each carrying its own per-message
|
|
1287
|
+
* ranked lists and its own similarity matrix. The whole stack
|
|
1288
|
+
* runs per window; the results are concatenated, not fused.
|
|
1289
|
+
*/
|
|
1290
|
+
windows: string;
|
|
1291
|
+
messages: string;
|
|
1292
|
+
}, "core:task/rank-semantic@1"> & {
|
|
1293
|
+
kind: 'task';
|
|
1294
|
+
slots?: {
|
|
1295
|
+
readonly params: {
|
|
1296
|
+
readonly kind: "parameters";
|
|
1297
|
+
readonly facet: "weights";
|
|
1298
|
+
readonly schema: {
|
|
1299
|
+
/**
|
|
1300
|
+
* ⚠ No `currentWindow` / `recentWindow` here, and there
|
|
1301
|
+
* were (culled 2026-09-16, R-12). They size the two query
|
|
1302
|
+
* windows — how many messages form the 'current' and the
|
|
1303
|
+
* 'recent' question — which `core:task/query-windows@1`
|
|
1304
|
+
* cuts and declares as its own params. Declared here too,
|
|
1305
|
+
* they were rendered twice and read once: the ranker
|
|
1306
|
+
* receives windows already cut and consults neither.
|
|
1307
|
+
*/
|
|
1308
|
+
readonly rrfK: {
|
|
1309
|
+
readonly type: "integer";
|
|
1310
|
+
readonly default: 60;
|
|
1311
|
+
readonly description: "Rank-fusion constant — higher values flatten the difference between ranks.";
|
|
1312
|
+
};
|
|
1313
|
+
readonly recencyBoost: {
|
|
1314
|
+
readonly type: "number";
|
|
1315
|
+
readonly default: 0.15;
|
|
1316
|
+
readonly description: "Extra score given to recent entries.";
|
|
1317
|
+
};
|
|
1318
|
+
readonly recencyDecay: {
|
|
1319
|
+
readonly type: "number";
|
|
1320
|
+
readonly default: 0.01;
|
|
1321
|
+
readonly description: "How quickly the recency boost fades per message of age.";
|
|
1322
|
+
};
|
|
1323
|
+
readonly thresholdMin: {
|
|
1324
|
+
readonly type: "number";
|
|
1325
|
+
readonly default: 0.3;
|
|
1326
|
+
readonly description: "Minimum similarity a match needs to be considered at all.";
|
|
1327
|
+
};
|
|
1328
|
+
readonly relativeThreshold: {
|
|
1329
|
+
readonly type: "number";
|
|
1330
|
+
readonly default: 0.7;
|
|
1331
|
+
readonly description: "Drop matches scoring below this fraction of the best match.";
|
|
1332
|
+
};
|
|
1333
|
+
readonly mmrLambda: {
|
|
1334
|
+
readonly type: "number";
|
|
1335
|
+
readonly default: 0.7;
|
|
1336
|
+
readonly description: "Balance between relevance and variety — 1 is pure relevance, 0 maximum variety.";
|
|
1337
|
+
};
|
|
1338
|
+
/**
|
|
1339
|
+
* ⚠ Not the five `SOURCES` the budget split uses. These are
|
|
1340
|
+
* the semantic mechanism's own record kinds — what a stored vector
|
|
1341
|
+
* *is* — and `historyEntry` vs `history` is a real
|
|
1342
|
+
* difference, not a spelling. Mapping one vocabulary onto
|
|
1343
|
+
* the other here would quietly rename keys the ranker
|
|
1344
|
+
* matches literally (`weights.ts DEFAULT_SEMANTIC`).
|
|
1345
|
+
*/
|
|
1346
|
+
readonly sourceBudget: {
|
|
1347
|
+
readonly type: "perMember";
|
|
1348
|
+
readonly members: readonly [{
|
|
1349
|
+
readonly key: "message";
|
|
1350
|
+
readonly label: {
|
|
1351
|
+
readonly en: "Messages";
|
|
1352
|
+
};
|
|
1353
|
+
readonly description: {
|
|
1354
|
+
readonly en: "Chat messages found by meaning.";
|
|
1355
|
+
};
|
|
1356
|
+
readonly tone: 0;
|
|
1357
|
+
}, {
|
|
1358
|
+
readonly key: "worldLore";
|
|
1359
|
+
readonly label: {
|
|
1360
|
+
readonly en: "World lore";
|
|
1361
|
+
};
|
|
1362
|
+
readonly description: {
|
|
1363
|
+
readonly en: "Lorebook entries about the world.";
|
|
1364
|
+
};
|
|
1365
|
+
readonly tone: 1;
|
|
1366
|
+
}, {
|
|
1367
|
+
readonly key: "characterLore";
|
|
1368
|
+
readonly label: {
|
|
1369
|
+
readonly en: "Character lore";
|
|
1370
|
+
};
|
|
1371
|
+
readonly description: {
|
|
1372
|
+
readonly en: "Lorebook entries bound to a character.";
|
|
1373
|
+
};
|
|
1374
|
+
readonly tone: 2;
|
|
1375
|
+
}, {
|
|
1376
|
+
readonly key: "historyEntry";
|
|
1377
|
+
readonly label: {
|
|
1378
|
+
readonly en: "History entries";
|
|
1379
|
+
};
|
|
1380
|
+
readonly description: {
|
|
1381
|
+
readonly en: "Dated entries recording earlier events.";
|
|
1382
|
+
};
|
|
1383
|
+
readonly tone: 3;
|
|
1384
|
+
}, {
|
|
1385
|
+
readonly key: "narrativeRelationship";
|
|
1386
|
+
readonly label: {
|
|
1387
|
+
readonly en: "Relationships";
|
|
1388
|
+
};
|
|
1389
|
+
readonly description: {
|
|
1390
|
+
readonly en: "The narrative graph. Off by default.";
|
|
1391
|
+
};
|
|
1392
|
+
readonly tone: 4;
|
|
1393
|
+
}];
|
|
1394
|
+
readonly default: {
|
|
1395
|
+
readonly message: 12;
|
|
1396
|
+
readonly worldLore: 8;
|
|
1397
|
+
readonly characterLore: 6;
|
|
1398
|
+
readonly historyEntry: 6;
|
|
1399
|
+
readonly narrativeRelationship: 5;
|
|
1400
|
+
};
|
|
1401
|
+
readonly label: {
|
|
1402
|
+
readonly en: "Most matches per kind";
|
|
1403
|
+
};
|
|
1404
|
+
readonly description: {
|
|
1405
|
+
readonly en: "A ceiling on how many semantic matches of each kind survive fusion, before the budget ranker sees them.";
|
|
1406
|
+
};
|
|
1407
|
+
};
|
|
1408
|
+
readonly defaultSourceBudget: {
|
|
1409
|
+
readonly type: "integer";
|
|
1410
|
+
readonly default: 20;
|
|
1411
|
+
readonly description: "The ceiling for any match kind not named above — what a plugin-added source gets until it declares its own.";
|
|
1412
|
+
};
|
|
1413
|
+
};
|
|
1414
|
+
};
|
|
1415
|
+
} | undefined;
|
|
1416
|
+
}>;
|
|
1417
|
+
/**
|
|
1418
|
+
* A plugin's ranker — same kind, same shape, so the swap list offers it (16 §5c).
|
|
1419
|
+
*
|
|
1420
|
+
* Named `rankRecall`, not `rankSemantic`: binding names derive from the id's
|
|
1421
|
+
* name segment and ignore the namespace, so this and `core:task/rank-semantic@1`
|
|
1422
|
+
* would both want to be `rankSemantic` and generation would emit one export
|
|
1423
|
+
* twice. `checkUnique` now catches that; the id changed here because a plugin
|
|
1424
|
+
* naming its ranker after its own product is the better name anyway.
|
|
1425
|
+
* @internal
|
|
1426
|
+
*/
|
|
1427
|
+
export declare const rankRecall: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
1428
|
+
main: string;
|
|
1429
|
+
candidates: string;
|
|
1430
|
+
/**
|
|
1431
|
+
* The per-candidate trail: score, included, reason, and the signal
|
|
1432
|
+
* breakdown behind it.
|
|
1433
|
+
*
|
|
1434
|
+
* A declared out-port rather than an implementation detail, because it is
|
|
1435
|
+
* what Assemble allocates from — and because a ranker swapped in by a
|
|
1436
|
+
* plugin has to produce it too, or the budget panel goes blank the moment
|
|
1437
|
+
* anyone changes rankers (16 §5c).
|
|
1438
|
+
*
|
|
1439
|
+
* Shape `S.decisions` (R64): a node publishing it is recorded in the
|
|
1440
|
+
* ranking store automatically — a plugin's ranker included.
|
|
1441
|
+
*/
|
|
1442
|
+
decisions: string;
|
|
1443
|
+
}, {
|
|
1444
|
+
candidates: string;
|
|
1445
|
+
budget: string;
|
|
1446
|
+
}, "chariot.recall:rank-recall@1"> & {
|
|
1447
|
+
kind: 'task';
|
|
1448
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
1449
|
+
}>;
|
|
1450
|
+
/** @public */
|
|
1451
|
+
export declare const assemble: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
1452
|
+
main: string;
|
|
1453
|
+
context: string;
|
|
1454
|
+
}, {
|
|
1455
|
+
candidates: string;
|
|
1456
|
+
budget: string;
|
|
1457
|
+
templateContext: string;
|
|
1458
|
+
/**
|
|
1459
|
+
* The ranker's per-candidate trail — score, verdict, reason.
|
|
1460
|
+
*
|
|
1461
|
+
* ⚠ **Supplied since the node was written, declared only now.**
|
|
1462
|
+
* All three shipped specs wire `decisions: $.rank.decisions`,
|
|
1463
|
+
* and the binding halts without them ("wire a ranker between
|
|
1464
|
+
* retrieval and assembly"), so this is not a new input — it is
|
|
1465
|
+
* the load-bearing one. What was missing was the declaration,
|
|
1466
|
+
* and the cost of that is exact: `validate.ts` skips its shape
|
|
1467
|
+
* check when either side is undeclared (`if (!outShape ||
|
|
1468
|
+
* !inShape) continue`), so a plugin ranker publishing the wrong
|
|
1469
|
+
* shape on this edge got no finding, and a plugin ASSEMBLER had
|
|
1470
|
+
* nothing to read to learn the port existed.
|
|
1471
|
+
*
|
|
1472
|
+
* `S.decisions`, matching `rankPorts.out.decisions` (R64) — a
|
|
1473
|
+
* decision is a candidate with its arithmetic attached, and the
|
|
1474
|
+
* panel reads the same objects the allocator does. Typed, so a
|
|
1475
|
+
* plugin ranker wired here publishes the shape the ranking store
|
|
1476
|
+
* records.
|
|
1477
|
+
*/
|
|
1478
|
+
decisions: string;
|
|
1479
|
+
/**
|
|
1480
|
+
* The finished chat lines, from `core:task/process-messages@1`.
|
|
1481
|
+
*
|
|
1482
|
+
* Wired by all three specs (`messages: $.lines.messages`) and
|
|
1483
|
+
* undeclared for the same stretch as `decisions`. Two readers
|
|
1484
|
+
* depend on it and neither is optional: the transcript the
|
|
1485
|
+
* template renders, and the depth the post-history reminder is
|
|
1486
|
+
* placed at — which is computed against *these* lines because
|
|
1487
|
+
* the context builder ships a placeholder index, the final
|
|
1488
|
+
* array not existing when it runs.
|
|
1489
|
+
*/
|
|
1490
|
+
messages: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* Per band: allocated, used, entries — the arithmetic the
|
|
1493
|
+
* ranker did while deciding (D-H).
|
|
1494
|
+
*
|
|
1495
|
+
* ⚠ **The one genuinely new edge in this set.** The two
|
|
1496
|
+
* above were supplied and undeclared; this was PUBLISHED by
|
|
1497
|
+
* `core:task/rank-hybrid@1` and wired by nobody, so `allocate`
|
|
1498
|
+
* fell to its own `{}` and the per-band numbers the ranker had
|
|
1499
|
+
* already computed were dropped on the floor between two
|
|
1500
|
+
* adjacent nodes.
|
|
1501
|
+
*
|
|
1502
|
+
* What it does NOT touch is the prompt: `allocate` puts this
|
|
1503
|
+
* straight onto `AllocatedContext.groups` and reads it nowhere
|
|
1504
|
+
* else, so `blocks`, `totalTokens` and `budget` — everything
|
|
1505
|
+
* the render sees — are byte-identical with it wired or not.
|
|
1506
|
+
* What changes is the receipt: `dispatch.ts` publishes
|
|
1507
|
+
* `payload.groups` as the run's `sources`, which is the budget
|
|
1508
|
+
* panel's whole data set and has been empty on every run.
|
|
1509
|
+
*
|
|
1510
|
+
* Undeclared on purpose for the other rankers. A ranker that
|
|
1511
|
+
* computes no per-band usage leaves this unwired and
|
|
1512
|
+
* `allocate` takes the branch it has always taken.
|
|
1513
|
+
*/
|
|
1514
|
+
groups: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* The annex a template may read, as `annex.<owner>.<key>`
|
|
1517
|
+
* (typed templates P6, edited in place — owner ruling Q4).
|
|
1518
|
+
*
|
|
1519
|
+
* Fed ONLY by `core:query/session-annex@1` with `view:
|
|
1520
|
+
* 'template'`: every DECLARED key of every owner in scope —
|
|
1521
|
+
* core, the enabled plugins — for the session's genre, keyed by
|
|
1522
|
+
* owner. A key no declaration covers never arrives, and a
|
|
1523
|
+
* declaration refuses secrets at write time (R61), so what
|
|
1524
|
+
* reaches a template is what an owner said may be kept there
|
|
1525
|
+
* (owner ruling Q1: "nothing dangerous should ever be stored
|
|
1526
|
+
* there"). Law T2 refuses anything else wired here, and a
|
|
1527
|
+
* template-view read wired anywhere else.
|
|
1528
|
+
*
|
|
1529
|
+
* Optional: unwired, `annex` is not in the template's scope at
|
|
1530
|
+
* all, so a template naming it is refused rather than rendering
|
|
1531
|
+
* nothing.
|
|
1532
|
+
*/
|
|
1533
|
+
annex: string;
|
|
1534
|
+
}, "core:task/assemble@2"> & {
|
|
1535
|
+
kind: 'task';
|
|
1536
|
+
slots?: {
|
|
1537
|
+
readonly template: {
|
|
1538
|
+
readonly kind: "template";
|
|
1539
|
+
readonly acceptedEngines: readonly [string, string];
|
|
1540
|
+
readonly facet: "templates";
|
|
1541
|
+
/**
|
|
1542
|
+
* Assemble's own names — what `render()` writes onto the context
|
|
1543
|
+
* AFTER spreading the prompts and the builder's context, so these
|
|
1544
|
+
* are the last word (typed templates P3, edited in place — owner
|
|
1545
|
+
* ruling Q4).
|
|
1546
|
+
*
|
|
1547
|
+
* Corrected 2026-09-27: this declared `blocks`, `budget` as two
|
|
1548
|
+
* bare names and `prompts` — `blocks` is a param that reorders the
|
|
1549
|
+
* template and never reaches it, and `prompts` is never a name:
|
|
1550
|
+
* the prompts slot's fields are spread at the top level. The
|
|
1551
|
+
* builder's keys and the prompts fields join these in
|
|
1552
|
+
* `templateScopeAt`; declared bands join them too.
|
|
1553
|
+
*/
|
|
1554
|
+
readonly variables: {
|
|
1555
|
+
readonly worldLore: {
|
|
1556
|
+
readonly type: 'string';
|
|
1557
|
+
readonly optional: true;
|
|
1558
|
+
readonly description: 'World lore that fit the budget, laid out.';
|
|
1559
|
+
};
|
|
1560
|
+
readonly characterLore: {
|
|
1561
|
+
readonly type: 'string';
|
|
1562
|
+
readonly optional: true;
|
|
1563
|
+
readonly description: 'Lore bound to a cast member that fit the budget, laid out — only what this speaker may see.';
|
|
1564
|
+
};
|
|
1565
|
+
readonly history: {
|
|
1566
|
+
readonly type: 'string';
|
|
1567
|
+
readonly optional: true;
|
|
1568
|
+
readonly description: 'History entries that fit the budget, laid out.';
|
|
1569
|
+
};
|
|
1570
|
+
readonly currentDate: {
|
|
1571
|
+
readonly type: 'string';
|
|
1572
|
+
readonly optional: true;
|
|
1573
|
+
readonly description: 'The story’s current date, laid out.';
|
|
1574
|
+
};
|
|
1575
|
+
readonly sessionMessages: {
|
|
1576
|
+
readonly type: 'list';
|
|
1577
|
+
readonly description: 'The transcript, oldest first, ending with the seed line.';
|
|
1578
|
+
readonly of: {
|
|
1579
|
+
readonly type: 'object';
|
|
1580
|
+
readonly fields: {
|
|
1581
|
+
readonly id: {
|
|
1582
|
+
readonly type: 'number';
|
|
1583
|
+
};
|
|
1584
|
+
readonly role: {
|
|
1585
|
+
readonly type: 'string';
|
|
1586
|
+
};
|
|
1587
|
+
readonly name: {
|
|
1588
|
+
readonly type: 'string';
|
|
1589
|
+
};
|
|
1590
|
+
readonly message: {
|
|
1591
|
+
readonly type: 'string';
|
|
1592
|
+
readonly optional: true;
|
|
1593
|
+
};
|
|
1594
|
+
/**
|
|
1595
|
+
* 🚧 The line's files, placed (PLAN-composer-attachments
|
|
1596
|
+
* §3.5): media markers, inlined text files and placeholders,
|
|
1597
|
+
* from `core:task/place-attachments@1`. Absent on a line
|
|
1598
|
+
* with no files, and on every line of a spec with no
|
|
1599
|
+
* placement step.
|
|
1600
|
+
*/
|
|
1601
|
+
readonly attachments: {
|
|
1602
|
+
readonly type: 'string';
|
|
1603
|
+
readonly optional: true;
|
|
1604
|
+
readonly description: "The line's attachments, placed: files the model receives, text files inlined, and names for the rest.";
|
|
1605
|
+
};
|
|
1606
|
+
};
|
|
1607
|
+
};
|
|
1608
|
+
};
|
|
1609
|
+
readonly injectionsByIndex: {
|
|
1610
|
+
readonly type: 'record';
|
|
1611
|
+
readonly description: 'Script injections, keyed by the message index they render at.';
|
|
1612
|
+
readonly of: {
|
|
1613
|
+
readonly type: 'list';
|
|
1614
|
+
readonly of: {
|
|
1615
|
+
readonly type: 'object';
|
|
1616
|
+
readonly fields: {
|
|
1617
|
+
readonly role: {
|
|
1618
|
+
readonly type: 'string';
|
|
1619
|
+
};
|
|
1620
|
+
readonly content: {
|
|
1621
|
+
readonly type: 'string';
|
|
1622
|
+
};
|
|
1623
|
+
};
|
|
1624
|
+
};
|
|
1625
|
+
};
|
|
1626
|
+
};
|
|
1627
|
+
readonly budget: {
|
|
1628
|
+
readonly type: 'object';
|
|
1629
|
+
readonly description: 'The token budget this prompt was allocated against.';
|
|
1630
|
+
readonly fields: {
|
|
1631
|
+
readonly total: {
|
|
1632
|
+
readonly type: 'number';
|
|
1633
|
+
};
|
|
1634
|
+
readonly used: {
|
|
1635
|
+
readonly type: 'number';
|
|
1636
|
+
};
|
|
1637
|
+
readonly remaining: {
|
|
1638
|
+
readonly type: 'number';
|
|
1639
|
+
};
|
|
1640
|
+
};
|
|
1641
|
+
};
|
|
1642
|
+
readonly postHistory: {
|
|
1643
|
+
readonly type: 'object';
|
|
1644
|
+
readonly optional: true;
|
|
1645
|
+
readonly description: 'The post-history block, placed: render it when the loop reaches targetIndex.';
|
|
1646
|
+
readonly fields: {
|
|
1647
|
+
readonly targetIndex: {
|
|
1648
|
+
readonly type: 'number';
|
|
1649
|
+
};
|
|
1650
|
+
readonly instructions: {
|
|
1651
|
+
readonly type: 'string';
|
|
1652
|
+
readonly optional: true;
|
|
1653
|
+
};
|
|
1654
|
+
readonly charInstructions: {
|
|
1655
|
+
readonly type: 'string';
|
|
1656
|
+
readonly optional: true;
|
|
1657
|
+
};
|
|
1658
|
+
readonly exampleDialogue: {
|
|
1659
|
+
readonly type: 'string';
|
|
1660
|
+
readonly optional: true;
|
|
1661
|
+
};
|
|
1662
|
+
readonly hasContent: {
|
|
1663
|
+
readonly type: 'boolean';
|
|
1664
|
+
};
|
|
1665
|
+
};
|
|
1666
|
+
};
|
|
1667
|
+
/**
|
|
1668
|
+
* 🚧 The session's **author's note**, placed (2026-10-02, AN1) — the
|
|
1669
|
+
* person's own steering text for this session, at its own depth, with no
|
|
1670
|
+
* token trigger. Not the post-history reminder: that one is the pipeline's
|
|
1671
|
+
* and the card's "how to respond"; this is the person's "what is true now".
|
|
1672
|
+
* Absent for a genre that declares no `authorsNote` field.
|
|
1673
|
+
*/
|
|
1674
|
+
readonly authorsNote: {
|
|
1675
|
+
readonly type: 'object';
|
|
1676
|
+
readonly optional: true;
|
|
1677
|
+
readonly description: 'The session’s author’s note, placed: render it when the loop reaches targetIndex, before the injections and the post-history block.';
|
|
1678
|
+
readonly fields: {
|
|
1679
|
+
readonly targetIndex: {
|
|
1680
|
+
readonly type: 'number';
|
|
1681
|
+
};
|
|
1682
|
+
readonly text: {
|
|
1683
|
+
readonly type: 'string';
|
|
1684
|
+
readonly optional: true;
|
|
1685
|
+
};
|
|
1686
|
+
readonly role: {
|
|
1687
|
+
readonly type: 'string';
|
|
1688
|
+
};
|
|
1689
|
+
readonly hasContent: {
|
|
1690
|
+
readonly type: 'boolean';
|
|
1691
|
+
};
|
|
1692
|
+
};
|
|
1693
|
+
};
|
|
1694
|
+
};
|
|
1695
|
+
readonly description: "The story string: the overall layout of the finished prompt — where the character cards, lore, history and instructions sit. Leave empty to use the built-in layout.";
|
|
1696
|
+
};
|
|
1697
|
+
readonly prompts: {
|
|
1698
|
+
readonly kind: "prompts";
|
|
1699
|
+
readonly quick: true;
|
|
1700
|
+
readonly facet: "prompts";
|
|
1701
|
+
readonly fields: {
|
|
1702
|
+
readonly system: {
|
|
1703
|
+
readonly type: "text";
|
|
1704
|
+
};
|
|
1705
|
+
readonly postHistory: {
|
|
1706
|
+
readonly type: "text";
|
|
1707
|
+
};
|
|
1708
|
+
};
|
|
1709
|
+
};
|
|
1710
|
+
/**
|
|
1711
|
+
* How the values Assemble itself produces are laid out.
|
|
1712
|
+
*
|
|
1713
|
+
* These exist here rather than upstream because they come out the
|
|
1714
|
+
* other side of the budget: what a layout receives is what actually
|
|
1715
|
+
* fit, which no earlier node knows. `characterLore` among them — the
|
|
1716
|
+
* admitted lore of cast members, which a context template places
|
|
1717
|
+
* with `{{{characterLore}}}` like any other lore.
|
|
1718
|
+
*/
|
|
1719
|
+
readonly variables: {
|
|
1720
|
+
readonly kind: "variables";
|
|
1721
|
+
readonly facet: "variables";
|
|
1722
|
+
readonly description: "How the retrieved lore and history are laid out — JSON, prose, or whatever you write. Duplicate one to change it.";
|
|
1723
|
+
readonly renders: {
|
|
1724
|
+
readonly worldLore: "core:var/world-lore@1";
|
|
1725
|
+
readonly characterLore: "core:var/character-lore@1";
|
|
1726
|
+
readonly history: "core:var/history@1";
|
|
1727
|
+
readonly currentDate: "core:var/current-date@1";
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* Open (typed templates P2, edited in place — owner ruling Q4):
|
|
1731
|
+
* every band declared upstream of `candidates` is rendered too,
|
|
1732
|
+
* under its key and through its variable's layout — a plugin's
|
|
1733
|
+
* source adds its band here by declaring it.
|
|
1734
|
+
*/
|
|
1735
|
+
readonly rendersBands: {
|
|
1736
|
+
readonly from: "candidates";
|
|
1737
|
+
};
|
|
1738
|
+
};
|
|
1739
|
+
readonly params: {
|
|
1740
|
+
readonly kind: "parameters";
|
|
1741
|
+
readonly facet: "weights";
|
|
1742
|
+
readonly schema: {
|
|
1743
|
+
/**
|
|
1744
|
+
* ⚠ No `budget` here either. It was an integer defaulting to
|
|
1745
|
+
* 4096 — the same re-entered number the ranker carried, with
|
|
1746
|
+
* the same defect: an absolute count on a node cannot know
|
|
1747
|
+
* which model the prompt is about to be sent to, so it was
|
|
1748
|
+
* free to disagree with the window and warn nobody. The
|
|
1749
|
+
* total now arrives on the `budget` in-port from
|
|
1750
|
+
* `core:task/context-budget@1`, which derives it from the
|
|
1751
|
+
* sampling config the reply is generated against.
|
|
1752
|
+
*/
|
|
1753
|
+
/**
|
|
1754
|
+
* Where the post-history reminder goes, and whether it goes
|
|
1755
|
+
* at all.
|
|
1756
|
+
*
|
|
1757
|
+
* Numbers, so they are parameters rather than prompt text —
|
|
1758
|
+
* a `prompts` slot carries authored strings and typing a
|
|
1759
|
+
* count as one would be the wrong shape wearing a
|
|
1760
|
+
* convenient home. The trigger is a **suppression**: below
|
|
1761
|
+
* it a short chat gets no reminder, because a reinforcement
|
|
1762
|
+
* note two messages after the system prompt is noise.
|
|
1763
|
+
*/
|
|
1764
|
+
readonly postHistoryDepth: {
|
|
1765
|
+
readonly type: "integer";
|
|
1766
|
+
readonly default: 0;
|
|
1767
|
+
readonly description: "Place the post-history reminder this many messages before the end. 0 puts it last.";
|
|
1768
|
+
};
|
|
1769
|
+
readonly postHistoryTokenTrigger: {
|
|
1770
|
+
readonly type: "integer";
|
|
1771
|
+
readonly default: 0;
|
|
1772
|
+
readonly description: "Only add the reminder once the chat is at least this many tokens long. 0 always adds it.";
|
|
1773
|
+
};
|
|
1774
|
+
/**
|
|
1775
|
+
* ⚠ No `truncation` here, and there was one — an enum of
|
|
1776
|
+
* `oldest-first | lowest-weight`, "what gets dropped first
|
|
1777
|
+
* when the context is over budget" — declared, rendered,
|
|
1778
|
+
* and read by nothing (culled 2026-09-16, R-12). What LORE
|
|
1779
|
+
* fits is decided upstream by the ranker's `select`, per
|
|
1780
|
+
* band, against `share`, `maxEntries`, `minEntries` and
|
|
1781
|
+
* `scoreLedAllocation` on `core:task/rank-hybrid@1`, and
|
|
1782
|
+
* this node renders the decisions it is handed. A second
|
|
1783
|
+
* drop rule for lore here would be a second owner of one
|
|
1784
|
+
* decision. NOMENCLATURE §25 records the cull.
|
|
1785
|
+
*
|
|
1786
|
+
* ⚠ The TRANSCRIPT is the exception, because nobody else
|
|
1787
|
+
* owns it (B2, 2026-10-03): no shipped spec ranks a message
|
|
1788
|
+
* candidate, so the conversation's rows were never fitted
|
|
1789
|
+
* at all and a long session went out larger than the
|
|
1790
|
+
* window. The host's binding measures what it rendered and,
|
|
1791
|
+
* over the budget, leaves out the oldest lines in a chunk
|
|
1792
|
+
* at a cut point it holds across turns — not a param,
|
|
1793
|
+
* because there is nothing to choose: a prompt that does
|
|
1794
|
+
* not fit is trimmed by the backend instead, from the
|
|
1795
|
+
* front, every turn.
|
|
1796
|
+
*/
|
|
1797
|
+
/**
|
|
1798
|
+
* Which sections the prompt is built from, and in what order —
|
|
1799
|
+
* SillyTavern's *prompt list*, as a param on the node that
|
|
1800
|
+
* assembles the prompt (ruling 2026-09-10).
|
|
1801
|
+
*
|
|
1802
|
+
* A param and not a session setting, and not a table: it is the
|
|
1803
|
+
* same kind of fact as "which prompt does this step use", so it
|
|
1804
|
+
* belongs in the configuration a preset selects and it is an
|
|
1805
|
+
* administrator's. A preset carries it to every session started
|
|
1806
|
+
* from it for free, because a preset's configuration is already
|
|
1807
|
+
* what a run resolves against.
|
|
1808
|
+
*
|
|
1809
|
+
* ⚠ **The declared default means "leave the template alone".** It
|
|
1810
|
+
* is the shipped template's own order, so a configuration nobody
|
|
1811
|
+
* has touched stores nothing and renders the bytes it always did —
|
|
1812
|
+
* and a template somebody WROTE, whose sections sit in an order
|
|
1813
|
+
* they chose, is not silently reordered into this one. See
|
|
1814
|
+
* `isShippedPromptBlocks`.
|
|
1815
|
+
*/
|
|
1816
|
+
readonly blocks: import("@serene-pub/sdk").FieldDecl<import("@serene-pub/sdk").FieldType, readonly string[]>;
|
|
1817
|
+
};
|
|
1818
|
+
};
|
|
1819
|
+
/**
|
|
1820
|
+
* Which connection this prompt is being written FOR.
|
|
1821
|
+
*
|
|
1822
|
+
* Not compute, and this node calls nothing: the only thing read out
|
|
1823
|
+
* of it is `metadata.promptFormat` — whether the finished prompt is
|
|
1824
|
+
* one instruct-wrapped string or a role-tagged array, and which
|
|
1825
|
+
* wrapper. A wire format is a property of the endpoint, and until
|
|
1826
|
+
* this slot existed there was no way for the node that renders the
|
|
1827
|
+
* prompt to learn it. `renderers.ts` fell back to Vicuna on every
|
|
1828
|
+
* run, so a ChatML or Llama-2 connection was sent Vicuna markers and
|
|
1829
|
+
* nothing anywhere said so.
|
|
1830
|
+
*
|
|
1831
|
+
* ## Wire it to the SENDING node, always
|
|
1832
|
+
*
|
|
1833
|
+
* `slot.connectionOf('generate')`, exactly as `contextBudget` shares
|
|
1834
|
+
* the sampling reference, and for the same reason stated there: a
|
|
1835
|
+
* prompt wrapped for one endpoint and sent to another is wrong
|
|
1836
|
+
* silently. Sharing the reference makes the two impossible to point
|
|
1837
|
+
* apart rather than documenting that they must agree and hoping.
|
|
1838
|
+
*
|
|
1839
|
+
* ## No `requires`
|
|
1840
|
+
*
|
|
1841
|
+
* The sibling connection slots declare one because they are about to
|
|
1842
|
+
* CALL the connection and an unmet capability should refuse at bind.
|
|
1843
|
+
* This one reads a label. Declaring a capability it never exercises
|
|
1844
|
+
* would let an untested connection grey itself out of a picker for a
|
|
1845
|
+
* node that was never going to send it anything.
|
|
1846
|
+
*/
|
|
1847
|
+
readonly connection: {
|
|
1848
|
+
readonly kind: "connection";
|
|
1849
|
+
readonly shape: string;
|
|
1850
|
+
readonly description: "Which connection this prompt is formatted for. Point it at the step that sends the reply — a prompt wrapped for one endpoint and sent to another is wrong in a way nothing reports.";
|
|
1851
|
+
};
|
|
1852
|
+
} | undefined;
|
|
1853
|
+
}>;
|
|
1854
|
+
/**
|
|
1855
|
+
* What a context builder's `templateContext` carries, in the template type
|
|
1856
|
+
* language (typed templates P3, 2026-09-27) — so a template editor offers
|
|
1857
|
+
* `{{{characters}}}` with a type, and `templateScopeAt` puts these keys in
|
|
1858
|
+
* the scope of whatever template renders the builder's output.
|
|
1859
|
+
*
|
|
1860
|
+
* Written from what the builder RETURNS (the app's `buildTemplateContext`),
|
|
1861
|
+
* not from the legacy `TemplateContext` type, which also lists names only
|
|
1862
|
+
* Assemble supplies (`worldLore`, `history`, `currentDate`). The app holds
|
|
1863
|
+
* the two together at compile time: the builder's returned object
|
|
1864
|
+
* `satisfies VarValue<typeof TEMPLATE_CONTEXT_SCHEMA>`, so a key added on
|
|
1865
|
+
* one side and not the other fails `tsc`.
|
|
1866
|
+
*
|
|
1867
|
+
* Every rendered value is a **string** — each is laid out through its
|
|
1868
|
+
* variable's selected layout before it leaves the builder (a user's
|
|
1869
|
+
* `{{{characters}}}` would otherwise render `[object Object]`). `state` is
|
|
1870
|
+
* the one structure: `templateScopeAt` re-types it from the session genre's
|
|
1871
|
+
* attribute slots. `sessionMessages` and `postHistory` are placeholders
|
|
1872
|
+
* Assemble supersedes with its own.
|
|
1873
|
+
*
|
|
1874
|
+
* **Policy** (`portSchemas`): it describes the payload; no hash moves.
|
|
1875
|
+
* @experimental
|
|
1876
|
+
*/
|
|
1877
|
+
export declare const TEMPLATE_CONTEXT_SCHEMA: {
|
|
1878
|
+
readonly type: 'object';
|
|
1879
|
+
readonly fields: {
|
|
1880
|
+
readonly instructions: {
|
|
1881
|
+
readonly type: 'string';
|
|
1882
|
+
readonly description: 'The system prompt, resolved and laid out.';
|
|
1883
|
+
};
|
|
1884
|
+
readonly characters: {
|
|
1885
|
+
readonly type: 'string';
|
|
1886
|
+
readonly description: 'The cast’s character cards, laid out (JSON by default), trimmed to the session’s character detail.';
|
|
1887
|
+
};
|
|
1888
|
+
readonly personas: {
|
|
1889
|
+
readonly type: 'string';
|
|
1890
|
+
readonly description: 'The personas, laid out (JSON by default).';
|
|
1891
|
+
};
|
|
1892
|
+
readonly scenario: {
|
|
1893
|
+
readonly type: 'string';
|
|
1894
|
+
readonly description: 'The scenario, resolved and laid out.';
|
|
1895
|
+
};
|
|
1896
|
+
readonly characterNames: {
|
|
1897
|
+
readonly type: 'string';
|
|
1898
|
+
readonly description: '“A, B, and C” — every enabled character’s name (none at speaker-only detail).';
|
|
1899
|
+
};
|
|
1900
|
+
readonly personaNames: {
|
|
1901
|
+
readonly type: 'string';
|
|
1902
|
+
readonly description: '“A, B, and C” — every persona’s name.';
|
|
1903
|
+
};
|
|
1904
|
+
readonly exampleDialogue: {
|
|
1905
|
+
readonly type: 'string';
|
|
1906
|
+
readonly description: 'The speaker’s example dialogue.';
|
|
1907
|
+
};
|
|
1908
|
+
readonly postHistoryInstructions: {
|
|
1909
|
+
readonly type: 'string';
|
|
1910
|
+
readonly description: 'The post-history instructions, resolved.';
|
|
1911
|
+
};
|
|
1912
|
+
readonly relationshipsPerspectives: {
|
|
1913
|
+
readonly type: 'string';
|
|
1914
|
+
readonly description: 'How the speaker regards everyone.';
|
|
1915
|
+
};
|
|
1916
|
+
readonly relationshipsKnown: {
|
|
1917
|
+
readonly type: 'string';
|
|
1918
|
+
readonly description: 'How everyone regards the speaker.';
|
|
1919
|
+
};
|
|
1920
|
+
readonly char: {
|
|
1921
|
+
readonly type: 'string';
|
|
1922
|
+
readonly description: 'The speaking character’s name.';
|
|
1923
|
+
};
|
|
1924
|
+
readonly character: {
|
|
1925
|
+
readonly type: 'string';
|
|
1926
|
+
readonly description: 'The speaking character’s name.';
|
|
1927
|
+
};
|
|
1928
|
+
readonly user: {
|
|
1929
|
+
readonly type: 'string';
|
|
1930
|
+
readonly description: 'The persona’s name.';
|
|
1931
|
+
};
|
|
1932
|
+
readonly persona: {
|
|
1933
|
+
readonly type: 'string';
|
|
1934
|
+
readonly description: 'The persona’s name.';
|
|
1935
|
+
};
|
|
1936
|
+
readonly postHistory: {
|
|
1937
|
+
readonly type: 'object';
|
|
1938
|
+
readonly description: 'The post-history block, before Assemble decides where it goes.';
|
|
1939
|
+
readonly fields: {
|
|
1940
|
+
readonly targetIndex: {
|
|
1941
|
+
readonly type: 'number';
|
|
1942
|
+
};
|
|
1943
|
+
readonly instructions: {
|
|
1944
|
+
readonly type: 'string';
|
|
1945
|
+
readonly optional: true;
|
|
1946
|
+
};
|
|
1947
|
+
readonly charInstructions: {
|
|
1948
|
+
readonly type: 'string';
|
|
1949
|
+
readonly optional: true;
|
|
1950
|
+
};
|
|
1951
|
+
readonly exampleDialogue: {
|
|
1952
|
+
readonly type: 'string';
|
|
1953
|
+
readonly optional: true;
|
|
1954
|
+
};
|
|
1955
|
+
readonly hasContent: {
|
|
1956
|
+
readonly type: 'boolean';
|
|
1957
|
+
};
|
|
1958
|
+
readonly gatedBy: {
|
|
1959
|
+
readonly type: 'string';
|
|
1960
|
+
readonly optional: true;
|
|
1961
|
+
};
|
|
1962
|
+
};
|
|
1963
|
+
};
|
|
1964
|
+
/**
|
|
1965
|
+
* 🚧 The author's note before Assemble places it — present only when
|
|
1966
|
+
* the session's genre declares `authorsNote` and the spec wires the
|
|
1967
|
+
* genre fields into this node. `targetIndex` is a placeholder, as
|
|
1968
|
+
* `postHistory`'s is.
|
|
1969
|
+
*/
|
|
1970
|
+
readonly authorsNote: {
|
|
1971
|
+
readonly type: 'object';
|
|
1972
|
+
readonly optional: true;
|
|
1973
|
+
readonly description: 'The session’s author’s note, before Assemble decides where it goes.';
|
|
1974
|
+
readonly fields: {
|
|
1975
|
+
readonly targetIndex: {
|
|
1976
|
+
readonly type: 'number';
|
|
1977
|
+
};
|
|
1978
|
+
readonly text: {
|
|
1979
|
+
readonly type: 'string';
|
|
1980
|
+
readonly optional: true;
|
|
1981
|
+
};
|
|
1982
|
+
readonly role: {
|
|
1983
|
+
readonly type: 'string';
|
|
1984
|
+
};
|
|
1985
|
+
readonly depth: {
|
|
1986
|
+
readonly type: 'number';
|
|
1987
|
+
};
|
|
1988
|
+
readonly interval: {
|
|
1989
|
+
readonly type: 'number';
|
|
1990
|
+
};
|
|
1991
|
+
readonly replyCount: {
|
|
1992
|
+
readonly type: 'number';
|
|
1993
|
+
readonly optional: true;
|
|
1994
|
+
};
|
|
1995
|
+
readonly hasContent: {
|
|
1996
|
+
readonly type: 'boolean';
|
|
1997
|
+
};
|
|
1998
|
+
readonly gatedBy: {
|
|
1999
|
+
readonly type: 'string';
|
|
2000
|
+
readonly optional: true;
|
|
2001
|
+
};
|
|
2002
|
+
};
|
|
2003
|
+
};
|
|
2004
|
+
readonly sessionMessages: {
|
|
2005
|
+
readonly type: 'list';
|
|
2006
|
+
readonly description: 'Empty here; Assemble supplies the transcript.';
|
|
2007
|
+
};
|
|
2008
|
+
readonly state: {
|
|
2009
|
+
readonly type: 'object';
|
|
2010
|
+
readonly optional: true;
|
|
2011
|
+
readonly description: 'The session’s stats and states — state.world.<slot>, state.cast.<member>.<slot>, state.locations.<place>.<slot>.';
|
|
2012
|
+
readonly fields: {
|
|
2013
|
+
readonly world: {
|
|
2014
|
+
readonly type: 'record';
|
|
2015
|
+
};
|
|
2016
|
+
readonly cast: {
|
|
2017
|
+
readonly type: 'record';
|
|
2018
|
+
};
|
|
2019
|
+
readonly locations: {
|
|
2020
|
+
readonly type: 'record';
|
|
2021
|
+
readonly optional: true;
|
|
2022
|
+
};
|
|
2023
|
+
};
|
|
2024
|
+
};
|
|
2025
|
+
};
|
|
2026
|
+
};
|
|
2027
|
+
/**
|
|
2028
|
+
* The reply pipeline's context builder.
|
|
2029
|
+
*
|
|
2030
|
+
* ## Why the narrator has its own type
|
|
2031
|
+
*
|
|
2032
|
+
* Through 0.6.0 both pipelines pinned this one, and the panel is generated from
|
|
2033
|
+
* the registry row — so each advertised the other's controls. Reply prompts all
|
|
2034
|
+
* carried an empty `narratorName` box, and the narrator offered layout pickers
|
|
2035
|
+
* for `exampleDialogue` (which comes from the speaking character it does not
|
|
2036
|
+
* have) and the two relationship variables (which its spec deliberately never supplies).
|
|
2037
|
+
* Three controls wired to nothing, in both directions.
|
|
2038
|
+
*
|
|
2039
|
+
* A type is the unit that declares a configurable surface — it is how a plugin
|
|
2040
|
+
* declares one, and `RegistryEntry.slots` carries the declaration precisely so
|
|
2041
|
+
* core can render a form without executing the plugin that owns it (12 §2, F6).
|
|
2042
|
+
* Narrowing per-spec instead would have meant the row said one thing and the
|
|
2043
|
+
* running pipeline another, which is the defect widening that column fixed.
|
|
2044
|
+
*
|
|
2045
|
+
* The two share `contextPorts` and `sharedRenders` rather than restating them,
|
|
2046
|
+
* so the halves that must not drift cannot.
|
|
2047
|
+
* @public
|
|
2048
|
+
*/
|
|
2049
|
+
export declare const buildTemplateContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2050
|
+
readonly main: string;
|
|
2051
|
+
readonly templateContext: string;
|
|
2052
|
+
/**
|
|
2053
|
+
* The name on the trailing assistant line.
|
|
2054
|
+
*
|
|
2055
|
+
* Its own port rather than a field inside the context, because
|
|
2056
|
+
* nothing renders `{{seedName}}` — it is not a template variable.
|
|
2057
|
+
* It is what the message processor writes on the line the model
|
|
2058
|
+
* continues from, and in narrator mode it is the one name that
|
|
2059
|
+
* must *not* be the joined cast list: seeding "Alice and Cara:"
|
|
2060
|
+
* teaches the model to write joint dialogue instead of narrating.
|
|
2061
|
+
*/
|
|
2062
|
+
readonly seedName: string;
|
|
2063
|
+
}, {
|
|
2064
|
+
cast: string;
|
|
2065
|
+
currentCharacterId: string;
|
|
2066
|
+
/**
|
|
2067
|
+
* The narrative graph, as the two claims it really is — how the
|
|
2068
|
+
* speaker regards everyone, and how everyone regards the
|
|
2069
|
+
* speaker (D-I).
|
|
2070
|
+
*
|
|
2071
|
+
* ⚠ **Supplied by `respond` since the split, declared here
|
|
2072
|
+
* only now.** The spec wires both off
|
|
2073
|
+
* `core:query/relationships-perspectives@1` and
|
|
2074
|
+
* `core:query/relationships-known@1`, the two `renders` above
|
|
2075
|
+
* name the variables they feed, and the builder reads both by
|
|
2076
|
+
* these exact names — so every part of the round trip was
|
|
2077
|
+
* written down except the ports themselves.
|
|
2078
|
+
*
|
|
2079
|
+
* `json`, matching what those queries publish and for the
|
|
2080
|
+
* reason stated at them: the structure travels so a variable
|
|
2081
|
+
* layout can render it, rather than a blob nothing can
|
|
2082
|
+
* restyle.
|
|
2083
|
+
*
|
|
2084
|
+
* ⚠ Declared on THIS type alone rather than in `contextPorts`,
|
|
2085
|
+
* which the narrator builder shares. Its own docblock says the
|
|
2086
|
+
* narrate spec never supplies these because graph context
|
|
2087
|
+
* needs a speaker's perspective and a narrator has none — so
|
|
2088
|
+
* widening the shared map would give it two ports it must
|
|
2089
|
+
* leave empty forever, and move its hash to say so (S3).
|
|
2090
|
+
*/
|
|
2091
|
+
relationshipsPerspectives: string;
|
|
2092
|
+
relationshipsKnown: string;
|
|
2093
|
+
/**
|
|
2094
|
+
* Who is speaking, when the speaker is not in the cast.
|
|
2095
|
+
*
|
|
2096
|
+
* ⚠ **Neither is wired by any spec, and both are supplied on
|
|
2097
|
+
* every side-character turn.** `core:task/build-side-character-
|
|
2098
|
+
* context@1` is not a separate implementation — the host's
|
|
2099
|
+
* binding for it unwraps its `sideCharacter` in-port and calls THIS
|
|
2100
|
+
* type's handler with the name and the card spread onto the
|
|
2101
|
+
* input, because `resolveContextInput` owns the card rules and
|
|
2102
|
+
* a side character's card and a cast member's must compile
|
|
2103
|
+
* through one function.
|
|
2104
|
+
*
|
|
2105
|
+
* So the supplier is the host rather than a document, and that
|
|
2106
|
+
* is exactly why declaring them matters: it is the only record
|
|
2107
|
+
* that this type's input surface is wider than its edges. An
|
|
2108
|
+
* undeclared key reaching a handler is indistinguishable from a
|
|
2109
|
+
* typo until someone reads both files at once.
|
|
2110
|
+
*
|
|
2111
|
+
* `speakerName` is `text` — it is the name on the seed line and
|
|
2112
|
+
* what `{{char}}` renders. `speakerCharacter` is `json`: the
|
|
2113
|
+
* card, or `null` for a free-form name, which is a normal turn
|
|
2114
|
+
* rather than a degraded one.
|
|
2115
|
+
*/
|
|
2116
|
+
speakerName: string;
|
|
2117
|
+
speakerCharacter: string;
|
|
2118
|
+
/**
|
|
2119
|
+
* Who is speaking, as a participant reference (R-18 (3); U5g,
|
|
2120
|
+
* 2026-09-16) — the turn strategy's `speaker`. Read for one
|
|
2121
|
+
* thing: an **envoy** (`envoy:<slug>`) has no character row, so
|
|
2122
|
+
* its card — name and description, off the genre's declaration
|
|
2123
|
+
* the cast read carries — is compiled here where a cast
|
|
2124
|
+
* member's would be, through the same `speakerName` /
|
|
2125
|
+
* `speakerCharacter` seam a side character uses. A `character:`
|
|
2126
|
+
* reference changes nothing: `currentCharacterId` already says
|
|
2127
|
+
* it. Optional; unwired on the specs that seat no envoy.
|
|
2128
|
+
*/
|
|
2129
|
+
speaker: string;
|
|
2130
|
+
/**
|
|
2131
|
+
* The session's resolved stats and states, as
|
|
2132
|
+
* `core:query/session-state@1` publishes them:
|
|
2133
|
+
* `{ world, cast, locations, slots, who, version }`, already
|
|
2134
|
+
* resolved down the session → lorebook → card → default chain
|
|
2135
|
+
* (a location's: this run's → the entry's → default; 🚧 phase 4).
|
|
2136
|
+
*
|
|
2137
|
+
* A template reads `state.world.weather` and
|
|
2138
|
+
* `state.cast.verity.hp` — the **resolved** value and nothing
|
|
2139
|
+
* below it. Which layer a number came from is a question for
|
|
2140
|
+
* the Cast member page, not for a prompt.
|
|
2141
|
+
*
|
|
2142
|
+
* ⚠ Declared on THIS type alone rather than in `contextPorts`,
|
|
2143
|
+
* following `relationshipsPerspectives` above and for the same
|
|
2144
|
+
* reason: widening the shared map moves the narrator's hash to
|
|
2145
|
+
* declare a port no shipped spec fills. Unwired — which is
|
|
2146
|
+
* every shipped spec today — the key is absent and the context
|
|
2147
|
+
* has no `state`, which is what a chat session should have.
|
|
2148
|
+
*/
|
|
2149
|
+
state: string;
|
|
2150
|
+
/**
|
|
2151
|
+
* What the person typed with the press, for an action that
|
|
2152
|
+
* reads its composer text as **direction** (lair pass B17,
|
|
2153
|
+
* 2026-09-27): the Lair's Trigger trap and Reveal, and
|
|
2154
|
+
* Whodunit's Search — what the detective is looking for (genre
|
|
2155
|
+
* uplift C2, 2026-09-29). Rendered as
|
|
2156
|
+
* `{{turnDirection}}` — the same name, and the same meaning,
|
|
2157
|
+
* `build-scene-context@1` gives the Lair's reply (B11). Absent
|
|
2158
|
+
* when blank, so a prompt writes `{{#if turnDirection}}…{{/if}}`
|
|
2159
|
+
* and a press with nothing typed leaves it to the prompt.
|
|
2160
|
+
* Declared here rather than in `contextPorts`, like `state`
|
|
2161
|
+
* above; the narrator and side-character builders declare
|
|
2162
|
+
* their own (C2). Unwired on every spec whose composer text is
|
|
2163
|
+
* a line somebody said.
|
|
2164
|
+
*/
|
|
2165
|
+
turnDirection: string;
|
|
2166
|
+
/**
|
|
2167
|
+
* The places the lorebook holds, for an envoy that talks about
|
|
2168
|
+
* the world from outside it (lair re-plan R6, 2026-09-28): the
|
|
2169
|
+
* Lair's Castellan in the Sanctum. A
|
|
2170
|
+
* `core:query/lorebook-entries@1` listing, rendered exactly as
|
|
2171
|
+
* the planner's and the scene's port of this name is —
|
|
2172
|
+
* `{{knownLocations}}` (their names) and `{{locationEntry}}`
|
|
2173
|
+
* (the room the world's `location` names). Declared on THIS
|
|
2174
|
+
* type alone, like `state`; unwired on every other spec.
|
|
2175
|
+
*/
|
|
2176
|
+
locationEntries: string;
|
|
2177
|
+
/**
|
|
2178
|
+
* The story's newest rows, for a speaker who talks ABOUT the
|
|
2179
|
+
* story from another channel (lair re-plan R6): the Castellan
|
|
2180
|
+
* in the Sanctum reads `main`'s last few rows. Transcript rows
|
|
2181
|
+
* (a `session-history@1` read), rendered as prose — one
|
|
2182
|
+
* `Name: line` per row, named as the transcript names them, no
|
|
2183
|
+
* JSON blocks — into `{{recentStory}}`, so they are background
|
|
2184
|
+
* in the instructions and never turns the model continues.
|
|
2185
|
+
* Absent when unwired or empty.
|
|
2186
|
+
*/
|
|
2187
|
+
recentStory: string;
|
|
2188
|
+
/**
|
|
2189
|
+
* The session's genre fields, by their own names (lair re-plan
|
|
2190
|
+
* R13, 2026-09-28): `{{sanctumSteers}}` for the Castellan in
|
|
2191
|
+
* the Sanctum, whose instructions say whether its talk shapes
|
|
2192
|
+
* the next turn. The planner's and the scene's `fields`, on the
|
|
2193
|
+
* same terms. Declared on THIS type alone, like `state`;
|
|
2194
|
+
* unwired on every other spec.
|
|
2195
|
+
*/
|
|
2196
|
+
fields: string;
|
|
2197
|
+
/**
|
|
2198
|
+
* The speaker's own running notes (lair re-plan R13, owner
|
|
2199
|
+
* 2026-09-28): the Castellan's **scratchpad**, the Lair's annex
|
|
2200
|
+
* field `castellan-scratchpad`, read for it alone
|
|
2201
|
+
* (`session-annex@1`'s AI view, with its own reference as the
|
|
2202
|
+
* speaker). Rendered as `{{scratchpad}}`; absent when unwired
|
|
2203
|
+
* or blank. Declared on THIS type alone, like `state`.
|
|
2204
|
+
*/
|
|
2205
|
+
scratchpad: string;
|
|
2206
|
+
}, "core:task/build-template-context@1"> & {
|
|
2207
|
+
kind: 'task';
|
|
2208
|
+
slots?: {
|
|
2209
|
+
readonly prompts: {
|
|
2210
|
+
readonly kind: "prompts";
|
|
2211
|
+
readonly quick: true;
|
|
2212
|
+
readonly facet: "prompts";
|
|
2213
|
+
readonly description: "The written instructions this pipeline sends the model — pick a prompt, or duplicate one and make it yours.";
|
|
2214
|
+
readonly fields: {
|
|
2215
|
+
readonly systemPrompt: {
|
|
2216
|
+
readonly type: "text";
|
|
2217
|
+
};
|
|
2218
|
+
readonly postHistoryInstructions: {
|
|
2219
|
+
readonly type: "text";
|
|
2220
|
+
};
|
|
2221
|
+
};
|
|
2222
|
+
};
|
|
2223
|
+
readonly variables: {
|
|
2224
|
+
readonly kind: "variables";
|
|
2225
|
+
readonly facet: "variables";
|
|
2226
|
+
readonly description: "How each part of the prompt is laid out — JSON, prose, or whatever you write. Duplicate one to change it.";
|
|
2227
|
+
readonly renders: {
|
|
2228
|
+
readonly instructions: 'core:var/instructions@1';
|
|
2229
|
+
readonly characters: 'core:var/characters@1';
|
|
2230
|
+
readonly personas: 'core:var/personas@1';
|
|
2231
|
+
readonly scenario: 'core:var/scenario@1';
|
|
2232
|
+
readonly postHistoryInstructions: 'core:var/post-history-instructions@1';
|
|
2233
|
+
readonly characterNames: 'core:var/character-names@1';
|
|
2234
|
+
readonly personaNames: 'core:var/persona-names@1';
|
|
2235
|
+
/** From the speaking character's card. */
|
|
2236
|
+
readonly exampleDialogue: "core:var/example-dialogue@1";
|
|
2237
|
+
/**
|
|
2238
|
+
* The narrative graph, as two variables rather than one.
|
|
2239
|
+
*
|
|
2240
|
+
* They were `speakerRelationships` — a single block holding
|
|
2241
|
+
* both what the speaker thinks of everyone and what everyone
|
|
2242
|
+
* thinks of the speaker. Opposite claims under one heading,
|
|
2243
|
+
* which a model reads as one list, and one layout, one
|
|
2244
|
+
* priority and one on/off switch for both.
|
|
2245
|
+
*/
|
|
2246
|
+
readonly relationshipsPerspectives: "core:var/relationships-perspectives@1";
|
|
2247
|
+
readonly relationshipsKnown: "core:var/relationships-known@1";
|
|
2248
|
+
};
|
|
2249
|
+
};
|
|
2250
|
+
/**
|
|
2251
|
+
* The pre-assemble context hook (18 §4a): user chains over the
|
|
2252
|
+
* finished template context — conditional style guides, seeded
|
|
2253
|
+
* event tables — after this node resolves it and before anything
|
|
2254
|
+
* renders it.
|
|
2255
|
+
*
|
|
2256
|
+
* `messages/inject` lives here too — **not** on the message
|
|
2257
|
+
* processor — because of the ruling of 2026-08-23: injections are
|
|
2258
|
+
* template-context *data* (`context.injections`, resolved to
|
|
2259
|
+
* `injectionsByIndex` beside `postHistory.targetIndex`), rendered
|
|
2260
|
+
* by the template's own message loop. Splicing them into the list
|
|
2261
|
+
* behind the template's back would be the §20 defect again, one
|
|
2262
|
+
* layer down: a position the template cannot express, an author
|
|
2263
|
+
* cannot see, and a corpus cannot check.
|
|
2264
|
+
*/
|
|
2265
|
+
readonly scripts: {
|
|
2266
|
+
readonly kind: "scripts";
|
|
2267
|
+
readonly accepts: ["core:script:context/transform@1", "core:script:messages/inject@1"];
|
|
2268
|
+
readonly port: "main";
|
|
2269
|
+
readonly phase: "after";
|
|
2270
|
+
readonly description: "Scripts over what the prompt template renders — edit the instructions, roll an occasional event, or inject a reminder at a depth in the conversation.";
|
|
2271
|
+
};
|
|
2272
|
+
} | undefined;
|
|
2273
|
+
}>;
|
|
2274
|
+
/**
|
|
2275
|
+
* The narrator pipeline's context builder.
|
|
2276
|
+
*
|
|
2277
|
+
* Same implementation, same ports, different surface — see
|
|
2278
|
+
* `buildTemplateContext` for why that makes it a different type.
|
|
2279
|
+
*
|
|
2280
|
+
* What it drops: `exampleDialogue`, which `characterExampleDialogue` reads off
|
|
2281
|
+
* the speaking character and so is always empty here, and both relationship
|
|
2282
|
+
* variables, which the narrate spec never supplies because graph context needs
|
|
2283
|
+
* a speaker's perspective and a narrator has none.
|
|
2284
|
+
*
|
|
2285
|
+
* What it adds: `narratorName`. Load-bearing rather than cosmetic — it is the
|
|
2286
|
+
* name on the seed line the model continues from, and `{{narratorName}}` in the
|
|
2287
|
+
* narrator's own prompt text.
|
|
2288
|
+
*
|
|
2289
|
+
* No `declaresRandomness`: the only random choice this node ever made was which
|
|
2290
|
+
* example dialogue to use, and it has none to choose from.
|
|
2291
|
+
* @public
|
|
2292
|
+
*/
|
|
2293
|
+
export declare const buildNarratorContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2294
|
+
readonly main: string;
|
|
2295
|
+
readonly templateContext: string;
|
|
2296
|
+
/**
|
|
2297
|
+
* The name on the trailing assistant line.
|
|
2298
|
+
*
|
|
2299
|
+
* Its own port rather than a field inside the context, because
|
|
2300
|
+
* nothing renders `{{seedName}}` — it is not a template variable.
|
|
2301
|
+
* It is what the message processor writes on the line the model
|
|
2302
|
+
* continues from, and in narrator mode it is the one name that
|
|
2303
|
+
* must *not* be the joined cast list: seeding "Alice and Cara:"
|
|
2304
|
+
* teaches the model to write joint dialogue instead of narrating.
|
|
2305
|
+
*/
|
|
2306
|
+
readonly seedName: string;
|
|
2307
|
+
}, {
|
|
2308
|
+
cast: string;
|
|
2309
|
+
currentCharacterId: string;
|
|
2310
|
+
/**
|
|
2311
|
+
* What the person asked this narration to do (genre uplift
|
|
2312
|
+
* C2, 2026-09-29): the narrator modal's text or `/narrate
|
|
2313
|
+
* <text>` — the turn's triggering text, `$.input.text`.
|
|
2314
|
+
* Rendered as `{{turnDirection}}`, the name and the meaning
|
|
2315
|
+
* `build-template-context@1` and `build-scene-context@1` give
|
|
2316
|
+
* it (B11); absent when blank, so a row writes
|
|
2317
|
+
* `{{#if turnDirection}}…{{/if}}` and an undirected narration
|
|
2318
|
+
* renders exactly what it did before.
|
|
2319
|
+
*
|
|
2320
|
+
* ⚠ Declared because the placeholder's `instructions` is not
|
|
2321
|
+
* a prompt: it is stored beside the row and shown with it. For
|
|
2322
|
+
* as long as that was the direction's only reader, 0.5.3's
|
|
2323
|
+
* _Additional focus for this response_ reached no model.
|
|
2324
|
+
*/
|
|
2325
|
+
turnDirection: string;
|
|
2326
|
+
}, "core:task/build-narrator-context@1"> & {
|
|
2327
|
+
kind: 'task';
|
|
2328
|
+
slots?: {
|
|
2329
|
+
readonly prompts: {
|
|
2330
|
+
readonly kind: "prompts";
|
|
2331
|
+
readonly quick: true;
|
|
2332
|
+
readonly facet: "prompts";
|
|
2333
|
+
readonly description: "The written instructions this pipeline sends the model — pick a prompt, or duplicate one and make it yours.";
|
|
2334
|
+
readonly fields: {
|
|
2335
|
+
readonly systemPrompt: {
|
|
2336
|
+
readonly type: "text";
|
|
2337
|
+
};
|
|
2338
|
+
readonly postHistoryInstructions: {
|
|
2339
|
+
readonly type: "text";
|
|
2340
|
+
};
|
|
2341
|
+
readonly narratorName: {
|
|
2342
|
+
readonly type: "text";
|
|
2343
|
+
};
|
|
2344
|
+
};
|
|
2345
|
+
};
|
|
2346
|
+
readonly variables: {
|
|
2347
|
+
readonly kind: "variables";
|
|
2348
|
+
readonly facet: "variables";
|
|
2349
|
+
readonly description: "How each part of the prompt is laid out — JSON, prose, or whatever you write. Duplicate one to change it.";
|
|
2350
|
+
readonly renders: {
|
|
2351
|
+
readonly instructions: 'core:var/instructions@1';
|
|
2352
|
+
readonly characters: 'core:var/characters@1';
|
|
2353
|
+
readonly personas: 'core:var/personas@1';
|
|
2354
|
+
readonly scenario: 'core:var/scenario@1';
|
|
2355
|
+
readonly postHistoryInstructions: 'core:var/post-history-instructions@1';
|
|
2356
|
+
readonly characterNames: 'core:var/character-names@1';
|
|
2357
|
+
readonly personaNames: 'core:var/persona-names@1';
|
|
2358
|
+
};
|
|
2359
|
+
};
|
|
2360
|
+
/** The same hook as `build-template-context` — see it for the terms. */
|
|
2361
|
+
readonly scripts: {
|
|
2362
|
+
readonly kind: "scripts";
|
|
2363
|
+
readonly accepts: ["core:script:context/transform@1", "core:script:messages/inject@1"];
|
|
2364
|
+
readonly port: "main";
|
|
2365
|
+
readonly phase: "after";
|
|
2366
|
+
readonly description: "Scripts over what the prompt template renders — edit the instructions, roll an occasional event, or inject a reminder at a depth in the conversation.";
|
|
2367
|
+
};
|
|
2368
|
+
} | undefined;
|
|
2369
|
+
}>;
|
|
2370
|
+
/**
|
|
2371
|
+
* The side-character pipeline's context builder (ruling 2026-09-07).
|
|
2372
|
+
*
|
|
2373
|
+
* Same implementation and the same ports as the other two, plus one in-port —
|
|
2374
|
+
* `sideCharacter` — and that port is the whole reason it is a third type rather
|
|
2375
|
+
* than a flag.
|
|
2376
|
+
*
|
|
2377
|
+
* ## Why the name is a port and not a prompt field
|
|
2378
|
+
*
|
|
2379
|
+
* `build-narrator-context@1` takes `narratorName` in its **prompts** slot,
|
|
2380
|
+
* which is correct there: the narrator's name is a setting, chosen once, the
|
|
2381
|
+
* same on every turn. A side character's name is *data from the trigger* — it
|
|
2382
|
+
* differs per turn and a person may type it in the modal — so putting it in a
|
|
2383
|
+
* prompts slot would mean editing a prompt config to speak as somebody else,
|
|
2384
|
+
* and every turn would render with whichever name was stored last.
|
|
2385
|
+
*
|
|
2386
|
+
* ## What it drops, and what it keeps
|
|
2387
|
+
*
|
|
2388
|
+
* Drops `exampleDialogue`, for the narrator's reason: it is read off the
|
|
2389
|
+
* speaking *cast member*, and a side character is not one. Drops both
|
|
2390
|
+
* relationship variables, because graph context is built from a cast member's
|
|
2391
|
+
* node and this speaker has none. Keeps every shared render, so the cards, the
|
|
2392
|
+
* scenario and the two name lists are laid out exactly as they are elsewhere.
|
|
2393
|
+
*
|
|
2394
|
+
* ⚠ It declares **no** `narratorName` prompt field. A side-character prompt
|
|
2395
|
+
* that wrote `{{narratorName}}` would render the narrator's configured name
|
|
2396
|
+
* into a turn the narrator is not speaking — the same "control wired to
|
|
2397
|
+
* nothing, in both directions" the two context builders were split to end.
|
|
2398
|
+
* `{{char}}` is the speaker here, exactly as it is in a reply.
|
|
2399
|
+
*
|
|
2400
|
+
* ⚠ And it does **not** inherit `contextPorts.in.currentCharacterId`, which the
|
|
2401
|
+
* other two carry. Not an oversight: character-lore visibility is decided by
|
|
2402
|
+
* the host read, which keys on the run's SCOPE, so a speaker id arriving here
|
|
2403
|
+
* could change whose voice the prompt is written in without changing whose lore
|
|
2404
|
+
* it was given — a prompt in one person's voice over another's private
|
|
2405
|
+
* knowledge. The port would be a control that half-works, which is the exact
|
|
2406
|
+
* class this whole split exists to remove. `sideCharacter` carries the name and
|
|
2407
|
+
* the card; the id stays where the host can act on it.
|
|
2408
|
+
*
|
|
2409
|
+
* ⚠ **The OUT-port `speaker` is the other half of that sentence** (added
|
|
2410
|
+
* 2026-09-17, W1). The half-working control was a speaker id that changed the
|
|
2411
|
+
* prompt's voice and not the lore; the repair is not an in-port but a lane
|
|
2412
|
+
* inside the same clause reading the answer this node already computed —
|
|
2413
|
+
* `core:query/character-lore@1` takes `speaker`, so the voice and its private
|
|
2414
|
+
* knowledge move together or not at all.
|
|
2415
|
+
* @experimental
|
|
2416
|
+
*/
|
|
2417
|
+
export declare const buildSideCharacterContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2418
|
+
main: string;
|
|
2419
|
+
templateContext: string;
|
|
2420
|
+
seedName: string;
|
|
2421
|
+
/**
|
|
2422
|
+
* Who this voice is, as a **participant reference** — the row
|
|
2423
|
+
* the fact named (`characterId` or `ref`), else
|
|
2424
|
+
* `character:<id>` for a name the cast holds, else null for a
|
|
2425
|
+
* free-form one. Additive, 2026-09-17 (W1). A lore read wired
|
|
2426
|
+
* to it takes null as unwired, so the run's scope decides for
|
|
2427
|
+
* a free-form voice.
|
|
2428
|
+
*
|
|
2429
|
+
* The resolution already happened: this node derives the
|
|
2430
|
+
* speaking character from the `sideCharacter` fact so the card,
|
|
2431
|
+
* `{{char}}` and the seed line agree. Publishing it is what lets
|
|
2432
|
+
* a lore lane INSIDE the same `each` be handed the same answer
|
|
2433
|
+
* — `speaker: $.voices.item.context.speaker` on
|
|
2434
|
+
* `core:query/character-lore@1` — rather than a second
|
|
2435
|
+
* name-to-row match somewhere downstream, which is how the
|
|
2436
|
+
* prompt's speaker and the lore's speaker come to disagree.
|
|
2437
|
+
*
|
|
2438
|
+
* ⚠ It is published, never taken: there is still no
|
|
2439
|
+
* `currentCharacterId` IN-port here, for the reason the header
|
|
2440
|
+
* gives. What changed is that the id the node computed is now
|
|
2441
|
+
* readable, not that a spec may set it.
|
|
2442
|
+
*/
|
|
2443
|
+
speaker: string;
|
|
2444
|
+
}, {
|
|
2445
|
+
cast: string;
|
|
2446
|
+
/**
|
|
2447
|
+
* `{ name, characterId, ref, known, character }`, from the
|
|
2448
|
+
* trigger's first step. `name` is what the seed line carries and
|
|
2449
|
+
* what `{{char}}` renders; `character` is the card, absent for a
|
|
2450
|
+
* free-form name, which is a normal turn rather than a degraded
|
|
2451
|
+
* one — the builder falls back to the name it was given,
|
|
2452
|
+
* because a typed name is all there is.
|
|
2453
|
+
*
|
|
2454
|
+
* `characterId` (a row id) or `ref` (a participant reference,
|
|
2455
|
+
* `character:<id>` — what a pressed option carries, plan A28
|
|
2456
|
+
* review) names the speaker BY ROW, and then the row is who
|
|
2457
|
+
* speaks: the name is a label, never a second lookup, so two
|
|
2458
|
+
* people sharing a name stay two people and a row the cast does
|
|
2459
|
+
* not seat is still the person it names. A fact with neither
|
|
2460
|
+
* resolves by name against the cast.
|
|
2461
|
+
*
|
|
2462
|
+
* Was `speaker` until 2026-09-16 — see the inlet's port of
|
|
2463
|
+
* this name for why the fact moved off that word.
|
|
2464
|
+
*/
|
|
2465
|
+
sideCharacter: string;
|
|
2466
|
+
/**
|
|
2467
|
+
* Where this turn is happening, as the world state says it.
|
|
2468
|
+
*
|
|
2469
|
+
* Declared late, and for a defect rather than for symmetry: a
|
|
2470
|
+
* voice built with no place in front of it answered from
|
|
2471
|
+
* whatever the transcript suggested and moved the scene to a
|
|
2472
|
+
* harbour the plan had never mentioned. Unwired on every
|
|
2473
|
+
* pipeline that had this node before it, so those keep the
|
|
2474
|
+
* context they already had.
|
|
2475
|
+
*/
|
|
2476
|
+
state: string;
|
|
2477
|
+
/**
|
|
2478
|
+
* The planner's document, for the one fact the state cannot
|
|
2479
|
+
* supply on a first turn: where the scene is, before anything
|
|
2480
|
+
* has written a location down.
|
|
2481
|
+
*/
|
|
2482
|
+
plan: string;
|
|
2483
|
+
/**
|
|
2484
|
+
* The rooms, listed (`core:query/lorebook-entries@1`), as the
|
|
2485
|
+
* planner and the scene get them (lair pass R8, 2026-09-28):
|
|
2486
|
+
* `{{knownLocations}}` and the one the party stand in as
|
|
2487
|
+
* `{{locationEntry}}`, so a voice can name the room it is in
|
|
2488
|
+
* now that nobody narrates it first. Unwired, neither renders.
|
|
2489
|
+
*/
|
|
2490
|
+
locationEntries: string;
|
|
2491
|
+
/**
|
|
2492
|
+
* A place described only in prose, as `{{locationPassage}}`
|
|
2493
|
+
* (lair pass R9, 2026-09-28): the paragraph
|
|
2494
|
+
* `core:task/undescribed-name@1` found describing the room the
|
|
2495
|
+
* party are about to walk into (its `passage`), when no entry
|
|
2496
|
+
* describes it — that room's text for this turn. Blank or
|
|
2497
|
+
* unwired, it does not render.
|
|
2498
|
+
*/
|
|
2499
|
+
locationPassage: string;
|
|
2500
|
+
/**
|
|
2501
|
+
* What the person asked this side character's turn to do
|
|
2502
|
+
* (genre uplift C2, 2026-09-29) — the narrator modal's text,
|
|
2503
|
+
* which feeds both of its halves. `{{turnDirection}}`, on the
|
|
2504
|
+
* terms `build-narrator-context@1` states; wired by
|
|
2505
|
+
* `core:spec/chat-side-character` alone, so a genre's voices
|
|
2506
|
+
* (whose composer text is a line somebody said) render
|
|
2507
|
+
* nothing new.
|
|
2508
|
+
*/
|
|
2509
|
+
turnDirection: string;
|
|
2510
|
+
}, "core:task/build-side-character-context@1"> & {
|
|
2511
|
+
kind: 'task';
|
|
2512
|
+
slots?: {
|
|
2513
|
+
readonly prompts: {
|
|
2514
|
+
readonly kind: "prompts";
|
|
2515
|
+
readonly quick: true;
|
|
2516
|
+
readonly facet: "prompts";
|
|
2517
|
+
readonly description: "The written instructions this pipeline sends the model — pick a prompt, or duplicate one and make it yours.";
|
|
2518
|
+
readonly fields: {
|
|
2519
|
+
readonly systemPrompt: {
|
|
2520
|
+
readonly type: "text";
|
|
2521
|
+
};
|
|
2522
|
+
readonly postHistoryInstructions: {
|
|
2523
|
+
readonly type: "text";
|
|
2524
|
+
};
|
|
2525
|
+
};
|
|
2526
|
+
};
|
|
2527
|
+
readonly variables: {
|
|
2528
|
+
readonly kind: "variables";
|
|
2529
|
+
readonly facet: "variables";
|
|
2530
|
+
readonly description: "How each part of the prompt is laid out — JSON, prose, or whatever you write. Duplicate one to change it.";
|
|
2531
|
+
readonly renders: {
|
|
2532
|
+
readonly instructions: 'core:var/instructions@1';
|
|
2533
|
+
readonly characters: 'core:var/characters@1';
|
|
2534
|
+
readonly personas: 'core:var/personas@1';
|
|
2535
|
+
readonly scenario: 'core:var/scenario@1';
|
|
2536
|
+
readonly postHistoryInstructions: 'core:var/post-history-instructions@1';
|
|
2537
|
+
readonly characterNames: 'core:var/character-names@1';
|
|
2538
|
+
readonly personaNames: 'core:var/persona-names@1';
|
|
2539
|
+
};
|
|
2540
|
+
};
|
|
2541
|
+
/** The same hook as the other two builders — see them for the terms. */
|
|
2542
|
+
readonly scripts: {
|
|
2543
|
+
readonly kind: "scripts";
|
|
2544
|
+
readonly accepts: ["core:script:context/transform@1", "core:script:messages/inject@1"];
|
|
2545
|
+
readonly port: "main";
|
|
2546
|
+
readonly phase: "after";
|
|
2547
|
+
readonly description: "Scripts over what the prompt template renders — edit the instructions, roll an occasional event, or inject a reminder at a depth in the conversation.";
|
|
2548
|
+
};
|
|
2549
|
+
} | undefined;
|
|
2550
|
+
}>;
|
|
2551
|
+
/**
|
|
2552
|
+
* The planner's context: the cast, the state, and nothing about a speaker.
|
|
2553
|
+
*
|
|
2554
|
+
* A planner decides who speaks; it is not itself anybody, so
|
|
2555
|
+
* `currentCharacterId` is deliberately absent rather than declared and left
|
|
2556
|
+
* empty. What it publishes is what every other builder publishes, so the
|
|
2557
|
+
* planner's prompt is assembled by the same node as everyone else's.
|
|
2558
|
+
* @experimental
|
|
2559
|
+
*/
|
|
2560
|
+
export declare const buildPlannerContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2561
|
+
readonly main: string;
|
|
2562
|
+
readonly templateContext: string;
|
|
2563
|
+
/**
|
|
2564
|
+
* The name on the trailing assistant line.
|
|
2565
|
+
*
|
|
2566
|
+
* Its own port rather than a field inside the context, because
|
|
2567
|
+
* nothing renders `{{seedName}}` — it is not a template variable.
|
|
2568
|
+
* It is what the message processor writes on the line the model
|
|
2569
|
+
* continues from, and in narrator mode it is the one name that
|
|
2570
|
+
* must *not* be the joined cast list: seeding "Alice and Cara:"
|
|
2571
|
+
* teaches the model to write joint dialogue instead of narrating.
|
|
2572
|
+
*/
|
|
2573
|
+
readonly seedName: string;
|
|
2574
|
+
}, {
|
|
2575
|
+
cast: string;
|
|
2576
|
+
state: string;
|
|
2577
|
+
/**
|
|
2578
|
+
* The session's own genre fields, by key — `tone`,
|
|
2579
|
+
* `difficulty` and whatever else the genre declared.
|
|
2580
|
+
*
|
|
2581
|
+
* On the template context under their own names, so an
|
|
2582
|
+
* authored prompt writes `{{tone}}` the way it writes
|
|
2583
|
+
* `{{char}}`. That is the whole round trip the genre's `fields`
|
|
2584
|
+
* declaration promises: declared on the genre, edited in
|
|
2585
|
+
* session settings, stored on the row, published by the input
|
|
2586
|
+
* node, and read here by the agent whose wording depends on
|
|
2587
|
+
* them. Without this port the last step was missing and a
|
|
2588
|
+
* prompt naming `{{tone}}` rendered a blank.
|
|
2589
|
+
*/
|
|
2590
|
+
fields: string;
|
|
2591
|
+
/**
|
|
2592
|
+
* What the person just sent, when the genre reads it as
|
|
2593
|
+
* **direction** rather than as a line somebody said (lair pass
|
|
2594
|
+
* B11, 2026-09-27) — the Lair's composer. On the template
|
|
2595
|
+
* context and in the prompt as `{{turnDirection}}`; empty or
|
|
2596
|
+
* absent on a turn nobody directed (a Continue), so a prompt
|
|
2597
|
+
* writes `{{#if turnDirection}}…{{/if}}`. A genre whose composer
|
|
2598
|
+
* text is a participant's line leaves it unwired: that line is
|
|
2599
|
+
* already in the transcript. *Turn* direction, never bare
|
|
2600
|
+
* `direction`: that word is the Lair's standing-note state slot
|
|
2601
|
+
* (`core:slot/direction@1`), a different fact (R1, renamed
|
|
2602
|
+
* 2026-09-27).
|
|
2603
|
+
*/
|
|
2604
|
+
turnDirection: string;
|
|
2605
|
+
/**
|
|
2606
|
+
* The places the lorebook holds — a
|
|
2607
|
+
* `core:query/lorebook-entries@1` listing of location entries
|
|
2608
|
+
* (lair pass B13, 2026-09-27). On the template context as
|
|
2609
|
+
* `{{knownLocations}}` (their names, one line) and
|
|
2610
|
+
* `{{locationEntry}}` (the entry whose name is the world's
|
|
2611
|
+
* `location` slot — where the party are, its exits included),
|
|
2612
|
+
* whatever the retrieval ranking admitted: a planner that is
|
|
2613
|
+
* never shown the room it stands in cannot tell an open door
|
|
2614
|
+
* from an unbuilt one. Both are absent when nothing is listed.
|
|
2615
|
+
*/
|
|
2616
|
+
locationEntries: string;
|
|
2617
|
+
/**
|
|
2618
|
+
* **Side talk** (lair re-plan R13, 2026-09-28): what was said on
|
|
2619
|
+
* another channel since the story's last line — the Lair's
|
|
2620
|
+
* Sanctum talk, read by `session-history@1` with
|
|
2621
|
+
* `unplayedOnly`. Transcript rows, rendered as prose into
|
|
2622
|
+
* `{{sideTalk}}` (one `Name: line` per row, as `recentStory`
|
|
2623
|
+
* is), so a prompt gives it its own labelled block and it never
|
|
2624
|
+
* reads as story turns. Absent when unwired or empty: the Lair
|
|
2625
|
+
* wires it only while the session's _Sanctum talk steers the
|
|
2626
|
+
* story_ is on.
|
|
2627
|
+
*/
|
|
2628
|
+
sideTalk: string;
|
|
2629
|
+
/**
|
|
2630
|
+
* The planner's own running notes (lair re-plan R13, owner
|
|
2631
|
+
* 2026-09-28): the Castellan's **scratchpad**, rendered as
|
|
2632
|
+
* `{{scratchpad}}`. Absent when unwired or blank; the Lair
|
|
2633
|
+
* wires it beside `sideTalk`.
|
|
2634
|
+
*/
|
|
2635
|
+
scratchpad: string;
|
|
2636
|
+
/**
|
|
2637
|
+
* **How the cast stand with each other** (genre plan F6(a),
|
|
2638
|
+
* 2026-09-29): the ranker's allocated candidates, of which the
|
|
2639
|
+
* builder reads the `relationships` band's `castRelationships`
|
|
2640
|
+
* lane — `core:query/relationship-search@1` read with nobody
|
|
2641
|
+
* speaking. Rendered as `{{castRelationships}}`: JSON keyed by
|
|
2642
|
+
* who holds each view, then by whom it is of, in rank order.
|
|
2643
|
+
* Only what the budget
|
|
2644
|
+
* admitted arrives, so a band at share 0 renders nothing. Absent
|
|
2645
|
+
* when unwired or empty.
|
|
2646
|
+
*
|
|
2647
|
+
* ⚠ On the planner and the scene only — the game master's two
|
|
2648
|
+
* agents. A voice is a cast member speaking, and
|
|
2649
|
+
* `build-side-character-context@1` has no such port on purpose:
|
|
2650
|
+
* another member's secret must never reach it.
|
|
2651
|
+
*/
|
|
2652
|
+
castRelationships: string;
|
|
2653
|
+
}, "core:task/build-planner-context@1"> & {
|
|
2654
|
+
kind: 'task';
|
|
2655
|
+
slots?: {
|
|
2656
|
+
prompts: {
|
|
2657
|
+
kind: "prompts";
|
|
2658
|
+
quick: true;
|
|
2659
|
+
facet: string;
|
|
2660
|
+
description: string;
|
|
2661
|
+
fields: Record<string, {
|
|
2662
|
+
type: 'text';
|
|
2663
|
+
}>;
|
|
2664
|
+
};
|
|
2665
|
+
variables: {
|
|
2666
|
+
kind: "variables";
|
|
2667
|
+
facet: string;
|
|
2668
|
+
description: string;
|
|
2669
|
+
renders: {
|
|
2670
|
+
instructions: 'core:var/instructions@1';
|
|
2671
|
+
characters: 'core:var/characters@1';
|
|
2672
|
+
personas: 'core:var/personas@1';
|
|
2673
|
+
scenario: 'core:var/scenario@1';
|
|
2674
|
+
postHistoryInstructions: 'core:var/post-history-instructions@1';
|
|
2675
|
+
characterNames: 'core:var/character-names@1';
|
|
2676
|
+
personaNames: 'core:var/persona-names@1';
|
|
2677
|
+
};
|
|
2678
|
+
};
|
|
2679
|
+
/** The same pre-assemble hook the other three builders carry. */
|
|
2680
|
+
scripts: {
|
|
2681
|
+
kind: "scripts";
|
|
2682
|
+
accepts: string[];
|
|
2683
|
+
port: string;
|
|
2684
|
+
phase: "after";
|
|
2685
|
+
description: string;
|
|
2686
|
+
};
|
|
2687
|
+
} | undefined;
|
|
2688
|
+
}>;
|
|
2689
|
+
/**
|
|
2690
|
+
* The narrator's context for a planned turn — the one builder that takes a
|
|
2691
|
+
* **plan**.
|
|
2692
|
+
*
|
|
2693
|
+
* `plan` is the only genuinely new thing in this file's three types: the
|
|
2694
|
+
* structured object the planning step produced, put on the template context
|
|
2695
|
+
* under `plan` so the narrator's story string can render its beats and its
|
|
2696
|
+
* world hints. It is a port rather than a nested literal on `state` because the
|
|
2697
|
+
* two are different facts and a template author should be able to tell which is
|
|
2698
|
+
* which — `state.world.weather` is what the world IS, `plan.worldHints` is what
|
|
2699
|
+
* this turn was asked to make of it.
|
|
2700
|
+
*
|
|
2701
|
+
* `narratorName` rides the prompts slot, as it does on `build-narrator-context@1`
|
|
2702
|
+
* and for the same reason: it is the name on the seed line the model continues
|
|
2703
|
+
* from, which is a setting somebody stored rather than data a trigger carried.
|
|
2704
|
+
* @experimental
|
|
2705
|
+
*/
|
|
2706
|
+
export declare const buildSceneContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2707
|
+
readonly main: string;
|
|
2708
|
+
readonly templateContext: string;
|
|
2709
|
+
/**
|
|
2710
|
+
* The name on the trailing assistant line.
|
|
2711
|
+
*
|
|
2712
|
+
* Its own port rather than a field inside the context, because
|
|
2713
|
+
* nothing renders `{{seedName}}` — it is not a template variable.
|
|
2714
|
+
* It is what the message processor writes on the line the model
|
|
2715
|
+
* continues from, and in narrator mode it is the one name that
|
|
2716
|
+
* must *not* be the joined cast list: seeding "Alice and Cara:"
|
|
2717
|
+
* teaches the model to write joint dialogue instead of narrating.
|
|
2718
|
+
*/
|
|
2719
|
+
readonly seedName: string;
|
|
2720
|
+
}, {
|
|
2721
|
+
cast: string;
|
|
2722
|
+
state: string;
|
|
2723
|
+
/** What the planning step decided this turn is about. */
|
|
2724
|
+
plan: string;
|
|
2725
|
+
/**
|
|
2726
|
+
* The session's own genre fields, by key — `tone`,
|
|
2727
|
+
* `difficulty` and whatever else the genre declared.
|
|
2728
|
+
*
|
|
2729
|
+
* On the template context under their own names, so an
|
|
2730
|
+
* authored prompt writes `{{tone}}` the way it writes
|
|
2731
|
+
* `{{char}}`. That is the whole round trip the genre's `fields`
|
|
2732
|
+
* declaration promises: declared on the genre, edited in
|
|
2733
|
+
* session settings, stored on the row, published by the input
|
|
2734
|
+
* node, and read here by the agent whose wording depends on
|
|
2735
|
+
* them. Without this port the last step was missing and a
|
|
2736
|
+
* prompt naming `{{tone}}` rendered a blank.
|
|
2737
|
+
*/
|
|
2738
|
+
fields: string;
|
|
2739
|
+
/**
|
|
2740
|
+
* What the person just sent, when the genre reads it as
|
|
2741
|
+
* **direction** rather than as a line somebody said (lair pass
|
|
2742
|
+
* B11, 2026-09-27) — the Lair's composer. On the template
|
|
2743
|
+
* context and in the prompt as `{{turnDirection}}`; empty or
|
|
2744
|
+
* absent on a turn nobody directed (a Continue), so a prompt
|
|
2745
|
+
* writes `{{#if turnDirection}}…{{/if}}`. A genre whose composer
|
|
2746
|
+
* text is a participant's line leaves it unwired: that line is
|
|
2747
|
+
* already in the transcript. *Turn* direction, never bare
|
|
2748
|
+
* `direction`: that word is the Lair's standing-note state slot
|
|
2749
|
+
* (`core:slot/direction@1`), a different fact (R1, renamed
|
|
2750
|
+
* 2026-09-27).
|
|
2751
|
+
*/
|
|
2752
|
+
turnDirection: string;
|
|
2753
|
+
/**
|
|
2754
|
+
* The places the lorebook holds — a
|
|
2755
|
+
* `core:query/lorebook-entries@1` listing of location entries
|
|
2756
|
+
* (lair pass B13, 2026-09-27). On the template context as
|
|
2757
|
+
* `{{knownLocations}}` (their names, one line) and
|
|
2758
|
+
* `{{locationEntry}}` (the room the world's `location` names,
|
|
2759
|
+
* else the planner's location hint — where the party are, its
|
|
2760
|
+
* exits included), whatever the retrieval ranking admitted: a
|
|
2761
|
+
* planner that is never shown the room it stands in cannot
|
|
2762
|
+
* tell an open door from an unbuilt one. Both are absent when
|
|
2763
|
+
* nothing is listed.
|
|
2764
|
+
*/
|
|
2765
|
+
locationEntries: string;
|
|
2766
|
+
/**
|
|
2767
|
+
* **Side talk** (lair re-plan R13, 2026-09-28), on the
|
|
2768
|
+
* planner's terms: the Lair's Sanctum talk since the story's
|
|
2769
|
+
* last line, rendered as prose into `{{sideTalk}}` — for the
|
|
2770
|
+
* Castellan's narration, wired while the session's _Sanctum
|
|
2771
|
+
* talk steers the story_ is on, or when Narrate was pressed in
|
|
2772
|
+
* the Sanctum. Absent when unwired or empty.
|
|
2773
|
+
*/
|
|
2774
|
+
sideTalk: string;
|
|
2775
|
+
/**
|
|
2776
|
+
* How the cast stand with each other, on the narrator's terms
|
|
2777
|
+
* — the same port as the planner's (F6(a), 2026-09-29), rendered
|
|
2778
|
+
* as `{{castRelationships}}`. See `buildPlannerContext`.
|
|
2779
|
+
*/
|
|
2780
|
+
castRelationships: string;
|
|
2781
|
+
/**
|
|
2782
|
+
* **Whose lines this call writes** (Lair party speech,
|
|
2783
|
+
* 2026-09-30): a list of side-character facts — the planner's
|
|
2784
|
+
* `{ name, intent }`, or `{ characterId }` for a picked
|
|
2785
|
+
* delver — rendered as `{{partySpeakers}}`, one line per
|
|
2786
|
+
* speaker in order: the name the cast gives them, then what
|
|
2787
|
+
* they mean to do when the fact says. A nested list is read
|
|
2788
|
+
* flat, so a spec may hand `[first, rest]` from
|
|
2789
|
+
* `split-first@1` as it is. A name the cast does not hold is
|
|
2790
|
+
* kept as written. Absent when unwired or empty.
|
|
2791
|
+
*
|
|
2792
|
+
* For a call that writes the cast's lines **as nobody's
|
|
2793
|
+
* voice** — the Lair's Castellan speaking for the party: this
|
|
2794
|
+
* surface hears no holder-only slot and reads no member's
|
|
2795
|
+
* private lore, so naming the speakers here gives away nothing
|
|
2796
|
+
* a voice of their own would keep.
|
|
2797
|
+
*/
|
|
2798
|
+
partySpeakers: string;
|
|
2799
|
+
/**
|
|
2800
|
+
* 🚧 **Which places' stats this surface reads** (place sight,
|
|
2801
|
+
* owner ruling 2026-09-30), a literal: `'reach'` — the place
|
|
2802
|
+
* the scene is at and the places one way from it (the room's
|
|
2803
|
+
* listed links to other places, the "From here:" ways); every
|
|
2804
|
+
* other place's stats are left out, its name kept. Absent, the
|
|
2805
|
+
* session's sight: every place it sees. The Lair's Castellan
|
|
2806
|
+
* speaking for the party wires `'reach'`; its narration does
|
|
2807
|
+
* not.
|
|
2808
|
+
*/
|
|
2809
|
+
placeSight: string;
|
|
2810
|
+
}, "core:task/build-scene-context@1"> & {
|
|
2811
|
+
kind: 'task';
|
|
2812
|
+
slots?: {
|
|
2813
|
+
prompts: {
|
|
2814
|
+
kind: "prompts";
|
|
2815
|
+
quick: true;
|
|
2816
|
+
facet: string;
|
|
2817
|
+
description: string;
|
|
2818
|
+
fields: Record<string, {
|
|
2819
|
+
type: 'text';
|
|
2820
|
+
}>;
|
|
2821
|
+
};
|
|
2822
|
+
variables: {
|
|
2823
|
+
kind: "variables";
|
|
2824
|
+
facet: string;
|
|
2825
|
+
description: string;
|
|
2826
|
+
renders: {
|
|
2827
|
+
instructions: 'core:var/instructions@1';
|
|
2828
|
+
characters: 'core:var/characters@1';
|
|
2829
|
+
personas: 'core:var/personas@1';
|
|
2830
|
+
scenario: 'core:var/scenario@1';
|
|
2831
|
+
postHistoryInstructions: 'core:var/post-history-instructions@1';
|
|
2832
|
+
characterNames: 'core:var/character-names@1';
|
|
2833
|
+
personaNames: 'core:var/persona-names@1';
|
|
2834
|
+
};
|
|
2835
|
+
};
|
|
2836
|
+
/** The same pre-assemble hook the other three builders carry. */
|
|
2837
|
+
scripts: {
|
|
2838
|
+
kind: "scripts";
|
|
2839
|
+
accepts: string[];
|
|
2840
|
+
port: string;
|
|
2841
|
+
phase: "after";
|
|
2842
|
+
description: string;
|
|
2843
|
+
};
|
|
2844
|
+
} | undefined;
|
|
2845
|
+
}>;
|
|
2846
|
+
/**
|
|
2847
|
+
* The state-keeper's context: the state as it stands, so the keeper can report
|
|
2848
|
+
* only what the scene changed about it.
|
|
2849
|
+
*
|
|
2850
|
+
* Its own type rather than the planner's because the two read the same facts
|
|
2851
|
+
* for opposite purposes — one is deciding what should happen, the other is
|
|
2852
|
+
* writing down what did — and a shared pool would ship them one set of
|
|
2853
|
+
* instructions.
|
|
2854
|
+
* @experimental
|
|
2855
|
+
*/
|
|
2856
|
+
export declare const buildKeeperContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2857
|
+
readonly main: string;
|
|
2858
|
+
readonly templateContext: string;
|
|
2859
|
+
/**
|
|
2860
|
+
* The name on the trailing assistant line.
|
|
2861
|
+
*
|
|
2862
|
+
* Its own port rather than a field inside the context, because
|
|
2863
|
+
* nothing renders `{{seedName}}` — it is not a template variable.
|
|
2864
|
+
* It is what the message processor writes on the line the model
|
|
2865
|
+
* continues from, and in narrator mode it is the one name that
|
|
2866
|
+
* must *not* be the joined cast list: seeding "Alice and Cara:"
|
|
2867
|
+
* teaches the model to write joint dialogue instead of narrating.
|
|
2868
|
+
*/
|
|
2869
|
+
readonly seedName: string;
|
|
2870
|
+
}, {
|
|
2871
|
+
cast: string;
|
|
2872
|
+
state: string;
|
|
2873
|
+
/**
|
|
2874
|
+
* The reply this keeper is reading, as text — put on the
|
|
2875
|
+
* template context under `reply`, because the thing a keeper
|
|
2876
|
+
* reports on is the scene that was just written and the
|
|
2877
|
+
* transcript does not contain it yet.
|
|
2878
|
+
*/
|
|
2879
|
+
reply: string;
|
|
2880
|
+
/**
|
|
2881
|
+
* ⚠ **An ORDERING edge, and nothing else reads it.**
|
|
2882
|
+
*
|
|
2883
|
+
* A state change is anchored to the newest message in the
|
|
2884
|
+
* session, which is how a swipe takes its changes back with it.
|
|
2885
|
+
* So the keeper has to run AFTER the reply is written, not
|
|
2886
|
+
* merely beside it — and in a graph whose order is its edges,
|
|
2887
|
+
* the only way to say "after that write" is to take the write's
|
|
2888
|
+
* result on a port. It is the write result rather than the text
|
|
2889
|
+
* for exactly that reason: the text exists before the write and
|
|
2890
|
+
* would order nothing.
|
|
2891
|
+
*
|
|
2892
|
+
* ⚠ Typed `json`, NOT `write-result@1`, and the difference is
|
|
2893
|
+
* the standing rule rather than a convenience.
|
|
2894
|
+
* `core:shape/write-result@1` is deliberately accepted nowhere:
|
|
2895
|
+
* under async review a write is a proposal a reviewer may still
|
|
2896
|
+
* reject, so a port declaring that shape is a port promising to
|
|
2897
|
+
* handle both arms of it. This node handles neither — it never
|
|
2898
|
+
* looks inside — and declaring the shape would claim otherwise.
|
|
2899
|
+
* `json` is the honest type for a value taken as opaque, and
|
|
2900
|
+
* write results are assignable to it like everything else.
|
|
2901
|
+
*/
|
|
2902
|
+
afterWrite: string;
|
|
2903
|
+
/**
|
|
2904
|
+
* The session's own genre fields, by key — `tone`,
|
|
2905
|
+
* `difficulty` and whatever else the genre declared.
|
|
2906
|
+
*
|
|
2907
|
+
* On the template context under their own names, so an
|
|
2908
|
+
* authored prompt writes `{{tone}}` the way it writes
|
|
2909
|
+
* `{{char}}`. That is the whole round trip the genre's `fields`
|
|
2910
|
+
* declaration promises: declared on the genre, edited in
|
|
2911
|
+
* session settings, stored on the row, published by the input
|
|
2912
|
+
* node, and read here by the agent whose wording depends on
|
|
2913
|
+
* them. Without this port the last step was missing and a
|
|
2914
|
+
* prompt naming `{{tone}}` rendered a blank.
|
|
2915
|
+
*/
|
|
2916
|
+
fields: string;
|
|
2917
|
+
}, "core:task/build-keeper-context@1"> & {
|
|
2918
|
+
kind: 'task';
|
|
2919
|
+
slots?: {
|
|
2920
|
+
prompts: {
|
|
2921
|
+
kind: "prompts";
|
|
2922
|
+
quick: true;
|
|
2923
|
+
facet: string;
|
|
2924
|
+
description: string;
|
|
2925
|
+
fields: Record<string, {
|
|
2926
|
+
type: 'text';
|
|
2927
|
+
}>;
|
|
2928
|
+
};
|
|
2929
|
+
variables: {
|
|
2930
|
+
kind: "variables";
|
|
2931
|
+
facet: string;
|
|
2932
|
+
description: string;
|
|
2933
|
+
renders: {
|
|
2934
|
+
instructions: 'core:var/instructions@1';
|
|
2935
|
+
characters: 'core:var/characters@1';
|
|
2936
|
+
personas: 'core:var/personas@1';
|
|
2937
|
+
scenario: 'core:var/scenario@1';
|
|
2938
|
+
postHistoryInstructions: 'core:var/post-history-instructions@1';
|
|
2939
|
+
characterNames: 'core:var/character-names@1';
|
|
2940
|
+
personaNames: 'core:var/persona-names@1';
|
|
2941
|
+
};
|
|
2942
|
+
};
|
|
2943
|
+
/** The same pre-assemble hook the other three builders carry. */
|
|
2944
|
+
scripts: {
|
|
2945
|
+
kind: "scripts";
|
|
2946
|
+
accepts: string[];
|
|
2947
|
+
port: string;
|
|
2948
|
+
phase: "after";
|
|
2949
|
+
description: string;
|
|
2950
|
+
};
|
|
2951
|
+
} | undefined;
|
|
2952
|
+
}>;
|
|
2953
|
+
/**
|
|
2954
|
+
* Chat rows into the objects a template renders.
|
|
2955
|
+
*
|
|
2956
|
+
* A Task rather than part of the history Query, because naming a message —
|
|
2957
|
+
* which participant said it, under what name at the time — is a *decision*, and
|
|
2958
|
+
* decisions are the things a plugin should be able to replace. The Query returns
|
|
2959
|
+
* rows; this says who spoke.
|
|
2960
|
+
* @public
|
|
2961
|
+
*/
|
|
2962
|
+
export declare const processMessages: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
2963
|
+
main: string;
|
|
2964
|
+
messages: string;
|
|
2965
|
+
}, {
|
|
2966
|
+
messages: string;
|
|
2967
|
+
cast: string;
|
|
2968
|
+
templateContext: string;
|
|
2969
|
+
seedName: string;
|
|
2970
|
+
/**
|
|
2971
|
+
* Text the model is being asked to CONTINUE — the seed line's
|
|
2972
|
+
* body rather than a message of its own (ruling 2026-09-08,
|
|
2973
|
+
* D-2).
|
|
2974
|
+
*
|
|
2975
|
+
* ⚠ **Absent on an ordinary turn, and that is the normal case.**
|
|
2976
|
+
* There is no `optional` marker for a port: a port nothing wires
|
|
2977
|
+
* resolves to `undefined`, the seed line renders empty, and the
|
|
2978
|
+
* model starts the reply. Every spec but an extend leaves it
|
|
2979
|
+
* unwired on purpose.
|
|
2980
|
+
*
|
|
2981
|
+
* It is a port rather than a second synthetic message because a
|
|
2982
|
+
* partial reply is not a turn: appending it as one produces two
|
|
2983
|
+
* consecutive assistant entries on a chat endpoint and a
|
|
2984
|
+
* wrongly-closed block on a completion one. The seed is the one
|
|
2985
|
+
* place in the prompt whose block is deliberately left open
|
|
2986
|
+
* (`includeClose: false` for id -2), which is exactly what a
|
|
2987
|
+
* continuation needs.
|
|
2988
|
+
*
|
|
2989
|
+
* ⚠ It is **not** a stored message, and nothing downstream may
|
|
2990
|
+
* treat it as one. The row holding it is `isGenerating` and is
|
|
2991
|
+
* excluded from every message read, so lore scans, semantic and
|
|
2992
|
+
* entity queries and history windows do not see it. It counts
|
|
2993
|
+
* against the token budget, because it is in the prompt.
|
|
2994
|
+
*/
|
|
2995
|
+
continuationPrefill: string;
|
|
2996
|
+
}, "core:task/process-messages@1"> & {
|
|
2997
|
+
kind: 'task';
|
|
2998
|
+
slots?: {
|
|
2999
|
+
/**
|
|
3000
|
+
* The message-rewrite hook (18 §4a), on the *processed* list —
|
|
3001
|
+
* names resolved, per-message interpolation done. `transform` only:
|
|
3002
|
+
* `messages/inject` deliberately does **not** live here. Injection
|
|
3003
|
+
* is a statement about *position in the rendered conversation*, and
|
|
3004
|
+
* position belongs to the template (§20, ruling of 2026-08-23) —
|
|
3005
|
+
* inject chains attach on the context builders, land as
|
|
3006
|
+
* `context.injections`, and the template's own loop renders them.
|
|
3007
|
+
* Splicing rows into this list would be a position the template
|
|
3008
|
+
* cannot express and an author cannot see.
|
|
3009
|
+
*/
|
|
3010
|
+
readonly scripts: {
|
|
3011
|
+
readonly kind: "scripts";
|
|
3012
|
+
readonly accepts: ["core:script:messages/transform@1"];
|
|
3013
|
+
readonly port: "main";
|
|
3014
|
+
readonly phase: "after";
|
|
3015
|
+
readonly description: "Scripts over the message list the model will see — rewrite or drop lines. Reminders at a depth attach on the context step instead.";
|
|
3016
|
+
};
|
|
3017
|
+
} | undefined;
|
|
3018
|
+
}>;
|
|
3019
|
+
/**
|
|
3020
|
+
* The conversation as PROSE, for a step that reads it rather than takes a turn.
|
|
3021
|
+
*
|
|
3022
|
+
* Two differences from `process-messages@1`, and both are properties of the
|
|
3023
|
+
* transcript rather than of the request, which is why they live here and not on
|
|
3024
|
+
* the Provider: by the time a prompt is rendered for a completion wire the
|
|
3025
|
+
* conversation is one string with an open block at the end of it, and nothing
|
|
3026
|
+
* downstream can take either of them back out.
|
|
3027
|
+
*
|
|
3028
|
+
* · **No seed.** `process-messages@1` ends its list with an empty assistant
|
|
3029
|
+
* line carrying the next speaker's name, because that line is what tells a
|
|
3030
|
+
* model whose turn it is. A planner and a state keeper are not taking a
|
|
3031
|
+
* turn, and a prompt that ends `Verity:` asks for Verity's next paragraph
|
|
3032
|
+
* however plainly the instructions asked for JSON.
|
|
3033
|
+
* · **No JSON blocks.** A reply that carried a document at the end of it
|
|
3034
|
+
* teaches the next turn's planner its own schema and the keeper somebody
|
|
3035
|
+
* else's. The cut happens on the way into the prompt and never on the
|
|
3036
|
+
* stored row — see `prompt/jsonBlocks.ts`.
|
|
3037
|
+
*
|
|
3038
|
+
* Everything else is the same naming and the same interpolation, from the same
|
|
3039
|
+
* implementation: who spoke, under what name at the time, reaching through
|
|
3040
|
+
* participants who have since left.
|
|
3041
|
+
* @public
|
|
3042
|
+
*/
|
|
3043
|
+
export declare const proseTranscript: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3044
|
+
main: string;
|
|
3045
|
+
messages: string;
|
|
3046
|
+
}, {
|
|
3047
|
+
messages: string;
|
|
3048
|
+
cast: string;
|
|
3049
|
+
templateContext: string;
|
|
3050
|
+
}, "core:task/prose-transcript@1"> & {
|
|
3051
|
+
kind: 'task';
|
|
3052
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3053
|
+
}>;
|
|
3054
|
+
/**
|
|
3055
|
+
* 🚧 **Where each line's attachments go** (PLAN-composer-attachments §3.5; owner
|
|
3056
|
+
* D2/D3, 2026-10-02).
|
|
3057
|
+
*
|
|
3058
|
+
* Pure. Takes the processed lines and the attachments by message, and gives
|
|
3059
|
+
* each line an `attachments` string the template renders after the line's text
|
|
3060
|
+
* (`{{{attachments}}}` in the shipped template):
|
|
3061
|
+
*
|
|
3062
|
+
* - an image or PDF the call can read, within `mediaLookback` messages of the
|
|
3063
|
+
* end, becomes a **media marker** the prompt parser lifts onto that line's
|
|
3064
|
+
* own turn;
|
|
3065
|
+
* - a text file becomes a fenced block with its name, trimmed to
|
|
3066
|
+
* `textFileTokens` with a stated note — never silently;
|
|
3067
|
+
* - anything else — a kind the call cannot read, or media older than the
|
|
3068
|
+
* lookback — becomes a **placeholder**: `[image: cat.png]`, with the
|
|
3069
|
+
* person's description when there is one.
|
|
3070
|
+
*
|
|
3071
|
+
* What the call can read comes from its `connection` slot — wire it with
|
|
3072
|
+
* `slot.connectionOf('<the step that sends the prompt>')` — whose descriptor
|
|
3073
|
+
* carries `metadata.reads` (`ConnectionReadsV1`). Unwired, the call reads no
|
|
3074
|
+
* media and every image is a name: what a text-only step such as a summary
|
|
3075
|
+
* wants. A line with no files is passed through untouched, so a transcript
|
|
3076
|
+
* with no attachments renders byte for byte what it did without this step.
|
|
3077
|
+
*
|
|
3078
|
+
* `notes` are sentences for the run's receipt ("2 images older than the media
|
|
3079
|
+
* lookback were sent as names").
|
|
3080
|
+
* @experimental
|
|
3081
|
+
*/
|
|
3082
|
+
export declare const placeAttachments: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3083
|
+
main: string;
|
|
3084
|
+
messages: string;
|
|
3085
|
+
notes: string;
|
|
3086
|
+
}, {
|
|
3087
|
+
messages: string;
|
|
3088
|
+
attachments: string;
|
|
3089
|
+
}, "core:task/place-attachments@1"> & {
|
|
3090
|
+
kind: 'task';
|
|
3091
|
+
slots?: {
|
|
3092
|
+
readonly connection: {
|
|
3093
|
+
readonly kind: "connection";
|
|
3094
|
+
readonly shape: string;
|
|
3095
|
+
readonly description: "Which step these lines are written for. Point it at the step that sends the prompt: what that step can read decides whether an image is sent or named.";
|
|
3096
|
+
};
|
|
3097
|
+
readonly params: {
|
|
3098
|
+
readonly kind: "parameters";
|
|
3099
|
+
readonly facet: "weights";
|
|
3100
|
+
readonly schema: {
|
|
3101
|
+
readonly mediaLookback: {
|
|
3102
|
+
readonly type: "integer";
|
|
3103
|
+
readonly min: 0;
|
|
3104
|
+
readonly default: 10;
|
|
3105
|
+
readonly label: {
|
|
3106
|
+
readonly en: "Media lookback (messages)";
|
|
3107
|
+
};
|
|
3108
|
+
readonly description: {
|
|
3109
|
+
readonly en: "Images and PDFs in the last this-many messages are sent to the model; older ones are sent as their names. Set to zero to send every attachment as a name.";
|
|
3110
|
+
};
|
|
3111
|
+
};
|
|
3112
|
+
readonly textFileTokens: {
|
|
3113
|
+
readonly type: "integer";
|
|
3114
|
+
readonly min: 0;
|
|
3115
|
+
readonly default: 4000;
|
|
3116
|
+
readonly label: {
|
|
3117
|
+
readonly en: "Text file budget (tokens)";
|
|
3118
|
+
};
|
|
3119
|
+
readonly description: {
|
|
3120
|
+
readonly en: "How much of each attached text file goes into the prompt. A longer file is cut here, and the prompt says it was cut.";
|
|
3121
|
+
};
|
|
3122
|
+
};
|
|
3123
|
+
};
|
|
3124
|
+
};
|
|
3125
|
+
} | undefined;
|
|
3126
|
+
}>;
|
|
3127
|
+
/**
|
|
3128
|
+
* Round robin: the candidates that have not spoken since the last user row,
|
|
3129
|
+
* in candidate order. A character spoke when a non-hidden, non-narrator row
|
|
3130
|
+
* after the last user row carries its id; an envoy when `metadata.speaker`
|
|
3131
|
+
* carries its reference; a persona when a user row carries its `personaId`
|
|
3132
|
+
* — which is how a session knows it is the person's turn (R15).
|
|
3133
|
+
* @experimental
|
|
3134
|
+
*/
|
|
3135
|
+
export declare const turnRoundRobin: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3136
|
+
/**
|
|
3137
|
+
* The prepared turns, in order. `main` and `order` carry the
|
|
3138
|
+
* same value: `main` is what the shape-based swap list keys
|
|
3139
|
+
* on (a strategy is a node publishing `turn-entries@1`), and
|
|
3140
|
+
* `order` is what `set-turn-order` is wired from, named for
|
|
3141
|
+
* what it is.
|
|
3142
|
+
*/
|
|
3143
|
+
main: string;
|
|
3144
|
+
order: string;
|
|
3145
|
+
}, {
|
|
3146
|
+
/** Who may be seated — the pool's output, through any orderers. */
|
|
3147
|
+
candidates: string;
|
|
3148
|
+
/** The session's visible history, ascending. */
|
|
3149
|
+
messages: string;
|
|
3150
|
+
}, "core:task/turn-round-robin@1"> & {
|
|
3151
|
+
kind: 'task';
|
|
3152
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3153
|
+
}>;
|
|
3154
|
+
/**
|
|
3155
|
+
* A seeded uniform pick over the not-yet-spoken candidates — one entry.
|
|
3156
|
+
* `declaresRandomness`, so a replayed run re-rolls identically; an
|
|
3157
|
+
* unrelated recompute may roll differently, which is documented rather than
|
|
3158
|
+
* prevented (§4.4).
|
|
3159
|
+
* @experimental
|
|
3160
|
+
*/
|
|
3161
|
+
export declare const turnRandom: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3162
|
+
/**
|
|
3163
|
+
* The prepared turns, in order. `main` and `order` carry the
|
|
3164
|
+
* same value: `main` is what the shape-based swap list keys
|
|
3165
|
+
* on (a strategy is a node publishing `turn-entries@1`), and
|
|
3166
|
+
* `order` is what `set-turn-order` is wired from, named for
|
|
3167
|
+
* what it is.
|
|
3168
|
+
*/
|
|
3169
|
+
main: string;
|
|
3170
|
+
order: string;
|
|
3171
|
+
}, {
|
|
3172
|
+
/** Who may be seated — the pool's output, through any orderers. */
|
|
3173
|
+
candidates: string;
|
|
3174
|
+
/** The session's visible history, ascending. */
|
|
3175
|
+
messages: string;
|
|
3176
|
+
}, "core:task/turn-random@1"> & {
|
|
3177
|
+
kind: 'task';
|
|
3178
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3179
|
+
}>;
|
|
3180
|
+
/**
|
|
3181
|
+
* Round robin over the candidates whose `ownerUserId` is the last sender's,
|
|
3182
|
+
* so one person's cast completes a turn before another's; plain round robin
|
|
3183
|
+
* when that set is empty. The rule narrows, it never starves.
|
|
3184
|
+
* @experimental
|
|
3185
|
+
*/
|
|
3186
|
+
export declare const turnUserSplit: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3187
|
+
/**
|
|
3188
|
+
* The prepared turns, in order. `main` and `order` carry the
|
|
3189
|
+
* same value: `main` is what the shape-based swap list keys
|
|
3190
|
+
* on (a strategy is a node publishing `turn-entries@1`), and
|
|
3191
|
+
* `order` is what `set-turn-order` is wired from, named for
|
|
3192
|
+
* what it is.
|
|
3193
|
+
*/
|
|
3194
|
+
main: string;
|
|
3195
|
+
order: string;
|
|
3196
|
+
}, {
|
|
3197
|
+
/** Who may be seated — the pool's output, through any orderers. */
|
|
3198
|
+
candidates: string;
|
|
3199
|
+
/** The session's visible history, ascending. */
|
|
3200
|
+
messages: string;
|
|
3201
|
+
}, "core:task/turn-user-split@1"> & {
|
|
3202
|
+
kind: 'task';
|
|
3203
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3204
|
+
}>;
|
|
3205
|
+
/**
|
|
3206
|
+
* Round robin, with the `select` point free to rewrite it: the host hands
|
|
3207
|
+
* `{ order, candidates, lastSpeaker, sinceUser }` to a
|
|
3208
|
+
* `core:script:turn/select@1` chain and keeps the entries it returns whose
|
|
3209
|
+
* `ref` is a candidate — a script cannot seat somebody the pool did not
|
|
3210
|
+
* admit, and a refusal is a receipt note. Entries the chain changed carry
|
|
3211
|
+
* `via: 'script'`.
|
|
3212
|
+
* @experimental
|
|
3213
|
+
*/
|
|
3214
|
+
export declare const turnScripted: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3215
|
+
/**
|
|
3216
|
+
* The prepared turns, in order. `main` and `order` carry the
|
|
3217
|
+
* same value: `main` is what the shape-based swap list keys
|
|
3218
|
+
* on (a strategy is a node publishing `turn-entries@1`), and
|
|
3219
|
+
* `order` is what `set-turn-order` is wired from, named for
|
|
3220
|
+
* what it is.
|
|
3221
|
+
*/
|
|
3222
|
+
main: string;
|
|
3223
|
+
order: string;
|
|
3224
|
+
}, {
|
|
3225
|
+
/** Who may be seated — the pool's output, through any orderers. */
|
|
3226
|
+
candidates: string;
|
|
3227
|
+
/** The session's visible history, ascending. */
|
|
3228
|
+
messages: string;
|
|
3229
|
+
}, "core:task/turn-scripted@1"> & {
|
|
3230
|
+
kind: 'task';
|
|
3231
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3232
|
+
}>;
|
|
3233
|
+
/** Always an empty order: nothing is prepared, and every turn is a press. @experimental */
|
|
3234
|
+
export declare const turnManual: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3235
|
+
/**
|
|
3236
|
+
* The prepared turns, in order. `main` and `order` carry the
|
|
3237
|
+
* same value: `main` is what the shape-based swap list keys
|
|
3238
|
+
* on (a strategy is a node publishing `turn-entries@1`), and
|
|
3239
|
+
* `order` is what `set-turn-order` is wired from, named for
|
|
3240
|
+
* what it is.
|
|
3241
|
+
*/
|
|
3242
|
+
main: string;
|
|
3243
|
+
order: string;
|
|
3244
|
+
}, {
|
|
3245
|
+
/** Who may be seated — the pool's output, through any orderers. */
|
|
3246
|
+
candidates: string;
|
|
3247
|
+
/** The session's visible history, ascending. */
|
|
3248
|
+
messages: string;
|
|
3249
|
+
}, "core:task/turn-manual@1"> & {
|
|
3250
|
+
kind: 'task';
|
|
3251
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3252
|
+
}>;
|
|
3253
|
+
/**
|
|
3254
|
+
* One entry in the pipeline's own voice (`{ ref: null, via: 'voice' }`) when
|
|
3255
|
+
* the last row is a user row, else empty. How a planner genre — Adventure,
|
|
3256
|
+
* the Lair, the Whodunit showcase plugin — gets exactly one reply per send
|
|
3257
|
+
* with no cast in the pool at all.
|
|
3258
|
+
* @experimental
|
|
3259
|
+
*/
|
|
3260
|
+
export declare const turnNarrator: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3261
|
+
/**
|
|
3262
|
+
* The prepared turns, in order. `main` and `order` carry the
|
|
3263
|
+
* same value: `main` is what the shape-based swap list keys
|
|
3264
|
+
* on (a strategy is a node publishing `turn-entries@1`), and
|
|
3265
|
+
* `order` is what `set-turn-order` is wired from, named for
|
|
3266
|
+
* what it is.
|
|
3267
|
+
*/
|
|
3268
|
+
main: string;
|
|
3269
|
+
order: string;
|
|
3270
|
+
}, {
|
|
3271
|
+
/** Who may be seated — the pool's output, through any orderers. */
|
|
3272
|
+
candidates: string;
|
|
3273
|
+
/** The session's visible history, ascending. */
|
|
3274
|
+
messages: string;
|
|
3275
|
+
}, "core:task/turn-narrator@1"> & {
|
|
3276
|
+
kind: 'task';
|
|
3277
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3278
|
+
}>;
|
|
3279
|
+
/**
|
|
3280
|
+
* The pool (§4.4): who *may* be seated this recompute, from the settings
|
|
3281
|
+
* document's cast and the history.
|
|
3282
|
+
*
|
|
3283
|
+
* Its four params are the whole of a genre's or a session's say over
|
|
3284
|
+
* eligibility. Two floors are not params, because a param that could
|
|
3285
|
+
* override them would be a way to seat somebody who has left: a row with
|
|
3286
|
+
* `removedAt` is never a candidate, and an envoy declared `speaks:
|
|
3287
|
+
* 'on-action'` is never a candidate — it speaks through its action's
|
|
3288
|
+
* outputs alone.
|
|
3289
|
+
*
|
|
3290
|
+
* Output order is characters by `position`, then personas by `position`,
|
|
3291
|
+
* then envoys by `position`. An orderer may rewrite it; a strategy reads it
|
|
3292
|
+
* as given.
|
|
3293
|
+
* @experimental
|
|
3294
|
+
*/
|
|
3295
|
+
export declare const turnPool: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3296
|
+
main: string;
|
|
3297
|
+
}, {
|
|
3298
|
+
/** The settings document's cast, envoys included (§4.12). */
|
|
3299
|
+
cast: string;
|
|
3300
|
+
/** The session's visible history, ascending. */
|
|
3301
|
+
messages: string;
|
|
3302
|
+
}, "core:task/turn-pool@1"> & {
|
|
3303
|
+
kind: 'task';
|
|
3304
|
+
slots?: {
|
|
3305
|
+
readonly params: {
|
|
3306
|
+
readonly kind: "parameters";
|
|
3307
|
+
readonly facet: "behavior";
|
|
3308
|
+
readonly schema: {
|
|
3309
|
+
readonly characters: {
|
|
3310
|
+
readonly type: "enum";
|
|
3311
|
+
readonly of: readonly ["active", "all", "none"];
|
|
3312
|
+
readonly members: readonly [{
|
|
3313
|
+
readonly key: "active";
|
|
3314
|
+
readonly label: {
|
|
3315
|
+
readonly en: "Active";
|
|
3316
|
+
};
|
|
3317
|
+
readonly description: {
|
|
3318
|
+
readonly en: "The characters switched on in the cast.";
|
|
3319
|
+
};
|
|
3320
|
+
}, {
|
|
3321
|
+
readonly key: "all";
|
|
3322
|
+
readonly label: {
|
|
3323
|
+
readonly en: "All";
|
|
3324
|
+
};
|
|
3325
|
+
readonly description: {
|
|
3326
|
+
readonly en: "Ones switched off in the cast too.";
|
|
3327
|
+
};
|
|
3328
|
+
}, {
|
|
3329
|
+
readonly key: "none";
|
|
3330
|
+
readonly label: {
|
|
3331
|
+
readonly en: "None";
|
|
3332
|
+
};
|
|
3333
|
+
}];
|
|
3334
|
+
readonly default: "active";
|
|
3335
|
+
readonly label: {
|
|
3336
|
+
readonly en: "Characters";
|
|
3337
|
+
};
|
|
3338
|
+
readonly description: {
|
|
3339
|
+
readonly en: "Which of the session's characters may take a turn. 'All' admits ones switched off in the cast; a removed character never is.";
|
|
3340
|
+
};
|
|
3341
|
+
};
|
|
3342
|
+
readonly personas: {
|
|
3343
|
+
readonly type: "enum";
|
|
3344
|
+
readonly of: readonly ["none", "all", "others"];
|
|
3345
|
+
readonly members: readonly [{
|
|
3346
|
+
readonly key: "none";
|
|
3347
|
+
readonly label: {
|
|
3348
|
+
readonly en: "None";
|
|
3349
|
+
};
|
|
3350
|
+
}, {
|
|
3351
|
+
readonly key: "all";
|
|
3352
|
+
readonly label: {
|
|
3353
|
+
readonly en: "All";
|
|
3354
|
+
};
|
|
3355
|
+
readonly description: {
|
|
3356
|
+
readonly en: "Everyone in the session.";
|
|
3357
|
+
};
|
|
3358
|
+
}, {
|
|
3359
|
+
readonly key: "others";
|
|
3360
|
+
readonly label: {
|
|
3361
|
+
readonly en: "Others";
|
|
3362
|
+
};
|
|
3363
|
+
readonly description: {
|
|
3364
|
+
readonly en: "Everyone but whoever just wrote.";
|
|
3365
|
+
};
|
|
3366
|
+
}];
|
|
3367
|
+
readonly default: "all";
|
|
3368
|
+
readonly label: {
|
|
3369
|
+
readonly en: "Personas";
|
|
3370
|
+
};
|
|
3371
|
+
readonly description: {
|
|
3372
|
+
readonly en: "Whether the people in the session appear in the order. A person's entry is shown as their turn and never generated — that is how a session says it is your turn. 'Others' leaves out whoever just wrote.";
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3375
|
+
readonly envoys: {
|
|
3376
|
+
readonly type: "enum";
|
|
3377
|
+
readonly of: readonly ["in-turn", "none", "only", "except"];
|
|
3378
|
+
readonly members: readonly [{
|
|
3379
|
+
readonly key: "in-turn";
|
|
3380
|
+
readonly label: {
|
|
3381
|
+
readonly en: "Those that take turns";
|
|
3382
|
+
};
|
|
3383
|
+
readonly description: {
|
|
3384
|
+
readonly en: "Envoys declared to speak in turn; one that speaks only on an action never does.";
|
|
3385
|
+
};
|
|
3386
|
+
}, {
|
|
3387
|
+
readonly key: "none";
|
|
3388
|
+
readonly label: {
|
|
3389
|
+
readonly en: "None";
|
|
3390
|
+
};
|
|
3391
|
+
}, {
|
|
3392
|
+
readonly key: "only";
|
|
3393
|
+
readonly label: {
|
|
3394
|
+
readonly en: "Only";
|
|
3395
|
+
};
|
|
3396
|
+
readonly description: {
|
|
3397
|
+
readonly en: "Only the envoys in the list below.";
|
|
3398
|
+
};
|
|
3399
|
+
}, {
|
|
3400
|
+
readonly key: "except";
|
|
3401
|
+
readonly label: {
|
|
3402
|
+
readonly en: "Except";
|
|
3403
|
+
};
|
|
3404
|
+
readonly description: {
|
|
3405
|
+
readonly en: "Every envoy but those in the list below.";
|
|
3406
|
+
};
|
|
3407
|
+
}];
|
|
3408
|
+
readonly default: "in-turn";
|
|
3409
|
+
readonly label: {
|
|
3410
|
+
readonly en: "Envoys";
|
|
3411
|
+
};
|
|
3412
|
+
readonly description: {
|
|
3413
|
+
readonly en: "Which of the genre's envoys may take a turn. 'Only' and 'Except' read the list below.";
|
|
3414
|
+
};
|
|
3415
|
+
};
|
|
3416
|
+
readonly envoySlugs: {
|
|
3417
|
+
readonly type: "string";
|
|
3418
|
+
readonly list: true;
|
|
3419
|
+
readonly default: readonly [];
|
|
3420
|
+
readonly label: {
|
|
3421
|
+
readonly en: "Envoy list";
|
|
3422
|
+
};
|
|
3423
|
+
readonly description: {
|
|
3424
|
+
readonly en: "The envoys 'Only' admits, or 'Except' leaves out. Ignored otherwise.";
|
|
3425
|
+
};
|
|
3426
|
+
};
|
|
3427
|
+
};
|
|
3428
|
+
};
|
|
3429
|
+
} | undefined;
|
|
3430
|
+
}>;
|
|
3431
|
+
/**
|
|
3432
|
+
* The first orderer (R8): mentioned candidates sort to the front.
|
|
3433
|
+
*
|
|
3434
|
+
* A composable node rather than a seventh strategy, because "who was named"
|
|
3435
|
+
* and "whose turn it is" are two questions — a session can have the
|
|
3436
|
+
* mentioned rule under round robin, under user-split or under a plugin's
|
|
3437
|
+
* strategy by placing this before any of them.
|
|
3438
|
+
*
|
|
3439
|
+
* Case-insensitive whole-word match of each candidate's `name` and
|
|
3440
|
+
* `nickname` against the most recent `lookback` **user** rows; mentioned
|
|
3441
|
+
* candidates move to the front ordered by first mention, and the rest keep
|
|
3442
|
+
* the order they arrived in. The receipt records `mentioned`. (A
|
|
3443
|
+
* gazetteer-backed match is a later improvement; this is names.)
|
|
3444
|
+
* @experimental
|
|
3445
|
+
*/
|
|
3446
|
+
export declare const turnMentioned: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3447
|
+
main: string;
|
|
3448
|
+
}, {
|
|
3449
|
+
candidates: string;
|
|
3450
|
+
messages: string;
|
|
3451
|
+
}, "core:task/turn-mentioned@1"> & {
|
|
3452
|
+
kind: 'task';
|
|
3453
|
+
slots?: {
|
|
3454
|
+
readonly params: {
|
|
3455
|
+
readonly kind: "parameters";
|
|
3456
|
+
readonly facet: "behavior";
|
|
3457
|
+
readonly schema: {
|
|
3458
|
+
readonly lookback: {
|
|
3459
|
+
readonly type: "integer";
|
|
3460
|
+
readonly default: 1;
|
|
3461
|
+
readonly min: 1;
|
|
3462
|
+
readonly label: {
|
|
3463
|
+
readonly en: "Messages scanned";
|
|
3464
|
+
};
|
|
3465
|
+
readonly description: {
|
|
3466
|
+
readonly en: "How many of your most recent messages are read for names.";
|
|
3467
|
+
};
|
|
3468
|
+
};
|
|
3469
|
+
};
|
|
3470
|
+
};
|
|
3471
|
+
} | undefined;
|
|
3472
|
+
}>;
|
|
3473
|
+
/**
|
|
3474
|
+
* Tool calling's two pure halves (20 §9). A *tool* is any same-shaped
|
|
3475
|
+
* provider — a sandboxed plugin hook canonically — and these tasks only
|
|
3476
|
+
* decide how the model learns about it and how its answer is read back.
|
|
3477
|
+
* Between them sits the ordinary generate step; around them sits the loop
|
|
3478
|
+
* block, whose iterations are the receipted agentic turn.
|
|
3479
|
+
* @experimental
|
|
3480
|
+
*/
|
|
3481
|
+
export declare const advertiseTools: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3482
|
+
main: string;
|
|
3483
|
+
native: string;
|
|
3484
|
+
prompt: string;
|
|
3485
|
+
}, {
|
|
3486
|
+
tools: string;
|
|
3487
|
+
}, "core:task/advertise-tools@1"> & {
|
|
3488
|
+
kind: 'task';
|
|
3489
|
+
slots?: {
|
|
3490
|
+
readonly params: {
|
|
3491
|
+
readonly kind: "parameters";
|
|
3492
|
+
readonly schema: {
|
|
3493
|
+
readonly style: {
|
|
3494
|
+
readonly type: "enum";
|
|
3495
|
+
readonly of: readonly ["native", "prompt"];
|
|
3496
|
+
readonly members: readonly [{
|
|
3497
|
+
readonly key: "native";
|
|
3498
|
+
readonly label: {
|
|
3499
|
+
readonly en: "Native tool calling";
|
|
3500
|
+
};
|
|
3501
|
+
readonly description: {
|
|
3502
|
+
readonly en: "Hands the declarations to the API's own tool-calling.";
|
|
3503
|
+
};
|
|
3504
|
+
}, {
|
|
3505
|
+
readonly key: "prompt";
|
|
3506
|
+
readonly label: {
|
|
3507
|
+
readonly en: "In the prompt";
|
|
3508
|
+
};
|
|
3509
|
+
readonly description: {
|
|
3510
|
+
readonly en: "Writes them into the context, for models without tool-calling.";
|
|
3511
|
+
};
|
|
3512
|
+
}];
|
|
3513
|
+
readonly default: "prompt";
|
|
3514
|
+
readonly description: "How the model learns its tools: natively through the API's own tool-calling, or written into the prompt for models without one.";
|
|
3515
|
+
};
|
|
3516
|
+
};
|
|
3517
|
+
};
|
|
3518
|
+
} | undefined;
|
|
3519
|
+
}>;
|
|
3520
|
+
/** @experimental */
|
|
3521
|
+
export declare const parseToolCall: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3522
|
+
main: string;
|
|
3523
|
+
call: string;
|
|
3524
|
+
text: string;
|
|
3525
|
+
}, {
|
|
3526
|
+
text: string;
|
|
3527
|
+
tools: string;
|
|
3528
|
+
}, "core:task/parse-tool-call@1"> & {
|
|
3529
|
+
kind: 'task';
|
|
3530
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3531
|
+
}>;
|
|
3532
|
+
/**
|
|
3533
|
+
* A repeated block's outputs, as one string.
|
|
3534
|
+
*
|
|
3535
|
+
* The missing half of `map` and `loop`. Both publish a **list** — `values`, one
|
|
3536
|
+
* entry per iteration — and everything that writes (a message, a lore entry)
|
|
3537
|
+
* takes a scalar, so every spec that repeats anything has needed this and
|
|
3538
|
+
* every spec has had to end at the block. Reducing in a Consumer instead would
|
|
3539
|
+
* put the join inside the write, where no receipt can show it and no author
|
|
3540
|
+
* can change it.
|
|
3541
|
+
*
|
|
3542
|
+
* `path` is what makes it usable on a block: an iteration's value is that
|
|
3543
|
+
* chain's last node's **ports object**, so the interesting text is at
|
|
3544
|
+
* `.text` or `.answer` rather than at the top. Empty entries are skipped
|
|
3545
|
+
* rather than joined, which is what makes "every iteration's answer, and only
|
|
3546
|
+
* the iteration that had one" a wiring rather than a filter node.
|
|
3547
|
+
* @experimental
|
|
3548
|
+
*/
|
|
3549
|
+
export declare const joinText: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3550
|
+
main: string;
|
|
3551
|
+
text: string;
|
|
3552
|
+
}, {
|
|
3553
|
+
items: string;
|
|
3554
|
+
}, "core:task/join-text@1"> & {
|
|
3555
|
+
kind: 'task';
|
|
3556
|
+
slots?: {
|
|
3557
|
+
readonly params: {
|
|
3558
|
+
readonly kind: "parameters";
|
|
3559
|
+
readonly schema: {
|
|
3560
|
+
readonly path: {
|
|
3561
|
+
readonly type: "string";
|
|
3562
|
+
readonly default: "text";
|
|
3563
|
+
readonly description: "Which key to read off each entry. Empty reads the entry itself, for a list of plain strings.";
|
|
3564
|
+
};
|
|
3565
|
+
readonly separator: {
|
|
3566
|
+
readonly type: "string";
|
|
3567
|
+
readonly default: "\n\n";
|
|
3568
|
+
readonly description: "What goes between the entries that had something to say.";
|
|
3569
|
+
};
|
|
3570
|
+
};
|
|
3571
|
+
};
|
|
3572
|
+
} | undefined;
|
|
3573
|
+
}>;
|
|
3574
|
+
/**
|
|
3575
|
+
* A document's lists, as one **folded section** a reply carries collapsed
|
|
3576
|
+
* (lair pass B5, decision D5, 2026-09-27).
|
|
3577
|
+
*
|
|
3578
|
+
* The producer the message outlets' `sections` in-port was built for: a
|
|
3579
|
+
* planner's document is structure, and the person reading the reply wants its
|
|
3580
|
+
* beats and speakers as a short list under a "Plan" heading — never the JSON,
|
|
3581
|
+
* and never in the body. `path` names the keys read, comma-separated and in
|
|
3582
|
+
* order; each list entry becomes one line, and an object entry reads as its
|
|
3583
|
+
* own text values joined with ` — ` (`sectionItemsOf` in the SDK is the one
|
|
3584
|
+
* reading). A document with nothing to list publishes an empty list, which a
|
|
3585
|
+
* write takes as "no sections".
|
|
3586
|
+
*
|
|
3587
|
+
* `kind` and `label` are parameters, not ports: they are what the section IS,
|
|
3588
|
+
* chosen by whoever wires it, and a model never names them.
|
|
3589
|
+
* @experimental
|
|
3590
|
+
*/
|
|
3591
|
+
export declare const listSection: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3592
|
+
main: string;
|
|
3593
|
+
sections: string;
|
|
3594
|
+
/**
|
|
3595
|
+
* The same lines as a markdown list, one `- ` item per line
|
|
3596
|
+
* (lair pass R8, 2026-09-28) — for a message whose BODY is the
|
|
3597
|
+
* list: the Lair's beats row in the Sanctum. Empty when
|
|
3598
|
+
* nothing was listed.
|
|
3599
|
+
*/
|
|
3600
|
+
text: string;
|
|
3601
|
+
}, {
|
|
3602
|
+
json: string;
|
|
3603
|
+
}, "core:task/list-section@1"> & {
|
|
3604
|
+
kind: 'task';
|
|
3605
|
+
slots?: {
|
|
3606
|
+
readonly params: {
|
|
3607
|
+
readonly kind: "parameters";
|
|
3608
|
+
readonly schema: {
|
|
3609
|
+
readonly path: {
|
|
3610
|
+
readonly type: "string";
|
|
3611
|
+
readonly default: "";
|
|
3612
|
+
readonly description: "Which keys of the document to list, comma-separated and in order. Empty lists the document itself.";
|
|
3613
|
+
};
|
|
3614
|
+
readonly kind: {
|
|
3615
|
+
readonly type: "string";
|
|
3616
|
+
readonly default: "notes";
|
|
3617
|
+
readonly description: "The section's kind: a lowercase slug such as 'plan'.";
|
|
3618
|
+
};
|
|
3619
|
+
readonly label: {
|
|
3620
|
+
readonly type: "string";
|
|
3621
|
+
readonly default: "Notes";
|
|
3622
|
+
readonly description: "The heading the section's button shows.";
|
|
3623
|
+
};
|
|
3624
|
+
};
|
|
3625
|
+
};
|
|
3626
|
+
} | undefined;
|
|
3627
|
+
}>;
|
|
3628
|
+
/**
|
|
3629
|
+
* A list, split into its **first** item and the **rest**, in order (lair pass
|
|
3630
|
+
* R8, 2026-09-28).
|
|
3631
|
+
*
|
|
3632
|
+
* A data reference is `{node, port}` with no sub-path, and `parse-json@1`'s
|
|
3633
|
+
* `path` selects a key or an index but never a tail — so a spec that treats
|
|
3634
|
+
* the first of a list differently from the others (the Lair's lead delver,
|
|
3635
|
+
* whose line streams into the run's live row, before the rest of the party
|
|
3636
|
+
* speak in an `each`) had no way to name "all but the first". Pure: no read,
|
|
3637
|
+
* no model, 1 ms.
|
|
3638
|
+
*
|
|
3639
|
+
* `first` is absent on an empty list, so a junction on it skips the step
|
|
3640
|
+
* that needs one; `rest` is always a list — empty on a list of one or none —
|
|
3641
|
+
* so an `each` wired to it never has to defend itself. Anything that is not
|
|
3642
|
+
* a list is a list of one.
|
|
3643
|
+
* @experimental
|
|
3644
|
+
*/
|
|
3645
|
+
export declare const splitFirst: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3646
|
+
main: string;
|
|
3647
|
+
first: string;
|
|
3648
|
+
rest: string;
|
|
3649
|
+
}, {
|
|
3650
|
+
items: string;
|
|
3651
|
+
}, "core:task/split-first@1"> & {
|
|
3652
|
+
kind: 'task';
|
|
3653
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3654
|
+
}>;
|
|
3655
|
+
/**
|
|
3656
|
+
* A model's JSON answer, read back as data.
|
|
3657
|
+
*
|
|
3658
|
+
* ## Why a Task and not a shape on the Provider
|
|
3659
|
+
*
|
|
3660
|
+
* `core:oracle/generate-text@1` is published and frozen, and it publishes
|
|
3661
|
+
* prose. A pipeline that wants structure out of a model therefore needs one
|
|
3662
|
+
* more step, and that step is the honest place for every way the reading can
|
|
3663
|
+
* fail: a fenced block, a preamble the model could not resist, a reply cut off
|
|
3664
|
+
* by the token limit. Put inside the Provider it would be a second job hidden
|
|
3665
|
+
* in the node that calls the model; here it is a node on the receipt, with its
|
|
3666
|
+
* own timing and its own halt.
|
|
3667
|
+
*
|
|
3668
|
+
* ## `path` is what makes the result WIREABLE
|
|
3669
|
+
*
|
|
3670
|
+
* A data reference is `{node, port}` — there is no sub-path — so a downstream
|
|
3671
|
+
* `map` cannot iterate `plan.speakers` off a port carrying the whole document.
|
|
3672
|
+
* `path` is the answer: the parsed document is always on `json`, and `value`
|
|
3673
|
+
* and `items` carry whatever `path` selects, so one node serves both the step
|
|
3674
|
+
* that reads the whole plan and the block that iterates one list inside it.
|
|
3675
|
+
* `items` is `value` as a list — an absent or single value becomes an empty or
|
|
3676
|
+
* one-element list, so a map wired to it never has to defend itself.
|
|
3677
|
+
*
|
|
3678
|
+
* ## It halts rather than inventing an empty answer
|
|
3679
|
+
*
|
|
3680
|
+
* A reply this node cannot read is a model that did not do what it was asked,
|
|
3681
|
+
* and an empty object published as though it were an answer would travel
|
|
3682
|
+
* downstream as "nothing changed" — indistinguishable from a turn where
|
|
3683
|
+
* genuinely nothing did. `optional: true` on the node is how a spec says it can
|
|
3684
|
+
* live without the structure; the executor then records `recoveredAsEmpty` and
|
|
3685
|
+
* a reader can see which one happened.
|
|
3686
|
+
* @experimental
|
|
3687
|
+
*/
|
|
3688
|
+
export declare const parseJson: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3689
|
+
main: string;
|
|
3690
|
+
/** The whole parsed document, whatever `path` says. */
|
|
3691
|
+
json: string;
|
|
3692
|
+
/** The value at `path` — the document itself when `path` is empty. */
|
|
3693
|
+
value: string;
|
|
3694
|
+
/** That same value as a list, for a `map` to iterate. */
|
|
3695
|
+
items: string;
|
|
3696
|
+
}, {
|
|
3697
|
+
text: string;
|
|
3698
|
+
}, "core:task/parse-json@1"> & {
|
|
3699
|
+
kind: 'task';
|
|
3700
|
+
slots?: {
|
|
3701
|
+
readonly params: {
|
|
3702
|
+
readonly kind: "parameters";
|
|
3703
|
+
readonly schema: {
|
|
3704
|
+
readonly path: {
|
|
3705
|
+
readonly type: "string";
|
|
3706
|
+
readonly quick: true;
|
|
3707
|
+
readonly description: "Which value inside the answer to publish on `value` and `items`, as a dotted path. Empty publishes the whole answer.";
|
|
3708
|
+
};
|
|
3709
|
+
};
|
|
3710
|
+
};
|
|
3711
|
+
} | undefined;
|
|
3712
|
+
}>;
|
|
3713
|
+
/** @internal */
|
|
3714
|
+
export declare const roll: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3715
|
+
main: string;
|
|
3716
|
+
total: string;
|
|
3717
|
+
}, {
|
|
3718
|
+
notation: string;
|
|
3719
|
+
}, "chariot.dice-tray:roll@1"> & {
|
|
3720
|
+
kind: 'task';
|
|
3721
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3722
|
+
}>;
|
|
3723
|
+
/** @internal */
|
|
3724
|
+
export declare const gate: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3725
|
+
main: string;
|
|
3726
|
+
}, {
|
|
3727
|
+
main: string;
|
|
3728
|
+
}, "test:task/gate@1"> & {
|
|
3729
|
+
kind: 'task';
|
|
3730
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3731
|
+
}>;
|
|
3732
|
+
/** @internal */
|
|
3733
|
+
export declare const slow: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3734
|
+
main: string;
|
|
3735
|
+
}, {
|
|
3736
|
+
main: string;
|
|
3737
|
+
}, "test:task/slow@1"> & {
|
|
3738
|
+
kind: 'task';
|
|
3739
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3740
|
+
}>;
|
|
3741
|
+
/** @internal */
|
|
3742
|
+
export declare const passthrough: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3743
|
+
main: string;
|
|
3744
|
+
}, {
|
|
3745
|
+
main: string;
|
|
3746
|
+
}, "test:task/passthrough@1"> & {
|
|
3747
|
+
kind: 'task';
|
|
3748
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3749
|
+
}>;
|
|
3750
|
+
/** @internal */
|
|
3751
|
+
export declare const badToggleable: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3752
|
+
main: string;
|
|
3753
|
+
}, {
|
|
3754
|
+
main: string;
|
|
3755
|
+
}, "test:task/bad-toggleable@1"> & {
|
|
3756
|
+
kind: 'task';
|
|
3757
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3758
|
+
}>;
|
|
3759
|
+
/**
|
|
3760
|
+
* A stream consumer with no `earlyExit` declared — the fixture that proves
|
|
3761
|
+
* stream-abandoned. Its `earlyExit: true` twin lives with the SDK's own suite
|
|
3762
|
+
* (`sdk-tests/fixtures.ts`), where the early-exit proofs are.
|
|
3763
|
+
* @internal
|
|
3764
|
+
*/
|
|
3765
|
+
export declare const sloppyStream: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3766
|
+
main: string;
|
|
3767
|
+
}, {
|
|
3768
|
+
main: string;
|
|
3769
|
+
}, "test:task/sloppy-stream@1"> & {
|
|
3770
|
+
kind: 'task';
|
|
3771
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3772
|
+
}>;
|
|
3773
|
+
/**
|
|
3774
|
+
* The form as a prompt and as a schema. Takes the block and the context the
|
|
3775
|
+
* builder compiled for the addressee, and publishes the context with the
|
|
3776
|
+
* question and the options laid in (`formQuestion`, `formOptions` — what the
|
|
3777
|
+
* assembly template renders under the transcript), the JSON Schema the
|
|
3778
|
+
* oracle answers against (`formAnswerSchema`: an enum of the option keys, or
|
|
3779
|
+
* the field schema), and the question as text. Pure; no model, no rows.
|
|
3780
|
+
* @experimental
|
|
3781
|
+
*/
|
|
3782
|
+
export declare const formContext: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3783
|
+
main: string;
|
|
3784
|
+
templateContext: string;
|
|
3785
|
+
schema: string;
|
|
3786
|
+
question: string;
|
|
3787
|
+
}, {
|
|
3788
|
+
form: string;
|
|
3789
|
+
templateContext: string;
|
|
3790
|
+
}, "core:task/form-context@1"> & {
|
|
3791
|
+
kind: 'task';
|
|
3792
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3793
|
+
}>;
|
|
3794
|
+
/**
|
|
3795
|
+
* An oracle's question, as blocks. Takes the document a `generate-json@1`
|
|
3796
|
+
* produced — `{ question, options: [{ key, label }], addressee? }` — and the
|
|
3797
|
+
* function the options fire, and publishes a block list holding one
|
|
3798
|
+
* `choices` block: the question on it, its options carrying the keys,
|
|
3799
|
+
* addressed to whom the document names. The document's `addressee` is a
|
|
3800
|
+
* **name** the model read off the transcript or a participant reference; a
|
|
3801
|
+
* name is resolved against `cast` into `character:<id>` (or `envoy:<slug>`),
|
|
3802
|
+
* and the `addressee` in-port, when wired, wins over both. A name nobody in
|
|
3803
|
+
* the cast bears leaves the block unaddressed — buttons, not a form. The
|
|
3804
|
+
* host stamps the action identity and the block id at the write; this task
|
|
3805
|
+
* only shapes. `text` is the question as prose, for the row's own content,
|
|
3806
|
+
* so a transcript that reads content alone still carries what was asked. A
|
|
3807
|
+
* document with no options publishes an empty list and an empty text.
|
|
3808
|
+
* @experimental
|
|
3809
|
+
*/
|
|
3810
|
+
export declare const makeChoices: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3811
|
+
main: string;
|
|
3812
|
+
blocks: string;
|
|
3813
|
+
/** The question as prose — the row's content. */
|
|
3814
|
+
text: string;
|
|
3815
|
+
/** Who the block was addressed to, resolved; null when nobody. */
|
|
3816
|
+
addressee: string;
|
|
3817
|
+
}, {
|
|
3818
|
+
/** The oracle's document: `{ question, options, addressee? }`. */
|
|
3819
|
+
json: string;
|
|
3820
|
+
/** The function every option fires — the block's `fn`. */
|
|
3821
|
+
fn: string;
|
|
3822
|
+
/**
|
|
3823
|
+
* The identity of the declaration the options fire, when it is
|
|
3824
|
+
* another spec's (`core:spec/adventure-answer#answer`). Absent,
|
|
3825
|
+
* the host stamps this spec's own declaration for `fn` at the
|
|
3826
|
+
* write.
|
|
3827
|
+
*/
|
|
3828
|
+
action: string;
|
|
3829
|
+
/** Who the question is put to. Wired, it wins over the document's. */
|
|
3830
|
+
addressee: string;
|
|
3831
|
+
/** The cast, to resolve a name the document used into a reference. */
|
|
3832
|
+
cast: string;
|
|
3833
|
+
/**
|
|
3834
|
+
* What the question is about, by name — stamped on the block
|
|
3835
|
+
* as its `referent` and handed back by `read-answer@1` to the
|
|
3836
|
+
* run the press fires (lair pass B12, 2026-09-27: the room the
|
|
3837
|
+
* party knocked at). Blank or absent writes none.
|
|
3838
|
+
*/
|
|
3839
|
+
referent: string;
|
|
3840
|
+
/**
|
|
3841
|
+
* Where the question was asked **from**, by name — stamped on
|
|
3842
|
+
* the block as its `vantage` and handed back by
|
|
3843
|
+
* `read-answer@1`, beside `referent` (plan A27, 2026-09-30:
|
|
3844
|
+
* the room the Lair's planner said the party stood in as
|
|
3845
|
+
* they knocked). JSON because it is usually read off a
|
|
3846
|
+
* model's document (`parse-json@1`'s `value`); anything but
|
|
3847
|
+
* a non-blank string writes none.
|
|
3848
|
+
*/
|
|
3849
|
+
vantage: string;
|
|
3850
|
+
}, "core:task/make-choices@1"> & {
|
|
3851
|
+
kind: 'task';
|
|
3852
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3853
|
+
}>;
|
|
3854
|
+
/**
|
|
3855
|
+
* A form's answer, port by port — for the action a form fires. Takes the
|
|
3856
|
+
* inlet's `payload` (what the press sent) and `form` (the block facts the
|
|
3857
|
+
* host read off the row) and publishes the parts a spec wires: the chosen
|
|
3858
|
+
* option's key and label, the addressee and their character row, the
|
|
3859
|
+
* question, and the answered values. Pure.
|
|
3860
|
+
* @experimental
|
|
3861
|
+
*/
|
|
3862
|
+
export declare const readAnswer: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3863
|
+
main: string;
|
|
3864
|
+
/** The chosen option's key (`choices`), else null. */
|
|
3865
|
+
choice: string;
|
|
3866
|
+
/** The chosen option's label, else null. */
|
|
3867
|
+
label: string;
|
|
3868
|
+
/** Who answered, as a participant reference — the form's addressee. */
|
|
3869
|
+
addressee: string;
|
|
3870
|
+
/** The addressee's character row, null for an envoy or a person. */
|
|
3871
|
+
characterId: string;
|
|
3872
|
+
question: string;
|
|
3873
|
+
/**
|
|
3874
|
+
* What the question was about, by name — the block's
|
|
3875
|
+
* `referent`, as the asking run stamped it (lair pass B12);
|
|
3876
|
+
* empty when it named nothing, never null, so a write wired
|
|
3877
|
+
* to it still offers the field at its review gate (a review
|
|
3878
|
+
* form shows only the fields a payload carries).
|
|
3879
|
+
*/
|
|
3880
|
+
referent: string;
|
|
3881
|
+
/**
|
|
3882
|
+
* Where the question was asked from, by name — the block's
|
|
3883
|
+
* `vantage`, as the asking run stamped it (plan A27); null
|
|
3884
|
+
* when it named nowhere.
|
|
3885
|
+
*/
|
|
3886
|
+
vantage: string;
|
|
3887
|
+
/** The whole answer: `{ choice }` or the entered values. */
|
|
3888
|
+
values: string;
|
|
3889
|
+
}, {
|
|
3890
|
+
payload: string;
|
|
3891
|
+
form: string;
|
|
3892
|
+
}, "core:task/read-answer@1"> & {
|
|
3893
|
+
kind: 'task';
|
|
3894
|
+
slots?: Record<string, SlotDecl> | undefined;
|
|
3895
|
+
}>;
|
|
3896
|
+
/**
|
|
3897
|
+
* Cut the messages into batches a model can hold.
|
|
3898
|
+
*
|
|
3899
|
+
* A Task, not a Query: the cut is a *decision* — how many tokens per batch, and
|
|
3900
|
+
* therefore how much context each draft is written against — and it is the
|
|
3901
|
+
* first parameter a user with long posts reaches for.
|
|
3902
|
+
* @internal
|
|
3903
|
+
*/
|
|
3904
|
+
export declare const batchMessages: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3905
|
+
main: string;
|
|
3906
|
+
batches: string;
|
|
3907
|
+
}, {
|
|
3908
|
+
messages: string;
|
|
3909
|
+
attachments: string;
|
|
3910
|
+
}, "core:task/batch-messages@1"> & {
|
|
3911
|
+
kind: 'task';
|
|
3912
|
+
slots?: {
|
|
3913
|
+
/**
|
|
3914
|
+
* The window the cut is clamped to — the same slot, by reference,
|
|
3915
|
+
* that the drafting step generates against.
|
|
3916
|
+
*
|
|
3917
|
+
* The context window belongs to the sampling config, never to a knob
|
|
3918
|
+
* on a node (17 §1a), and the executor resolves a `sampling` slot to
|
|
3919
|
+
* the config's switched-on *values* — so this stays a pure Task
|
|
3920
|
+
* reading data it was handed rather than a Query looking one up. Same
|
|
3921
|
+
* shape and same reason as `core:task/context-budget@1`.
|
|
3922
|
+
*
|
|
3923
|
+
* ⚠ Wire it as a REFERENCE to the drafting oracle's sampling slot
|
|
3924
|
+
* (`slot.samplingOf(...)`), not as a picker of its own. A batch cut
|
|
3925
|
+
* against one window and drafted against another is wrong in the
|
|
3926
|
+
* direction that overflows, silently — and unlike the assembled
|
|
3927
|
+
* context there is no truncation on this path to catch it, because
|
|
3928
|
+
* the batch prompt is injected whole.
|
|
3929
|
+
*/
|
|
3930
|
+
readonly sampling: {
|
|
3931
|
+
readonly kind: "sampling";
|
|
3932
|
+
readonly quick: true;
|
|
3933
|
+
};
|
|
3934
|
+
readonly params: {
|
|
3935
|
+
readonly kind: "parameters";
|
|
3936
|
+
readonly facet: "weights";
|
|
3937
|
+
readonly schema: {
|
|
3938
|
+
/**
|
|
3939
|
+
* The chat half of a batch prompt, and only that half — the
|
|
3940
|
+
* template around it and the room the draft is written back
|
|
3941
|
+
* into are a reserve the binding adds on top, which is why
|
|
3942
|
+
* this can be raised right up to the window minus that
|
|
3943
|
+
* reserve and no further.
|
|
3944
|
+
*
|
|
3945
|
+
* ⚠ Bigger is not better. Long-context models degrade in the
|
|
3946
|
+
* middle, so this is a QUALITY point rather than a fraction
|
|
3947
|
+
* of whatever window happens to be available: nothing scales
|
|
3948
|
+
* it up to fill a large one, and the window is only ever a
|
|
3949
|
+
* ceiling on what an admin asks for.
|
|
3950
|
+
*
|
|
3951
|
+
* 2560 is 0.5's effective batch (`4096 - 1500`) at a round
|
|
3952
|
+
* 2.5 Ki, so arriving here re-tunes nobody.
|
|
3953
|
+
*/
|
|
3954
|
+
readonly batchTokens: {
|
|
3955
|
+
readonly type: "integer";
|
|
3956
|
+
readonly default: 2560;
|
|
3957
|
+
readonly label: {
|
|
3958
|
+
readonly en: "How much chat each batch holds";
|
|
3959
|
+
};
|
|
3960
|
+
readonly description: {
|
|
3961
|
+
readonly en: "Tokens of chat one summary draft is written from. Capped by the drafting step’s Context Tokens, less room for the prompt and the draft itself.";
|
|
3962
|
+
};
|
|
3963
|
+
};
|
|
3964
|
+
readonly minBatchMessages: {
|
|
3965
|
+
readonly type: "integer";
|
|
3966
|
+
readonly default: 1;
|
|
3967
|
+
readonly description: "Never cut a batch smaller than this many messages.";
|
|
3968
|
+
};
|
|
3969
|
+
};
|
|
3970
|
+
};
|
|
3971
|
+
} | undefined;
|
|
3972
|
+
}>;
|
|
3973
|
+
/** @experimental */
|
|
3974
|
+
export declare const setState: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
3975
|
+
main: string;
|
|
3976
|
+
applied: string;
|
|
3977
|
+
proposed: string;
|
|
3978
|
+
refused: string;
|
|
3979
|
+
}, {
|
|
3980
|
+
changes: string;
|
|
3981
|
+
scope: string;
|
|
3982
|
+
/**
|
|
3983
|
+
* The **state version** the changes are deltas against (plans/29
|
|
3984
|
+
* R-15 *Staleness and order*; U5f) — the session-state query's
|
|
3985
|
+
* `version`, for every change that does not carry its own
|
|
3986
|
+
* `base`. In `apply` mode a base behind the current version is
|
|
3987
|
+
* **rebased**: a change whose slot is untouched since the base
|
|
3988
|
+
* still holds and is applied; one whose slot moved is put on
|
|
3989
|
+
* `refused` with the versions named, and the next turn's
|
|
3990
|
+
* `resolve-state-changes` re-resolves it — a run never re-enters
|
|
3991
|
+
* an earlier node. In `propose` mode the base is stamped on the
|
|
3992
|
+
* proposal for the accept to judge the same way. Optional: with
|
|
3993
|
+
* none, the write is against whatever is current.
|
|
3994
|
+
*/
|
|
3995
|
+
base: string;
|
|
3996
|
+
/**
|
|
3997
|
+
* **The row the WORLD's changes are filed at** (lair pass R8,
|
|
3998
|
+
* 2026-09-28): a message this run wrote earlier, as that
|
|
3999
|
+
* write's result. Optional, and only for world-owned changes
|
|
4000
|
+
* (the session and its places); a cast member's change still
|
|
4001
|
+
* files at that member's own latest line (the turn lock).
|
|
4002
|
+
* Declared, never inferred: the Lair wires its Sanctum beats
|
|
4003
|
+
* row, so the turn's world changes show in the Sanctum beside
|
|
4004
|
+
* the plan that made them rather than on whichever delver
|
|
4005
|
+
* spoke last. A write-result only — a run may name its OWN
|
|
4006
|
+
* row, which is open to it for the rest of its turn; any
|
|
4007
|
+
* other value is refused.
|
|
4008
|
+
*/
|
|
4009
|
+
worldRow: string;
|
|
4010
|
+
}, "core:task/set-state@1"> & {
|
|
4011
|
+
kind: 'task';
|
|
4012
|
+
slots?: {
|
|
4013
|
+
readonly params: {
|
|
4014
|
+
readonly kind: "parameters";
|
|
4015
|
+
readonly schema: {
|
|
4016
|
+
readonly mode: {
|
|
4017
|
+
readonly type: "enum";
|
|
4018
|
+
readonly of: readonly ["propose", "apply"];
|
|
4019
|
+
readonly members: readonly [{
|
|
4020
|
+
readonly key: "propose";
|
|
4021
|
+
readonly label: {
|
|
4022
|
+
readonly en: "Propose";
|
|
4023
|
+
};
|
|
4024
|
+
readonly description: {
|
|
4025
|
+
readonly en: "Holds the changes for the player to accept or reject.";
|
|
4026
|
+
};
|
|
4027
|
+
}, {
|
|
4028
|
+
readonly key: "apply";
|
|
4029
|
+
readonly label: {
|
|
4030
|
+
readonly en: "Apply";
|
|
4031
|
+
};
|
|
4032
|
+
readonly description: {
|
|
4033
|
+
readonly en: "Writes them immediately, stamped with this run. Only where the pipeline itself decided the number.";
|
|
4034
|
+
};
|
|
4035
|
+
}];
|
|
4036
|
+
readonly default: "propose";
|
|
4037
|
+
readonly quick: true;
|
|
4038
|
+
readonly description: "Whether the changes wait for the player or are written at once. Use Apply only where the pipeline itself decided the number.";
|
|
4039
|
+
};
|
|
4040
|
+
};
|
|
4041
|
+
};
|
|
4042
|
+
} | undefined;
|
|
4043
|
+
}>;
|
|
4044
|
+
/**
|
|
4045
|
+
* A room name, unless something already describes it (lair pass R7,
|
|
4046
|
+
* 2026-09-28; replaced `core:task/unlisted-name@1`).
|
|
4047
|
+
*
|
|
4048
|
+
* The Lair's planner names the room the party are about to walk into when it
|
|
4049
|
+
* thinks nobody has built it, and the turn stops to ask the dungeon's master
|
|
4050
|
+
* to describe it (owner ruling 2, 2026-09-28: *ask, unless it is already
|
|
4051
|
+
* described in prose or the lorebook*). This is the deterministic check after
|
|
4052
|
+
* the planner's judgement. Lookups, in order; the first hit wins:
|
|
4053
|
+
*
|
|
4054
|
+
* 1. **Entry.** An entry whose `name`, or any of whose `keys` (a list, or a
|
|
4055
|
+
* comma-separated string, split on commas), is the same name. Entries on
|
|
4056
|
+
* `locationEntries` are checked before `entries`. Any entry type counts.
|
|
4057
|
+
* → `describedBy` `entry`, `entryId`.
|
|
4058
|
+
* 2. **Prose.** Among the newest `window` rows of `messages` on the
|
|
4059
|
+
* `channels` named, the newest row whose author is **a person, an envoy or
|
|
4060
|
+
* a speakerless reply** — never a character: a delver's line naming a door
|
|
4061
|
+
* is not a description — with a paragraph (split on blank lines) that
|
|
4062
|
+
* names the name and holds at least `minWords` words besides it.
|
|
4063
|
+
* → `describedBy` `prose`, `passage` (that paragraph).
|
|
4064
|
+
* 3. Otherwise `undescribed` is the name, trimmed.
|
|
4065
|
+
*
|
|
4066
|
+
* "The same name" and "names the name" are the SDK's name rule
|
|
4067
|
+
* (`normalizeName`, `sameName`, `passageNaming` in `names.ts`): NFKC, case,
|
|
4068
|
+
* a possessive `'s`, apostrophes and punctuation, and one leading article —
|
|
4069
|
+
* then whole equality, never a substring ("the vault" is not "the sunken
|
|
4070
|
+
* vault").
|
|
4071
|
+
*
|
|
4072
|
+
* Pure: the rows come in on ports (a `core:query/lorebook-entries@1` listing,
|
|
4073
|
+
* a `core:query/session-history@1` read), so a genre decides what is read
|
|
4074
|
+
* and the task decides only what counts. `channels` filters the rows by their
|
|
4075
|
+
* own `channel` (a bare slug is every lane of it), so a core task never
|
|
4076
|
+
* hard-codes a genre's slug: a spec that wants a side channel's prose to count
|
|
4077
|
+
* reads it and names it here.
|
|
4078
|
+
*
|
|
4079
|
+
* ## Which room is this one (places plan B6, 2026-09-29)
|
|
4080
|
+
*
|
|
4081
|
+
* The same lookup answers the Lair's other question: *which room do the party
|
|
4082
|
+
* stand in?* — the world's `location` stat, resolved against the rooms, so
|
|
4083
|
+
* *Answer the door* can link the room it writes to it. Two things make that
|
|
4084
|
+
* wireable:
|
|
4085
|
+
*
|
|
4086
|
+
* - **`path`**: a data reference has no sub-path, and the location sits
|
|
4087
|
+
* inside a `core:query/session-state@1` document, so `path` says where the
|
|
4088
|
+
* name is inside `name` (`world.location`) — the dotted spelling
|
|
4089
|
+
* `parse-json@1` and `generate-json@1` read. Empty reads `name` itself.
|
|
4090
|
+
* - **A lore reference is its entry.** A location stat set to a place entry
|
|
4091
|
+
* holds `{ entryId }`, not words, and naming it again by its title would
|
|
4092
|
+
* find a namesake. So a value with an `entryId` is answered by the listed
|
|
4093
|
+
* entry with that id (`describedBy` `entry`), and by nothing when no
|
|
4094
|
+
* listing holds it — archived, or hidden from this read.
|
|
4095
|
+
* - **`fallbackName`** (plan A27, 2026-09-30): what to look for when `name`
|
|
4096
|
+
* (at `path`) names nothing — for the Lair, the room its planner said the
|
|
4097
|
+
* party stood in as they knocked (the knock's `vantage`). The world's
|
|
4098
|
+
* value wins and the hint stands in only while it names nothing: the
|
|
4099
|
+
* order a play turn's prompts read the location in (the world's value,
|
|
4100
|
+
* else that turn's plan). No prompt in the knock turn shows the hinted
|
|
4101
|
+
* room; it is the planner's own answer for that turn. Read whole, by the
|
|
4102
|
+
* same rules as `name`.
|
|
4103
|
+
* @experimental
|
|
4104
|
+
*/
|
|
4105
|
+
export declare const undescribedName: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
4106
|
+
main: string;
|
|
4107
|
+
/** `name`, trimmed, when nothing describes it; else empty. */
|
|
4108
|
+
undescribed: string;
|
|
4109
|
+
/** `entry`, `prose`, or empty when nothing describes it. */
|
|
4110
|
+
describedBy: string;
|
|
4111
|
+
/** The describing entry's id, or null. */
|
|
4112
|
+
entryId: string;
|
|
4113
|
+
/** The describing paragraph, or empty. */
|
|
4114
|
+
passage: string;
|
|
4115
|
+
}, {
|
|
4116
|
+
/**
|
|
4117
|
+
* The name to look for — JSON rather than text because it is
|
|
4118
|
+
* usually read off a model's document (`parse-json@1`'s
|
|
4119
|
+
* `value`), or a document holding it at `path`; anything but a
|
|
4120
|
+
* string is no name, and nothing is undescribed — save a lore
|
|
4121
|
+
* reference (`{ entryId }`), which is the listed entry it
|
|
4122
|
+
* references (B6).
|
|
4123
|
+
*/
|
|
4124
|
+
name: string;
|
|
4125
|
+
/**
|
|
4126
|
+
* What to look for when `name` at `path` names nothing — a
|
|
4127
|
+
* name or a lore reference, read whole (no `path`). Unwired,
|
|
4128
|
+
* nothing is looked for in its place.
|
|
4129
|
+
*/
|
|
4130
|
+
fallbackName: string;
|
|
4131
|
+
/** Location entries (rows with `id`, `name`, `keys`), checked first. */
|
|
4132
|
+
locationEntries: string;
|
|
4133
|
+
/** The rest of the book, any entry type, checked second. */
|
|
4134
|
+
entries: string;
|
|
4135
|
+
/** Recent rows, ascending, each carrying its `channel`. */
|
|
4136
|
+
messages: string;
|
|
4137
|
+
}, "core:task/undescribed-name@1"> & {
|
|
4138
|
+
kind: 'task';
|
|
4139
|
+
slots?: {
|
|
4140
|
+
readonly params: {
|
|
4141
|
+
readonly kind: "parameters";
|
|
4142
|
+
readonly facet: "behavior";
|
|
4143
|
+
readonly schema: {
|
|
4144
|
+
/**
|
|
4145
|
+
* Whose prose counts, by channel slug. `main` by default;
|
|
4146
|
+
* the Lair adds its side channel so a room its master
|
|
4147
|
+
* described there counts too.
|
|
4148
|
+
*/
|
|
4149
|
+
readonly channels: {
|
|
4150
|
+
readonly type: "string";
|
|
4151
|
+
readonly list: true;
|
|
4152
|
+
readonly default: readonly ["main"];
|
|
4153
|
+
readonly label: {
|
|
4154
|
+
readonly en: "Channels read";
|
|
4155
|
+
};
|
|
4156
|
+
readonly description: {
|
|
4157
|
+
readonly en: "Which channels’ messages can describe a room. A slug covers every lane of that channel.";
|
|
4158
|
+
};
|
|
4159
|
+
};
|
|
4160
|
+
/** How far back prose counts, in rows across those channels. */
|
|
4161
|
+
readonly window: {
|
|
4162
|
+
readonly type: "integer";
|
|
4163
|
+
readonly default: 40;
|
|
4164
|
+
readonly min: 1;
|
|
4165
|
+
readonly max: 500;
|
|
4166
|
+
readonly label: {
|
|
4167
|
+
readonly en: "Messages read";
|
|
4168
|
+
};
|
|
4169
|
+
readonly description: {
|
|
4170
|
+
readonly en: "How many of the newest messages on those channels are searched for a description.";
|
|
4171
|
+
};
|
|
4172
|
+
};
|
|
4173
|
+
/**
|
|
4174
|
+
* How long a paragraph must be to be a description rather
|
|
4175
|
+
* than a mention: words besides the name itself.
|
|
4176
|
+
*/
|
|
4177
|
+
readonly minWords: {
|
|
4178
|
+
readonly type: "integer";
|
|
4179
|
+
readonly default: 12;
|
|
4180
|
+
readonly min: 0;
|
|
4181
|
+
readonly max: 500;
|
|
4182
|
+
readonly label: {
|
|
4183
|
+
readonly en: "Words to describe";
|
|
4184
|
+
};
|
|
4185
|
+
readonly description: {
|
|
4186
|
+
readonly en: "How many words, besides the name, a paragraph needs before it counts as describing the room rather than mentioning it.";
|
|
4187
|
+
};
|
|
4188
|
+
};
|
|
4189
|
+
/**
|
|
4190
|
+
* Where the name is inside `name`, as a dotted path (places
|
|
4191
|
+
* plan B6) — the Lair reads `world.location` off a
|
|
4192
|
+
* session-state document. Empty reads `name` itself.
|
|
4193
|
+
*/
|
|
4194
|
+
readonly path: {
|
|
4195
|
+
readonly type: "string";
|
|
4196
|
+
readonly default: "";
|
|
4197
|
+
readonly label: {
|
|
4198
|
+
readonly en: "Where the name is";
|
|
4199
|
+
};
|
|
4200
|
+
readonly description: {
|
|
4201
|
+
readonly en: "Where the name sits inside what is wired in, as a dotted path such as world.location. Leave it empty when the name itself is wired in.";
|
|
4202
|
+
};
|
|
4203
|
+
};
|
|
4204
|
+
};
|
|
4205
|
+
};
|
|
4206
|
+
} | undefined;
|
|
4207
|
+
}>;
|
|
4208
|
+
/**
|
|
4209
|
+
* The item this session picks — a pure function of a key and a list.
|
|
4210
|
+
*
|
|
4211
|
+
* ## The gap it closes
|
|
4212
|
+
*
|
|
4213
|
+
* Nothing in the bound catalogue evaluated a pure function over run data. The
|
|
4214
|
+
* closest was `core:task/turn-random@1`, which draws on `ctx.random` — seeded
|
|
4215
|
+
* per RUN, so it answers differently every turn — and that is right for whose
|
|
4216
|
+
* turn it is and useless for a fact that has to stay the same all game. So a
|
|
4217
|
+
* genre wanting its hidden fact **chosen** (which suspect did it, which lore
|
|
4218
|
+
* entry the answer is) had two options and neither was honest: ask a model,
|
|
4219
|
+
* which can change its mind between two answers, or write it into the one
|
|
4220
|
+
* per-session store a spec can reach — the attribute-slot ledger, which the
|
|
4221
|
+
* player's own state panel renders. Whodunit shipped adjudicating from an
|
|
4222
|
+
* authored case file for exactly this reason, with its rendezvous rule
|
|
4223
|
+
* published, tested and called by nobody.
|
|
4224
|
+
*
|
|
4225
|
+
* Derived instead: the create run and every later turn hand the same
|
|
4226
|
+
* `scopeKey` and the same list to this node and reach the same item, with
|
|
4227
|
+
* nothing written down anywhere and nothing on screen.
|
|
4228
|
+
*
|
|
4229
|
+
* ## Rendezvous hashing, and why not `list[hash % length]`
|
|
4230
|
+
*
|
|
4231
|
+
* Each candidate is scored on its own — `hash(key + '#' + itemKey)` — and the
|
|
4232
|
+
* highest wins (`rendezvousPick`, SDK `pick.ts`, the one implementation the
|
|
4233
|
+
* app's binding and a plugin's own picker share). A modulo into the list
|
|
4234
|
+
* moves *every* session's answer when the list length changes; rendezvous
|
|
4235
|
+
* moves it exactly when the newcomer's own score wins, so seating a fifth
|
|
4236
|
+
* suspect mid-case displaces the culprit in about a fifth of sessions and
|
|
4237
|
+
* leaves the rest alone. The hash carries murmur3's `fmix32` finalizer
|
|
4238
|
+
* because the comparison is over whole hashes and plain FNV-1a leaves the
|
|
4239
|
+
* high bits systematic for ids differing in their last digit — measured at
|
|
4240
|
+
* 49% of sessions for the first of three, instead of 33%.
|
|
4241
|
+
*
|
|
4242
|
+
* ## `scopeKey` is the session's address, never the run's seed
|
|
4243
|
+
*
|
|
4244
|
+
* A spec wires `$.input.sessionScope` (or a literal) — something durable. The
|
|
4245
|
+
* run's seed is a different string every turn and a pick keyed on it would
|
|
4246
|
+
* move between two questions. It is `scopeKey` and not `key` (R3, named
|
|
4247
|
+
* 2026-09-17, before anything shipped): *key* alone is the option key on a
|
|
4248
|
+
* choice, the identity a candidate is scored under, and a settings field's
|
|
4249
|
+
* name, and this port is none of them — it is the scope the pick is made
|
|
4250
|
+
* within.
|
|
4251
|
+
*
|
|
4252
|
+
* ## No `optional`
|
|
4253
|
+
*
|
|
4254
|
+
* Absent, so an empty list is the run's failure. A genre that derived its
|
|
4255
|
+
* secret from this node cannot be handed "nobody" and carry on, and
|
|
4256
|
+
* `optional: true` would turn that into an `ok` with every downstream port
|
|
4257
|
+
* reading absent — indistinguishable from a turn where the pick genuinely
|
|
4258
|
+
* chose nothing.
|
|
4259
|
+
* @experimental
|
|
4260
|
+
*/
|
|
4261
|
+
export declare const pickByHash: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
4262
|
+
/** The chosen entry, whole and exactly as it arrived. */
|
|
4263
|
+
main: string;
|
|
4264
|
+
/**
|
|
4265
|
+
* Where it sat in the list **as handed in**, not among the
|
|
4266
|
+
* identifiable entries. `pickIndex` rather than `index`
|
|
4267
|
+
* (R3): a bare *index* is a database index, a message's
|
|
4268
|
+
* position and a list offset all at once.
|
|
4269
|
+
*/
|
|
4270
|
+
pickIndex: string;
|
|
4271
|
+
/**
|
|
4272
|
+
* The identity it won under — the string the hash was taken
|
|
4273
|
+
* over. This is the side a later junction compares an answer
|
|
4274
|
+
* against with `equalsPath`, which is why it is published at
|
|
4275
|
+
* all: the chosen item is a document, and a predicate
|
|
4276
|
+
* compares keys.
|
|
4277
|
+
*/
|
|
4278
|
+
chosenKey: string;
|
|
4279
|
+
}, {
|
|
4280
|
+
/** The list to pick from. */
|
|
4281
|
+
items: string;
|
|
4282
|
+
/**
|
|
4283
|
+
* The stable key this session picks under.
|
|
4284
|
+
*
|
|
4285
|
+
* Either the session's **scope** — `$.input.sessionScope`,
|
|
4286
|
+
* which the binding spells `session:<id>` — or a literal
|
|
4287
|
+
* string for a pick that is not per-session.
|
|
4288
|
+
*
|
|
4289
|
+
* ⚠ `S.json` rather than `S.text`, and not for want of a
|
|
4290
|
+
* type. `session-scope@1` is not assignable to `text@1`, and
|
|
4291
|
+
* there is no text-shaped port anywhere that carries a
|
|
4292
|
+
* session's identity — so a `text` port here could be wired
|
|
4293
|
+
* to a literal and to nothing else, which would give every
|
|
4294
|
+
* session of a genre the same answer. `json` is the
|
|
4295
|
+
* permissive sink, so the scope wires, a literal wires, and
|
|
4296
|
+
* anything a spec wires that the binding cannot read as a key
|
|
4297
|
+
* halts with a sentence naming what to wire instead.
|
|
4298
|
+
*/
|
|
4299
|
+
scopeKey: string;
|
|
4300
|
+
}, "core:task/pick-by-hash@1"> & {
|
|
4301
|
+
kind: 'task';
|
|
4302
|
+
slots?: {
|
|
4303
|
+
readonly params: {
|
|
4304
|
+
readonly kind: "parameters";
|
|
4305
|
+
readonly schema: {
|
|
4306
|
+
/**
|
|
4307
|
+
* Which field on each entry identifies it.
|
|
4308
|
+
*
|
|
4309
|
+
* The identity is what the hash is taken over, so it
|
|
4310
|
+
* decides the answer: two runs that disagree about it
|
|
4311
|
+
* disagree about the pick. Absent, an entry that IS a
|
|
4312
|
+
* string is its own identity and anything else is
|
|
4313
|
+
* identified by `id` — the two shapes a core list
|
|
4314
|
+
* actually arrives in (`cast-choices` publishes `key`,
|
|
4315
|
+
* a lore listing publishes rows with `id`).
|
|
4316
|
+
*
|
|
4317
|
+
* ⚠ It must be **stable**: a name the author may edit
|
|
4318
|
+
* moves the pick the day they edit it. A row id does not.
|
|
4319
|
+
*/
|
|
4320
|
+
readonly by: {
|
|
4321
|
+
readonly type: "string";
|
|
4322
|
+
readonly quick: true;
|
|
4323
|
+
readonly label: {
|
|
4324
|
+
readonly en: "Identified by";
|
|
4325
|
+
};
|
|
4326
|
+
readonly description: "Which field on each entry identifies it — a row id, or the option key. Leave it empty for plain strings, or for rows with an `id`.";
|
|
4327
|
+
};
|
|
4328
|
+
};
|
|
4329
|
+
};
|
|
4330
|
+
} | undefined;
|
|
4331
|
+
}>;
|
|
4332
|
+
/**
|
|
4333
|
+
* The room, as options a question can be put with.
|
|
4334
|
+
*
|
|
4335
|
+
* `core:task/make-choices@1` needs `{ key, label }` options and nothing in
|
|
4336
|
+
* core turned a cast into that list, so both Whodunit pickers spend a model
|
|
4337
|
+
* call whose entire job is to read the cast back out as JSON — a request, a
|
|
4338
|
+
* schema and a wait, for a fact the run already held. Worse than slow: a
|
|
4339
|
+
* model enumerating the room can misspell a suspect, invent one, or leave one
|
|
4340
|
+
* out, and the options it writes are what the player may press.
|
|
4341
|
+
*
|
|
4342
|
+
* Pure. The cast read is the fact; this shapes it.
|
|
4343
|
+
*
|
|
4344
|
+
* ## The key is a participant reference
|
|
4345
|
+
*
|
|
4346
|
+
* `character:<id>`, the reference vocabulary (R-18 (3)) — not a name, which
|
|
4347
|
+
* two cast members can share and an author can edit, and not a bare id, which
|
|
4348
|
+
* says nothing about what it identifies. It survives the round trip: the key
|
|
4349
|
+
* lands on the pressed option, `core:task/read-answer@1` publishes it as
|
|
4350
|
+
* `choice`, and a junction can compare that against a
|
|
4351
|
+
* `core:task/pick-by-hash@1` `chosenKey` derived over these same options.
|
|
4352
|
+
*
|
|
4353
|
+
* ## Who is in the list
|
|
4354
|
+
*
|
|
4355
|
+
* Live seats only — a departed or inactive cast member is not somebody a
|
|
4356
|
+
* question may be put about — and **never an envoy**: `exclude` offers no way
|
|
4357
|
+
* to turn one off, and a narrator among the suspects with no way to remove it
|
|
4358
|
+
* is worse than a narrator a spec has to add for itself.
|
|
4359
|
+
*
|
|
4360
|
+
* ## It publishes the whole document, not only the list (ruled (b), 2026-09-17)
|
|
4361
|
+
*
|
|
4362
|
+
* `make-choices@1` reads `{ question, options, addressee? }` off ONE `json`
|
|
4363
|
+
* port, so a spec handed only `options` still has nowhere to put the question
|
|
4364
|
+
* — and the obvious repair, a second in-port on `make-choices`, would move
|
|
4365
|
+
* the hash of a node that is published and wired into shipped specs. So the
|
|
4366
|
+
* shaping happens on this side: `question` comes in, `json` goes out in
|
|
4367
|
+
* exactly the shape that port reads, and the two nodes wire straight to each
|
|
4368
|
+
* other with no model call in between. `options` stays beside it for a spec
|
|
4369
|
+
* that wants the bare list (a pick over the same options, a `each` over the
|
|
4370
|
+
* room), which is the same value the document carries.
|
|
4371
|
+
*
|
|
4372
|
+
* No `addressee`: the document's is a **name** `make-choices` resolves
|
|
4373
|
+
* against the cast, and this node has no more idea who the question is for
|
|
4374
|
+
* than the cast document does. A spec that knows wires `make-choices`'s own
|
|
4375
|
+
* `addressee` port, which wins over the document's anyway.
|
|
4376
|
+
* @experimental
|
|
4377
|
+
*/
|
|
4378
|
+
export declare const castChoices: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
4379
|
+
/** `{ key, label }[]`, in seating order: characters, then personas. */
|
|
4380
|
+
main: string;
|
|
4381
|
+
options: string;
|
|
4382
|
+
/**
|
|
4383
|
+
* `{ question, options }` — the document
|
|
4384
|
+
* `core:task/make-choices@1` reads off its own `json` port,
|
|
4385
|
+
* in exactly that shape, so the two wire straight to each
|
|
4386
|
+
* other and no oracle stands between a cast read and the
|
|
4387
|
+
* question it is asked with.
|
|
4388
|
+
*/
|
|
4389
|
+
json: string;
|
|
4390
|
+
}, {
|
|
4391
|
+
cast: string;
|
|
4392
|
+
/**
|
|
4393
|
+
* The question the options answer — the prose that sits
|
|
4394
|
+
* above them on the block, and the row's own content.
|
|
4395
|
+
*
|
|
4396
|
+
* Unwired it is the empty string, and `make-choices@1`
|
|
4397
|
+
* publishes no block for a document with no question — the
|
|
4398
|
+
* same silence it answers an empty option list with, rather
|
|
4399
|
+
* than a block asking nothing.
|
|
4400
|
+
*/
|
|
4401
|
+
question: string;
|
|
4402
|
+
}, "core:task/cast-choices@1"> & {
|
|
4403
|
+
kind: 'task';
|
|
4404
|
+
slots?: {
|
|
4405
|
+
readonly params: {
|
|
4406
|
+
readonly kind: "parameters";
|
|
4407
|
+
readonly schema: {
|
|
4408
|
+
/**
|
|
4409
|
+
* Which half of the room to leave out.
|
|
4410
|
+
*
|
|
4411
|
+
* A persona is a character the player voices (0132), so
|
|
4412
|
+
* both halves are cast members and which one a question
|
|
4413
|
+
* is about depends entirely on the question: *who do you
|
|
4414
|
+
* accuse* is asked about the suspects and must not offer
|
|
4415
|
+
* the detective, while *who do you play* is the other way
|
|
4416
|
+
* round.
|
|
4417
|
+
*/
|
|
4418
|
+
readonly exclude: {
|
|
4419
|
+
readonly type: "enum";
|
|
4420
|
+
readonly of: readonly ["none", "personas", "characters"];
|
|
4421
|
+
readonly members: readonly [{
|
|
4422
|
+
readonly key: "none";
|
|
4423
|
+
readonly label: {
|
|
4424
|
+
readonly en: "Nobody";
|
|
4425
|
+
};
|
|
4426
|
+
}, {
|
|
4427
|
+
readonly key: "personas";
|
|
4428
|
+
readonly label: {
|
|
4429
|
+
readonly en: "Personas";
|
|
4430
|
+
};
|
|
4431
|
+
readonly description: {
|
|
4432
|
+
readonly en: "The characters the players voice.";
|
|
4433
|
+
};
|
|
4434
|
+
}, {
|
|
4435
|
+
readonly key: "characters";
|
|
4436
|
+
readonly label: {
|
|
4437
|
+
readonly en: "Characters";
|
|
4438
|
+
};
|
|
4439
|
+
readonly description: {
|
|
4440
|
+
readonly en: "The rest of the cast.";
|
|
4441
|
+
};
|
|
4442
|
+
}];
|
|
4443
|
+
readonly default: "none";
|
|
4444
|
+
readonly quick: true;
|
|
4445
|
+
readonly label: {
|
|
4446
|
+
readonly en: "Left out";
|
|
4447
|
+
};
|
|
4448
|
+
readonly description: "Leave out the characters the players voice (personas), the rest of the cast (characters), or nobody.";
|
|
4449
|
+
};
|
|
4450
|
+
};
|
|
4451
|
+
};
|
|
4452
|
+
} | undefined;
|
|
4453
|
+
}>;
|
|
4454
|
+
/**
|
|
4455
|
+
* Two values, side by side in one document, under names a path can read.
|
|
4456
|
+
*
|
|
4457
|
+
* ## The gap it closes
|
|
4458
|
+
*
|
|
4459
|
+
* A junction branches on **one** port, and `equalsPath` compares two paths of
|
|
4460
|
+
* **one** document (D-4a). So the grammar can ask *is the accused the culprit?*
|
|
4461
|
+
* only once something has put the accused and the culprit in the same
|
|
4462
|
+
* document, and nothing in core did: no task merged two json ports, and the
|
|
4463
|
+
* obvious repair — a second in-port on the junction — is not a repair, it is a
|
|
4464
|
+
* different clause. Whodunit shipped with its verdict's `accused` node wired to
|
|
4465
|
+
* nothing for exactly this reason.
|
|
4466
|
+
*
|
|
4467
|
+
* Pure, and deliberately the dullest node in the catalogue. It computes
|
|
4468
|
+
* nothing, decides nothing and reads nothing: it is the shape change that lets
|
|
4469
|
+
* a predicate see both sides.
|
|
4470
|
+
*
|
|
4471
|
+
* ## ⚠ An absent side is **omitted**, never null
|
|
4472
|
+
*
|
|
4473
|
+
* This is the whole of the node's behaviour worth stating. `predicateHolds`
|
|
4474
|
+
* answers `false` when either side of an `equalsPath` is `undefined` — two
|
|
4475
|
+
* absences are not a match — and that rule is what makes a junction over this
|
|
4476
|
+
* document **safe on a turn where nothing was decided**: a run in which the
|
|
4477
|
+
* accuse never happened has no `accused`, so
|
|
4478
|
+
* `{ path: 'accused', equalsPath: 'culprit' }` fires nothing, and the spec
|
|
4479
|
+
* falls through to its default branch.
|
|
4480
|
+
*
|
|
4481
|
+
* Writing `null` for an unwired side would destroy that. `null` is a *value*:
|
|
4482
|
+
* `readPath` returns it, it is not `undefined`, and `null === null` — so a
|
|
4483
|
+
* document with both sides missing would compare **equal** and the verdict
|
|
4484
|
+
* branch would fire on a turn where nobody accused anybody. The omission is
|
|
4485
|
+
* therefore load-bearing and pinned by a test, not an implementation detail of
|
|
4486
|
+
* the handler.
|
|
4487
|
+
*
|
|
4488
|
+
* The same rule covers the side that is wired but produced nothing: a port
|
|
4489
|
+
* resolving absent is absent here too. What arrives is written; what does not
|
|
4490
|
+
* is not mentioned.
|
|
4491
|
+
*
|
|
4492
|
+
* ## The names are the spec's
|
|
4493
|
+
*
|
|
4494
|
+
* `firstKey` and `secondKey` decide what the document's keys are called, so
|
|
4495
|
+
* the same node reads as `{ accused, culprit }` in one spec and
|
|
4496
|
+
* `{ guess, secret }` in another and the predicate paths are the spec's own
|
|
4497
|
+
* words. Defaults `first` and `second`, which are honest and nobody would
|
|
4498
|
+
* write a predicate against on purpose.
|
|
4499
|
+
*
|
|
4500
|
+
* Two keys that are the same string are refused rather than collapsed: one key
|
|
4501
|
+
* holding whichever side was written last is a document that compares equal to
|
|
4502
|
+
* itself, which is the one answer this node must never produce by accident.
|
|
4503
|
+
* @experimental
|
|
4504
|
+
*/
|
|
4505
|
+
export declare const pair: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
|
|
4506
|
+
/**
|
|
4507
|
+
* `{ [firstKey]: first, [secondKey]: second }`, with an absent
|
|
4508
|
+
* side **omitted** — see the note above; it is the property a
|
|
4509
|
+
* junction over this document depends on.
|
|
4510
|
+
*/
|
|
4511
|
+
main: string;
|
|
4512
|
+
}, {
|
|
4513
|
+
/** Whatever the spec wants compared. Absent is a legal input. */
|
|
4514
|
+
first: string;
|
|
4515
|
+
second: string;
|
|
4516
|
+
}, "core:task/pair@1"> & {
|
|
4517
|
+
kind: 'task';
|
|
4518
|
+
slots?: {
|
|
4519
|
+
readonly params: {
|
|
4520
|
+
readonly kind: "parameters";
|
|
4521
|
+
readonly schema: {
|
|
4522
|
+
readonly firstKey: {
|
|
4523
|
+
readonly type: "string";
|
|
4524
|
+
readonly default: "first";
|
|
4525
|
+
readonly quick: true;
|
|
4526
|
+
readonly label: {
|
|
4527
|
+
readonly en: "Name for the first value";
|
|
4528
|
+
};
|
|
4529
|
+
readonly description: "What the first value is called in the document — the word a branch reads it by.";
|
|
4530
|
+
};
|
|
4531
|
+
readonly secondKey: {
|
|
4532
|
+
readonly type: "string";
|
|
4533
|
+
readonly default: "second";
|
|
4534
|
+
readonly quick: true;
|
|
4535
|
+
readonly label: {
|
|
4536
|
+
readonly en: "Name for the second value";
|
|
4537
|
+
};
|
|
4538
|
+
readonly description: "What the second value is called in the document. It must differ from the first.";
|
|
4539
|
+
};
|
|
4540
|
+
};
|
|
4541
|
+
};
|
|
4542
|
+
} | undefined;
|
|
4543
|
+
}>;
|
|
4544
|
+
//# sourceMappingURL=tasks.d.ts.map
|