@serene-pub/contracts 0.6.0-pr-1 → 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.
@@ -0,0 +1,3318 @@
1
+ /**
2
+ * Core's **query** node definitions — reads.
3
+ *
4
+ * One file per node kind, with the helpers only that kind uses; `index.ts`
5
+ * re-exports them all.
6
+ */
7
+ /** @public */
8
+ export declare const sessionHistory: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
9
+ /**
10
+ * Transcript rows, on both — `messages@1` (was
11
+ * `context-candidates@1` until 2026-09-17, U5d review W9: the
12
+ * value had always been rows, for `process-messages` and
13
+ * `prose-transcript`, and the intent rides `band` alone).
14
+ * Neither is a candidates list (R-a, the same day): a spec that
15
+ * wires either into a merge, a concat or `assemble`'s
16
+ * `candidates` gets a `validate()` warning naming `band` — the
17
+ * host drops rows handed as candidates rather than ranking them.
18
+ */
19
+ main: string;
20
+ messages: string;
21
+ /**
22
+ * The conversation's **band intent**, alone — a candidates
23
+ * list holding one element and no items (`BandIntent`), for a
24
+ * spec to concatenate in with the lore so the ranker reserves
25
+ * the transcript's slice. Its own port because `main` and
26
+ * `messages` carry transcript rows for `process-messages`, and
27
+ * an intent element ahead of them would be read as a message.
28
+ * Opens with a band-intent element (and holds nothing else)
29
+ * — readers call `splitCandidates()`.
30
+ */
31
+ band: string;
32
+ }, {
33
+ scope: string;
34
+ /**
35
+ * **The window this read is sized by** (history window,
36
+ * 2026-10-03) — `$.contextBudget.available`, the same value
37
+ * the prompt's `assemble` is handed. Wired, the read is the
38
+ * newest rows until a deliberately generous estimate
39
+ * (characters ÷ 4, nothing for names or scaffolding) reaches
40
+ * **twice** the budget's `total`, or every row — never more
41
+ * than 2000 — and `limit` is not read. Fitting those rows to
42
+ * the window stays `assemble`'s (its transcript fit, which
43
+ * cuts the oldest lines in a chunk and holds the cut across
44
+ * turns): reading twice what fits is what lets that held cut,
45
+ * not a row count, decide where the conversation starts.
46
+ * Unwired, the window is the newest `limit` rows, as it
47
+ * always was.
48
+ *
49
+ * Not read with `unplayedOnly` (the talk keeps its `limit`)
50
+ * or a wired `messageId` (one row). There was a `budget`
51
+ * in-port once (culled 2026-09-16, R-12): declared and read by
52
+ * nothing. This one has a reader.
53
+ */
54
+ budget: string;
55
+ /**
56
+ * **One row, by id** (lair re-plan R11, 2026-09-28): wired —
57
+ * `$.input.messageId`, the message a press on a message's ⋮
58
+ * was made on — the read is exactly that row, whatever its
59
+ * channel, as a one-row transcript; `limit`, `budget`,
60
+ * `channel`, `unplayedOnly` and `talkOnly` do not apply. The row must be
61
+ * this session's, and a hidden or still-generating row reads
62
+ * as nothing, the same as in any window. Unwired, the window
63
+ * reads as it always did. For an action that acts on the row
64
+ * it was pressed on (the Lair's *File as a room*): the inlet
65
+ * carries the id, never the text, so the row is read here.
66
+ */
67
+ messageId: string;
68
+ }, "core:query/session-history@1"> & {
69
+ kind: 'query';
70
+ slots?: {
71
+ /**
72
+ * ⚠ No `template` slot, and there was one.
73
+ *
74
+ * It declared "how each chat message is written into the context",
75
+ * and three things were true of it: no binding ever read it, no row
76
+ * was ever seeded for its pool, and so the panel rendered a picker
77
+ * with **nothing in it** on every pipeline that used this node. A
78
+ * control that cannot be given a value and would not be used if it
79
+ * could is worse than the absence of the feature.
80
+ *
81
+ * If per-message wording becomes configurable, it belongs on
82
+ * `core:task/process-messages@1`, which is what actually formats a
83
+ * line. This node fetches rows.
84
+ */
85
+ readonly params: {
86
+ readonly kind: "parameters";
87
+ readonly facet: "weights";
88
+ readonly schema: {
89
+ /**
90
+ * ⚠ The default is **100 because 100 is what every install
91
+ * has been getting**, not because 100 was chosen.
92
+ *
93
+ * It read 40 here and nothing read it: the binding took
94
+ * `input.limit`, a key nothing supplies, and fell through to
95
+ * a literal 100 on every run. Wiring the control while
96
+ * leaving the declared number at 40 would have moved the
97
+ * transcript window from 100 to 40 on every install at
98
+ * defaults — a retrieval change smuggled in behind a typing
99
+ * fix. So the declaration is corrected to the effective
100
+ * value first; changing the number is a separate decision,
101
+ * made against the measure corpus.
102
+ *
103
+ * Exactly the ruling `topK` got (2026-09-07), for exactly
104
+ * the same defect.
105
+ *
106
+ * ⚠ **Not read when `budget` is wired** (history window,
107
+ * 2026-10-03): that read is sized by the context window,
108
+ * which belongs to the sampling config (17 §1a) — a count
109
+ * of rows beside it is the same number entered twice, and
110
+ * the count is what moved the prompt's first line on every
111
+ * turn once a session passed it. Every shipped reply wires
112
+ * the budget; the asking steps (a form's answer, Adventure's
113
+ * Ask, the Lair's room drafting), the turn order and any
114
+ * spec that does not keep reading this.
115
+ */
116
+ readonly limit: {
117
+ readonly type: "integer";
118
+ readonly default: 100;
119
+ readonly description: "How many recent messages are read. Not used where the read is sized by the context window — every shipped reply — which reads as much as the window could hold twice over and lets the prompt decide where the conversation starts.";
120
+ };
121
+ /**
122
+ * The channel this history reads (20 §7). A session's
123
+ * lanes are the mode's declaration; a pipeline chooses
124
+ * which one builds its context — the map narrator reads
125
+ * `map`, the chat pipeline reads `main`, and a custom
126
+ * spec may do otherwise on purpose.
127
+ */
128
+ readonly channel: {
129
+ readonly type: "string";
130
+ readonly default: "main";
131
+ readonly description: "Which of the session's channels this history reads. The chat log is 'main'.";
132
+ };
133
+ /**
134
+ * **Only the unplayed talk** (lair re-plan R13, 2026-09-28):
135
+ * the rows of a side channel written since the story's
136
+ * newest generated line — the newest visible `main` row
137
+ * whose role is not `user`. Of those it keeps a person's own
138
+ * lines and the replies a run fired ON this channel wrote
139
+ * there (its inlet's `channel` is this one); a row a create
140
+ * run wrote (a greeting) or a story turn wrote (the Lair's
141
+ * beats row) is left out, read off the run artifacts, never
142
+ * a row's metadata. `limit` still caps it, newest kept.
143
+ *
144
+ * Refused with `channel: 'main'`: the story's own rows are
145
+ * the bound, never the talk.
146
+ */
147
+ readonly unplayedOnly: {
148
+ readonly type: "boolean";
149
+ readonly default: false;
150
+ readonly label: {
151
+ readonly en: "Only since the last story line";
152
+ };
153
+ readonly description: {
154
+ readonly en: "Read only what was said on this channel since the story's newest generated line: people's lines and the replies to them. Cannot be used with the 'main' channel.";
155
+ };
156
+ };
157
+ /**
158
+ * **Side channels as talk** (lair re-plan R10's fold-in of
159
+ * the R9 follow-up, 2026-09-28): on every channel but
160
+ * `main`, keep only the talk — a person's own lines and the
161
+ * replies a run fired ON that channel wrote there — by the
162
+ * rule `unplayedOnly` uses, without its bound. A row a
163
+ * create run wrote (a greeting) or a story turn wrote (the
164
+ * Lair's Sanctum beats row) is left out, read off the run
165
+ * artifacts, never a row's metadata. `main` rows are kept
166
+ * whole. The window is the newest `limit` rows before the
167
+ * filter, so it may hand on fewer.
168
+ *
169
+ * The Lair's room check reads every channel with it
170
+ * (`exitProse`): a beats list naming a room is the
171
+ * Castellan's plan, not a description of the room.
172
+ */
173
+ readonly talkOnly: {
174
+ readonly type: "boolean";
175
+ readonly default: false;
176
+ readonly label: {
177
+ readonly en: "Side channels: talk only";
178
+ };
179
+ readonly description: {
180
+ readonly en: "On every channel but 'main', read only what was said there: people's lines and the replies to them — never a greeting or a turn's notes.";
181
+ };
182
+ };
183
+ /**
184
+ * The transcript's intent, on the node that produces the
185
+ * transcript (R-7 P5, built 2026-09-16 — see
186
+ * `bandIntentFields`). `weight: 0.4` and `minInclude: 6`
187
+ * were here once, moved to the ranker's per-source map as
188
+ * `share.messages` and `minEntries.messages`, and are back
189
+ * where 16 §5a always said they belonged, at the numbers
190
+ * the map held: half the window is `MESSAGE_FILL_FRACTION`,
191
+ * and six is the minimum the map carried for the one band
192
+ * R6 allows one.
193
+ *
194
+ * ⚠ **No shipped spec ranks a message candidate** —
195
+ * `main` carries the transcript rows for
196
+ * `process-messages`, and `assemble` builds the transcript
197
+ * from those, never from ranked candidates. Two things
198
+ * keep it so: `entity-search`'s past lines publish on
199
+ * their own `recalledLines` band, and `vector-search`
200
+ * asks the index for lorebook entries only (the app's
201
+ * binding names them; plan A1). Its intent
202
+ * still reaches the ranker, on the `band` out-port a spec
203
+ * concatenates in with the lore, and its `share` is what
204
+ * halves the pool the lore sources divide: the
205
+ * conversation's slice is reserved and whatever it does
206
+ * not spend is swept to the others, exactly as the map's
207
+ * `messages: 0.5` did. `maxEntries` and `minEntries` bind
208
+ * only when a spec does rank message candidates (a
209
+ * compression region, or a plugin source publishing on
210
+ * this band); they are declared at the map's values so
211
+ * that spec inherits what every install has stored, not
212
+ * so a person moving them today sees a prompt change —
213
+ * they will not.
214
+ */
215
+ readonly share: {
216
+ readonly type: "number";
217
+ readonly min: 0;
218
+ readonly default: 0.5;
219
+ readonly quick: true;
220
+ readonly label: {
221
+ readonly en: "Share — conversation";
222
+ };
223
+ readonly description: {
224
+ readonly en: "How much of the context window the conversation may take, relative to every other source. What it does not spend is handed to the lore. Set to zero to give the whole window to the other sources.";
225
+ };
226
+ };
227
+ readonly maxEntries: {
228
+ readonly type: "integer";
229
+ readonly min: 0;
230
+ readonly default: 50;
231
+ readonly label: {
232
+ readonly en: "Most entries — conversation";
233
+ };
234
+ readonly description: {
235
+ readonly en: "A ceiling on how many retrieved messages may reach the prompt as ranked entries, whatever the share. The transcript itself is sized by the window, not by this.";
236
+ };
237
+ };
238
+ readonly minEntries: {
239
+ readonly type: "integer";
240
+ readonly min: 0;
241
+ readonly default: 6;
242
+ readonly label: {
243
+ readonly en: "Always keep at least";
244
+ };
245
+ readonly description: {
246
+ readonly en: "Recent messages kept as ranked entries whatever the shares say, so a lore-heavy chat stays readable. Dropped when there is no room. Lore has no minimum — it competes on score (R6).";
247
+ };
248
+ };
249
+ /**
250
+ * Read, at last (R-7 P5; it was declared and read by nothing
251
+ * from the day it was written, allow-listed in the
252
+ * declared-reads guard until this landed). `normal` is no
253
+ * ordering at all; see `BAND_PRIORITIES` in the SDK for
254
+ * what the other three do to the ranker's sweep.
255
+ */
256
+ readonly priority: {
257
+ readonly type: "enum";
258
+ readonly of: readonly ["low", "normal", "high", "always"];
259
+ readonly members: {
260
+ key: string;
261
+ label: {
262
+ en: string;
263
+ };
264
+ description: {
265
+ en: string;
266
+ };
267
+ }[];
268
+ readonly default: "normal";
269
+ readonly label: {
270
+ readonly en: "Priority — conversation";
271
+ };
272
+ readonly description: {
273
+ readonly en: "How strongly the conversation resists being trimmed once the shares are spent — 'always' keeps every message the window can hold.";
274
+ };
275
+ };
276
+ };
277
+ };
278
+ } | undefined;
279
+ }>;
280
+ /** @public */
281
+ export declare const lorebookTriggers: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
282
+ main: string;
283
+ hits: string;
284
+ /**
285
+ * The entries this scan **found and then excluded** — an
286
+ * entry's own selective logic said *not here* — as verdicts
287
+ * `{ source, id, reason }` (C2, 2026-10-02). A copy of one that
288
+ * another mechanism brings in (by meaning, by name) is the
289
+ * same entry the author ruled out, and
290
+ * `core:task/eligibility@1` marks it ineligible with this
291
+ * reason instead of letting it through by the side door.
292
+ */
293
+ exclusions: string;
294
+ }, {
295
+ scope: string;
296
+ /**
297
+ * **Whose private lore this read is for** — a participant
298
+ * reference (`character:<id>`), additive, 2026-09-17 (W1).
299
+ *
300
+ * Character-lore visibility is decided at the host read against
301
+ * ONE subject, and until this port existed that subject was the
302
+ * run's scope — so every voice of a multi-agent turn was handed
303
+ * every character's private lore, because one gather ran once for
304
+ * all of them. Wired inside a repeating clause
305
+ * (`speaker: $.voices.item.context.speaker`) it names the speaker
306
+ * THIS iteration is writing as, and the host applies the same
307
+ * binding-visibility gate for that character instead of the
308
+ * scope's.
309
+ *
310
+ * Unwired, `null` or empty, the scope decides exactly as it
311
+ * always did (a scope of nobody is the omniscient narrator's
312
+ * read). Any other reference that names no character row — an
313
+ * envoy, a role, a row that does not exist — reads no private
314
+ * lore at all. A reference is never *widened* here: the port
315
+ * chooses whose secrets are readable, never whether the gate runs.
316
+ */
317
+ speaker: string;
318
+ }, "core:query/lorebook-triggers@1"> & {
319
+ kind: 'query';
320
+ slots?: {
321
+ /**
322
+ * ⚠ No `template` slot, and there was one — a *source* template for
323
+ * "how one triggered entry is written into the context".
324
+ *
325
+ * Nothing read it and nothing seeded a row for it, so it rendered as
326
+ * an empty picker. A source template belongs on the node whose job
327
+ * is the rendering — a `render-entries` task, when one is bound
328
+ * (culled unbound, plans/29 R-2); two declarations of one idea, one
329
+ * of them inert, is how they drift.
330
+ */
331
+ readonly params: {
332
+ readonly kind: "parameters";
333
+ readonly facet: "weights";
334
+ readonly schema: {
335
+ /**
336
+ * 10, matching `DEFAULT_RETRIEVAL.scanDepth` — the value the
337
+ * scan actually ran on while this declaration said 3 and
338
+ * nothing read it.
339
+ *
340
+ * Round-sized on purpose. A group session with five
341
+ * characters takes five messages to come back round, so a
342
+ * depth of 3 cannot see the turn it belongs to: the window
343
+ * has already slid past where the round began. Scan depth
344
+ * has to be at least a round, and a round grows with the
345
+ * cast.
346
+ */
347
+ readonly scanDepth: {
348
+ readonly type: "integer";
349
+ readonly default: 10;
350
+ readonly label: {
351
+ readonly en: "Messages scanned for keywords";
352
+ };
353
+ readonly description: "How many recent messages are scanned for lorebook keywords.";
354
+ };
355
+ /**
356
+ * On this type as well as on `loreSlots`, for the reason its
357
+ * three siblings below give: the narrator runs its lore
358
+ * through this type, and this number reaches the same
359
+ * `keywordQuery` from the same `retrievalParamsFrom` seam —
360
+ * so a control that exists on the reply pipeline and not on
361
+ * the narrator is a difference no user could discover a
362
+ * reason for.
363
+ */
364
+ readonly guaranteedMessages: {
365
+ readonly type: 'integer';
366
+ readonly default: 10;
367
+ readonly min: 1;
368
+ readonly label: {
369
+ readonly en: 'Messages that count as "now"';
370
+ };
371
+ readonly description: 'How much of the recent conversation counts as the current moment when judging relevance — which characters are present, and which words the scene is actually using. Separate from how far back a keyword may fire from.';
372
+ };
373
+ /**
374
+ * The ceiling, spelled the way its three siblings spell it.
375
+ *
376
+ * ⚠ This was `recursionDepth`, and the one letter of
377
+ * difference is why it looked wired and was not:
378
+ * `retrievalParamsFrom` reads `maxRecursionDepth`, so the
379
+ * number this node stored was handed to nothing and the
380
+ * narrator ran on `DEFAULT_RETRIEVAL` whatever anybody
381
+ * typed. `narrate@1.10.0`'s own note says "Scan Depth and
382
+ * Max Recursion Depth rendered, validated and saved here
383
+ * without ever being read" — half of that was fixed by
384
+ * wiring the slot, and this is the other half, because the
385
+ * control it names was never called that here.
386
+ *
387
+ * Renamed rather than read under both spellings: two names
388
+ * for one ceiling is how the four lore types drift apart
389
+ * again, and `loreSlots` below has the older claim on the
390
+ * name. Migration 0195 carries the stored values across so
391
+ * a number somebody typed keeps its meaning — it simply
392
+ * starts working, which is the 0186 rule.
393
+ *
394
+ * Same default and same words as `loreSlots`': the narrator
395
+ * runs its lore through this type, and a ceiling that
396
+ * exists on the reply pipeline and not on the narrator is a
397
+ * difference no user could discover a reason for.
398
+ */
399
+ readonly maxRecursionDepth: {
400
+ readonly type: "integer";
401
+ readonly default: 0;
402
+ readonly label: {
403
+ readonly en: "Follow keyword chains this deep";
404
+ };
405
+ readonly description: "A ceiling on how far entries may trigger further entries via keywords found in their text, however deep an individual entry asks to go. It never follows links between entries.";
406
+ };
407
+ /**
408
+ * ⚠ `caseSensitive`, `useRegex`, `weight` and `minInclude`
409
+ * were here, and are gone rather than wired. All four
410
+ * rendered, validated, stored a row and resolved through
411
+ * every scope layer while `retrievalParamsFrom` read none
412
+ * of them — plan bug 15, and the last of the dead-control
413
+ * clusters bug 12 found the first of.
414
+ *
415
+ * They divide cleanly in two, and neither half is a control
416
+ * this node should own:
417
+ *
418
+ * · `caseSensitive` and `useRegex` describe how an *entry*
419
+ * matches. `loreSlots` below already states the rule —
420
+ * the entry is what somebody is looking at when they
421
+ * want to change that — and the entry is where they
422
+ * live: `signals.ts` reads `entry.caseSensitive` and
423
+ * folds `entry.useRegex` into `entry.matchMode`, both
424
+ * columns with their own editor control. A node-level
425
+ * copy could only ever be a second answer to a question
426
+ * the row already answers.
427
+ * · `weight` and `minInclude` are the ranker's, and this
428
+ * is the same pair `core:query/session-history@1` lost
429
+ * for the same reason: they ask how one source fares
430
+ * against everything else, and a node that fetches rows
431
+ * cannot see everything else to answer it. They are
432
+ * `share` / `signal*` and `minEntries` on
433
+ * `core:task/rank-hybrid@1` now, beside their peers,
434
+ * where a share is normalised against the others rather
435
+ * than free to disagree with them.
436
+ *
437
+ * Deleting an address culls it: `reconcileConfigs` removes
438
+ * the stored value and writes a notice carrying what it
439
+ * was, which the admin workspace renders. That is the
440
+ * whole reason a cull is allowed to be the answer here —
441
+ * before the notices surface had a reader, "delete it" and
442
+ * "lose it silently" were the same act.
443
+ */
444
+ readonly admitThreshold: {
445
+ readonly type: 'number';
446
+ readonly default: 0;
447
+ readonly min: 0;
448
+ readonly max: 1;
449
+ readonly quick: true;
450
+ readonly label: {
451
+ readonly en: 'Find without keywords';
452
+ };
453
+ readonly description: {
454
+ readonly en: 'How readily an entry is brought in on relevance alone when none of its keywords matched — the names the conversation is using, and the distinctive words it shares with the entry. 0 keeps keywords the only way in; try 0.3 to turn it on.';
455
+ };
456
+ };
457
+ /**
458
+ * The three lexical-quality controls, on this type as well
459
+ * as on `loreSlots` and for `admitThreshold`'s reason: the
460
+ * narrator runs its lore through this type, and a control
461
+ * that exists on the reply pipeline and not on the narrator
462
+ * is a difference no user could discover a reason for.
463
+ */
464
+ readonly lexicalScoring: {
465
+ readonly type: 'enum';
466
+ readonly default: 'overlap';
467
+ readonly label: {
468
+ readonly en: 'Relevance balance';
469
+ };
470
+ readonly members: readonly [{
471
+ readonly key: 'overlap';
472
+ readonly label: {
473
+ readonly en: 'Raw overlap';
474
+ };
475
+ readonly description: {
476
+ readonly en: 'Every repeat of a word counts again, so a longer entry has more chances to score.';
477
+ };
478
+ }, {
479
+ readonly key: 'balanced';
480
+ readonly label: {
481
+ readonly en: 'Length-aware';
482
+ };
483
+ readonly description: {
484
+ readonly en: 'A repeated word stops adding as much, and an entry is judged against how long lorebook entries usually are. Better when entries differ a lot in length.';
485
+ };
486
+ }];
487
+ readonly description: {
488
+ readonly en: "How an entry's own wording is weighed when deciding how relevant it is to what is being said.";
489
+ };
490
+ };
491
+ readonly trigramFolding: {
492
+ readonly type: 'number';
493
+ readonly default: 0;
494
+ readonly min: 0;
495
+ readonly max: 1;
496
+ readonly label: {
497
+ readonly en: 'Match near-misses';
498
+ };
499
+ readonly description: {
500
+ readonly en: 'How much a keyword that is nearly present counts — a different ending, a typo, or a language that does not put spaces between words. 0 requires an exact match; try 0.5 to turn it on.';
501
+ };
502
+ };
503
+ readonly titleWeight: {
504
+ readonly type: 'number';
505
+ readonly default: 1;
506
+ readonly min: 0;
507
+ readonly max: 5;
508
+ readonly label: {
509
+ readonly en: 'Title counts extra';
510
+ };
511
+ readonly description: {
512
+ readonly en: "How much more a word in an entry's title counts than the same word among its keywords. 1 treats them alike.";
513
+ };
514
+ };
515
+ readonly characterLoreMaxEntries: {
516
+ type: 'integer';
517
+ min: number;
518
+ default?: number | undefined;
519
+ label: {
520
+ en: string;
521
+ };
522
+ description: {
523
+ en: string;
524
+ };
525
+ };
526
+ readonly characterLorePriority: {
527
+ type: 'enum';
528
+ of: readonly ["low", "normal", "high", "always"];
529
+ members: {
530
+ key: string;
531
+ label: {
532
+ en: string;
533
+ };
534
+ description: {
535
+ en: string;
536
+ };
537
+ }[];
538
+ default: 'normal';
539
+ label: {
540
+ en: string;
541
+ };
542
+ description: {
543
+ en: string;
544
+ };
545
+ };
546
+ readonly characterLoreShare: {
547
+ type: 'number';
548
+ min: number;
549
+ default: number;
550
+ quick: boolean;
551
+ label: {
552
+ en: string;
553
+ };
554
+ description: {
555
+ en: string;
556
+ };
557
+ };
558
+ readonly historyMaxEntries: {
559
+ type: 'integer';
560
+ min: number;
561
+ default?: number | undefined;
562
+ label: {
563
+ en: string;
564
+ };
565
+ description: {
566
+ en: string;
567
+ };
568
+ };
569
+ readonly historyPriority: {
570
+ type: 'enum';
571
+ of: readonly ["low", "normal", "high", "always"];
572
+ members: {
573
+ key: string;
574
+ label: {
575
+ en: string;
576
+ };
577
+ description: {
578
+ en: string;
579
+ };
580
+ }[];
581
+ default: 'normal';
582
+ label: {
583
+ en: string;
584
+ };
585
+ description: {
586
+ en: string;
587
+ };
588
+ };
589
+ readonly historyShare: {
590
+ type: 'number';
591
+ min: number;
592
+ default: number;
593
+ quick: boolean;
594
+ label: {
595
+ en: string;
596
+ };
597
+ description: {
598
+ en: string;
599
+ };
600
+ };
601
+ readonly worldLoreMaxEntries: {
602
+ type: 'integer';
603
+ min: number;
604
+ default?: number | undefined;
605
+ label: {
606
+ en: string;
607
+ };
608
+ description: {
609
+ en: string;
610
+ };
611
+ };
612
+ readonly worldLorePriority: {
613
+ type: 'enum';
614
+ of: readonly ["low", "normal", "high", "always"];
615
+ members: {
616
+ key: string;
617
+ label: {
618
+ en: string;
619
+ };
620
+ description: {
621
+ en: string;
622
+ };
623
+ }[];
624
+ default: 'normal';
625
+ label: {
626
+ en: string;
627
+ };
628
+ description: {
629
+ en: string;
630
+ };
631
+ };
632
+ readonly worldLoreShare: {
633
+ type: 'number';
634
+ min: number;
635
+ default: number;
636
+ quick: boolean;
637
+ label: {
638
+ en: string;
639
+ };
640
+ description: {
641
+ en: string;
642
+ };
643
+ };
644
+ };
645
+ };
646
+ } | undefined;
647
+ }>;
648
+ /** @experimental */
649
+ export declare const worldLore: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
650
+ main: string;
651
+ hits: string;
652
+ /**
653
+ * The entries this scan **found and then excluded** — an
654
+ * entry's own selective logic said *not here* — as verdicts
655
+ * `{ source, id, reason }` (C2, 2026-10-02). A copy of one that
656
+ * another mechanism brings in (by meaning, by name) is the
657
+ * same entry the author ruled out, and
658
+ * `core:task/eligibility@1` marks it ineligible with this
659
+ * reason instead of letting it through by the side door.
660
+ */
661
+ exclusions: string;
662
+ }, {
663
+ scope: string;
664
+ }, "core:query/world-lore@1"> & {
665
+ kind: 'query';
666
+ slots?: {
667
+ params: {
668
+ kind: 'parameters';
669
+ facet: 'weights';
670
+ schema: {
671
+ share: {
672
+ type: 'number';
673
+ min: number;
674
+ default: number;
675
+ quick: boolean;
676
+ label: {
677
+ en: string;
678
+ };
679
+ description: {
680
+ en: string;
681
+ };
682
+ };
683
+ maxEntries: {
684
+ type: 'integer';
685
+ min: number;
686
+ default?: number | undefined;
687
+ label: {
688
+ en: string;
689
+ };
690
+ description: {
691
+ en: string;
692
+ };
693
+ };
694
+ priority: {
695
+ type: 'enum';
696
+ of: readonly ["low", "normal", "high", "always"];
697
+ members: {
698
+ key: string;
699
+ label: {
700
+ en: string;
701
+ };
702
+ description: {
703
+ en: string;
704
+ };
705
+ }[];
706
+ default: 'normal';
707
+ label: {
708
+ en: string;
709
+ };
710
+ description: {
711
+ en: string;
712
+ };
713
+ };
714
+ /**
715
+ * 10, matching `DEFAULT_RETRIEVAL.scanDepth` — the value every scan
716
+ * has actually run on. This said 3 for as long as the three lore
717
+ * lanes shipped without a wired `params` slot, so the number was
718
+ * never handed to anything and the two could not be seen to
719
+ * disagree.
720
+ *
721
+ * Round-sized on purpose. A group session with five characters
722
+ * takes five messages to come back round, so a depth of 3 cannot
723
+ * see the turn it belongs to: the window has already slid past
724
+ * where the round began. Scan depth has to be at least a round,
725
+ * and a round grows with the cast.
726
+ */
727
+ scanDepth: {
728
+ type: 'integer';
729
+ default: number;
730
+ quick: boolean;
731
+ shared: boolean;
732
+ label: {
733
+ en: string;
734
+ };
735
+ description: string;
736
+ };
737
+ /**
738
+ * Beside `scanDepth` because the pair is only legible together:
739
+ * one is how far back a key may fire from, the other is how much
740
+ * conversation counts as the present moment. See
741
+ * `GUARANTEED_MESSAGES`.
742
+ */
743
+ guaranteedMessages: {
744
+ type: 'integer';
745
+ default: 10;
746
+ min: 1;
747
+ label: {
748
+ readonly en: 'Messages that count as "now"';
749
+ };
750
+ description: 'How much of the recent conversation counts as the current moment when judging relevance — which characters are present, and which words the scene is actually using. Separate from how far back a keyword may fire from.';
751
+ shared: boolean;
752
+ };
753
+ maxRecursionDepth: {
754
+ type: 'integer';
755
+ default: number;
756
+ shared: boolean;
757
+ label: {
758
+ en: string;
759
+ };
760
+ description: string;
761
+ };
762
+ /**
763
+ * Declared on all three lanes, held by one: since R-7 P2 a spec
764
+ * names ONE owner for the seven knobs and the other lanes read the
765
+ * owner's slot, so this is one row governing world lore, character
766
+ * lore and history alike — not one row per lane. World lore
767
+ * without keys is the case it exists for; the other two sources
768
+ * take the same answer. A per-source answer is a weight, and
769
+ * weights live on the source (`bandIntentFields`), not here.
770
+ */
771
+ admitThreshold: {
772
+ type: 'number';
773
+ default: 0;
774
+ min: 0;
775
+ max: 1;
776
+ quick: true;
777
+ label: {
778
+ readonly en: 'Find without keywords';
779
+ };
780
+ description: {
781
+ readonly en: 'How readily an entry is brought in on relevance alone when none of its keywords matched — the names the conversation is using, and the distinctive words it shares with the entry. 0 keeps keywords the only way in; try 0.3 to turn it on.';
782
+ };
783
+ shared: boolean;
784
+ };
785
+ /**
786
+ * One row for the three lanes, like `admitThreshold`: the owner's
787
+ * value reaches world lore, where entry lengths differ most,
788
+ * character lore, already narrowed to whoever is speaking, and
789
+ * dated history — which has no title at all, so the value reaches
790
+ * it and moves nothing. That is the honest state rather than a
791
+ * fourth declaration.
792
+ */
793
+ lexicalScoring: {
794
+ type: 'enum';
795
+ default: 'overlap';
796
+ label: {
797
+ readonly en: 'Relevance balance';
798
+ };
799
+ members: readonly [{
800
+ readonly key: 'overlap';
801
+ readonly label: {
802
+ readonly en: 'Raw overlap';
803
+ };
804
+ readonly description: {
805
+ readonly en: 'Every repeat of a word counts again, so a longer entry has more chances to score.';
806
+ };
807
+ }, {
808
+ readonly key: 'balanced';
809
+ readonly label: {
810
+ readonly en: 'Length-aware';
811
+ };
812
+ readonly description: {
813
+ readonly en: 'A repeated word stops adding as much, and an entry is judged against how long lorebook entries usually are. Better when entries differ a lot in length.';
814
+ };
815
+ }];
816
+ description: {
817
+ readonly en: "How an entry's own wording is weighed when deciding how relevant it is to what is being said.";
818
+ };
819
+ shared: boolean;
820
+ };
821
+ trigramFolding: {
822
+ type: 'number';
823
+ default: 0;
824
+ min: 0;
825
+ max: 1;
826
+ label: {
827
+ readonly en: 'Match near-misses';
828
+ };
829
+ description: {
830
+ readonly en: 'How much a keyword that is nearly present counts — a different ending, a typo, or a language that does not put spaces between words. 0 requires an exact match; try 0.5 to turn it on.';
831
+ };
832
+ shared: boolean;
833
+ };
834
+ titleWeight: {
835
+ type: 'number';
836
+ default: 1;
837
+ min: 0;
838
+ max: 5;
839
+ label: {
840
+ readonly en: 'Title counts extra';
841
+ };
842
+ description: {
843
+ readonly en: "How much more a word in an entry's title counts than the same word among its keywords. 1 treats them alike.";
844
+ };
845
+ shared: boolean;
846
+ };
847
+ };
848
+ };
849
+ } | undefined;
850
+ }>;
851
+ /** @experimental */
852
+ export declare const characterLore: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
853
+ main: string;
854
+ hits: string;
855
+ /**
856
+ * The entries this scan **found and then excluded** — an
857
+ * entry's own selective logic said *not here* — as verdicts
858
+ * `{ source, id, reason }` (C2, 2026-10-02). A copy of one that
859
+ * another mechanism brings in (by meaning, by name) is the
860
+ * same entry the author ruled out, and
861
+ * `core:task/eligibility@1` marks it ineligible with this
862
+ * reason instead of letting it through by the side door.
863
+ */
864
+ exclusions: string;
865
+ }, {
866
+ scope: string;
867
+ /**
868
+ * **Whose private lore this read is for** — a participant
869
+ * reference (`character:<id>`), additive, 2026-09-17 (W1).
870
+ *
871
+ * Character-lore visibility is decided at the host read against
872
+ * ONE subject, and until this port existed that subject was the
873
+ * run's scope — so every voice of a multi-agent turn was handed
874
+ * every character's private lore, because one gather ran once for
875
+ * all of them. Wired inside a repeating clause
876
+ * (`speaker: $.voices.item.context.speaker`) it names the speaker
877
+ * THIS iteration is writing as, and the host applies the same
878
+ * binding-visibility gate for that character instead of the
879
+ * scope's.
880
+ *
881
+ * Unwired, `null` or empty, the scope decides exactly as it
882
+ * always did (a scope of nobody is the omniscient narrator's
883
+ * read). Any other reference that names no character row — an
884
+ * envoy, a role, a row that does not exist — reads no private
885
+ * lore at all. A reference is never *widened* here: the port
886
+ * chooses whose secrets are readable, never whether the gate runs.
887
+ */
888
+ speaker: string;
889
+ }, "core:query/character-lore@1"> & {
890
+ kind: 'query';
891
+ slots?: {
892
+ params: {
893
+ kind: 'parameters';
894
+ facet: 'weights';
895
+ schema: {
896
+ share: {
897
+ type: 'number';
898
+ min: number;
899
+ default: number;
900
+ quick: boolean;
901
+ label: {
902
+ en: string;
903
+ };
904
+ description: {
905
+ en: string;
906
+ };
907
+ };
908
+ maxEntries: {
909
+ type: 'integer';
910
+ min: number;
911
+ default?: number | undefined;
912
+ label: {
913
+ en: string;
914
+ };
915
+ description: {
916
+ en: string;
917
+ };
918
+ };
919
+ priority: {
920
+ type: 'enum';
921
+ of: readonly ["low", "normal", "high", "always"];
922
+ members: {
923
+ key: string;
924
+ label: {
925
+ en: string;
926
+ };
927
+ description: {
928
+ en: string;
929
+ };
930
+ }[];
931
+ default: 'normal';
932
+ label: {
933
+ en: string;
934
+ };
935
+ description: {
936
+ en: string;
937
+ };
938
+ };
939
+ /**
940
+ * 10, matching `DEFAULT_RETRIEVAL.scanDepth` — the value every scan
941
+ * has actually run on. This said 3 for as long as the three lore
942
+ * lanes shipped without a wired `params` slot, so the number was
943
+ * never handed to anything and the two could not be seen to
944
+ * disagree.
945
+ *
946
+ * Round-sized on purpose. A group session with five characters
947
+ * takes five messages to come back round, so a depth of 3 cannot
948
+ * see the turn it belongs to: the window has already slid past
949
+ * where the round began. Scan depth has to be at least a round,
950
+ * and a round grows with the cast.
951
+ */
952
+ scanDepth: {
953
+ type: 'integer';
954
+ default: number;
955
+ quick: boolean;
956
+ shared: boolean;
957
+ label: {
958
+ en: string;
959
+ };
960
+ description: string;
961
+ };
962
+ /**
963
+ * Beside `scanDepth` because the pair is only legible together:
964
+ * one is how far back a key may fire from, the other is how much
965
+ * conversation counts as the present moment. See
966
+ * `GUARANTEED_MESSAGES`.
967
+ */
968
+ guaranteedMessages: {
969
+ type: 'integer';
970
+ default: 10;
971
+ min: 1;
972
+ label: {
973
+ readonly en: 'Messages that count as "now"';
974
+ };
975
+ description: 'How much of the recent conversation counts as the current moment when judging relevance — which characters are present, and which words the scene is actually using. Separate from how far back a keyword may fire from.';
976
+ shared: boolean;
977
+ };
978
+ maxRecursionDepth: {
979
+ type: 'integer';
980
+ default: number;
981
+ shared: boolean;
982
+ label: {
983
+ en: string;
984
+ };
985
+ description: string;
986
+ };
987
+ /**
988
+ * Declared on all three lanes, held by one: since R-7 P2 a spec
989
+ * names ONE owner for the seven knobs and the other lanes read the
990
+ * owner's slot, so this is one row governing world lore, character
991
+ * lore and history alike — not one row per lane. World lore
992
+ * without keys is the case it exists for; the other two sources
993
+ * take the same answer. A per-source answer is a weight, and
994
+ * weights live on the source (`bandIntentFields`), not here.
995
+ */
996
+ admitThreshold: {
997
+ type: 'number';
998
+ default: 0;
999
+ min: 0;
1000
+ max: 1;
1001
+ quick: true;
1002
+ label: {
1003
+ readonly en: 'Find without keywords';
1004
+ };
1005
+ description: {
1006
+ readonly en: 'How readily an entry is brought in on relevance alone when none of its keywords matched — the names the conversation is using, and the distinctive words it shares with the entry. 0 keeps keywords the only way in; try 0.3 to turn it on.';
1007
+ };
1008
+ shared: boolean;
1009
+ };
1010
+ /**
1011
+ * One row for the three lanes, like `admitThreshold`: the owner's
1012
+ * value reaches world lore, where entry lengths differ most,
1013
+ * character lore, already narrowed to whoever is speaking, and
1014
+ * dated history — which has no title at all, so the value reaches
1015
+ * it and moves nothing. That is the honest state rather than a
1016
+ * fourth declaration.
1017
+ */
1018
+ lexicalScoring: {
1019
+ type: 'enum';
1020
+ default: 'overlap';
1021
+ label: {
1022
+ readonly en: 'Relevance balance';
1023
+ };
1024
+ members: readonly [{
1025
+ readonly key: 'overlap';
1026
+ readonly label: {
1027
+ readonly en: 'Raw overlap';
1028
+ };
1029
+ readonly description: {
1030
+ readonly en: 'Every repeat of a word counts again, so a longer entry has more chances to score.';
1031
+ };
1032
+ }, {
1033
+ readonly key: 'balanced';
1034
+ readonly label: {
1035
+ readonly en: 'Length-aware';
1036
+ };
1037
+ readonly description: {
1038
+ readonly en: 'A repeated word stops adding as much, and an entry is judged against how long lorebook entries usually are. Better when entries differ a lot in length.';
1039
+ };
1040
+ }];
1041
+ description: {
1042
+ readonly en: "How an entry's own wording is weighed when deciding how relevant it is to what is being said.";
1043
+ };
1044
+ shared: boolean;
1045
+ };
1046
+ trigramFolding: {
1047
+ type: 'number';
1048
+ default: 0;
1049
+ min: 0;
1050
+ max: 1;
1051
+ label: {
1052
+ readonly en: 'Match near-misses';
1053
+ };
1054
+ description: {
1055
+ readonly en: 'How much a keyword that is nearly present counts — a different ending, a typo, or a language that does not put spaces between words. 0 requires an exact match; try 0.5 to turn it on.';
1056
+ };
1057
+ shared: boolean;
1058
+ };
1059
+ titleWeight: {
1060
+ type: 'number';
1061
+ default: 1;
1062
+ min: 0;
1063
+ max: 5;
1064
+ label: {
1065
+ readonly en: 'Title counts extra';
1066
+ };
1067
+ description: {
1068
+ readonly en: "How much more a word in an entry's title counts than the same word among its keywords. 1 treats them alike.";
1069
+ };
1070
+ shared: boolean;
1071
+ };
1072
+ };
1073
+ };
1074
+ } | undefined;
1075
+ }>;
1076
+ /**
1077
+ * Dated summaries of earlier events.
1078
+ *
1079
+ * ⚠ **This lane did not exist between spec 1.8.0 and 1.10.0, and history was
1080
+ * silently absent from every prompt in that window.**
1081
+ *
1082
+ * `lorebook-triggers@1` returned all three sources through one port. Splitting
1083
+ * world and character lore into two nodes replaced it with two lanes that each
1084
+ * filter the shared scan to their own `source` — and nothing filtered for
1085
+ * `history`, so those candidates were built, scored, and then dropped on the
1086
+ * floor. Nothing failed: the ranker kept a `history` band, `assemble` kept
1087
+ * asking for history blocks, and both got nothing.
1088
+ *
1089
+ * The parity corpus stayed green throughout because its harness renders through
1090
+ * `lorebook-triggers@1` rather than the shipped document — the exact divergence
1091
+ * a comment in that file warns about. The corpus mirrors the three lanes now.
1092
+ *
1093
+ * Same retrieval as its two siblings: one scan, one filter.
1094
+ * @experimental
1095
+ */
1096
+ export declare const historyEntries: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1097
+ main: string;
1098
+ hits: string;
1099
+ /**
1100
+ * The entries this scan **found and then excluded** — an
1101
+ * entry's own selective logic said *not here* — as verdicts
1102
+ * `{ source, id, reason }` (C2, 2026-10-02). A copy of one that
1103
+ * another mechanism brings in (by meaning, by name) is the
1104
+ * same entry the author ruled out, and
1105
+ * `core:task/eligibility@1` marks it ineligible with this
1106
+ * reason instead of letting it through by the side door.
1107
+ */
1108
+ exclusions: string;
1109
+ }, {
1110
+ scope: string;
1111
+ }, "core:query/history-entries@1"> & {
1112
+ kind: 'query';
1113
+ slots?: {
1114
+ params: {
1115
+ kind: 'parameters';
1116
+ facet: 'weights';
1117
+ schema: {
1118
+ share: {
1119
+ type: 'number';
1120
+ min: number;
1121
+ default: number;
1122
+ quick: boolean;
1123
+ label: {
1124
+ en: string;
1125
+ };
1126
+ description: {
1127
+ en: string;
1128
+ };
1129
+ };
1130
+ maxEntries: {
1131
+ type: 'integer';
1132
+ min: number;
1133
+ default?: number | undefined;
1134
+ label: {
1135
+ en: string;
1136
+ };
1137
+ description: {
1138
+ en: string;
1139
+ };
1140
+ };
1141
+ priority: {
1142
+ type: 'enum';
1143
+ of: readonly ["low", "normal", "high", "always"];
1144
+ members: {
1145
+ key: string;
1146
+ label: {
1147
+ en: string;
1148
+ };
1149
+ description: {
1150
+ en: string;
1151
+ };
1152
+ }[];
1153
+ default: 'normal';
1154
+ label: {
1155
+ en: string;
1156
+ };
1157
+ description: {
1158
+ en: string;
1159
+ };
1160
+ };
1161
+ /**
1162
+ * 10, matching `DEFAULT_RETRIEVAL.scanDepth` — the value every scan
1163
+ * has actually run on. This said 3 for as long as the three lore
1164
+ * lanes shipped without a wired `params` slot, so the number was
1165
+ * never handed to anything and the two could not be seen to
1166
+ * disagree.
1167
+ *
1168
+ * Round-sized on purpose. A group session with five characters
1169
+ * takes five messages to come back round, so a depth of 3 cannot
1170
+ * see the turn it belongs to: the window has already slid past
1171
+ * where the round began. Scan depth has to be at least a round,
1172
+ * and a round grows with the cast.
1173
+ */
1174
+ scanDepth: {
1175
+ type: 'integer';
1176
+ default: number;
1177
+ quick: boolean;
1178
+ shared: boolean;
1179
+ label: {
1180
+ en: string;
1181
+ };
1182
+ description: string;
1183
+ };
1184
+ /**
1185
+ * Beside `scanDepth` because the pair is only legible together:
1186
+ * one is how far back a key may fire from, the other is how much
1187
+ * conversation counts as the present moment. See
1188
+ * `GUARANTEED_MESSAGES`.
1189
+ */
1190
+ guaranteedMessages: {
1191
+ type: 'integer';
1192
+ default: 10;
1193
+ min: 1;
1194
+ label: {
1195
+ readonly en: 'Messages that count as "now"';
1196
+ };
1197
+ description: 'How much of the recent conversation counts as the current moment when judging relevance — which characters are present, and which words the scene is actually using. Separate from how far back a keyword may fire from.';
1198
+ shared: boolean;
1199
+ };
1200
+ maxRecursionDepth: {
1201
+ type: 'integer';
1202
+ default: number;
1203
+ shared: boolean;
1204
+ label: {
1205
+ en: string;
1206
+ };
1207
+ description: string;
1208
+ };
1209
+ /**
1210
+ * Declared on all three lanes, held by one: since R-7 P2 a spec
1211
+ * names ONE owner for the seven knobs and the other lanes read the
1212
+ * owner's slot, so this is one row governing world lore, character
1213
+ * lore and history alike — not one row per lane. World lore
1214
+ * without keys is the case it exists for; the other two sources
1215
+ * take the same answer. A per-source answer is a weight, and
1216
+ * weights live on the source (`bandIntentFields`), not here.
1217
+ */
1218
+ admitThreshold: {
1219
+ type: 'number';
1220
+ default: 0;
1221
+ min: 0;
1222
+ max: 1;
1223
+ quick: true;
1224
+ label: {
1225
+ readonly en: 'Find without keywords';
1226
+ };
1227
+ description: {
1228
+ readonly en: 'How readily an entry is brought in on relevance alone when none of its keywords matched — the names the conversation is using, and the distinctive words it shares with the entry. 0 keeps keywords the only way in; try 0.3 to turn it on.';
1229
+ };
1230
+ shared: boolean;
1231
+ };
1232
+ /**
1233
+ * One row for the three lanes, like `admitThreshold`: the owner's
1234
+ * value reaches world lore, where entry lengths differ most,
1235
+ * character lore, already narrowed to whoever is speaking, and
1236
+ * dated history — which has no title at all, so the value reaches
1237
+ * it and moves nothing. That is the honest state rather than a
1238
+ * fourth declaration.
1239
+ */
1240
+ lexicalScoring: {
1241
+ type: 'enum';
1242
+ default: 'overlap';
1243
+ label: {
1244
+ readonly en: 'Relevance balance';
1245
+ };
1246
+ members: readonly [{
1247
+ readonly key: 'overlap';
1248
+ readonly label: {
1249
+ readonly en: 'Raw overlap';
1250
+ };
1251
+ readonly description: {
1252
+ readonly en: 'Every repeat of a word counts again, so a longer entry has more chances to score.';
1253
+ };
1254
+ }, {
1255
+ readonly key: 'balanced';
1256
+ readonly label: {
1257
+ readonly en: 'Length-aware';
1258
+ };
1259
+ readonly description: {
1260
+ readonly en: 'A repeated word stops adding as much, and an entry is judged against how long lorebook entries usually are. Better when entries differ a lot in length.';
1261
+ };
1262
+ }];
1263
+ description: {
1264
+ readonly en: "How an entry's own wording is weighed when deciding how relevant it is to what is being said.";
1265
+ };
1266
+ shared: boolean;
1267
+ };
1268
+ trigramFolding: {
1269
+ type: 'number';
1270
+ default: 0;
1271
+ min: 0;
1272
+ max: 1;
1273
+ label: {
1274
+ readonly en: 'Match near-misses';
1275
+ };
1276
+ description: {
1277
+ readonly en: 'How much a keyword that is nearly present counts — a different ending, a typo, or a language that does not put spaces between words. 0 requires an exact match; try 0.5 to turn it on.';
1278
+ };
1279
+ shared: boolean;
1280
+ };
1281
+ titleWeight: {
1282
+ type: 'number';
1283
+ default: 1;
1284
+ min: 0;
1285
+ max: 5;
1286
+ label: {
1287
+ readonly en: 'Title counts extra';
1288
+ };
1289
+ description: {
1290
+ readonly en: "How much more a word in an entry's title counts than the same word among its keywords. 1 treats them alike.";
1291
+ };
1292
+ shared: boolean;
1293
+ };
1294
+ };
1295
+ };
1296
+ } | undefined;
1297
+ }>;
1298
+ /**
1299
+ * **Who is in the world, and when** — the cast's presences, as the session's
1300
+ * reading sees them (E-2, R4; built 2026-10-02).
1301
+ *
1302
+ * A presence says *this member, at this point of their own life, is here from
1303
+ * this date until that one* (`cast_presences`). The host reads the scope
1304
+ * session's book and resolves the line before returning: only presences on the
1305
+ * session's line (its own, and an ancestor's that begin at or before the fork
1306
+ * cut) — another line's spans never reach a node. `until` is exclusive: gone at
1307
+ * Y6 is present at Y5 and absent at Y6.
1308
+ *
1309
+ * `main` is the rows `{ bindingId, from, until, position }` (`from` / `until`
1310
+ * a story date `{ year, month?, day? }` or null); `at` is the moment the
1311
+ * session reads at — its story clock, or null for the head ("now", where every
1312
+ * presence with an `until` has ended). A member with **no** rows is always
1313
+ * present: declaring nothing means being here, as it always has.
1314
+ *
1315
+ * What it is for: `core:task/eligibility@1`'s presence rule, which gates the
1316
+ * lore of a member who is not in the world at `at`. A custom retrieval reads it
1317
+ * the same way (plan E-11).
1318
+ * @experimental
1319
+ */
1320
+ export declare const castPresences: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1321
+ /** `{ bindingId, from, until, position }[]`, on the session's line. */
1322
+ main: string;
1323
+ /** The story date the session reads at, or null for the head. */
1324
+ at: string;
1325
+ }, {
1326
+ scope: string;
1327
+ }, "core:query/cast-presences@1"> & {
1328
+ kind: 'query';
1329
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
1330
+ }>;
1331
+ /** @experimental */
1332
+ export declare const vectorSearch: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1333
+ main: string;
1334
+ hits: string;
1335
+ /** One ranked list per query vector, in the order they were given. */
1336
+ lists: string;
1337
+ /**
1338
+ * `cos(i, j)` over `hits`, by index. What MMR needs, without any
1339
+ * embedding leaving the host.
1340
+ */
1341
+ similarity: string;
1342
+ }, {
1343
+ /**
1344
+ * Several query vectors, one ranked list each — a list, so
1345
+ * `json@1` (was `vector@1` until 2026-09-17, U5d review W9):
1346
+ * what `embed-text@1`'s `vectors` publishes and what the
1347
+ * host's search reads.
1348
+ */
1349
+ vectors: string;
1350
+ scope: string;
1351
+ /**
1352
+ * **Whose private lore this search may return** — a participant
1353
+ * reference, with `core:query/character-lore@1`'s exact
1354
+ * semantics (C3, 2026-10-02): unwired, `null` or empty, the
1355
+ * scope decides as it always did; a `character:<id>` reads
1356
+ * that character's own private lore and nobody else's; any
1357
+ * other reference reads none. The leak guard for a search
1358
+ * wired inside a repeating clause, where the run's scope is
1359
+ * not the voice being written.
1360
+ */
1361
+ speaker: string;
1362
+ }, "core:query/vector-search@1"> & {
1363
+ kind: 'query';
1364
+ slots?: {
1365
+ readonly params: {
1366
+ readonly kind: "parameters";
1367
+ readonly facet: "weights";
1368
+ readonly schema: {
1369
+ /**
1370
+ * A **ceiling, not the mechanism's switch** (2026-09-29) — see
1371
+ * `query-windows.searchByMeaning`, which is. Non-zero so that
1372
+ * turning the mechanism on with one control does something:
1373
+ * a feature whose two controls both default to off is one
1374
+ * where turning the first one on appears to do nothing.
1375
+ *
1376
+ * It *was* the switch — 0, the shipped default, was off — and
1377
+ * that was the defect: this is the chain's last node, so the
1378
+ * probes had already been embedded by the time 0 said
1379
+ * nothing was wanted. Every turn with an embedding model
1380
+ * ready paid for an embed it threw away.
1381
+ *
1382
+ * A **cap on what this mechanism contributes**, not a cap on what
1383
+ * it looks at — `topK` is that, one field down. 0 still
1384
+ * contributes nothing, and the binding returns before its
1385
+ * reads for it, but it is not how the mechanism is turned off.
1386
+ */
1387
+ readonly maxEntries: {
1388
+ readonly type: "integer";
1389
+ readonly default: 5;
1390
+ readonly min: 0;
1391
+ readonly label: {
1392
+ readonly en: "Entries found by meaning";
1393
+ };
1394
+ readonly description: "The most lorebook entries a search by meaning may bring in on one turn. The switch is Search by meaning, on the retrieval queries step. A pipeline that ranks this arm separately reads its per-query lists instead, which this does not cut.";
1395
+ };
1396
+ /**
1397
+ * ⚠ **40, and it was 12.** The number never reached the
1398
+ * host: the binding read `input?.topK` — an *in-port* name
1399
+ * this node does not declare — and fell through to a
1400
+ * literal `?? 40` on every run since the mechanism was
1401
+ * written. So 40 is the value every install has actually
1402
+ * been searching at, and 12 is a number that was rendered,
1403
+ * validated, saved and resolved through the whole scope
1404
+ * chain without ever being handed to anything.
1405
+ *
1406
+ * Defaulted to the effective behaviour rather than to the
1407
+ * declared one on purpose. Wiring a control is not a licence
1408
+ * to re-tune every install that never touched it: the fix is
1409
+ * that the number now *means* something, and it means what
1410
+ * it has been doing.
1411
+ *
1412
+ * A cap on what each query *looks at*, which is a different
1413
+ * question from `maxEntries` one field up — that one caps
1414
+ * what the mechanism *contributes*. Raising this widens the
1415
+ * pool the ranker's other signals get to score; raising
1416
+ * `maxEntries` lets more of it through. Neither decides
1417
+ * whether the mechanism runs at all — that is
1418
+ * `query-windows.searchByMeaning`, Automatic by default
1419
+ * (on whenever an embedding model is set up).
1420
+ */
1421
+ readonly topK: {
1422
+ readonly type: "integer";
1423
+ readonly default: 40;
1424
+ readonly min: 1;
1425
+ readonly label: {
1426
+ readonly en: "Closest matches per query";
1427
+ };
1428
+ readonly description: "How many of the closest matches each retrieval query returns. A wider pool for the ranker to score, not a cap on what this arm contributes.";
1429
+ };
1430
+ /**
1431
+ * How sharply a weak resemblance is discounted — and
1432
+ * emphatically **not** a minimum.
1433
+ *
1434
+ * ⚠ **This replaced `minScore: 0.35`, and the replacement is
1435
+ * a ruling rather than a rename.** A minimum similarity
1436
+ * removes a row from the pool outright, and a row that is not
1437
+ * in the pool can no longer be found by keyword, by name or
1438
+ * by proximity either — one mechanism's opinion silently
1439
+ * disabling four others. The governing rule is that a weak or
1440
+ * unavailable mechanism *subtracts a signal* and never
1441
+ * removes a candidate, so the cutoff could not stay whatever
1442
+ * number it was set to. (It was never read either; nothing
1443
+ * anywhere consumed `minScore`.)
1444
+ *
1445
+ * What replaces it shapes the **contribution** instead:
1446
+ *
1447
+ * semantic = cos ** similarityFalloff
1448
+ *
1449
+ * 1 is the raw cosine and is the off position. Above 1 the
1450
+ * curve is convex, fixed at both ends (0→0, 1→1), so a
1451
+ * near-miss loses most of its contribution while a strong
1452
+ * match keeps nearly all of its own — and the row stays in
1453
+ * the pool at every value, which is the whole point.
1454
+ *
1455
+ * ⚠ **Chosen as a shape because a threshold is not
1456
+ * portable.** Cosine distributions are not comparable across
1457
+ * embedding models: one model puts unrelated text at 0.1 and
1458
+ * another at 0.6, so `0.35` means "almost everything" on the
1459
+ * first and "almost nothing" on the second, and an install
1460
+ * that swaps models silently changes what its lorebook
1461
+ * retrieves. An exponent has no cliff to move. It is
1462
+ * strictly monotonic, so it can never reorder this
1463
+ * mechanism's own hits or turn one off — it only decides how
1464
+ * much the semantic signal is allowed to outweigh a keyword
1465
+ * that actually fired.
1466
+ */
1467
+ readonly similarityFalloff: {
1468
+ readonly type: "number";
1469
+ readonly default: 1;
1470
+ readonly min: 1;
1471
+ readonly max: 8;
1472
+ readonly label: {
1473
+ readonly en: "Discount weak matches";
1474
+ };
1475
+ readonly description: "How sharply a loose resemblance counts for less than a close one. 1 takes the similarity as it comes; higher pushes vague matches down without ever removing them, so they can still be found by a keyword or a name.";
1476
+ };
1477
+ };
1478
+ };
1479
+ } | undefined;
1480
+ }>;
1481
+ /**
1482
+ * The third mechanism — retrieval by the names a scene is using.
1483
+ *
1484
+ * The keyword mechanism matches an author's written keys against a window; the vector
1485
+ * mechanism matches an embedding. This one matches **entities**: the characters,
1486
+ * places and things the recent conversation named, against the same entities
1487
+ * found in every lorebook entry and every earlier message. A peer of the other
1488
+ * two rather than a signal inside one, because it queries a different index and
1489
+ * ranks on a different question.
1490
+ *
1491
+ * Three things follow, and they are why it exists:
1492
+ *
1493
+ * 1. **It is how a book with no keywords works.** An entry nobody indexed is
1494
+ * reached because the scene is naming the same people it names. The
1495
+ * `admitThreshold` control on the lore nodes does this *inside* the keyword
1496
+ * scan; this does it as a source of candidates in its own right.
1497
+ * 2. **It searches the transcript**, which nothing else does. The keyword scan
1498
+ * reads only a bounded recent window and the semantic mechanism never
1499
+ * searches messages (its binding asks the index for lorebook entries
1500
+ * only), so this is the one way to retrieve an *older message* by what it
1501
+ * was about.
1502
+ * 3. **It needs no embedding model.** Names are matched, not encoded, so this
1503
+ * is available on every install rather than only on the ones with a model
1504
+ * loaded.
1505
+ *
1506
+ * It reads annotations written in the background, so it is cheap per turn: the
1507
+ * work of finding names in a lorebook happens when the lorebook is written, not
1508
+ * when a turn is taken.
1509
+ * @experimental
1510
+ */
1511
+ export declare const entitySearch: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1512
+ main: string;
1513
+ hits: string;
1514
+ /**
1515
+ * Earlier messages, as candidates in the declared
1516
+ * **`recalledLines`** band, headed by that band's intent
1517
+ * (2026-09-27; they sat in the transcript's `messages` band
1518
+ * before, budgeted and rendered nowhere).
1519
+ *
1520
+ * A port of its own rather than part of `main`, because the two
1521
+ * are budgeted separately and a pipeline that wants lore found
1522
+ * by name almost certainly does not want its context window
1523
+ * spent on retrieved transcript by accident.
1524
+ */
1525
+ messages: string;
1526
+ }, {
1527
+ scope: string;
1528
+ /**
1529
+ * **Whose private lore this search may return** — a participant
1530
+ * reference, with `core:query/character-lore@1`'s exact
1531
+ * semantics (C3, 2026-10-02): unwired, `null` or empty, the
1532
+ * scope decides as it always did; a `character:<id>` reads
1533
+ * that character's own private lore and nobody else's; any
1534
+ * other reference reads none. The leak guard for a search
1535
+ * wired inside a repeating clause, where the run's scope is
1536
+ * not the voice being written.
1537
+ */
1538
+ speaker: string;
1539
+ }, "core:query/entity-search@1"> & {
1540
+ kind: 'query';
1541
+ slots?: {
1542
+ readonly params: {
1543
+ readonly kind: "parameters";
1544
+ readonly facet: "weights";
1545
+ readonly schema: {
1546
+ /**
1547
+ * **On by default — 5** (R5, ruled 2026-09-30: all supported
1548
+ * retrieval is on by default; built 2026-10-02). It was 0,
1549
+ * the `maxRecursionDepth` / `admitThreshold` convention of
1550
+ * "turned on rather than arrived at"; the ruling replaced
1551
+ * that convention for retrieval. 0 still turns it off — a
1552
+ * preset that wants keys only says so.
1553
+ */
1554
+ readonly maxEntries: {
1555
+ readonly type: "integer";
1556
+ readonly default: 5;
1557
+ readonly min: 0;
1558
+ readonly quick: true;
1559
+ readonly label: {
1560
+ readonly en: "Entries found by name";
1561
+ };
1562
+ readonly description: "How many lorebook entries this may bring in because the conversation is naming the same people, places and things they do. 0 turns it off.";
1563
+ };
1564
+ /**
1565
+ * Separate from `maxEntries`, because the two answer
1566
+ * different questions and only one of them has somewhere to
1567
+ * go today.
1568
+ */
1569
+ readonly maxMessages: {
1570
+ readonly type: "integer";
1571
+ readonly default: 20;
1572
+ readonly min: 0;
1573
+ readonly label: {
1574
+ readonly en: "Earlier messages found by name";
1575
+ };
1576
+ readonly description: "How many earlier messages this may return, as recalled lines, for naming what the scene is naming. They reach the prompt only where a pipeline ranks them and its context template places {{{recalledLines}}}. 0 turns this half off.";
1577
+ };
1578
+ /**
1579
+ * The recalled lines' **share** — a band-namespaced field
1580
+ * (§7), because this definition publishes lore on `main`
1581
+ * and its own band on `messages`. Published as the band's
1582
+ * intent at the head of `messages` whenever `maxMessages`
1583
+ * turns the half on; the cap is `maxMessages`, which
1584
+ * already says it. The default is one lore lane's.
1585
+ */
1586
+ readonly recalledLinesShare: {
1587
+ readonly type: "number";
1588
+ readonly min: 0;
1589
+ readonly default: 0.1667;
1590
+ readonly label: {
1591
+ readonly en: "Share — recalled lines";
1592
+ };
1593
+ readonly description: {
1594
+ readonly en: "How much of the context window recalled lines may take, relative to every other source. The ranker normalises the shares it is handed; set this to zero to leave recalled lines out.";
1595
+ };
1596
+ };
1597
+ readonly scanDepth: {
1598
+ readonly type: "integer";
1599
+ readonly default: 10;
1600
+ readonly label: {
1601
+ readonly en: "Messages read for names";
1602
+ };
1603
+ readonly description: "How many recent messages are read to decide what the scene is currently about.";
1604
+ };
1605
+ /**
1606
+ * The mechanism's strength, and it is declared rather than
1607
+ * constant because the graded overlap *compresses* what it
1608
+ * measures: one strongly-shared name saturates around 0.63
1609
+ * and two around 0.86, so a weight sized for a 0/1 signal
1610
+ * would leave the improvement invisible.
1611
+ *
1612
+ * The default is deliberately the keyword weight: one thing
1613
+ * the conversation is naming that not every entry names is
1614
+ * worth about as much as one of an entry's own keys firing,
1615
+ * and the saturation then keeps it strictly below a full
1616
+ * keyword match — so authored keys still win, and this only
1617
+ * ever adds.
1618
+ */
1619
+ readonly entityWeight: {
1620
+ readonly type: "number";
1621
+ readonly default: 0.35;
1622
+ readonly min: 0;
1623
+ readonly max: 1;
1624
+ readonly label: {
1625
+ readonly en: "Strength";
1626
+ };
1627
+ readonly description: "How much weight a shared name carries against the other ways an entry can be found. 0 leaves the arm finding things and ranking them last.";
1628
+ };
1629
+ };
1630
+ };
1631
+ } | undefined;
1632
+ }>;
1633
+ /**
1634
+ * Documentation search — the guide genre's one retrieval mechanism (plans/29
1635
+ * R-18; built 2026-09-16 as U5g).
1636
+ *
1637
+ * The app compiles its docs — its own guides and the SDK's — into a section
1638
+ * index at build time (title, anchor, body text per heading). This reads the
1639
+ * person's most recent messages, ranks every section against them, and
1640
+ * publishes the relevant ones as candidates in its own declared band,
1641
+ * **`docsExcerpts`** (2026-09-27; it borrowed `worldLore` before) — so the
1642
+ * ranker budgets them and a template places them as `{{{docsExcerpts}}}`,
1643
+ * framed as the app's manual rather than as a story's lore, with an `{{else}}`
1644
+ * for the turn nothing matched. Each excerpt starts with its page's path.
1645
+ *
1646
+ * A question the docs do not cover publishes the band's intent and nothing
1647
+ * else — on purpose: an empty band is what lets the prompt say "nothing in the
1648
+ * docs matched" instead of handing a model loosely related text to extrapolate
1649
+ * from.
1650
+ *
1651
+ * `optional`, and it degrades to nothing: an install whose docs were never
1652
+ * compiled (a fresh checkout, `npm test`) publishes an empty band with its
1653
+ * intent, and the turn loses excerpts rather than failing.
1654
+ * @internal
1655
+ */
1656
+ export declare const docsSearch: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1657
+ main: string;
1658
+ candidates: string;
1659
+ }, {
1660
+ scope: string;
1661
+ }, "core:query/docs-search@1"> & {
1662
+ kind: 'query';
1663
+ slots?: {
1664
+ readonly params: {
1665
+ readonly kind: "parameters";
1666
+ readonly facet: "weights";
1667
+ readonly schema: {
1668
+ readonly share: {
1669
+ type: 'number';
1670
+ min: number;
1671
+ default: number;
1672
+ quick: boolean;
1673
+ label: {
1674
+ en: string;
1675
+ };
1676
+ description: {
1677
+ en: string;
1678
+ };
1679
+ };
1680
+ readonly maxEntries: {
1681
+ type: 'integer';
1682
+ min: number;
1683
+ default?: number | undefined;
1684
+ label: {
1685
+ en: string;
1686
+ };
1687
+ description: {
1688
+ en: string;
1689
+ };
1690
+ };
1691
+ readonly priority: {
1692
+ type: 'enum';
1693
+ of: readonly ["low", "normal", "high", "always"];
1694
+ members: {
1695
+ key: string;
1696
+ label: {
1697
+ en: string;
1698
+ };
1699
+ description: {
1700
+ en: string;
1701
+ };
1702
+ }[];
1703
+ default: 'normal';
1704
+ label: {
1705
+ en: string;
1706
+ };
1707
+ description: {
1708
+ en: string;
1709
+ };
1710
+ };
1711
+ readonly scanDepth: {
1712
+ readonly type: "integer";
1713
+ readonly min: 1;
1714
+ readonly default: 4;
1715
+ readonly quick: true;
1716
+ readonly label: {
1717
+ readonly en: "Messages searched";
1718
+ };
1719
+ readonly description: {
1720
+ readonly en: "How many of the most recent messages are read for the person's questions. Only their own messages are searched, never the guide's replies, and the newest counts most.";
1721
+ };
1722
+ };
1723
+ };
1724
+ };
1725
+ } | undefined;
1726
+ }>;
1727
+ /**
1728
+ * The mention detector — the query half of the entity-vector space.
1729
+ *
1730
+ * What the current scene refers to by **describing** it rather than by naming
1731
+ * it: *"the captain"*, *"the order"*, *"that bridge"*. Nothing in the lexical
1732
+ * stack can see these — no key matches them, no trigram folds them onto a
1733
+ * title, and the gazetteer has nothing to look up — and they are, as the plan
1734
+ * puts it, the references people actually write.
1735
+ *
1736
+ * A Query and not a Task, because the answer depends on the world's own
1737
+ * vocabulary: a description that turns out to be an authored lower-case name
1738
+ * (*"the ashguard"*) is dropped here, since the exact matcher owns it.
1739
+ * @experimental
1740
+ */
1741
+ export declare const mentionSpans: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1742
+ main: string;
1743
+ /** The mentions with their offsets, for a receipt to point at. */
1744
+ mentions: string;
1745
+ /** The same strings in the same order, for the embed Provider. */
1746
+ texts: string;
1747
+ }, {
1748
+ scope: string;
1749
+ }, "core:query/mention-spans@1"> & {
1750
+ kind: 'query';
1751
+ slots?: {
1752
+ readonly params: {
1753
+ readonly kind: "parameters";
1754
+ readonly facet: "weights";
1755
+ readonly schema: {
1756
+ /**
1757
+ * **On by default — 8** (R5, ruled 2026-09-30: all supported
1758
+ * retrieval is on by default; built 2026-10-02). It was 0.
1759
+ * Still the mechanism's one switch: 0 turns it off.
1760
+ *
1761
+ * **This is the entity-vector mechanism's one switch**, and it is
1762
+ * on the first node of the chain on purpose: switched off,
1763
+ * this returns before reading anything, `embed-text` is
1764
+ * handed no texts and makes no model call, and `entity-link`
1765
+ * returns before its own read. The mechanism costs literally
1766
+ * nothing until somebody asks for it — not a message read,
1767
+ * not an embedding.
1768
+ *
1769
+ * `entity-link.maxLinks` is therefore a ceiling rather than
1770
+ * a second switch and ships non-zero: a feature whose two
1771
+ * controls both default to off is one where turning the
1772
+ * first one up appears to do nothing.
1773
+ */
1774
+ readonly maxMentions: {
1775
+ readonly type: "integer";
1776
+ readonly default: 8;
1777
+ readonly min: 0;
1778
+ readonly quick: true;
1779
+ readonly label: {
1780
+ readonly en: "Descriptions to follow up";
1781
+ };
1782
+ readonly description: "How many descriptive references in the recent messages — \"the captain\", \"the order\" — are matched against what your entries are called, for entries no keyword reached. Needs an embedding model; 0 turns the whole arm off.";
1783
+ };
1784
+ readonly scanDepth: {
1785
+ readonly type: "integer";
1786
+ readonly default: 10;
1787
+ readonly label: {
1788
+ readonly en: "Messages read for descriptions";
1789
+ };
1790
+ readonly description: "How many recent messages are read for descriptions. A description points at what is being discussed now, so this is deliberately short.";
1791
+ };
1792
+ };
1793
+ };
1794
+ } | undefined;
1795
+ }>;
1796
+ /**
1797
+ * The entity-vector mechanism — mention → name linking.
1798
+ *
1799
+ * A second named vector space holding **one vector per name** rather than one
1800
+ * per entry: an entry's title, the aliases its body declares, and for a
1801
+ * character-anchored entry the bound character's names. Queried with the
1802
+ * descriptions `core:query/mention-spans@1` found, so *"the captain"* reaches
1803
+ * Captain Vell and *"the order"* reaches The Ashguard Riders.
1804
+ *
1805
+ * ## A separate space, not a second use of the content vectors
1806
+ *
1807
+ * Different text at different lengths means different similarity
1808
+ * distributions, so a cutoff tuned for two-word names is wrong for
1809
+ * two-hundred-word passages. The two want different weights, because *"is
1810
+ * called that"* and *"is about that"* are different evidence. And they
1811
+ * invalidate independently — renaming re-embeds the names and not the content;
1812
+ * rewriting the body re-embeds the content and not the names. Comparing a short
1813
+ * string to a short string is also what embeddings are most reliable at, where
1814
+ * a two-word mention against a whole-entry vector is a granularity mismatch.
1815
+ *
1816
+ * ## ⚠ It may only reorder. It may never admit.
1817
+ *
1818
+ * The pool is the `candidates` in-port, and this returns that same list with a
1819
+ * signal attached to whatever linked. There is no id it can emit that some
1820
+ * other mechanism did not already produce, and that is a wiring guarantee
1821
+ * rather than a promise in a comment.
1822
+ *
1823
+ * It matters because invented proper nouns are where embeddings are least
1824
+ * reliable: "Vell" has no learned meaning, so its vector is assembled from
1825
+ * subword fragments and Vell, Vall and Vela cluster. A confident wrong link is
1826
+ * worse than a miss — it would inject wrong lore at high confidence into a
1827
+ * fixed budget, displacing right lore. Constrained to reordering, the same
1828
+ * wrong link costs a position and a line in the receipt naming it.
1829
+ *
1830
+ * So: exact and trigram matching own invented names; entity vectors own
1831
+ * descriptive references.
1832
+ *
1833
+ * ## No threshold, anywhere
1834
+ *
1835
+ * Links rank, they do not gate. What bounds this is a **count**, over links
1836
+ * ordered by match quality — never a similarity cutoff, because *"is 0.62 a
1837
+ * match"* has no answer that survives changing the encoder, and a number that
1838
+ * needs per-corpus calibration is a number nobody can set.
1839
+ * @experimental
1840
+ */
1841
+ export declare const entityLink: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1842
+ main: string;
1843
+ candidates: string;
1844
+ /** Each link as text — *matched "the captain" → Captain Vell*. */
1845
+ links: string;
1846
+ }, {
1847
+ scope: string;
1848
+ /**
1849
+ * ⚠ **The pool, and the reason this mechanism cannot admit.** It
1850
+ * scores what arrives here and returns it; an entry no other
1851
+ * mechanism produced is not in this list and therefore cannot
1852
+ * be in the output.
1853
+ */
1854
+ candidates: string;
1855
+ /** The descriptions, from `core:query/mention-spans@1`. */
1856
+ mentions: string;
1857
+ /** Their embeddings, in the same order. Index alignment is the contract. */
1858
+ vectors: string;
1859
+ /**
1860
+ * **Whose private lore this search may return** — a participant
1861
+ * reference, with `core:query/character-lore@1`'s exact
1862
+ * semantics (C3, 2026-10-02): unwired, `null` or empty, the
1863
+ * scope decides as it always did; a `character:<id>` reads
1864
+ * that character's own private lore and nobody else's; any
1865
+ * other reference reads none. The leak guard for a search
1866
+ * wired inside a repeating clause, where the run's scope is
1867
+ * not the voice being written.
1868
+ */
1869
+ speaker: string;
1870
+ }, "core:query/entity-link@1"> & {
1871
+ kind: 'query';
1872
+ slots?: {
1873
+ readonly params: {
1874
+ readonly kind: "parameters";
1875
+ readonly facet: "weights";
1876
+ readonly schema: {
1877
+ /**
1878
+ * A **ceiling, not the mechanism's switch** — see
1879
+ * `mention-spans.maxMentions`, which is. Non-zero so that
1880
+ * turning the mechanism on with one control does something.
1881
+ */
1882
+ readonly maxLinks: {
1883
+ readonly type: "integer";
1884
+ readonly default: 5;
1885
+ readonly min: 0;
1886
+ readonly label: {
1887
+ readonly en: "Most entries linked";
1888
+ };
1889
+ readonly description: "A ceiling on how many entries one turn may have matched to a description. The best matches are kept; this never brings in an entry nothing else found, it only changes where one comes in the order.";
1890
+ };
1891
+ };
1892
+ };
1893
+ } | undefined;
1894
+ }>;
1895
+ /** Illegal by construction elsewhere; used to prove the purity probe. @internal */
1896
+ export declare const network: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1897
+ main: string;
1898
+ }, import("@serene-pub/sdk").PortDecl, "test:query/network@1"> & {
1899
+ kind: 'query';
1900
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
1901
+ }>;
1902
+ /**
1903
+ * Builds the object a context template renders against.
1904
+ *
1905
+ * A Task, not a Query, even though it reads the cast: what it *is* is the
1906
+ * resolution — which characters appear, which get named, which scenario wins —
1907
+ * and that is a decision anyone should be able to replace. The read reaches the
1908
+ * host like any other (F11 keeps the services out of the Task itself).
1909
+ *
1910
+ * Separate from Assemble on purpose. Assemble allocates a budget and renders;
1911
+ * this decides what there is to render. A plugin that wants different character
1912
+ * cards should not have to reimplement token allocation to get them.
1913
+ * @public
1914
+ */
1915
+ export declare const sessionCast: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1916
+ main: string;
1917
+ cast: string;
1918
+ /**
1919
+ * The seated envoys on their own (PLAN-turn-order §4.4,
1920
+ * additive 2026-09-21): `{ slug, key, origin, name, speaks,
1921
+ * default, position, removedAt }` per seat, live and departed,
1922
+ * in seat order — the rows `main` already carries under
1923
+ * `envoys`, offered as a port so a pool or a strategy can be
1924
+ * wired to them without taking the whole cast. There is no
1925
+ * separate envoy query node, and none should be made.
1926
+ */
1927
+ envoys: string;
1928
+ }, {
1929
+ scope: string;
1930
+ }, "core:query/session-cast@1"> & {
1931
+ kind: 'query';
1932
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
1933
+ }>;
1934
+ /**
1935
+ * The session's settings document, re-read (PLAN-turn-order §4.12, R13).
1936
+ *
1937
+ * Every core inlet that takes a session already publishes the document on
1938
+ * its `session` port, resolved once by the host at run start. This node is
1939
+ * the second way in: placed **after a write that may have moved a value** —
1940
+ * a turn-order write, an annex write — so the rest of the graph reads what
1941
+ * is stored now rather than what the run began with. Same document, same
1942
+ * resolver (`resolveSessionSettings`), no other table read.
1943
+ * @experimental
1944
+ */
1945
+ export declare const sessionSettings: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1946
+ main: string;
1947
+ }, {
1948
+ scope: string;
1949
+ }, "core:query/session-settings@1"> & {
1950
+ kind: 'query';
1951
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
1952
+ }>;
1953
+ /** How the speaking character regards everyone else. @experimental */
1954
+ export declare const relationshipsPerspectives: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
1955
+ main: string;
1956
+ relationshipsPerspectives: string;
1957
+ }, {
1958
+ scope: string;
1959
+ }, "core:query/relationships-perspectives@1"> & {
1960
+ kind: 'query';
1961
+ slots?: {
1962
+ params: {
1963
+ kind: 'parameters';
1964
+ facet: 'weights';
1965
+ schema: {
1966
+ maxEntries: {
1967
+ type: 'integer';
1968
+ /**
1969
+ * ⚠ **No `default:`, and its absence is the declaration.**
1970
+ *
1971
+ * Neither spec ever named this slot, so `resolveInput` never
1972
+ * resolved it and `bindings.ts` called `capRelationships` with
1973
+ * `undefined` on every run this node type has ever made — which
1974
+ * that function reads as *no ceiling at all* and returns the
1975
+ * section whole. `respond` wires `params: slot.params()` now, so
1976
+ * whatever is declared here becomes live; under ruling D-8 the
1977
+ * declared default must therefore BE the value every run has
1978
+ * actually used, and that value is "uncapped".
1979
+ *
1980
+ * Uncapped is not expressible as a number here. `0` is already
1981
+ * taken and means the opposite — `capRelationships` returns
1982
+ * `null` for it, so the section is dropped entirely, which is the
1983
+ * `admitThreshold` / `maxEntries` off-switch convention this
1984
+ * package uses everywhere. A negative sentinel IS what
1985
+ * `capRelationships` reads as "no cap" (`cap < 0` returns the
1986
+ * section), but `min: 0` forbids one and no other parameter in
1987
+ * this package uses a negative sentinel; inventing the convention
1988
+ * here would be a design decision riding in on a wiring fix. And
1989
+ * a large finite number is not the value either — it is a
1990
+ * different value that is *usually* indistinguishable, which is
1991
+ * the kind of nearly-right that D-8 exists to refuse.
1992
+ *
1993
+ * So: no default. `resolveSlot`'s params branch copies a schema
1994
+ * default only `if (v?.default !== undefined)`, and
1995
+ * `reconcileConfigs` back-fills a row only when a declaration
1996
+ * carries one — so an untouched install resolves `undefined` and
1997
+ * stays uncapped, exactly as before. The control renders as an
1998
+ * empty box, which `NumberControl` and the panel already treat as
1999
+ * "unset" (an emptied box commits `undefined` and clears the
2000
+ * row), so the empty state round-trips rather than being a hole.
2001
+ */
2002
+ min: number;
2003
+ quick: boolean;
2004
+ label: {
2005
+ en: string;
2006
+ };
2007
+ description: {
2008
+ en: string;
2009
+ };
2010
+ };
2011
+ };
2012
+ };
2013
+ } | undefined;
2014
+ }>;
2015
+ /**
2016
+ * How everyone else regards the speaking character, and who is known to all.
2017
+ *
2018
+ * `legendaryFigures` rides here rather than on the other node, and the choice
2019
+ * is arguable enough to write down: it is neither the speaker's view nor a view
2020
+ * of the speaker, it is what is *publicly known* — which is the same kind of
2021
+ * claim as "how others regard you" and the opposite kind from "what you think
2022
+ * of them". Splitting it into a third node would put a mostly-empty block in
2023
+ * every prompt on every install that has never marked a node legendary.
2024
+ * @experimental
2025
+ */
2026
+ export declare const relationshipsKnown: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2027
+ main: string;
2028
+ relationshipsKnown: string;
2029
+ }, {
2030
+ scope: string;
2031
+ }, "core:query/relationships-known@1"> & {
2032
+ kind: 'query';
2033
+ slots?: {
2034
+ params: {
2035
+ kind: 'parameters';
2036
+ facet: 'weights';
2037
+ schema: {
2038
+ maxEntries: {
2039
+ type: 'integer';
2040
+ /**
2041
+ * ⚠ **No `default:`, and its absence is the declaration.**
2042
+ *
2043
+ * Neither spec ever named this slot, so `resolveInput` never
2044
+ * resolved it and `bindings.ts` called `capRelationships` with
2045
+ * `undefined` on every run this node type has ever made — which
2046
+ * that function reads as *no ceiling at all* and returns the
2047
+ * section whole. `respond` wires `params: slot.params()` now, so
2048
+ * whatever is declared here becomes live; under ruling D-8 the
2049
+ * declared default must therefore BE the value every run has
2050
+ * actually used, and that value is "uncapped".
2051
+ *
2052
+ * Uncapped is not expressible as a number here. `0` is already
2053
+ * taken and means the opposite — `capRelationships` returns
2054
+ * `null` for it, so the section is dropped entirely, which is the
2055
+ * `admitThreshold` / `maxEntries` off-switch convention this
2056
+ * package uses everywhere. A negative sentinel IS what
2057
+ * `capRelationships` reads as "no cap" (`cap < 0` returns the
2058
+ * section), but `min: 0` forbids one and no other parameter in
2059
+ * this package uses a negative sentinel; inventing the convention
2060
+ * here would be a design decision riding in on a wiring fix. And
2061
+ * a large finite number is not the value either — it is a
2062
+ * different value that is *usually* indistinguishable, which is
2063
+ * the kind of nearly-right that D-8 exists to refuse.
2064
+ *
2065
+ * So: no default. `resolveSlot`'s params branch copies a schema
2066
+ * default only `if (v?.default !== undefined)`, and
2067
+ * `reconcileConfigs` back-fills a row only when a declaration
2068
+ * carries one — so an untouched install resolves `undefined` and
2069
+ * stays uncapped, exactly as before. The control renders as an
2070
+ * empty box, which `NumberControl` and the panel already treat as
2071
+ * "unset" (an emptied box commits `undefined` and clears the
2072
+ * row), so the empty state round-trips rather than being a hole.
2073
+ */
2074
+ min: number;
2075
+ quick: boolean;
2076
+ label: {
2077
+ en: string;
2078
+ };
2079
+ description: {
2080
+ en: string;
2081
+ };
2082
+ };
2083
+ };
2084
+ };
2085
+ } | undefined;
2086
+ }>;
2087
+ /**
2088
+ * The narrative graph as a retrieval **mechanism** (ruling 2026-09-10, Q1).
2089
+ *
2090
+ * ⚠ The ruling calls this an *arm*, and the id deliberately does not. Two
2091
+ * reasons, and the second is the stronger: NOMENCLATURE §22 retires *arm* in
2092
+ * favour of **mechanism**, and every sibling in this package is named for what
2093
+ * it retrieves rather than for the machinery — `entity-search`,
2094
+ * `vector-search`, `world-lore`. The word survives in the *descriptions* on
2095
+ * those siblings, which is prose a user reads (§23.6); an id is a frozen
2096
+ * contract, which is the one place a retired word should not land.
2097
+ *
2098
+ * The two nodes above are a *dump*: they hand the whole graph section to the
2099
+ * template, in whatever order the database returned the rows, and the only
2100
+ * control over it is a ceiling. Every other source the prompt is built from is
2101
+ * shared, ranked and allocated — which is what makes "world lore matters more
2102
+ * than history in this chat" sayable, and what makes "why is this entry here"
2103
+ * answerable. Relationships were the one source none of that reached.
2104
+ *
2105
+ * This is the same three sections read as **candidates**, one per relationship,
2106
+ * in the `relationships` band the ranker and the budget have carried since they
2107
+ * were written. What it buys is the whole retrieval surface at once: the band's
2108
+ * share divides the window, `select` decides what fits, and every relationship
2109
+ * arrives on the receipt with a reason.
2110
+ *
2111
+ * ## Ranked here, not by a second ranker
2112
+ *
2113
+ * `core:task/rank-hybrid@1` takes this like any other candidate source — the
2114
+ * band exists, the share exists, the entry cap exists — so there is no new rank
2115
+ * node and no new signal weight. What this node contributes is the **order**,
2116
+ * as a `presetScore` the ranker uses directly: scene presence first, then
2117
+ * whether the speaker is party to the tie, then how recently it changed. The
2118
+ * arithmetic is deterministic and the receipt states each term, which is the
2119
+ * standard `presetScore` carries — `core:query/entity-search@1` ranks its own
2120
+ * hits the same way for the same reason.
2121
+ *
2122
+ * ⚠ **It does not duplicate the two nodes above.** All three reach
2123
+ * `core:task/build-template-context@1`, on the same two in-ports and never
2124
+ * twice: this band is what those sections are built from on a run that
2125
+ * allocated any of it, and the two nodes' own dump is what they are built from
2126
+ * on a run that did not — which is every run until somebody raises the
2127
+ * relationships share. See docs/embeddings-and-rag.md.
2128
+ *
2129
+ * `relationshipSlots` rather than a declaration of its own, so the ceiling here
2130
+ * means exactly what it means on the two nodes above: on/off plus a ceiling,
2131
+ * with an absent value uncapped and 0 leaving it out altogether.
2132
+ *
2133
+ * ## Nobody speaking: the cast-wide read (genre plan F6(a), 2026-09-29)
2134
+ *
2135
+ * The three sections are claims about a SPEAKER, and a scope whose
2136
+ * `currentCharacterId` is null has none — an Adventure turn is the narrator's
2137
+ * entry, and its planner and narrator are nobody's voice. Such a scope reads
2138
+ * the **cast-wide read** instead: every relationship a cast member holds, one
2139
+ * candidate each in the `castRelationships` lane, headed by its holder and
2140
+ * naming the other end. A host decides what it may carry; Serene Pub withholds
2141
+ * a member's secrets, since nobody's voice is not the holder's. Ordered
2142
+ * the same way — presence (both ends in the cast), then recency; no tie
2143
+ * touches a speaker. Which agents are handed that band is the spec's choice:
2144
+ * a voice is somebody speaking, and wires none of it.
2145
+ *
2146
+ * `loreLinks` switches the one-hop walk from the entries the turn chose (a
2147
+ * room's ways out, what an item belongs to). On by default, which is what this
2148
+ * node has always done; a genre whose places say their own ways out ("From
2149
+ * here:") turns it off, so a place link is said once, by the place.
2150
+ * @experimental
2151
+ */
2152
+ export declare const relationshipSearch: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2153
+ main: string;
2154
+ hits: string;
2155
+ /**
2156
+ * How many ties were walked, how many the scene was present
2157
+ * for, and what the ceiling did — the mechanism-level half of
2158
+ * the trail, which no per-candidate row can carry.
2159
+ *
2160
+ * Declared rather than merely published, unlike the lore lanes'
2161
+ * own diagnostics: an undeclared out-port is invisible to
2162
+ * `validate.ts` and unreadable by a plugin, which is the finding
2163
+ * `core:task/rank-hybrid@1`'s `groups` cost a release.
2164
+ */
2165
+ diagnostics: string;
2166
+ }, {
2167
+ scope: string;
2168
+ }, "core:query/relationship-search@1"> & {
2169
+ kind: 'query';
2170
+ slots?: {
2171
+ readonly params: {
2172
+ readonly kind: 'parameters';
2173
+ readonly facet: 'weights';
2174
+ readonly schema: {
2175
+ readonly share: {
2176
+ type: 'number';
2177
+ min: number;
2178
+ default: number;
2179
+ quick: boolean;
2180
+ label: {
2181
+ en: string;
2182
+ };
2183
+ description: {
2184
+ en: string;
2185
+ };
2186
+ };
2187
+ readonly priority: {
2188
+ type: 'enum';
2189
+ of: readonly ["low", "normal", "high", "always"];
2190
+ members: {
2191
+ key: string;
2192
+ label: {
2193
+ en: string;
2194
+ };
2195
+ description: {
2196
+ en: string;
2197
+ };
2198
+ }[];
2199
+ default: 'normal';
2200
+ label: {
2201
+ en: string;
2202
+ };
2203
+ description: {
2204
+ en: string;
2205
+ };
2206
+ };
2207
+ readonly maxEntries: {
2208
+ type: 'integer';
2209
+ /**
2210
+ * ⚠ **No `default:`, and its absence is the declaration.**
2211
+ *
2212
+ * Neither spec ever named this slot, so `resolveInput` never
2213
+ * resolved it and `bindings.ts` called `capRelationships` with
2214
+ * `undefined` on every run this node type has ever made — which
2215
+ * that function reads as *no ceiling at all* and returns the
2216
+ * section whole. `respond` wires `params: slot.params()` now, so
2217
+ * whatever is declared here becomes live; under ruling D-8 the
2218
+ * declared default must therefore BE the value every run has
2219
+ * actually used, and that value is "uncapped".
2220
+ *
2221
+ * Uncapped is not expressible as a number here. `0` is already
2222
+ * taken and means the opposite — `capRelationships` returns
2223
+ * `null` for it, so the section is dropped entirely, which is the
2224
+ * `admitThreshold` / `maxEntries` off-switch convention this
2225
+ * package uses everywhere. A negative sentinel IS what
2226
+ * `capRelationships` reads as "no cap" (`cap < 0` returns the
2227
+ * section), but `min: 0` forbids one and no other parameter in
2228
+ * this package uses a negative sentinel; inventing the convention
2229
+ * here would be a design decision riding in on a wiring fix. And
2230
+ * a large finite number is not the value either — it is a
2231
+ * different value that is *usually* indistinguishable, which is
2232
+ * the kind of nearly-right that D-8 exists to refuse.
2233
+ *
2234
+ * So: no default. `resolveSlot`'s params branch copies a schema
2235
+ * default only `if (v?.default !== undefined)`, and
2236
+ * `reconcileConfigs` back-fills a row only when a declaration
2237
+ * carries one — so an untouched install resolves `undefined` and
2238
+ * stays uncapped, exactly as before. The control renders as an
2239
+ * empty box, which `NumberControl` and the panel already treat as
2240
+ * "unset" (an emptied box commits `undefined` and clears the
2241
+ * row), so the empty state round-trips rather than being a hole.
2242
+ */
2243
+ min: number;
2244
+ quick: boolean;
2245
+ label: {
2246
+ en: string;
2247
+ };
2248
+ description: {
2249
+ en: string;
2250
+ };
2251
+ };
2252
+ /**
2253
+ * The lore-link hop: relationships one edge from an entry
2254
+ * this turn's keyword scan chose, with an entry at an end
2255
+ * (NOMENCLATURE §17 *lore link*).
2256
+ *
2257
+ * `true` is what every run before it did, so the default
2258
+ * moves nothing. Off, the hop is not walked at all — no
2259
+ * link read, no second scan — and the band holds cast ties
2260
+ * only. Adventure's preset turns it off (F6(a)): a place
2261
+ * link belongs to the place ("From here:"), and a hop would
2262
+ * spend the band on a door no section renders.
2263
+ */
2264
+ readonly loreLinks: {
2265
+ readonly type: "boolean";
2266
+ readonly default: true;
2267
+ readonly label: {
2268
+ readonly en: "Follow lore links";
2269
+ };
2270
+ readonly description: {
2271
+ readonly en: "Also offer the links one step from the lore this turn found — a room’s ways out, what an item belongs to. Off keeps the band to relationships between characters.";
2272
+ };
2273
+ };
2274
+ };
2275
+ };
2276
+ } | undefined;
2277
+ }>;
2278
+ /**
2279
+ * 🚧 **A transcript's attachments** (PLAN-composer-attachments §3.5, 2026-10-02).
2280
+ *
2281
+ * Takes the history read's rows and publishes, per message id, the files its
2282
+ * active revision shows — `core:image` and `core:file` parts, in part order —
2283
+ * as `HistoryAttachmentV1` references (`core:shape/media-by-message@1`). One
2284
+ * query for the whole transcript. A text file arrives with its body (up to
2285
+ * `textFileBytes`), because a text file reaches every model as text and the
2286
+ * placement step after this one cannot read a disk.
2287
+ *
2288
+ * Reads only rows of the run's own session; a message of any other session
2289
+ * contributes nothing. A message with no files is absent from the record.
2290
+ * @experimental
2291
+ */
2292
+ export declare const historyAttachments: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2293
+ main: string;
2294
+ attachments: string;
2295
+ }, {
2296
+ messages: string;
2297
+ }, "core:query/history-attachments@1"> & {
2298
+ kind: 'query';
2299
+ slots?: {
2300
+ readonly params: {
2301
+ readonly kind: "parameters";
2302
+ readonly facet: "weights";
2303
+ readonly schema: {
2304
+ readonly textFileBytes: {
2305
+ readonly type: "integer";
2306
+ readonly min: 0;
2307
+ readonly default: 65536;
2308
+ readonly label: {
2309
+ readonly en: "Text file read limit (bytes)";
2310
+ };
2311
+ readonly description: {
2312
+ readonly en: "How much of each attached text file is read for the prompt. The placement step trims it further to its own token budget and says when it did.";
2313
+ };
2314
+ };
2315
+ };
2316
+ };
2317
+ } | undefined;
2318
+ }>;
2319
+ /**
2320
+ * Which tools this session can call, and how each one is described to a model.
2321
+ *
2322
+ * A Query rather than a literal on `advertise-tools`, because the answer is
2323
+ * not a property of the spec: the core tools are fixed, but an install's
2324
+ * extensions are not, and a spec that listed its tools by hand would advertise
2325
+ * a tool an uninstalled plugin no longer provides — and refuse, by name, the
2326
+ * one that was installed yesterday.
2327
+ *
2328
+ * Each entry is `{ name, description, parameters }` with `parameters` as JSON
2329
+ * Schema, which is the shape `advertise-tools` takes and the shape every
2330
+ * native tool API wants. Nothing here executes anything; `run-tool` does that,
2331
+ * and refuses any name this list did not carry.
2332
+ * @experimental
2333
+ */
2334
+ export declare const availableTools: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2335
+ main: string;
2336
+ tools: string;
2337
+ }, {
2338
+ scope: string;
2339
+ }, "core:query/available-tools@1"> & {
2340
+ kind: 'query';
2341
+ slots?: {
2342
+ readonly params: {
2343
+ readonly kind: "parameters";
2344
+ readonly schema: {
2345
+ readonly include: {
2346
+ readonly type: "string[]";
2347
+ readonly description: "Offer only these tools, by name, in this order. Empty offers every tool the session has.";
2348
+ };
2349
+ readonly plugins: {
2350
+ readonly type: "boolean";
2351
+ readonly default: true;
2352
+ readonly description: "Offer tools contributed by the session's enabled extensions, as well as the built-in ones.";
2353
+ };
2354
+ };
2355
+ };
2356
+ } | undefined;
2357
+ }>;
2358
+ /**
2359
+ * Create a message.
2360
+ *
2361
+ * Split from the old `commitMessage`, which decided new-vs-update from whether an id
2362
+ * happened to be present (13 §10b). That was an implicit branch, and F25 exists because
2363
+ * implicit branches are unreadable: two specs that did different things looked identical,
2364
+ * and the receipt could not tell you which had happened. Two ids, two names, no inference.
2365
+ *
2366
+ * Gate-eligible, so it publishes the discriminated write result rather than raw ids
2367
+ * (13 §7j-b). Under async review this is a proposal a reviewer may still reject.
2368
+ */
2369
+ /**
2370
+ * The create pipeline's read (24 §12, T8): what the session's cast wants to
2371
+ * say first — one entry per character in position order, each carrying the
2372
+ * full greeting history (the first text seeds the message, the rest become
2373
+ * swipes), interpolated against the session's first persona.
2374
+ *
2375
+ * A Query, because deciding what a greeting *is* — group-only lists, the
2376
+ * interpolation, the fallback line — is exactly the kind of decision a
2377
+ * custom genre should be able to replace without reimplementing the write.
2378
+ * @experimental
2379
+ */
2380
+ export declare const sessionGreetings: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2381
+ main: string;
2382
+ greetings: string;
2383
+ }, {
2384
+ scope: string;
2385
+ }, "core:query/session-greetings@1"> & {
2386
+ kind: 'query';
2387
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
2388
+ }>;
2389
+ /**
2390
+ * A seated envoy's **declared greeting**, interpolated (lair re-plan R6,
2391
+ * 2026-09-28) — the line an envoy opens a new session with
2392
+ * (`EnvoyDecl.greeting`): the Lair's Castellan introduces the game.
2393
+ *
2394
+ * The create pipeline's read, beside `session-greetings@1`, which stays the
2395
+ * CARDS' greetings. A Query for the same reason that one is: what a greeting
2396
+ * says is a decision a custom genre may replace without reimplementing the
2397
+ * write.
2398
+ *
2399
+ * **Absent** — `text` empty — when the envoy is not seated in the session
2400
+ * or declares no greeting, so a spec writes behind a junction on `text` and
2401
+ * a session whose envoy was never seated gets no line under its name.
2402
+ * Interpolated with the envoy as `{{char}}`, the session's `{{playerLabel}}`
2403
+ * and the party as `{{characterNames}}` (empty at creation for a genre that
2404
+ * seats nobody yet, so the copy writes `{{#if characterNames}}`).
2405
+ *
2406
+ * No model call: a create run is a person waiting (`lair-create`).
2407
+ * @experimental
2408
+ */
2409
+ export declare const envoyGreeting: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2410
+ main: string;
2411
+ text: string;
2412
+ }, {
2413
+ scope: string;
2414
+ }, "core:query/envoy-greeting@1"> & {
2415
+ kind: 'query';
2416
+ slots?: {
2417
+ readonly params: {
2418
+ readonly kind: "parameters";
2419
+ readonly schema: {
2420
+ /** The envoy, by its genre-local key (`castellan`). */
2421
+ readonly envoy: {
2422
+ readonly type: "text";
2423
+ readonly label: {
2424
+ readonly en: "Envoy";
2425
+ };
2426
+ readonly description: "Which of the genre's envoys greets, by its key.";
2427
+ };
2428
+ };
2429
+ };
2430
+ } | undefined;
2431
+ }>;
2432
+ /**
2433
+ * 🚧 The **standing turn plan** a character turn plays from (Lair character
2434
+ * turns, owner ruling 2026-09-30).
2435
+ *
2436
+ * A planner's row carries the turns it planned (`create-message@1`'s
2437
+ * `turnPlan`, stored as `metadata.turnPlan`). Each named member then takes a
2438
+ * **character turn** of their own — a separate run, fired off the turn order
2439
+ * — and that run reads the plan back here: the planner's document (where the
2440
+ * scene is, what was planned) and the prose describing a room nobody filed.
2441
+ *
2442
+ * The plan that **stands** is the newest planner's row in the session's
2443
+ * history, unless a person's line on `main` is newer than it — a person
2444
+ * speaking after a plan has moved the story past it. With `messageId` (a
2445
+ * regenerate or swipe re-voicing that row) only rows older than it count, so
2446
+ * a re-voiced line reads the plan it was played from. No plan standing, every
2447
+ * port reads absent and the turn plays from the scene as it stands.
2448
+ * @experimental
2449
+ */
2450
+ export declare const turnPlan: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2451
+ main: string;
2452
+ /** The planner's document, as the planner's row stored it. */
2453
+ plan: string;
2454
+ /** Prose describing the room the plan heads into, when the plan carried any. */
2455
+ locationPassage: string;
2456
+ }, {
2457
+ scope: string;
2458
+ /** The row a regenerate or swipe re-voices — the inlet's `messageId`. Absent on a fresh turn. */
2459
+ messageId: string;
2460
+ }, "core:query/turn-plan@1"> & {
2461
+ kind: 'query';
2462
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
2463
+ }>;
2464
+ /**
2465
+ * The session's **annex** (PLAN-turn-order §4.3, R6): read one owner's
2466
+ * document out of `sessions.annex`.
2467
+ *
2468
+ * The annex is the pipeline layer's free field, namespaced by owner key — a
2469
+ * genre id, a plugin id, or a user-authored spec's slug. `metadata` is
2470
+ * core's own and read-only from here; this is where a spec keeps what it
2471
+ * needs to remember without core ever reinterpreting it.
2472
+ *
2473
+ * The owner defaults to the running spec's own namespace, which is the
2474
+ * whole safety of it: a spec reads its own document by default and has to
2475
+ * say `sharedAnnex` out loud to read anybody else's.
2476
+ * @experimental
2477
+ */
2478
+ export declare const sessionAnnex: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2479
+ main: string;
2480
+ }, {
2481
+ scope: string;
2482
+ /**
2483
+ * `'ai'` for the prompt-safe view (R57): only the values the
2484
+ * model's context may carry — those whose audience holds `ai`,
2485
+ * `participant`, or the `speaker` below. Absent is everything,
2486
+ * as a pipeline reads it. A literal.
2487
+ *
2488
+ * `'template'` (typed templates P6) reads what a template may
2489
+ * reference: every DECLARED key of every owner in scope — core
2490
+ * and the enabled plugins, for the session's genre — as
2491
+ * `{ <owner>: { <key>: value } }`. `owner` and `sharedAnnex`
2492
+ * do not apply; a key no declaration covers is left out. Law
2493
+ * T2 lets it feed only a template node's `annex` in-port.
2494
+ */
2495
+ view: string;
2496
+ /** Whose prompt, for `view: 'ai'` — a `character:` or `envoy:` reference. */
2497
+ speaker: string;
2498
+ }, "core:query/session-annex@1"> & {
2499
+ kind: 'query';
2500
+ slots?: {
2501
+ readonly params: {
2502
+ readonly kind: "parameters";
2503
+ readonly facet: "behavior";
2504
+ readonly schema: {
2505
+ readonly owner: {
2506
+ readonly type: "string";
2507
+ readonly default: "";
2508
+ readonly label: {
2509
+ readonly en: "Owner";
2510
+ };
2511
+ readonly description: {
2512
+ readonly en: "Whose document to read. Blank means this pipeline's own.";
2513
+ };
2514
+ };
2515
+ readonly sharedAnnex: {
2516
+ readonly type: "boolean";
2517
+ readonly default: false;
2518
+ readonly label: {
2519
+ readonly en: "Read another owner";
2520
+ };
2521
+ readonly description: {
2522
+ readonly en: "Allow reading a document this pipeline does not own. Off refuses, with a note on the receipt.";
2523
+ };
2524
+ };
2525
+ };
2526
+ };
2527
+ } | undefined;
2528
+ }>;
2529
+ /** The messages a summary is drawn from, already scoped and ordered. @internal */
2530
+ export declare const summarizeSource: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2531
+ main: string;
2532
+ messages: string;
2533
+ }, {
2534
+ scope: string;
2535
+ request: string;
2536
+ }, "core:query/summarize-source@1"> & {
2537
+ kind: 'query';
2538
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
2539
+ }>;
2540
+ /**
2541
+ * The keywords an entry is proposed to be found by — **without a model**.
2542
+ *
2543
+ * ## The defect it exists for
2544
+ *
2545
+ * The summarizer writes a history entry with `keys: []`. Keyword matching is the
2546
+ * only retrieval mechanism on by shipped default, and a history row carries no
2547
+ * title for `nameMatch` to read either, so a summary a user made *so the model
2548
+ * would remember* cannot be found by anything. Measured on the core corpus:
2549
+ * with no keys, **0 of 12** history entries are reachable by any conversation
2550
+ * about them.
2551
+ *
2552
+ * ## ⚠ Why it is not a Provider, and why that is the whole point
2553
+ *
2554
+ * Every sibling in this section calls a model — `name-entry@1` writes the title,
2555
+ * `extract-cast@1` reads the cast. This one is `core:query`, computes from the
2556
+ * lorebook it already has, and **cannot invent a keyword**: every key it emits
2557
+ * is a substring of the text it was given. A proposal that cannot hallucinate
2558
+ * needs no review for hallucination, only for judgement, which is a far cheaper
2559
+ * review — and it costs no tokens, no connection and no wait.
2560
+ *
2561
+ * ## ⚠ The failure mode it is built against
2562
+ *
2563
+ * **Character names are the worst possible keys for a scene.** They are also
2564
+ * what any extractor finds first, and if every scene's entry is keyed on who was
2565
+ * in it then every one of them fires whenever that person is mentioned. That
2566
+ * replaces *"history entries never fire"* with *"all history entries fire
2567
+ * together"*, which is worse — one entry crowding out the rest, across a whole
2568
+ * lane, in a fixed budget where a wrong entry displaces a right one.
2569
+ *
2570
+ * Measured, on ten messages that name two cast members and nothing else:
2571
+ * **0 of 12** history entries fire, and **11 of 12** with the guards against it
2572
+ * removed. Everything the node does is downstream of that number.
2573
+ *
2574
+ * ⚠ There are two guards, not one, and the measurement needed both removed. A
2575
+ * name in every scene also fails the *statistical* test — it already matches
2576
+ * most of the book — so on a lorebook with entries to count over, either one
2577
+ * holds the line. On a lorebook with two entries in it, only the structural
2578
+ * rule can, and that is the lorebook a user has when they start making
2579
+ * summaries.
2580
+ *
2581
+ * ## What a consumer gets
2582
+ *
2583
+ * `keys` carries each proposal with its evidence — where in the text it occurs,
2584
+ * the sentence around it, how distinctive it is in this lorebook, and how many
2585
+ * other entries it already matches — and `rejected` carries every candidate
2586
+ * turned away with the rule that turned it away. Both exist because this node
2587
+ * **proposes and never writes**: what it emits is meant to reach a person who
2588
+ * can edit it before `core:outlet/create-lore-entry@1` stores anything, and a
2589
+ * reviewer who has to hunt for the reason will approve without reading.
2590
+ *
2591
+ * ⚠ It never proposes **secondary** keys. Those carry a user's `selectiveLogic`
2592
+ * conditions — *"fire on dragon, but not when statue is present"* — which is an
2593
+ * author saying *not here*, and nothing that guesses is entitled to say it.
2594
+ * @internal
2595
+ */
2596
+ export declare const entryKeys: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2597
+ main: string;
2598
+ /** The proposals, each with the evidence for it. */
2599
+ keys: string;
2600
+ /** Every candidate turned away, and the rule that turned it away. */
2601
+ rejected: string;
2602
+ }, {
2603
+ /** The lorebook and the cast — what distinctiveness is measured against. */
2604
+ scope: string;
2605
+ /**
2606
+ * The passage keys are proposed for.
2607
+ *
2608
+ * `content`, matching `name-entry@1`, so both proposal steps take
2609
+ * the drafted summary off the same out-port under the same name.
2610
+ */
2611
+ content: string;
2612
+ }, "core:query/entry-keys@1"> & {
2613
+ kind: 'query';
2614
+ slots?: {
2615
+ readonly params: {
2616
+ readonly kind: "parameters";
2617
+ readonly facet: "weights";
2618
+ readonly schema: {
2619
+ /**
2620
+ * ⚠ **A ceiling on firing opportunities, not a display
2621
+ * preference.** Any single key matching admits the entry, so
2622
+ * this is how wide the entry's door is — and the keyword
2623
+ * signal is `matched / keys.length`, so a longer list also
2624
+ * makes the entry *rank* worse for the same single hit.
2625
+ *
2626
+ * Five: a scene is about a place, a thing and an event or
2627
+ * two. Measured at eight, with the ordinary-word cap opened
2628
+ * with it, **six of twelve** history entries fire on
2629
+ * narrative prose naming nothing from any scene — against
2630
+ * one at five — and the shared-name probe stops being clean.
2631
+ * **0 is off**, in the `admitThreshold` convention.
2632
+ *
2633
+ * It is a ceiling and never a target — fewer is the normal
2634
+ * result and none is a valid one.
2635
+ */
2636
+ readonly maxKeys: {
2637
+ readonly type: "integer";
2638
+ readonly default: 5;
2639
+ readonly min: 0;
2640
+ readonly max: 20;
2641
+ readonly quick: true;
2642
+ readonly label: {
2643
+ readonly en: "Most keywords suggested";
2644
+ };
2645
+ readonly description: "A ceiling on how many keywords are proposed for one entry. Each one is another way the entry can be pulled into a prompt, so a short list is usually a better one. 0 suggests none.";
2646
+ };
2647
+ /**
2648
+ * ⚠ **The one calibration a user can actually reason about**,
2649
+ * and the reason the others are not here. How rare a word has
2650
+ * to be, how short it may be, how much of a name to keep —
2651
+ * those are measurements, not preferences, and a settings
2652
+ * panel cannot perform them.
2653
+ *
2654
+ * This one is a preference, because it trades two things a
2655
+ * user can feel: an ordinary word like "watch" or "left" is
2656
+ * how an entry gets found when it names nothing proper, and
2657
+ * it is also how an entry starts firing on any scene at all.
2658
+ * Two ordinary words of five; 0 restricts suggestions to
2659
+ * names and places, which measured cleanest and left two of
2660
+ * twelve summaries with no keys at all.
2661
+ */
2662
+ readonly maxOrdinaryWords: {
2663
+ readonly type: "integer";
2664
+ readonly default: 2;
2665
+ readonly min: 0;
2666
+ readonly max: 20;
2667
+ readonly label: {
2668
+ readonly en: "Ordinary words allowed";
2669
+ };
2670
+ readonly description: "How many of the suggestions may be everyday words rather than names of people, places or things. Names are far less likely to pull the entry into an unrelated scene; 0 suggests names only.";
2671
+ };
2672
+ };
2673
+ };
2674
+ } | undefined;
2675
+ }>;
2676
+ /** @internal */
2677
+ export declare const graphScenes: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2678
+ main: string;
2679
+ scenes: string;
2680
+ }, {
2681
+ scope: string;
2682
+ }, "core:query/graph-scenes@1"> & {
2683
+ kind: 'query';
2684
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
2685
+ }>;
2686
+ /**
2687
+ * The session's stats and states, resolved — an inventory is one, the
2688
+ * `inventory` list stat (phase 3b retired possessions as edges).
2689
+ *
2690
+ * `{ world, cast, slots, who, version }` — the same object `stateFor(sessionId)`
2691
+ * returns and the shape `state` on `core:task/build-template-context@1` takes.
2692
+ * Every value is already resolved down session → lorebook → card →
2693
+ * declaration default, with absence meaning **inherit** rather than zero, and
2694
+ * derived slots computed rather than read.
2695
+ *
2696
+ * A Query, and a plain one: what it is is a read. There is no as-of parameter
2697
+ * — this is the `current` view, and the temporal registry that would give the
2698
+ * other one is not built (see docs/stats-and-states.md).
2699
+ *
2700
+ * `version` is the session's **state version** (plans/29 R-15 *Staleness and
2701
+ * order*; 30 §U5f): a counter every applied change moves, in turn order,
2702
+ * under a lock. A run that reads state here and later asks to change it
2703
+ * hands the version back as `base` on `resolve-state-changes@1` /
2704
+ * `set-state@1`, so a change proposed against a state that has since moved
2705
+ * is rebased or superseded rather than applied blind. The same number rides
2706
+ * the resolved document as `state.version`, where an enabled-when can name it.
2707
+ * @experimental
2708
+ */
2709
+ export declare const sessionState: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2710
+ main: string;
2711
+ state: string;
2712
+ version: string;
2713
+ }, {
2714
+ scope: string;
2715
+ }, "core:query/session-state@1"> & {
2716
+ kind: 'query';
2717
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
2718
+ }>;
2719
+ /**
2720
+ * 🚧 How many of an item are held, and how many are left (attributes phase 3a,
2721
+ * 2026-09-26).
2722
+ *
2723
+ * An item is a `core:entry/item@1` lore entry whose **supply** is unique,
2724
+ * limited to N, or unlimited; a holder's **held count** rides the list item
2725
+ * that references it (`{ entryId, count }`) in any list slot the session
2726
+ * tracks — usually `inventory`. This answers, per entry asked about:
2727
+ * `{ entryId, name, supply, limit, held, remaining, holders }` —
2728
+ * `held` = Σ count across the session's owners (the world and every cast
2729
+ * member), `remaining` = limit − held, never below zero, and `null` for an
2730
+ * unlimited supply.
2731
+ *
2732
+ * ⚠ **It answers; it never enforces.** The owner ruled that supply is enforced
2733
+ * by genre pipelines: a pipeline that hands out the last key reads this first
2734
+ * and decides what a zero means (refuse, swap, narrate a shortage). The host
2735
+ * writes whatever the gate accepts.
2736
+ *
2737
+ * `entryIds` optional: with none it answers for every item entry in the
2738
+ * session's lorebook. An entry outside that lorebook is not answered for — the
2739
+ * scoping refusal, as for every Query.
2740
+ * @experimental
2741
+ */
2742
+ export declare const itemSupply: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2743
+ main: string;
2744
+ supply: string;
2745
+ }, {
2746
+ scope: string;
2747
+ entryIds: string;
2748
+ }, "core:query/item-supply@1"> & {
2749
+ kind: 'query';
2750
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
2751
+ }>;
2752
+ /**
2753
+ * 🚧 The stats a **lorebook** holds — for its world, each cast member and each
2754
+ * place — as durable values (owner-confirmed 2026-09-27: "Pipelines should be
2755
+ * allowed to query stats from the lorebook as well").
2756
+ *
2757
+ * ## The book's layer, and no session needed
2758
+ *
2759
+ * What write-back recorded onto the book's timeline, plus what an author set
2760
+ * on the lorebook, a cast member or a place: the row in force per owner and
2761
+ * slot, the same one a new session played in the book would inherit. Nothing
2762
+ * falls through to a card or a declaration default — a slot the book never
2763
+ * valued is an absent key, not the default — and no session is read, so a
2764
+ * pipeline with no session in play (a run the scope grants the book to) can
2765
+ * read it.
2766
+ *
2767
+ * `{ lorebookId, branchId, slots, world, cast, locations }`, keyed like
2768
+ * `session-state@1`'s document: `world.hp`; `cast.byId[castMemberId]` and
2769
+ * `cast[slug]` over one set of objects, each carrying `id` (the **cast
2770
+ * member's** id — `lorebook_bindings.id`, never the card's), `key` and `name`;
2771
+ * `locations` the same by location entry id. `branchId` is the line read
2772
+ * (null is main).
2773
+ *
2774
+ * ## Only what the book tracks
2775
+ *
2776
+ * A lorebook has no genre, so its vocabulary is phase 1's **world
2777
+ * attributes**: the sheets on the lorebook, its cast members and its places,
2778
+ * plus every declared, pickable slot the book holds a durable value for. It
2779
+ * fails closed: an undeclared slot, or one a mechanism keeps, is never read.
2780
+ *
2781
+ * ## Where on the book
2782
+ *
2783
+ * By default: the scope session's own line and moment when the book is that
2784
+ * session's; otherwise the book's **most recently used** line (the line of
2785
+ * the session played most recently) at the **head** of its timeline. On a
2786
+ * branch, main's dated values count only up to the fork date. The document
2787
+ * says where it read: `branchId`, `moment` (null = head), `forkedAt` — where
2788
+ * main was cut, which on a fork of a fork is the EARLIEST fork date along the
2789
+ * parent chain, not the branch's own (null = no cut).
2790
+ *
2791
+ * 🚧 A custom reading, all optional: `branch` — `'main'`, `'mostRecent'`,
2792
+ * `'session'` or a branch id of this book; `at` — `'head'` or a story date
2793
+ * `{ year, month?, day? }`, keeping only values dated on or before it;
2794
+ * `forkCut: false` — let all of main through on a branch. A branch of
2795
+ * another book is refused like the book.
2796
+ *
2797
+ * ## Scope
2798
+ *
2799
+ * The scope session's own lorebook by default. `lorebookId` may name that
2800
+ * book, or one the run's scope grants; any other is **refused** with a
2801
+ * sentence, never read as empty — and so is an owner filter naming a cast
2802
+ * member or place of another book.
2803
+ * @experimental
2804
+ */
2805
+ export declare const lorebookState: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2806
+ main: string;
2807
+ state: string;
2808
+ }, {
2809
+ /** Which session's lorebook, when `lorebookId` does not say. Optional. */
2810
+ scope: string;
2811
+ /** A lorebook id: the scope session's own, or one the run's scope grants. Optional. */
2812
+ lorebookId: string;
2813
+ /**
2814
+ * One owner: `"world"`, `{ kind: 'cast_member', id }` or
2815
+ * `{ kind: 'location', id }` (the session kinds `session`,
2816
+ * `session_cast`, `session_location` are translated). Optional.
2817
+ */
2818
+ owner: string;
2819
+ /** 🚧 `'main'`, `'mostRecent'`, `'session'` or a branch id of this book. Optional. */
2820
+ branch: string;
2821
+ /** 🚧 `'head'` or a story date `{ year, month?, day? }`. Optional. */
2822
+ at: string;
2823
+ /** 🚧 `false` lets all of main through on a branch. Optional. */
2824
+ forkCut: string;
2825
+ }, "core:query/lorebook-state@1"> & {
2826
+ kind: 'query';
2827
+ slots?: {
2828
+ readonly params: {
2829
+ readonly kind: "parameters";
2830
+ readonly schema: {
2831
+ /**
2832
+ * Which stats to read, by full id (`core:slot/hp@1`) or
2833
+ * local name (`hp`). Empty or absent reads every stat the
2834
+ * book tracks; a name it does not track reads nothing.
2835
+ */
2836
+ readonly slotIds: {
2837
+ readonly type: "list";
2838
+ readonly item: {
2839
+ readonly type: "text";
2840
+ };
2841
+ readonly label: {
2842
+ readonly en: "Only these stats";
2843
+ };
2844
+ readonly description: "Which stats to read, by name. Leave it empty for every stat the lorebook tracks.";
2845
+ };
2846
+ };
2847
+ };
2848
+ } | undefined;
2849
+ }>;
2850
+ /**
2851
+ * 🚧 The **stat trail**: one stat's values over time, for one owner — the
2852
+ * world, a cast member or a place (owner-confirmed 2026-09-27: "stats over
2853
+ * time / over cast progression"). Its document is on `trail` (and `main`).
2854
+ *
2855
+ * ## Two clocks
2856
+ *
2857
+ * - `messages` — the scope session's own changes, in message order. A swiped
2858
+ * or regenerated reply's changes are gone (the swipe retracts them), and a
2859
+ * branched session holds its own copies, so neither leaks in.
2860
+ * - `timeline` — what the lorebook recorded across every session, ordered by
2861
+ * the date of the history entry each hangs from (the one story-date
2862
+ * comparator). An undated value — an author's, or one recorded before any
2863
+ * capture — sorts first.
2864
+ * - `both` (default) — the timeline, then the session's messages: the session
2865
+ * is played at the book's present. A timeline value this session itself
2866
+ * recorded is dropped here, since it is already one of its points.
2867
+ *
2868
+ * Each point: `{ value, layer: 'session' | 'timeline', anchor, provenance }` —
2869
+ * `anchor` is `{ messageId }` or `{ historyEntryId, date }`; `provenance` is
2870
+ * `{ updatedBy, sessionId, messageId, sceneId, note, createdAt }` (who wrote
2871
+ * it: `user`, `run:<id>`, or `session:<id>` for write-back). The document is
2872
+ * `{ lorebookId, sessionId, branchId, owner, slotId, mode, tracked, points }`;
2873
+ * `tracked: false` with no points when neither the book nor the session tracks
2874
+ * the slot (fails closed).
2875
+ *
2876
+ * ## Limits
2877
+ *
2878
+ * `last` keeps the newest N points after every other cut. `since` is
2879
+ * `{ messageId?, date? }`: `messageId` keeps session points AFTER that
2880
+ * message (and drops the timeline in `both`, which precedes it); `date` keeps
2881
+ * timeline points dated ON or after it (a date is a period).
2882
+ *
2883
+ * ## Where on the book
2884
+ *
2885
+ * The timeline stands where `lorebook-state@1` does, with the same optional
2886
+ * `branch`, `at` and `forkCut` ports: on a branch, main's values after the
2887
+ * fork date are not points; at a date, nothing dated after it is. The
2888
+ * session's own messages are its own and are not cut. The document adds
2889
+ * `moment` and `forkedAt` (the effective cut, as in `lorebook-state@1`).
2890
+ *
2891
+ * Scoped like `lorebook-state@1`: the scope session's lorebook, or one the
2892
+ * run's scope grants; any other, or an owner of another book, is refused.
2893
+ * @experimental
2894
+ */
2895
+ export declare const statTrail: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
2896
+ main: string;
2897
+ trail: string;
2898
+ points: string;
2899
+ }, {
2900
+ scope: string;
2901
+ /** A lorebook id: the scope session's own, or one the run's scope grants. Optional. */
2902
+ lorebookId: string;
2903
+ /** `"world"` (default), `{ kind: 'cast_member', id }` or `{ kind: 'location', id }`. */
2904
+ owner: string;
2905
+ /** `{ messageId?, date?: { year, month?, day? } }`. Optional. */
2906
+ since: string;
2907
+ /** 🚧 `'main'`, `'mostRecent'`, `'session'` or a branch id of this book. Optional. */
2908
+ branch: string;
2909
+ /** 🚧 `'head'` or a story date `{ year, month?, day? }`. Optional. */
2910
+ at: string;
2911
+ /** 🚧 `false` lets all of main through on a branch. Optional. */
2912
+ forkCut: string;
2913
+ }, "core:query/stat-trail@1"> & {
2914
+ kind: 'query';
2915
+ slots?: {
2916
+ readonly params: {
2917
+ readonly kind: "parameters";
2918
+ readonly schema: {
2919
+ /** The stat, by full id or local name. */
2920
+ readonly slotId: {
2921
+ readonly type: "text";
2922
+ readonly quick: true;
2923
+ readonly label: {
2924
+ readonly en: "Stat";
2925
+ };
2926
+ readonly description: "Which stat to follow, by name — for example hp.";
2927
+ };
2928
+ readonly mode: {
2929
+ readonly type: "enum";
2930
+ readonly of: readonly ["both", "messages", "timeline"];
2931
+ readonly members: readonly [{
2932
+ readonly key: "both";
2933
+ readonly label: {
2934
+ readonly en: "Both";
2935
+ };
2936
+ readonly description: {
2937
+ readonly en: "Across sessions, then this session.";
2938
+ };
2939
+ }, {
2940
+ readonly key: "messages";
2941
+ readonly label: {
2942
+ readonly en: "This session";
2943
+ };
2944
+ readonly description: {
2945
+ readonly en: "This session, message by message.";
2946
+ };
2947
+ }, {
2948
+ readonly key: "timeline";
2949
+ readonly label: {
2950
+ readonly en: "Across sessions";
2951
+ };
2952
+ readonly description: {
2953
+ readonly en: "What the lorebook recorded across sessions, by story date.";
2954
+ };
2955
+ }];
2956
+ readonly default: "both";
2957
+ readonly quick: true;
2958
+ readonly label: {
2959
+ readonly en: "Which trail";
2960
+ };
2961
+ readonly description: "This session message by message, what the lorebook recorded across sessions by story date, or both.";
2962
+ };
2963
+ readonly last: {
2964
+ readonly type: "integer";
2965
+ readonly default: 50;
2966
+ readonly min: 1;
2967
+ readonly max: 1000;
2968
+ readonly label: {
2969
+ readonly en: "Most changes listed";
2970
+ };
2971
+ readonly description: "Keep only the most recent changes, up to this many.";
2972
+ };
2973
+ };
2974
+ };
2975
+ } | undefined;
2976
+ }>;
2977
+ /**
2978
+ * Change state — or ask to.
2979
+ *
2980
+ * ## Why `propose` is the default
2981
+ *
2982
+ * The three writers do not have equal authority (`DESIGN-stats-and-states.md`).
2983
+ * A person editing a bar is authoritative; a genre's own script rolling damage
2984
+ * is authoritative because the genre author wrote the arithmetic; a **model**
2985
+ * is neither, and a model that could set a number silently is a model that can
2986
+ * rewrite the fiction between two messages with no receipt a player can
2987
+ * refuse. Defaulting to `propose` means a spec that wires a model's output
2988
+ * straight into this node produces a pending line with Accept / Reject, and a
2989
+ * genre that wants the other behaviour says so in one parameter.
2990
+ *
2991
+ * ## Why it is a Task
2992
+ *
2993
+ * It writes, which a Task is not otherwise supposed to do, and the alternative
2994
+ * is worse: F7 allows a spec **one** write-class Consumer and that one is the
2995
+ * message. A damage roll that also saves a reply would be unspecifiable. What
2996
+ * makes it defensible rather than a hole is that these rows are not the run's
2997
+ * primary artifact — every one of them is anchored to a message and retracted
2998
+ * with it, so a rejected turn takes its state changes with it.
2999
+ *
3000
+ * `changes` is one ordered list of `{ owner, slotId, value }` — or, for a
3001
+ * list slot, `{ owner, slotId, op: 'add' | 'remove', items }`. An item
3002
+ * changing hands is exactly that on the owner's `inventory` stat (phase 3b
3003
+ * retired the `{ owner, entryId, delta }` possession edge; the model-facing
3004
+ * item line survives on `resolve-state-changes@1`, which turns it into this). One
3005
+ * port because one turn's changes are one ordered list, and splitting them
3006
+ * would let a spec apply half of them.
3007
+ */
3008
+ /**
3009
+ * Changes a model NAMED, turned into changes `set-state` can write.
3010
+ *
3011
+ * ## A Query, because resolving a name is a READ
3012
+ *
3013
+ * "Verity" becomes a cast row by looking her up in this session's cast, which
3014
+ * is a read of the host and therefore a Query's job — a Task is handed no
3015
+ * services (F11). That also buys the scoping refusal for free: the cast it
3016
+ * matches against is the cast of the session on the `scope` port and no other.
3017
+ *
3018
+ * ## Why this is a node and not a leniency inside `set-state`
3019
+ *
3020
+ * `core:task/set-state@1` takes an owner as `{ kind, id }` — a row, resolved,
3021
+ * unambiguous. A model has no row ids: it has the names the transcript gave it
3022
+ * ("Verity", "the world") and the local name of a stat ("hp"). Something has to
3023
+ * resolve one into the other, and the two candidates were this node or a
3024
+ * widened `set-state`.
3025
+ *
3026
+ * It is this node, because the two callers are genuinely different. A genre's
3027
+ * own script that rolled damage knows which cast row it hit and must not have
3028
+ * its exact owner re-guessed by a fuzzy name match; a model's proposal has
3029
+ * nothing else to offer. Widening `set-state` would make every writer pay for
3030
+ * the model's ambiguity, and would move a resolution failure inside the node
3031
+ * that writes — where it can only be a refusal, never a line on the receipt.
3032
+ *
3033
+ * The same resolution the three state tools do (`set_state`, `give_item`,
3034
+ * `take_item`), reached from a structured block instead of from a tool call.
3035
+ * An item line (`{ owner, entryId, delta }`) resolves to an `add` / `remove`
3036
+ * with a held count on the owner's `inventory` stat, refused as a sentence
3037
+ * when the session does not track inventory (phase 3b).
3038
+ *
3039
+ * ## A name it cannot resolve is a RESULT, not a halt
3040
+ *
3041
+ * A keeper that named five changes and got one character's name wrong should
3042
+ * land four proposals and a sentence about the fifth. `refused` carries those
3043
+ * sentences so the receipt can show them; `changes` carries what resolved.
3044
+ * Halting the turn over one bad name would lose the other four, which is the
3045
+ * same argument `set-state`'s own per-change refusal makes.
3046
+ * @experimental
3047
+ */
3048
+ export declare const resolveStateChanges: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
3049
+ main: string;
3050
+ /** Ready for `core:task/set-state@1`'s `changes` port — each carrying `base` when one was wired. */
3051
+ changes: string;
3052
+ /** One sentence per change that named something not here. */
3053
+ refused: string;
3054
+ }, {
3055
+ /**
3056
+ * `[{ owner, slot, value } | { owner, entryId, delta }]` as a
3057
+ * model writes them: `owner` is a name from the conversation or
3058
+ * `world`, `slot` is a stat's local name (`hp`) or its full id,
3059
+ * and an item line moves `delta` of a lore entry into (+) or
3060
+ * out of (−) the owner's inventory.
3061
+ */
3062
+ changes: string;
3063
+ /**
3064
+ * Who a change that names no `owner` is for, as participant
3065
+ * references (lair re-plan R10, 2026-09-28): each such change
3066
+ * is made once per reference, the same slot and value on each —
3067
+ * the Lair's Whisper writes its one line on every recipient the
3068
+ * press collected (`core:inlet/user-message@1.recipients`). A
3069
+ * `character:<id>` resolves to that seated cast member; any
3070
+ * other reference, or a character this session does not seat,
3071
+ * is a sentence on `refused`. A change that names its own
3072
+ * `owner` keeps it. Optional: unwired, an owner-less change is
3073
+ * the world's, as before.
3074
+ */
3075
+ owners: string;
3076
+ /**
3077
+ * 🚧 **Whose stats this keeper keeps** (stat ownership, owner
3078
+ * ruling 2026-09-30): `'world'` — the world and its places, so
3079
+ * a change naming a cast member is refused; or one participant
3080
+ * reference (`character:<id>`) — that member alone, so a change
3081
+ * to the world, a place or anybody else is refused. Either may
3082
+ * also be a party speaker (`{ characterId }`, or `{ name }` as a
3083
+ * plan writes it, resolved like a change's `owner`), and a list
3084
+ * keeps every item it holds, read flat — an absent item keeps
3085
+ * nobody more. Each refusal is a sentence on `refused`. Unwired,
3086
+ * any owner may be named, as before. The Lair's Castellan keeper
3087
+ * wires `'world'` and the delvers it voiced this turn; each
3088
+ * character turn's keeper wires its own speaker.
3089
+ */
3090
+ keeps: string;
3091
+ /** Which session's cast the names are resolved against. */
3092
+ scope: string;
3093
+ /**
3094
+ * The planner's document, whose `worldHints` are a second,
3095
+ * smaller set of named changes: where this turn happens, the
3096
+ * time of day and the weather.
3097
+ *
3098
+ * Its own port rather than more entries on `changes`, because
3099
+ * a reference is `{node, port}` with no sub-path — a spec
3100
+ * cannot join one node's list to another node's object on one
3101
+ * port, and the two are written by different agents answering
3102
+ * different questions. A hint that repeats what the world
3103
+ * already says proposes nothing, which is what makes "repeat
3104
+ * the state when this turn changes none of it" safe to ask of
3105
+ * the planner.
3106
+ */
3107
+ plan: string;
3108
+ /**
3109
+ * The **state version** this turn read (U5f): the session-state
3110
+ * query's `version`. Passed through onto every resolved change
3111
+ * as `base`, so `set-state` can tell a delta against the state
3112
+ * the model saw from one against a state that has since moved.
3113
+ * Optional: a spec that wires none proposes against whatever
3114
+ * is current at the write.
3115
+ */
3116
+ base: string;
3117
+ /**
3118
+ * 🚧 `core:query/item-supply@1`'s answer (phase 3b). Optional,
3119
+ * and the only way supply is ever checked: core never enforces
3120
+ * it (owner ruling 2026-09-25), so a genre that wants a unique
3121
+ * item to stay unique wires this, and an item line granting
3122
+ * more than is left lands on `refused` as a sentence. A take
3123
+ * frees what that owner held before the turn's gives are
3124
+ * counted.
3125
+ */
3126
+ supply: string;
3127
+ }, "core:query/resolve-state-changes@1"> & {
3128
+ kind: 'query';
3129
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
3130
+ }>;
3131
+ /**
3132
+ * The session's attached lorebook, **listed** — every entry, or the one with a
3133
+ * given name.
3134
+ *
3135
+ * ## Not a retrieval, and that is the whole point
3136
+ *
3137
+ * The four entries-shaped definitions above — `lorebook-triggers@1`,
3138
+ * `world-lore@1`, `character-lore@1`, `history-entries@1` — are one keyword
3139
+ * scan over the conversation, and an entry reaches a prompt through them only
3140
+ * by matching a key, by clearing `admitThreshold` on other evidence, or by
3141
+ * declaring itself `constant`. That is right for a reply and it is no use at
3142
+ * all to a genre that needs to see the book: on a **create** run there is no
3143
+ * conversation to scan, so the window is empty and only always-on entries are
3144
+ * admitted — and a genre asking *is there a room called the Cellar?*, *pick one
3145
+ * of these as the secret*, or *who are the suspects?* had no door at all
3146
+ * (plans/genres §10 G13/G14, §11 L4).
3147
+ *
3148
+ * This is that door, and it is deliberately dull: **no mechanism runs, nothing
3149
+ * is scored, nothing is ranked.** `main` and `entries` carry one bare list of
3150
+ * rows — a **listing**, never `core:shape/context-candidates@1` — so there is
3151
+ * no order of merit in it for a reader to mistake for one. A spec that wants
3152
+ * the book ranked concatenates it into the ranker like any other source; this
3153
+ * node will not do it for them.
3154
+ *
3155
+ * ## The rows are retrieval's rows
3156
+ *
3157
+ * Same fields, from the same host read and the same `toLoreEntry` projection
3158
+ * the four definitions above publish on each candidate's `payload` — `id`,
3159
+ * `source`, `name`, `content`, `keys`, `constant`, `enabled`, `position`,
3160
+ * `priority`, the matcher set, `bindingCharacterId`,
3161
+ * `fingerprint`, and history's `year` / `month` / `day`. That is the contract
3162
+ * worth having: a task written against a retrieved entry reads a listed one
3163
+ * without a second shape to learn, and there is no second projection to keep in
3164
+ * step (R5 — the vocabularies are reconciled at the host's read, not merged).
3165
+ * The one addition is asked for: `withLinks` puts each row's lore links on it
3166
+ * as `links` (`LoreLinkRow[]`), said from that row.
3167
+ *
3168
+ * ## What it will not hand over
3169
+ *
3170
+ * · **Another session's lorebook.** `scope` decides which session, and a
3171
+ * `sessionId` that disagrees with the run's is refused with a sentence
3172
+ * (`assertScoped`), never filtered down to an empty list.
3173
+ * · **Disabled or archived entries.** `enabled: false` is a switch the author
3174
+ * left off and `archived` is the column whose stated meaning is *don't
3175
+ * retrieve it and don't show it to me*; a listing that offered either would
3176
+ * make a switched-off room exist and a shelved suspect answer for a crime.
3177
+ * Both are filtered at the read. (The scan above still *sees* disabled rows,
3178
+ * on purpose — it reports them on `skipped` so a person can be told why their
3179
+ * lore did not come in. Nothing here changes that.)
3180
+ * · **Character lore that is private from the current speaker.** The read
3181
+ * applies the same binding-visibility policy the four definitions above run
3182
+ * under, so this is not a way around it. In the case this node exists for —
3183
+ * a create run, an oracle, anything narrator-shaped — `currentCharacterId` is
3184
+ * null, the policy is omniscient, and the whole book comes back.
3185
+ *
3186
+ * ## No `optional`
3187
+ *
3188
+ * Absent, so a failure is the run's failure. A genre that picked its secret
3189
+ * from this list cannot be handed an empty one and carry on: `optional: true`
3190
+ * turns an error into an empty `ok`, and an empty book and a book that failed
3191
+ * to load are the same value to every reader downstream. It is also not a node
3192
+ * a person should be able to switch off — a Twenty Questions pipeline without
3193
+ * it has nothing to play with.
3194
+ * @experimental
3195
+ */
3196
+ export declare const lorebookEntries: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
3197
+ main: string;
3198
+ entries: string;
3199
+ }, {
3200
+ scope: string;
3201
+ }, "core:query/lorebook-entries@1"> & {
3202
+ kind: 'query';
3203
+ slots?: {
3204
+ readonly params: {
3205
+ readonly kind: "parameters";
3206
+ readonly schema: {
3207
+ /**
3208
+ * Which entry types to list — `core:entry/world-lore`,
3209
+ * `core:entry/character-lore`, `core:entry/history`, or a
3210
+ * plugin's own. Bare ids, no `@version`: the version is a
3211
+ * separate column and a type's rows are its rows across
3212
+ * versions.
3213
+ *
3214
+ * A `list` of `text` rather than an `enum` of the three
3215
+ * core ids, because the set is open — an install with a
3216
+ * plugin entry type has more of them, and an enum frozen
3217
+ * into this definition's content hash could not grow
3218
+ * without a re-projection. An id no type declares matches
3219
+ * nothing, which is the honest answer to a typo.
3220
+ *
3221
+ * Empty or absent lists every entry type.
3222
+ *
3223
+ * Named `entryTypes` rather than `types` (R3): *type* alone
3224
+ * is the word four other vocabularies use — a node type, a
3225
+ * session type, a part type — and a parameter may not take
3226
+ * the bare noun.
3227
+ */
3228
+ readonly entryTypes: {
3229
+ readonly type: "list";
3230
+ readonly item: {
3231
+ readonly type: "text";
3232
+ };
3233
+ readonly label: {
3234
+ readonly en: "Entry types listed";
3235
+ };
3236
+ readonly description: "Which kinds of entry to list, by type id — world lore, character lore, history, or a type an extension declares. Leave it empty for all of them.";
3237
+ };
3238
+ /**
3239
+ * The *does it exist* case: one exact name, matched
3240
+ * case-insensitively with surrounding whitespace trimmed
3241
+ * on both sides.
3242
+ *
3243
+ * Exact and never a substring or a pattern. A genre asking
3244
+ * "is there a room called the Cellar?" needs *yes* or *no*,
3245
+ * and a match that also returned "Cellar Door" and "The
3246
+ * Wine Cellars" would answer a question nobody asked — the
3247
+ * search-shaped reading of this node is the keyword scan
3248
+ * above, which already exists and is better at it.
3249
+ *
3250
+ * History entries have no name at all (the type declares no
3251
+ * title role), so naming one lists nothing.
3252
+ *
3253
+ * Absent lists every entry of the chosen types.
3254
+ */
3255
+ readonly name: {
3256
+ readonly type: "text";
3257
+ readonly quick: true;
3258
+ readonly label: {
3259
+ readonly en: "Only the entry named";
3260
+ };
3261
+ readonly description: "List only the entry with exactly this name, ignoring capitalisation and surrounding spaces. Leave it empty to list them all.";
3262
+ };
3263
+ /**
3264
+ * A ceiling on rows read, not a page: there is no offset
3265
+ * and no cursor, so raising it is the only way to see more.
3266
+ *
3267
+ * 500 is a large lorebook and 2000 is a ceiling on the
3268
+ * ceiling — this list is usually on its way into a prompt,
3269
+ * and a book that would not fit in a context window is not
3270
+ * made to fit by asking for all of it. The cap is enforced
3271
+ * at the read as well as declared here; a node's parameter
3272
+ * is a control, never a promise the host takes on trust.
3273
+ */
3274
+ readonly limit: {
3275
+ readonly type: "integer";
3276
+ readonly default: 500;
3277
+ readonly min: 1;
3278
+ readonly max: 2000;
3279
+ readonly label: {
3280
+ readonly en: "Most entries listed";
3281
+ };
3282
+ readonly description: "A ceiling on how many entries are listed. When there are more, the newest are listed. There is no second page — raising this is the only way to see more.";
3283
+ };
3284
+ /**
3285
+ * Each row's **lore links**, on the row as `links`
3286
+ * (`LoreLinkRow[]`) — places plan B2, 2026-09-29. Drizzle's
3287
+ * `with: { … }` in spirit: the listing stays a listing, and a
3288
+ * reader that wants a room's ways out says so.
3289
+ *
3290
+ * Each link is said **from the listed entry** — its wording
3291
+ * from here, the far end named — and only a link that is a
3292
+ * way out of here is listed: between two entries, standing
3293
+ * (active, not secret) on the session's line at its moment,
3294
+ * both ends live, and never one drawn *into* here with no
3295
+ * wording back (one way, inbound). The far end passes the
3296
+ * visibility gate for the WIRED `speaker`; with none wired,
3297
+ * a far end the listing does not itself carry is named only
3298
+ * when every voice may see it — an unwired listing may be
3299
+ * read once and shared by every voice in a turn (the Lair's
3300
+ * rooms). Never a way round the gate.
3301
+ *
3302
+ * Off by default: a row read without it carries no `links`
3303
+ * at all, so every spec written before it reads exactly what
3304
+ * it did.
3305
+ */
3306
+ readonly withLinks: {
3307
+ readonly type: "boolean";
3308
+ readonly default: false;
3309
+ readonly label: {
3310
+ readonly en: "With each entry’s links";
3311
+ };
3312
+ readonly description: "Also list, on each entry, the links that lead from it to other entries — a room’s ways out, what it is inside — each said from that entry.";
3313
+ };
3314
+ };
3315
+ };
3316
+ } | undefined;
3317
+ }>;
3318
+ //# sourceMappingURL=queries.d.ts.map