@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,990 @@
1
+ /**
2
+ * Core's **outlet** node definitions — writes, attaches, emits: where a run leaves
3
+ * into the world.
4
+ *
5
+ * One file per node kind, with the helpers only that kind uses; `index.ts`
6
+ * re-exports them all.
7
+ */
8
+ import type { WriteResult } from '@serene-pub/sdk';
9
+ /**
10
+ * An author defaulting review ON for their own consumer — and unable to forbid it (F14).
11
+ *
12
+ * Bound 2026-09-17 (plans/29 R-2): the host's commit for it existed and no
13
+ * binding reached it. `target` is the row the part lands on — the same port
14
+ * `update-message` takes, fed from an earlier write in the document (the reply's
15
+ * placeholder, R-17) or from the inlet's `messageId`. An update whose target is
16
+ * an earlier write is the same row, so placing this after `create-message` is
17
+ * one live row, not two (F7). The host reads the id off `target`, or off the
18
+ * media reference's own `messageId` where a caller outside the graph set one.
19
+ * @experimental
20
+ */
21
+ export declare const attachImage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
22
+ main: string;
23
+ }, {
24
+ target: string;
25
+ image: string;
26
+ }, "core:outlet/attach-image@1"> & {
27
+ kind: 'outlet';
28
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
29
+ }>;
30
+ /**
31
+ * The create pipeline's write (24 §12, T8): seed the collected greetings as
32
+ * the session's first messages — one assistant message per entry, the full
33
+ * list as its swipe history, redirected to the genre's declared greeting
34
+ * channel when that is not `main`.
35
+ * @experimental
36
+ */
37
+ export declare const seedGreetings: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
38
+ main: string;
39
+ messageIds: string;
40
+ }, {
41
+ greetings: string;
42
+ /**
43
+ * The channel the greetings land on (20 §7) — the genre's
44
+ * declared greeting channel, written by the create specs as a
45
+ * literal (`createChat.ts`, `adventure.ts`). Absent is `main`.
46
+ * Declared 2026-09-16 (U2 residual): the host read it off the
47
+ * payload while no declaration supplied it.
48
+ */
49
+ channel: string;
50
+ }, "core:outlet/seed-greetings@1"> & {
51
+ kind: 'outlet';
52
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
53
+ }>;
54
+ /**
55
+ * Write a message — complete, or as the run's **placeholder** (R-17).
56
+ *
57
+ * A pipeline that wants a message creates it itself. The reply specs put this
58
+ * node straight after the inlet with `generating: true`: the row it inserts is
59
+ * empty and generating, it is the run's live row (`liveRow` — an oracle's
60
+ * stream lands in it, and Stop finalises it), and the spec's last node is an
61
+ * `update-message` that fills it. That create → update pair on one row inside
62
+ * one run is the run's **one live row** (F7). Without `generating` (or a
63
+ * claimed `row`) the message is complete, and an ordinary write — a pipeline
64
+ * may write as many as it likes, just never a second on the live row's
65
+ * channel. `message-created` fires on the create, which is now genuinely the
66
+ * moment the row exists.
67
+ *
68
+ * `reviewDefault: 'off'` — review of a reply, when an admin enables it, lands
69
+ * on the *update* of the primary row and never on this create by default
70
+ * (R-21 (3)): a placeholder is a write, and an admin who gates this node gets
71
+ * a run that shows nothing until approved, which is honest and rarely wanted.
72
+ * Turning it on is still the admin's to do.
73
+ * @public
74
+ */
75
+ export declare const createMessage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
76
+ main: string;
77
+ messageId: string;
78
+ }, {
79
+ text: string;
80
+ /**
81
+ * Media to post WITH the message, as references.
82
+ *
83
+ * Posting an image as a NEW message is one write, not a create
84
+ * followed by an `attach-image`: the answer is the same one
85
+ * streaming got — one node with a settled output, not two nodes
86
+ * and a hope. The write that creates the message is the write
87
+ * that attaches its images.
88
+ */
89
+ media: string;
90
+ /**
91
+ * Who is speaking, as a cast row — the inlet's `characterId`.
92
+ * Null or absent means nobody in particular: narration, or a
93
+ * message no character voices.
94
+ */
95
+ characterId: string;
96
+ /**
97
+ * The participant voicing this message when they are **not** a
98
+ * cast row — the side-character fact `{ name, characterId, known }`
99
+ * off `side-character-turn@1`'s `sideCharacter` port. Stored
100
+ * beside the message under `metadata.sideCharacter` (was
101
+ * `metadata.speaker` until U5g, 2026-09-16 — that key is the
102
+ * participant reference now, on the row as on the inlet, R1),
103
+ * where the run and the receipt read it from; it never writes a
104
+ * cast row and never enters the rotation.
105
+ *
106
+ * Was `speaker` until 2026-09-16 — the inlet's port of that
107
+ * name is a participant reference now (R-18 (3)).
108
+ */
109
+ sideCharacter: string;
110
+ /**
111
+ * Who is speaking, as a **participant reference** (R-18 (3);
112
+ * U5g, 2026-09-16) — `character:<id>` or `envoy:<slug>`, the
113
+ * inlet's `speaker`. Stored beside the message as
114
+ * `metadata.speaker`; it is the only identity an envoy's turn
115
+ * carries, since an envoy has no row for `characterId` to name.
116
+ * Optional: a spec that wires only `characterId` writes the row
117
+ * it always wrote.
118
+ */
119
+ speaker: string;
120
+ /**
121
+ * Create the row as a **placeholder**: empty, generating, and the
122
+ * run's live row — filled by a later `update-message`, or
123
+ * finalised by core if the run stops first.
124
+ *
125
+ * A port, not a parameter, and the call site is what decides:
126
+ * the reply specs write `generating: true` as a literal into the
127
+ * node's config, in the same map as `text`, and `resolveInput`
128
+ * passes it through untouched — so the binding reads it exactly
129
+ * the way it reads a port (see `summarize-batch`'s `loreType`
130
+ * for the same reasoning at length). A `params` field would put
131
+ * a structural fact of the document in the panel as a knob.
132
+ */
133
+ generating: string;
134
+ /**
135
+ * The message is **narration** — not a character's turn. Shown
136
+ * under the narrator's name, never counted by the rotation. A
137
+ * literal, on the same terms as `generating`. The name is the
138
+ * session's narrator name, or the `speaker`'s where one was
139
+ * named; the host resolves it at the write, which is where the
140
+ * row is.
141
+ */
142
+ narration: string;
143
+ /**
144
+ * Instructions this message was asked for — a narrator's focus
145
+ * note. Stored beside the message and shown with it; never its
146
+ * text. Wired from the inlet's `text` on the narrate specs, which
147
+ * is what a narrator turn's triggering text is.
148
+ */
149
+ instructions: string;
150
+ /**
151
+ * The channel the row lands on (20 §7). Absent is `main`, so a
152
+ * pipeline that has never heard of channels writes where it
153
+ * always did; a channel the session's genre never declared is
154
+ * refused at the write. Declared 2026-09-16 (U2 residual) for
155
+ * the same reason `seed-greetings` declares its own.
156
+ */
157
+ channel: string;
158
+ /**
159
+ * An existing message row to take as the placeholder instead of
160
+ * inserting one — the inlet's `messageId` on a regenerate, swipe
161
+ * or extend. The row is reset to generating and becomes the
162
+ * run's live row; its text and swipe history stay as the verb
163
+ * left them. Absent on a fresh turn, which inserts.
164
+ */
165
+ row: string;
166
+ /**
167
+ * Message **blocks** to post with the row (20 §6; R-15
168
+ * *Forms*; U5d, 2026-09-17): a list of `MessageBlock` — text,
169
+ * tables, meters, and the two interactive kinds, `choices` and
170
+ * `form`, which are **forms** when they carry an `addressee`.
171
+ * The host validates the tree (`checkMessageBlocks`), refuses
172
+ * a block naming a function this spec declares no action for
173
+ * or one whose action is `world` (the effects line), stamps
174
+ * each form with the writing spec's action identity and an
175
+ * id, stores them as a `core:blocks` part, and — for a form
176
+ * whose addressee the run's pinned portrayals say the AI
177
+ * portrays — records `core:event/form-addressed@1` for the
178
+ * genre's answer pipeline once this run's receipt is saved.
179
+ * Absent on nearly every message.
180
+ */
181
+ blocks: string;
182
+ /**
183
+ * **Folded sections** to show collapsed beside the text — a
184
+ * narrator's Plan, a step's notes (`FoldedSectionV1[]`: each
185
+ * `{ kind, label, content }` or `{ kind, label, items }`; at
186
+ * most `MAX_FOLDED_SECTIONS`). Stored with the row as
187
+ * `core:section` parts above the body; never the text, and
188
+ * never read into the prompt transcript. A malformed section
189
+ * is refused by position. Absent on nearly every message.
190
+ */
191
+ sections: string;
192
+ /**
193
+ * 🚧 The **turn plan** this row carries (Lair character turns,
194
+ * owner ruling 2026-09-30): `{ plan, locationPassage? }`, where
195
+ * `plan` is a planner's document whose `speakers` (side-character
196
+ * facts — `{ name, intent }` or `{ characterId }`) name who takes
197
+ * a **character turn** next, in order, and `locationPassage` is
198
+ * prose that describes the room they are heading into. The host
199
+ * resolves each speaker to a seated cast member and stores the
200
+ * whole as `metadata.turnPlan` (`{ turns, plan, locationPassage? }`,
201
+ * `turns` the participant references in order). A turn-order
202
+ * strategy reads the **standing plan** off the history and
203
+ * prepares one entry per turn not yet taken (`via: 'plan'`); each
204
+ * character turn reads it back through `core:query/turn-plan@1`.
205
+ * Absent, or with no `plan`, the row plans nothing — which is
206
+ * every row but a planner's.
207
+ */
208
+ turnPlan: string;
209
+ }, "core:outlet/create-message@1"> & {
210
+ kind: 'outlet';
211
+ slots?: {
212
+ /**
213
+ * The write hook (18 §4a): one chain rewrites the final output, the
214
+ * other decides where a streamed reply stops. Stop is a verdict —
215
+ * min-reduction across every attached script, and the connection's
216
+ * own guards join the same union at dispatch (18 §4b), which is why
217
+ * order never needs ruling. `speakerName` and `castNames` are
218
+ * extras: readable, never writable, by construction (18 §6a).
219
+ */
220
+ readonly scripts: {
221
+ readonly kind: "scripts";
222
+ readonly accepts: ["core:script:text/transform@1", "core:script:text/stop@1"];
223
+ readonly port: "text";
224
+ readonly phase: "before";
225
+ readonly extras: ["speakerName", "castNames"];
226
+ readonly description: "Scripts over the reply as it is saved — clean up the text, or stop a streaming reply early.";
227
+ };
228
+ } | undefined;
229
+ }>;
230
+ /**
231
+ * Update an existing message — finish a placeholder, or edit a settled row.
232
+ *
233
+ * `target` takes `row-ids@1`, and a `write-result@1` from earlier in the same
234
+ * run is assignable to it (09-B B4): the reply specs wire `$.placeholder.messageId`
235
+ * here, which is the create → update pair that makes the pipeline own its row.
236
+ * The other case is unchanged — the id comes from outside the run because the
237
+ * user clicked a message, so it is on the inlet.
238
+ *
239
+ * Which of the two this is, the row decides: a target still **generating** — a
240
+ * placeholder this run created — is finished (the text lands, the generating
241
+ * state ends, the reasoning trace and the swipe slot are written); a settled
242
+ * target is edited and marked so. That is the row's own state, not a flag a
243
+ * spec could get wrong.
244
+ *
245
+ * Where review lands on a reply (R-21 (3)): when an admin turns review on
246
+ * for a reply's message writes, it is THIS node that parks — the placeholder
247
+ * ships `reviewDefault: 'off'` and declares no default here either, so nothing
248
+ * gates by default and a reviewer who asks for one sees the content, not an
249
+ * empty row. The executor's own rule (`resolvePosition`) is "the setting, else
250
+ * the author's default, else off", and this node leaves the default unset.
251
+ * @experimental
252
+ */
253
+ export declare const updateMessage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
254
+ main: string;
255
+ messageId: string;
256
+ }, {
257
+ target: string;
258
+ text: string;
259
+ /**
260
+ * The reasoning trace the oracle separated from its text, when
261
+ * the model produced one. Stored beside the message as the
262
+ * reasoning fold reads it; absent means none. Shown folded,
263
+ * and never re-sent to the model: the prompt transcript reads
264
+ * a row's text alone (decision D5, 2026-09-27).
265
+ */
266
+ reasoning: string;
267
+ /**
268
+ * Blocks to append to the row — the same list, the same
269
+ * checks and the same stamping as `create-message`'s
270
+ * `blocks`; appended as a `core:blocks` part after the text
271
+ * lands, so a reply can end with a question put to the cast.
272
+ */
273
+ blocks: string;
274
+ /**
275
+ * **Folded sections** for the reply — the same list and the
276
+ * same checks as `create-message`'s `sections`. Finishing a
277
+ * reply, they are the shown alternative's sections, whole: a
278
+ * regenerate replaces what the slot held, and a finish with
279
+ * none clears it, while every other alternative keeps its own.
280
+ * Editing a settled row, they replace the shown alternative's
281
+ * only when given. Like `reasoning`, never re-sent to the model.
282
+ */
283
+ sections: string;
284
+ }, "core:outlet/update-message@1"> & {
285
+ kind: 'outlet';
286
+ slots?: {
287
+ /** The same write hook as `create-message` — see it for the terms. */
288
+ readonly scripts: {
289
+ readonly kind: "scripts";
290
+ readonly accepts: ["core:script:text/transform@1", "core:script:text/stop@1"];
291
+ readonly port: "text";
292
+ readonly phase: "before";
293
+ readonly extras: ["speakerName", "castNames"];
294
+ readonly description: "Scripts over the reply as it is saved — clean up the text, or stop a streaming reply early.";
295
+ };
296
+ } | undefined;
297
+ }>;
298
+ /**
299
+ * Delete a message. Publishes `lost` — the content, role, speaker, channel
300
+ * and metadata the row held — beside the write result, so a listener (a
301
+ * plugin cleaning its rows, the next reply's inlet) knows what went.
302
+ * @experimental
303
+ */
304
+ export declare const deleteMessage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
305
+ main: string;
306
+ messageId: string;
307
+ lost: string;
308
+ }, {
309
+ target: string;
310
+ }, "core:outlet/delete-message@1"> & {
311
+ kind: 'outlet';
312
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
313
+ }>;
314
+ /**
315
+ * Write the session's turn order (PLAN-turn-order §4.2, §4.4; R5) — the ONE
316
+ * write path for `sessions.metadata.turnOrder`, and the only outlet that
317
+ * writes `metadata` at all.
318
+ *
319
+ * Before writing it drops what cannot be fired, each with a receipt note:
320
+ * an entry whose `ref` is not among `candidates` (a script or a plugin
321
+ * strategy cannot seat somebody the pool did not admit), and an entry on a
322
+ * channel the session does not have. Then `writeTurnOrder`, which refuses
323
+ * an order answering an older event than the one already stored and says
324
+ * `stale` on the receipt rather than failing.
325
+ *
326
+ * `causesEvent` is how `turn-order-changed` reaches the auto-advance
327
+ * listener and the `sessions:turnOrder` push; the `cause` wired in here is
328
+ * the one that rides along, so the listener can tell a person's send from a
329
+ * migration's backfill.
330
+ * @experimental
331
+ */
332
+ export declare const setTurnOrder: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
333
+ main: string;
334
+ /** The document as written, or the stored one when this was stale. */
335
+ turnOrder: string;
336
+ }, {
337
+ order: string;
338
+ candidates: string;
339
+ /** The instant the answered event happened — the staleness key. */
340
+ basedOnAt: string;
341
+ /** The event id this order answers. */
342
+ event: string;
343
+ /** The inlet's cause, carried into `turn-order-changed`. */
344
+ cause: string;
345
+ }, "core:outlet/set-turn-order@1"> & {
346
+ kind: 'outlet';
347
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
348
+ }>;
349
+ /**
350
+ * Write one owner's document into the session's annex (§4.3).
351
+ *
352
+ * Merged into what is there by default — a spec that keeps one key does not
353
+ * have to carry the rest — and written under
354
+ * `pg_advisory_xact_lock(hashtext('annex'), sessionId)` through `jsonb_set`,
355
+ * so two specs writing two owners' documents at once cannot lose each
356
+ * other's. Causes `core:event/annex-changed@1` (R30, the modder pass,
357
+ * reversing §4.3's "no causesEvent"): a package's state is the annex, and a
358
+ * genre that wants its turn order to answer that state binds the event in
359
+ * the open, where the event map draws it — not through a back door.
360
+ * @experimental
361
+ */
362
+ export declare const setSessionAnnex: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
363
+ main: string;
364
+ annex: string;
365
+ }, {
366
+ value: string;
367
+ }, "core:outlet/set-session-annex@1"> & {
368
+ kind: 'outlet';
369
+ slots?: {
370
+ readonly params: {
371
+ readonly kind: "parameters";
372
+ readonly facet: "behavior";
373
+ readonly schema: {
374
+ readonly owner: {
375
+ readonly type: "string";
376
+ readonly default: "";
377
+ readonly label: {
378
+ readonly en: "Owner";
379
+ };
380
+ readonly description: {
381
+ readonly en: "Whose document to write. Blank means this pipeline's own.";
382
+ };
383
+ };
384
+ readonly merge: {
385
+ readonly type: "boolean";
386
+ readonly default: true;
387
+ readonly label: {
388
+ readonly en: "Merge";
389
+ };
390
+ readonly description: {
391
+ readonly en: "Keep the keys already there and write over the ones given. Off replaces the whole document.";
392
+ };
393
+ };
394
+ readonly sharedAnnex: {
395
+ readonly type: "boolean";
396
+ readonly default: false;
397
+ readonly label: {
398
+ readonly en: "Write another owner";
399
+ };
400
+ readonly description: {
401
+ readonly en: "Allow writing a document this pipeline does not own. Off refuses, with a note on the receipt.";
402
+ };
403
+ };
404
+ };
405
+ };
406
+ } | undefined;
407
+ }>;
408
+ /**
409
+ * Set one **annex field** (2026-09-26): the write behind every
410
+ * `annexField()` a package declares — core's one pipeline for them all,
411
+ * `core:spec/set-annex-field`.
412
+ *
413
+ * `payload` is `{ field, value }`: `field` the field's action identity
414
+ * (`<owner>:annex#<key>`), which the host's door put there after judging the
415
+ * press — who pressed, the plugin switch, the shape. The host reads the
416
+ * declaration again here rather than trusting the payload: an undeclared
417
+ * key, a value its shape refuses, a secret, or a declared audience that is
418
+ * not one is refused, and the run halts on it. What is written goes through
419
+ * the same annex write as `set-session-annex` — the lock, one audience per
420
+ * key, `annex-changed`, every viewer's view re-sent — into
421
+ * `annex[<owner>][<key>]`, under the audience the declaration names.
422
+ * @experimental
423
+ */
424
+ export declare const setAnnexField: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
425
+ main: string;
426
+ annex: string;
427
+ }, {
428
+ payload: string;
429
+ }, "core:outlet/set-annex-field@1"> & {
430
+ kind: 'outlet';
431
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
432
+ }>;
433
+ /**
434
+ * Record an event your package declared: something happened, and
435
+ * pipelines bound to it — plugin listeners, and widgets when the event is
436
+ * delivered to the session — hear it.
437
+ *
438
+ * `event` is the declaration value (`defineSessionEvent(…)`), written into
439
+ * the document as its id; it is never wired, so what a pipeline records is
440
+ * known before it runs. `payload` must carry the event's declared shape. The
441
+ * write is the `session_changes` row, and the event it causes is the one it
442
+ * names — so a recorded event is, like every event, the consequence of a
443
+ * write. It is never the live row; a run may record several.
444
+ *
445
+ * Who may record it is the declaring package's to say
446
+ * (`defineExtension({ events: [{ event, genre, recordedBy }] })`): the host
447
+ * refuses a recording from a pipeline outside that scope.
448
+ * @experimental
449
+ */
450
+ export declare const recordEvent: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
451
+ main: string;
452
+ }, {
453
+ /** The declared event's id — a literal, never wired. */
454
+ event: string;
455
+ payload: string;
456
+ }, "core:outlet/record-event@1"> & {
457
+ kind: 'outlet';
458
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
459
+ }>;
460
+ /**
461
+ * Hide a message from the prompt, or show it again — a **ghost**. The row
462
+ * stays; `hidden` says which way it went.
463
+ * @experimental
464
+ */
465
+ export declare const hideMessage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
466
+ main: string;
467
+ messageId: string;
468
+ hidden: string;
469
+ }, {
470
+ target: string;
471
+ hidden: string;
472
+ }, "core:outlet/hide-message@1"> & {
473
+ kind: 'outlet';
474
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
475
+ }>;
476
+ /**
477
+ * A person's rewrite of a **settled** row: the text replaces, the selected
478
+ * alternative follows it, the embedding is cleared for re-indexing, and the
479
+ * row is marked edited. Publishes `previous` — the content it replaced.
480
+ *
481
+ * Distinct from `update-message@1`, which finishes a *generating* row with
482
+ * what a pipeline produced. A floor: every genre has it.
483
+ * @experimental
484
+ */
485
+ export declare const editMessage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
486
+ main: string;
487
+ messageId: string;
488
+ previous: string;
489
+ }, {
490
+ target: string;
491
+ text: string;
492
+ }, "core:outlet/edit-message@1"> & {
493
+ kind: 'outlet';
494
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
495
+ }>;
496
+ /**
497
+ * Move between a message's alternatives, or record a new one. `index`
498
+ * selects an alternative the row already holds; `text` records a new one and
499
+ * selects it — the reply road then fills an empty one it opened this way.
500
+ * Publishes `swipeIndex`, the alternative now showing, and `previous` — the
501
+ * content and index that were.
502
+ * @experimental
503
+ */
504
+ export declare const swipeMessage: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
505
+ main: string;
506
+ messageId: string;
507
+ swipeIndex: string;
508
+ previous: string;
509
+ }, {
510
+ target: string;
511
+ index: string;
512
+ text: string;
513
+ }, "core:outlet/swipe-message@1"> & {
514
+ kind: 'outlet';
515
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
516
+ }>;
517
+ /**
518
+ * Branch a session at a message: a new session with the same cast, guests
519
+ * and tags and a copy of the history up to and including `fromMessage`, each
520
+ * copy keeping its channel. Publishes the new `sessionId`. A floor.
521
+ * @experimental
522
+ */
523
+ export declare const branchSession: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
524
+ main: string;
525
+ sessionId: string;
526
+ }, {
527
+ fromMessage: string;
528
+ title: string;
529
+ }, "core:outlet/branch-session@1"> & {
530
+ kind: 'outlet';
531
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
532
+ }>;
533
+ /**
534
+ * Record a line's **shown sprite**. Writes it on the line's ACTIVE swipe
535
+ * (`metadata.swipes.spriteHistory[currentIdx]`, mirrored to
536
+ * `metadata.sprite`), so each swipe keeps its own face.
537
+ *
538
+ * Who chose it is `source`, written by the spec as a literal: `picker` after
539
+ * a reply, `person` in `core:spec/show-sprite` (a person's pick from the
540
+ * message menu). A picker never overwrites a person's pick. A picker's null
541
+ * pick writes nothing — the line keeps what it shows; a person's null clears
542
+ * the line's sprite.
543
+ * @experimental
544
+ */
545
+ export declare const showSprite: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
546
+ main: string;
547
+ messageId: string;
548
+ /** What the line now shows, or null. */
549
+ sprite: string;
550
+ /**
551
+ * True when nothing was written — a picker meeting a person's
552
+ * pick, a picker's null pick, or the sprite the line already
553
+ * shows.
554
+ */
555
+ kept: string;
556
+ }, {
557
+ target: string;
558
+ /** A `sprite-pick@1` — a picker's, or a person's; null for none. */
559
+ pick: string;
560
+ /**
561
+ * Who chose the pick: `'picker'` or `'person'`.
562
+ *
563
+ * ## A port, not a parameter, and the call site is what decides
564
+ *
565
+ * A literal in the node's config, on `create-message`'s
566
+ * `generating` terms: the reply specs write `source: 'picker'`
567
+ * and `core:spec/show-sprite` writes `source: 'person'`. A
568
+ * `params` field would put a structural fact of the document
569
+ * in the panel as a knob. It was the host's to decide from the
570
+ * running spec's id until 2026-10-05; the document says it now.
571
+ *
572
+ * ⚠ Stated, not trusted: a host accepts `'person'` only from
573
+ * core's own `core:spec/show-sprite`, run for a person whose
574
+ * pick it checked against the item rule, as for an edit.
575
+ */
576
+ source: string;
577
+ }, "core:outlet/show-sprite@1"> & {
578
+ kind: 'outlet';
579
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
580
+ }>;
581
+ /**
582
+ * Move a session's **story clock** — the session's own story now — by `by` of
583
+ * `unit`, through its lorebook's calendar (`advanceStoryTime`): carried by a
584
+ * declared calendar, and by the smallest-part rule in a free-form book.
585
+ * What "advance a minute per reply" places.
586
+ *
587
+ * Moves the session's clock only, never the book's or its line's present. A
588
+ * session with no clock of its own starts from its line's present. Refused
589
+ * with a sentence — the run halts — when the session has no lorebook, when
590
+ * there is no present to start from, and when the result does not land in
591
+ * the book's calendar; never clamped, never a silent no-op.
592
+ *
593
+ * `by` and `unit` in-ports, when wired, win over the parameters. To advance
594
+ * once per reply, place it in a spec bound to the reply's event, which runs
595
+ * after the reply is saved. (No ordering-only in-port: an unread port is a
596
+ * declared control no run consults — `declaredReads`.)
597
+ * @experimental
598
+ */
599
+ export declare const advanceStoryClock: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
600
+ main: string;
601
+ /** The session's story clock as it now stands: `{ year, month?, day?, hour?, minute? }`. */
602
+ clock: string;
603
+ /** It spelled through the book's calendar. */
604
+ label: string;
605
+ }, {
606
+ /** A whole number; wins over the `by` parameter when wired. */
607
+ by: string;
608
+ /** One of the units; wins over the `unit` parameter when wired. */
609
+ unit: string;
610
+ }, "core:outlet/advance-story-clock@1"> & {
611
+ kind: 'outlet';
612
+ slots?: {
613
+ readonly params: {
614
+ readonly kind: "parameters";
615
+ readonly facet: "behavior";
616
+ readonly schema: {
617
+ readonly by: {
618
+ readonly type: "integer";
619
+ readonly default: 1;
620
+ readonly label: {
621
+ readonly en: "By";
622
+ };
623
+ readonly description: {
624
+ readonly en: "How many units to move the clock. Negative goes back.";
625
+ };
626
+ };
627
+ readonly unit: {
628
+ readonly type: "enum";
629
+ readonly of: readonly ["minutes", "hours", "days", "months", "years"];
630
+ readonly members: readonly [{
631
+ readonly key: "minutes";
632
+ readonly label: {
633
+ readonly en: "Minutes";
634
+ };
635
+ }, {
636
+ readonly key: "hours";
637
+ readonly label: {
638
+ readonly en: "Hours";
639
+ };
640
+ }, {
641
+ readonly key: "days";
642
+ readonly label: {
643
+ readonly en: "Days";
644
+ };
645
+ }, {
646
+ readonly key: "months";
647
+ readonly label: {
648
+ readonly en: "Months";
649
+ };
650
+ }, {
651
+ readonly key: "years";
652
+ readonly label: {
653
+ readonly en: "Years";
654
+ };
655
+ }];
656
+ readonly default: "hours";
657
+ readonly label: {
658
+ readonly en: "Unit";
659
+ };
660
+ readonly description: {
661
+ readonly en: "What to count. In a free-form book only the part named moves: days never roll into a month.";
662
+ };
663
+ };
664
+ };
665
+ };
666
+ } | undefined;
667
+ }>;
668
+ /**
669
+ * Commit an oracle's answer to a form **exactly as a click would**.
670
+ *
671
+ * The host checks the answer against the form's schema, then fires the
672
+ * block's action through the same server path a press takes
673
+ * (`fireAction`): the run owner is the acting user, the actor portrays the
674
+ * addressee, the block's addressee is the audience, and the action's spec
675
+ * runs as a child of this run. It records `form-answered` in the session's
676
+ * changes with the answer and `answeredBy: 'oracle'`, so the next reply's
677
+ * inlet sees it. Refused outside a document on `core:inlet/form-addressed@1`
678
+ * (`validate()` and the host), refused when the addressee is not the AI's,
679
+ * and refused for a `world` action (the effects line — belt to the
680
+ * validator's braces). `reviewDefault: 'off'`; an admin may gate it, and the
681
+ * reviewer edits the `answer` alone.
682
+ * @experimental
683
+ */
684
+ export declare const answerForm: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
685
+ main: string;
686
+ messageId: string;
687
+ /** The answer as committed: `{ choice }` or the values. */
688
+ answer: string;
689
+ /** The identity of the action the answer fires — `<spec slug>#<key>`. */
690
+ firedAction: string;
691
+ /** The child run's id, chosen at the commit so this receipt can name it. */
692
+ firedRunId: string;
693
+ }, {
694
+ /** The block, as the inlet published it. */
695
+ form: string;
696
+ /** The oracle's document — checked against `formAnswerSchema(form)`. */
697
+ answer: string;
698
+ messageId: string;
699
+ blockId: string;
700
+ addressee: string;
701
+ }, "core:outlet/answer-form@1"> & {
702
+ kind: 'outlet';
703
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
704
+ }>;
705
+ /** The audio twin of `attach-image` — same `target`, same commit, bound the same day. @experimental */
706
+ export declare const attachAudio: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
707
+ main: string;
708
+ }, {
709
+ target: string;
710
+ audio: string;
711
+ }, "core:outlet/attach-audio@1"> & {
712
+ kind: 'outlet';
713
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
714
+ }>;
715
+ /**
716
+ * Write the finished entry. Gate-eligible, so it publishes a write result.
717
+ *
718
+ * ## Which kind of entry — the pipeline's decision, at last (L3, 2026-09-17)
719
+ *
720
+ * The host's commit case has said since the four summarize namespaces were
721
+ * written that *which kind of entry comes from the pipeline that ran*. It did
722
+ * not: it wrote world lore whatever ran, because nothing on this declaration
723
+ * could say otherwise. `entryType` is that sentence made true — a declared
724
+ * entry type id (`core:entry/world-lore`, `core:entry/history`,
725
+ * `core:entry/location`), bare, the way `core:query/lorebook-entries@1` spells
726
+ * them; the version is the row's own column.
727
+ *
728
+ * A **param** and not an in-port, because the kind of thing a pipeline writes
729
+ * is a fact about the pipeline rather than about the turn — a summarizer
730
+ * writes history every time it runs, a room-builder writes locations every
731
+ * time — and a param is what a preset can set per session without the spec
732
+ * being rewired. An unknown id is refused at the commit with a sentence
733
+ * naming the declared types, never coerced to world lore: a typo that silently
734
+ * files rooms as world lore is the defect this replaces.
735
+ *
736
+ * Default world lore, the agnostic shape, so every spec written before this
737
+ * keeps doing exactly what it did.
738
+ *
739
+ * ## `links`, or a second write
740
+ *
741
+ * Linking a new entry takes one of two shapes, and both exist on purpose.
742
+ * (A pipeline may write many times — F7 limits only the live row — so
743
+ * `core:outlet/link-lore-entries@1` may also follow this outlet in the same
744
+ * run, each its own transaction.)
745
+ *
746
+ * - `links` — the links land in the **same transaction** as the row, keyed
747
+ * from the entry just written. A genre that builds a room with its exits
748
+ * does it in one run and one commit, and a link naming an entry that does
749
+ * not exist fails the row with it rather than writing half a room. This is
750
+ * the shape a builder wants.
751
+ * - `core:outlet/link-lore-entries@1` takes its `to` by **name**, so a later
752
+ * run can link what an earlier one created without holding an id. This is
753
+ * the shape a second turn wants.
754
+ *
755
+ * Each entry of `links` is a name or an entry id, or a `LoreLinkInput` —
756
+ * `{ to, linkType?, reverseLinkType?, name?, description? }` — for one that
757
+ * says more (places plan B2, 2026-09-29). Absent on nearly every write, and an
758
+ * empty list is the same as none. A link the list states twice, or one the
759
+ * session already reads, is written once: see `linkLoreEntries` on idempotence.
760
+ * @internal
761
+ */
762
+ export declare const createLoreEntry: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
763
+ main: string;
764
+ entryId: string;
765
+ }, {
766
+ name: string;
767
+ content: string;
768
+ /**
769
+ * Links to write from this entry in the same commit — see the
770
+ * note above on F7. Names, entry ids, or `LoreLinkInput`s.
771
+ */
772
+ links: string;
773
+ }, "core:outlet/create-lore-entry@1"> & {
774
+ kind: 'outlet';
775
+ slots?: {
776
+ readonly params: {
777
+ readonly kind: "parameters";
778
+ readonly schema: {
779
+ readonly entryType: {
780
+ readonly type: "string";
781
+ readonly default: "core:entry/world-lore";
782
+ readonly quick: true;
783
+ readonly label: {
784
+ readonly en: "Kind of entry";
785
+ };
786
+ readonly description: "Which kind of lorebook entry this pipeline writes — world lore, history, a location. Leave it as world lore for anything that is simply about the world.";
787
+ };
788
+ };
789
+ };
790
+ } | undefined;
791
+ }>;
792
+ /**
793
+ * Link two lore entries (L2, 2026-09-17).
794
+ *
795
+ * ## The gap it closes
796
+ *
797
+ * `create-lore-entry@1` takes a name and a body and nothing else, so a genre
798
+ * whose world has *shape* — a room with exits, a street that runs past a shop
799
+ * — had one place to put that shape: the prose. Lair shipped writing an
800
+ * `Exits:` line into the content and parsing it back out, which is a link with
801
+ * no foreign key, no cascade and no second reader. The rows have existed all
802
+ * along (an entry-ended `narrative_relationships` row, the same edge the
803
+ * lorebook's own graph draws); no pipeline could write one.
804
+ *
805
+ * ## Both ends, and the one scope
806
+ *
807
+ * `from` is an entry id — or, straight off `create-lore-entry@1`, its
808
+ * `entryId` write result, which is assignable to `row-ids@1` (09-B B4). `to`
809
+ * is an id **or a name**, resolved within the session's own lorebook, case
810
+ * and surrounding space ignored. A name is the half that makes the law below
811
+ * survivable, and it is also the half that can be wrong in two ways, so both
812
+ * are refused with a sentence: a name nothing answers to, and a name **two**
813
+ * entries answer to — the second never picks one, because picking would link
814
+ * the wrong room silently and a duplicate name is the author's to resolve.
815
+ *
816
+ * One lorebook, both ends. An edge whose ends live in two books belongs to
817
+ * neither and the row carries one `lorebook_id`, so a cross-book link is
818
+ * refused rather than repaired — the same rule the socket handlers hold, held
819
+ * again here because a pipeline does not come through them.
820
+ *
821
+ * ## After a create
822
+ *
823
+ * It may follow `core:outlet/create-lore-entry@1` in the same run (F7 limits
824
+ * only the live row), linking by name what that write created — which is why
825
+ * `to` takes one; a later run can do the same. Each write is its own
826
+ * transaction, so a failed link leaves the entry behind. When the entry and
827
+ * its links are one thought, `create-lore-entry`'s own `links` in-port writes
828
+ * the edges in the row's transaction instead — the shape a room-builder wants.
829
+ *
830
+ * ## What the link says (places plan B2, 2026-09-29)
831
+ *
832
+ * The row is a **relationship**, and it carries the relationship's whole
833
+ * descriptor — the same four words the lorebook's own link form edits:
834
+ *
835
+ * - `linkType` — the relationship type, read from the `from` end ("leads
836
+ * north to"). Free text in the row and free text here: the app's list is a
837
+ * vocabulary of *suggestions*, and nothing reads a relationship type
838
+ * semantically. The default is `leads to`.
839
+ * - `reverseLinkType` — the wording read from the `to` end ("leads south
840
+ * to"). **Empty is one way**, and one way is the default: direction is
841
+ * something a spec says, never a guess the host makes from the forward
842
+ * words. A symmetric wording repeats itself (`connects to` / `connects to`).
843
+ * - `name` — the relationship's own name ("the rusted iron door", "the King's
844
+ * Road"), empty for an unnamed way. ⚠ Something you can stand in is a place
845
+ * of its own, not a named link.
846
+ * - `description` — its description. (It was the port `label`; one column,
847
+ * one word, no alias.)
848
+ *
849
+ * ## Idempotent
850
+ *
851
+ * One way is one row, **as the session reads** (the app's
852
+ * `linksOnReadingThatWay`): a link the session already reads — on its own
853
+ * line or one it inherits, undated or dated at or before its moment — with
854
+ * the same name (case aside) that says **everything** this one would (the same
855
+ * words read from the same end, both ways when both are asked, or its true
856
+ * mirror drawn from the far end) is **the standing row**. The outlet returns
857
+ * its id and writes nothing, so a re-run, a swipe or a second turn never stacks
858
+ * a room's ways out; `fromEntryId` is the row's own `from`. The standing row is
859
+ * never rewritten: a pipeline's repeat does not edit a link a person may have
860
+ * drawn or worded. And because this run did not make the row, the host neither
861
+ * records it as the run's (an undo of the run must not delete it) nor reports a
862
+ * write (`written: false`, so no `core:event/lore-link-created@1`).
863
+ *
864
+ * Refused with a sentence instead: a link that says only PART of this one (a
865
+ * one-way door where both ways is asked — a second row would say that part
866
+ * twice), and one that says it all but no longer stands (resolved, broken,
867
+ * secret) — nothing the session reads states it, and a pipeline does not
868
+ * reopen or reveal it.
869
+ * @internal
870
+ */
871
+ export declare const linkLoreEntries: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
872
+ main: string;
873
+ linkId: string;
874
+ }, {
875
+ /** The entry the link starts at — an id, or a write result. */
876
+ from: string;
877
+ /**
878
+ * The entry it ends at: an id, or a **name** resolved within
879
+ * this session's lorebook. `json` because it is either — and
880
+ * every shape is assignable into `json`, so an id port, a
881
+ * write result and a text name all wire here.
882
+ */
883
+ to: string;
884
+ /** The relationship's own name — "the rusted iron door". Optional. */
885
+ name: string;
886
+ /** Its description. Optional. */
887
+ description: string;
888
+ }, "core:outlet/link-lore-entries@1"> & {
889
+ kind: 'outlet';
890
+ slots?: {
891
+ readonly params: {
892
+ readonly kind: "parameters";
893
+ readonly schema: {
894
+ readonly linkType: {
895
+ readonly type: "string";
896
+ readonly default: "leads to";
897
+ readonly quick: true;
898
+ readonly label: {
899
+ readonly en: "Kind of link";
900
+ };
901
+ readonly description: "What the link says, read from the entry it starts at — “leads north to”, “connects to”, “is inside”, “keeper of”.";
902
+ };
903
+ readonly reverseLinkType: {
904
+ readonly type: "string";
905
+ readonly default: "";
906
+ readonly label: {
907
+ readonly en: "From there it…";
908
+ };
909
+ readonly description: "What the link says read from the other end — “leads south to”, “holds”. Leave it empty for a way that only goes one way.";
910
+ };
911
+ };
912
+ };
913
+ } | undefined;
914
+ }>;
915
+ /**
916
+ * One lore link a spec asks for — an element of
917
+ * `core:outlet/create-lore-entry@1`'s `links` (places plan B2, 2026-09-29).
918
+ *
919
+ * The same four words as `core:outlet/link-lore-entries@1`'s ports and
920
+ * parameters, and as the `LoreLinkRow` a listing reads back: what you write is
921
+ * what you read. A bare name, entry id or write result in `links` is the same
922
+ * as `{ to }` with nothing else said.
923
+ * @experimental
924
+ */
925
+ export interface LoreLinkInput {
926
+ /**
927
+ * The entry the link ends at: an entry id, the name of an entry in the
928
+ * session's lorebook (case and surrounding space ignored), or the write
929
+ * result of the write that made it.
930
+ */
931
+ to: number | string | WriteResult;
932
+ /** The relationship type, read from the entry being saved. Absent is `leads to`. */
933
+ linkType?: string;
934
+ /** The wording read from `to`'s end. Absent or empty is one way. */
935
+ reverseLinkType?: string;
936
+ /** The relationship's own name — "the rusted iron door". Absent is unnamed. */
937
+ name?: string;
938
+ /** Its description. */
939
+ description?: string;
940
+ }
941
+ /**
942
+ * One lore link on a `core:query/lorebook-entries@1` row, listed when the
943
+ * spec asks for `withLinks` (places plan B2, 2026-09-29).
944
+ *
945
+ * **Said from the listed entry**: `to` is the far end, whichever end of the
946
+ * relationship the listed entry is. A relationship drawn from here reads by
947
+ * its relationship type; one drawn to here reads by its reverse type, and one
948
+ * drawn to here with no reverse type (one way, inbound) is not listed at all —
949
+ * it is no way out of here. Only relationships between two entries, standing
950
+ * (active, not secret) on the session's line at its moment, with both ends
951
+ * live and the far end one the wired `speaker` may see — or, with no speaker
952
+ * wired, one every voice may see.
953
+ * @experimental
954
+ */
955
+ export interface LoreLinkRow {
956
+ /** The relationship's id. */
957
+ id: number;
958
+ /** The far end, named as the session's reading sees it (amendments applied). */
959
+ to: {
960
+ entryId: number;
961
+ name: string;
962
+ };
963
+ /** The wording read from the listed entry — "leads north to". */
964
+ linkType: string;
965
+ /** The wording read from the far end back to here. Absent is one way. */
966
+ reverseLinkType?: string;
967
+ /** The relationship's own name. Absent is unnamed. */
968
+ name?: string;
969
+ /** Its description. Absent is none. */
970
+ description?: string;
971
+ }
972
+ /**
973
+ * The proposal, held for review.
974
+ *
975
+ * `effects: 'write'` and therefore gate-eligible, which is the mechanism behind
976
+ * the rule that a graph build **stops at the review screen** and never applies
977
+ * itself. Under `async` review the proposal is exactly that — a proposal — and
978
+ * `write-result@1` is the shape that refuses to be mistaken for row ids.
979
+ * @internal
980
+ */
981
+ export declare const graphProposal: import("@serene-pub/sdk").Pinned<import("@serene-pub/sdk").Descriptor<{
982
+ main: string;
983
+ proposalId: string;
984
+ }, {
985
+ proposal: string;
986
+ }, "core:outlet/graph-proposal@1"> & {
987
+ kind: 'outlet';
988
+ slots?: Record<string, import("@serene-pub/sdk").SlotDecl> | undefined;
989
+ }>;
990
+ //# sourceMappingURL=outlets.d.ts.map