@serene-pub/contracts 0.6.0-pr-4 → 0.6.0-pr-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/outlets.js CHANGED
@@ -8,21 +8,21 @@
8
8
  import { S } from '@serene-pub/sdk';
9
9
  import { describeOutletDefinition, pin } from '@serene-pub/sdk';
10
10
  /**
11
- * An author defaulting review ON for their own consumer — and unable to forbid it (F14).
11
+ * An author defaulting review ON for their own consumer — and unable to forbid it.
12
12
  *
13
- * Bound 2026-09-17 (plans/29 R-2): the host's commit for it existed and no
13
+ * Bound 2026-09-17: the host's commit for it existed and no
14
14
  * binding reached it. `target` is the row the part lands on — the same port
15
15
  * `update-message` takes, fed from an earlier write in the document (the reply's
16
- * placeholder, R-17) or from the inlet's `messageId`. An update whose target is
16
+ * placeholder) or from the inlet's `messageId`. An update whose target is
17
17
  * an earlier write is the same row, so placing this after `create-message` is
18
- * one live row, not two (F7). The host reads the id off `target`, or off the
18
+ * one live row, not two. The host reads the id off `target`, or off the
19
19
  * media reference's own `messageId` where a caller outside the graph set one.
20
20
  * @experimental
21
21
  */
22
22
  export const attachImage = pin(describeOutletDefinition({
23
23
  id: 'core:outlet/attach-image@1',
24
24
  effects: 'write',
25
- /** The image is a reference to an asset this run rendered; nothing to retype (R-15 review fields). */
25
+ /** The image is a reference to an asset this run rendered; nothing to retype. */
26
26
  review: { fields: [] },
27
27
  timeoutMs: 5000,
28
28
  reviewDefault: 'on',
@@ -30,7 +30,7 @@ export const attachImage = pin(describeOutletDefinition({
30
30
  ports: { in: { target: S.rowIds, image: S.image }, out: { main: S.writeResult } },
31
31
  }));
32
32
  /**
33
- * The create pipeline's write (24 §12, T8): seed the collected greetings as
33
+ * The create pipeline's write: seed the collected greetings as
34
34
  * the session's first messages — one assistant message per entry, the full
35
35
  * list as its swipe history, redirected to the genre's declared greeting
36
36
  * channel when that is not `main`.
@@ -39,7 +39,7 @@ export const attachImage = pin(describeOutletDefinition({
39
39
  export const seedGreetings = pin(describeOutletDefinition({
40
40
  id: 'core:outlet/seed-greetings@1',
41
41
  effects: 'write',
42
- /** The greetings are the cards' own text and the channel the genre's: approve or refuse (R-15 review fields). */
42
+ /** The greetings are the cards' own text and the channel the genre's: approve or refuse. */
43
43
  review: { fields: [] },
44
44
  timeoutMs: 5000,
45
45
  causesEvent: 'core:event/message-created@1',
@@ -47,10 +47,10 @@ export const seedGreetings = pin(describeOutletDefinition({
47
47
  in: {
48
48
  greetings: S.json,
49
49
  /**
50
- * The channel the greetings land on (20 §7) — the genre's
50
+ * The channel the greetings land on — the genre's
51
51
  * declared greeting channel, written by the create specs as a
52
52
  * literal (`createChat.ts`, `adventure.ts`). Absent is `main`.
53
- * Declared 2026-09-16 (U2 residual): the host read it off the
53
+ * Declared 2026-09-16: the host read it off the
54
54
  * payload while no declaration supplied it.
55
55
  */
56
56
  channel: S.text,
@@ -59,22 +59,22 @@ export const seedGreetings = pin(describeOutletDefinition({
59
59
  },
60
60
  }));
61
61
  /**
62
- * Write a message — complete, or as the run's **placeholder** (R-17).
62
+ * Write a message — complete, or as the run's **placeholder**.
63
63
  *
64
64
  * A pipeline that wants a message creates it itself. The reply specs put this
65
65
  * node straight after the inlet with `generating: true`: the row it inserts is
66
66
  * empty and generating, it is the run's live row (`liveRow` — an oracle's
67
67
  * stream lands in it, and Stop finalises it), and the spec's last node is an
68
68
  * `update-message` that fills it. That create → update pair on one row inside
69
- * one run is the run's **one live row** (F7). Without `generating` (or a
69
+ * one run is the run's **one live row**. Without `generating` (or a
70
70
  * claimed `row`) the message is complete, and an ordinary write — a pipeline
71
71
  * may write as many as it likes, just never a second on the live row's
72
72
  * channel. `message-created` fires on the create, which is now genuinely the
73
73
  * moment the row exists.
74
74
  *
75
75
  * `reviewDefault: 'off'` — review of a reply, when an admin enables it, lands
76
- * on the *update* of the primary row and never on this create by default
77
- * (R-21 (3)): a placeholder is a write, and an admin who gates this node gets
76
+ * on the *update* of the primary row and never on this create by default:
77
+ * a placeholder is a write, and an admin who gates this node gets
78
78
  * a run that shows nothing until approved, which is honest and rarely wanted.
79
79
  * Turning it on is still the admin's to do.
80
80
  * @public
@@ -82,7 +82,7 @@ export const seedGreetings = pin(describeOutletDefinition({
82
82
  export const createMessage = pin(describeOutletDefinition({
83
83
  id: 'core:outlet/create-message@1',
84
84
  effects: 'write',
85
- /** The text may be reviewed; who speaks, which row and which channel are the run's identity (R-15 review fields). */
85
+ /** The text may be reviewed; who speaks, which row and which channel are the run's identity. */
86
86
  review: { fields: ['text'] },
87
87
  reviewDefault: 'off',
88
88
  liveRow: true,
@@ -90,12 +90,12 @@ export const createMessage = pin(describeOutletDefinition({
90
90
  causesEvent: 'core:event/message-created@1',
91
91
  slots: {
92
92
  /**
93
- * The write hook (18 §4a): one chain rewrites the final output, the
93
+ * The write hook: one chain rewrites the final output, the
94
94
  * other decides where a streamed reply stops. Stop is a verdict —
95
95
  * min-reduction across every attached script, and the connection's
96
- * own guards join the same union at dispatch (18 §4b), which is why
96
+ * own guards join the same union at dispatch, which is why
97
97
  * order never needs ruling. `speakerName` and `castNames` are
98
- * extras: readable, never writable, by construction (18 §6a).
98
+ * extras: readable, never writable, by construction.
99
99
  */
100
100
  scripts: {
101
101
  kind: 'scripts',
@@ -130,18 +130,18 @@ export const createMessage = pin(describeOutletDefinition({
130
130
  * cast row — the side-character fact `{ name, characterId, known }`
131
131
  * off `side-character-turn@1`'s `sideCharacter` port. Stored
132
132
  * beside the message under `metadata.sideCharacter` (was
133
- * `metadata.speaker` until U5g, 2026-09-16 — that key is the
134
- * participant reference now, on the row as on the inlet, R1),
133
+ * `metadata.speaker` until 2026-09-16 — that key is the
134
+ * participant reference now, on the row as on the inlet),
135
135
  * where the run and the receipt read it from; it never writes a
136
136
  * cast row and never enters the rotation.
137
137
  *
138
138
  * Was `speaker` until 2026-09-16 — the inlet's port of that
139
- * name is a participant reference now (R-18 (3)).
139
+ * name is a participant reference now.
140
140
  */
141
141
  sideCharacter: S.json,
142
142
  /**
143
- * Who is speaking, as a **participant reference** (R-18 (3);
144
- * U5g, 2026-09-16) — `character:<id>` or `envoy:<slug>`, the
143
+ * Who is speaking, as a **participant reference**
144
+ * (2026-09-16) — `character:<id>` or `envoy:<slug>`, the
145
145
  * inlet's `speaker`. Stored beside the message as
146
146
  * `metadata.speaker`; it is the only identity an envoy's turn
147
147
  * carries, since an envoy has no row for `characterId` to name.
@@ -180,10 +180,10 @@ export const createMessage = pin(describeOutletDefinition({
180
180
  */
181
181
  instructions: S.text,
182
182
  /**
183
- * The channel the row lands on (20 §7). Absent is `main`, so a
183
+ * The channel the row lands on. Absent is `main`, so a
184
184
  * pipeline that has never heard of channels writes where it
185
185
  * always did; a channel the session's genre never declared is
186
- * refused at the write. Declared 2026-09-16 (U2 residual) for
186
+ * refused at the write. Declared 2026-09-16 for
187
187
  * the same reason `seed-greetings` declares its own.
188
188
  */
189
189
  channel: S.text,
@@ -196,8 +196,8 @@ export const createMessage = pin(describeOutletDefinition({
196
196
  */
197
197
  row: S.rowIds,
198
198
  /**
199
- * Message **blocks** to post with the row (20 §6; R-15
200
- * *Forms*; U5d, 2026-09-17): a list of `MessageBlock` — text,
199
+ * Message **blocks** to post with the row
200
+ * (2026-09-17): a list of `MessageBlock` — text,
201
201
  * tables, meters, and the two interactive kinds, `choices` and
202
202
  * `form`, which are **forms** when they carry an `addressee`.
203
203
  * The host validates the tree (`checkMessageBlocks`), refuses
@@ -238,6 +238,45 @@ export const createMessage = pin(describeOutletDefinition({
238
238
  * every row but a planner's.
239
239
  */
240
240
  turnPlan: S.json,
241
+ /**
242
+ * 🚧 A folio line's **kind** (2026-10-17): one word stored as
243
+ * `metadata.kind` — the Dungeon Crawler's journal writes `did`
244
+ * · `found` · `met` · `changed` · `time` · `lead` — which a
245
+ * Messages copy filters on (`rowKinds`) and groups under. A
246
+ * literal in the node's config or a wired port; absent writes
247
+ * no kind, and a row with none always shows.
248
+ */
249
+ kind: S.text,
250
+ /**
251
+ * 🚧 `'user'`: the row is a **person's own message** — the run
252
+ * owner's, through `speaker` (`character:<id>` their persona,
253
+ * `player-seat:<id>` their card-less seat, `user:<id>` or
254
+ * nothing for themselves). A literal, on `generating`'s terms;
255
+ * absent is a reply. The host writes a person's row only for the
256
+ * run's own person on a root run, refuses a persona or seat that
257
+ * is not theirs, and fires the row's `message-completed` under
258
+ * the person's cause, so turn order and auto-advance answer it
259
+ * as a send. `core:spec/save-message` sets it.
260
+ * @ruling owner 2026-10-15
261
+ */
262
+ role: S.json,
263
+ /**
264
+ * 🚧 The person's ready **tray items** to post as the row's
265
+ * attachments (`core:image` / `core:file` parts), in one
266
+ * transaction with the row — or the write is refused whole and
267
+ * the tray stays. Only on a person's row (`role: 'user'`).
268
+ */
269
+ trayItems: S.json,
270
+ /**
271
+ * 🚧 `true`: the row is a **table line** — the table's own
272
+ * line, said in no voice (a Dungeon Crawler roll line,
273
+ * 2026-10-15). A literal, on `generating`'s terms. Stored as
274
+ * `metadata.tableLine`; the log draws it without a speaker's
275
+ * face or name, and a history read that asks for no table lines
276
+ * (`session-history@1`'s `tableLines: false`) leaves it out, so
277
+ * a model never takes it for its own speech and imitates it.
278
+ */
279
+ tableLine: S.json,
241
280
  },
242
281
  out: { main: S.writeResult, messageId: S.writeResult },
243
282
  },
@@ -246,7 +285,7 @@ export const createMessage = pin(describeOutletDefinition({
246
285
  * Update an existing message — finish a placeholder, or edit a settled row.
247
286
  *
248
287
  * `target` takes `row-ids@1`, and a `write-result@1` from earlier in the same
249
- * run is assignable to it (09-B B4): the reply specs wire `$.placeholder.messageId`
288
+ * run is assignable to it: the reply specs wire `$.placeholder.messageId`
250
289
  * here, which is the create → update pair that makes the pipeline own its row.
251
290
  * The other case is unchanged — the id comes from outside the run because the
252
291
  * user clicked a message, so it is on the inlet.
@@ -257,7 +296,7 @@ export const createMessage = pin(describeOutletDefinition({
257
296
  * target is edited and marked so. That is the row's own state, not a flag a
258
297
  * spec could get wrong.
259
298
  *
260
- * Where review lands on a reply (R-21 (3)): when an admin turns review on
299
+ * Where review lands on a reply: when an admin turns review on
261
300
  * for a reply's message writes, it is THIS node that parks — the placeholder
262
301
  * ships `reviewDefault: 'off'` and declares no default here either, so nothing
263
302
  * gates by default and a reviewer who asks for one sees the content, not an
@@ -268,7 +307,7 @@ export const createMessage = pin(describeOutletDefinition({
268
307
  export const updateMessage = pin(describeOutletDefinition({
269
308
  id: 'core:outlet/update-message@1',
270
309
  effects: 'write',
271
- /** The text may be reviewed; the row may not, nor the reasoning trace (R-15 review fields). */
310
+ /** The text may be reviewed; the row may not, nor the reasoning trace. */
272
311
  review: { fields: ['text'] },
273
312
  timeoutMs: 5000,
274
313
  causesEvent: 'core:event/message-updated@1',
@@ -292,7 +331,7 @@ export const updateMessage = pin(describeOutletDefinition({
292
331
  * the model produced one. Stored beside the message as the
293
332
  * reasoning fold reads it; absent means none. Shown folded,
294
333
  * and never re-sent to the model: the prompt transcript reads
295
- * a row's text alone (decision D5, 2026-09-27).
334
+ * a row's text alone (decided 2026-09-27).
296
335
  */
297
336
  reasoning: S.text,
298
337
  /**
@@ -312,6 +351,15 @@ export const updateMessage = pin(describeOutletDefinition({
312
351
  * only when given. Like `reasoning`, never re-sent to the model.
313
352
  */
314
353
  sections: S.foldedSections,
354
+ /**
355
+ * 🚧 The reply's PARTS, in order (O5, 2026-10-21; additive) —
356
+ * `generate-text@1`'s `parts`. Every media part (a spoken
357
+ * reply's audio, a drawn image) lands on the row as a message
358
+ * part in the order the model gave it, after the text. Text and
359
+ * reasoning parts are not written from here: `text` and
360
+ * `reasoning` carry them.
361
+ */
362
+ parts: S.partStream,
315
363
  },
316
364
  out: { main: S.writeResult, messageId: S.writeResult },
317
365
  },
@@ -342,6 +390,18 @@ export const updateMessage = pin(describeOutletDefinition({
342
390
  * Delete a message. Publishes `lost` — the content, role, speaker, channel
343
391
  * and metadata the row held — beside the write result, so a listener (a
344
392
  * plugin cleaning its rows, the next reply's inlet) knows what went.
393
+ *
394
+ * 🚧 **The deletion outlet** (RF fix 5, owner ruling 2026-10-23: deletion
395
+ * requires a pipeline, so the genre manages it). Placed by the built-in's
396
+ * own spec (⏳ retired as a person's verb), which names its row on `target`,
397
+ * and by a **deletion pipeline** — a document entered through
398
+ * `core:inlet/message-deletion-asked@1`, the only other place it may stand
399
+ * (`deletionPipelinePlaces`) — which hands it the deletion the event carried
400
+ * on `asked`, wired from the inlet's `main`
401
+ * (`C.deleteMessage.v1({ asked: $.input.main })`), and deletes that message
402
+ * and no other. One transaction: the row goes and everything the message
403
+ * changed goes with it by the one retraction rule (RF fix 4) — and `taken`
404
+ * says what that was.
345
405
  * @experimental
346
406
  */
347
407
  export const deleteMessage = pin(describeOutletDefinition({
@@ -356,12 +416,34 @@ export const deleteMessage = pin(describeOutletDefinition({
356
416
  timeoutMs: 5000,
357
417
  causesEvent: 'core:event/message-deleted@1',
358
418
  ports: {
359
- in: { target: S.rowIds },
360
- out: { main: S.writeResult, messageId: S.writeResult, lost: S.json },
419
+ in: {
420
+ /** The row to delete — the built-in's own spec's port. */
421
+ target: S.rowIds,
422
+ /**
423
+ * 🚧 The deletion a person asked for, whole (RF fix 5): a
424
+ * deletion pipeline's port, wired from
425
+ * `core:inlet/message-deletion-asked@1.main` and nothing else
426
+ * (`validate()`). The message deleted is the one it names.
427
+ */
428
+ asked: S.deletionAsked,
429
+ },
430
+ out: {
431
+ main: S.writeResult,
432
+ messageId: S.writeResult,
433
+ lost: S.json,
434
+ /**
435
+ * 🚧 What went with it (RF fix 5): the one retraction rule's
436
+ * count of what the message changed and was taken back —
437
+ * values, configurations, proposals, zone snapshots, lore
438
+ * writes by what became of each, the notes' entries, and
439
+ * whether the clock moved back.
440
+ */
441
+ taken: S.json,
442
+ },
361
443
  },
362
444
  }));
363
445
  /**
364
- * Write the session's turn order (PLAN-turn-order §4.2, §4.4; R5) — the ONE
446
+ * Write the session's turn order — the ONE
365
447
  * write path for `sessions.metadata.turnOrder`, and the only outlet that
366
448
  * writes `metadata` at all.
367
449
  *
@@ -408,14 +490,14 @@ export const setTurnOrder = pin(describeOutletDefinition({
408
490
  },
409
491
  }));
410
492
  /**
411
- * Write one owner's document into the session's annex (§4.3).
493
+ * Write one owner's document into the session's annex.
412
494
  *
413
495
  * Merged into what is there by default — a spec that keeps one key does not
414
496
  * have to carry the rest — and written under
415
497
  * `pg_advisory_xact_lock(hashtext('annex'), sessionId)` through `jsonb_set`,
416
498
  * so two specs writing two owners' documents at once cannot lose each
417
- * other's. Causes `core:event/annex-changed@1` (R30, the modder pass,
418
- * reversing §4.3's "no causesEvent"): a package's state is the annex, and a
499
+ * other's. Causes `core:event/annex-changed@1` (a later
500
+ * ruling, reversing the original "no causesEvent"): a package's state is the annex, and a
419
501
  * genre that wants its turn order to answer that state binds the event in
420
502
  * the open, where the event map draws it — not through a back door.
421
503
  * @experimental
@@ -477,6 +559,226 @@ export const setSessionAnnex = pin(describeOutletDefinition({
477
559
  out: { main: S.writeResult, annex: S.json },
478
560
  },
479
561
  }));
562
+ /**
563
+ * 🚧 Name a person's **player seat** in this session (Dungeon Crawler's
564
+ * interview, 2026-10-15): the pipeline door to the seat name a person sets
565
+ * by hand in session settings (`sessions:update` `seatName`). The seat is
566
+ * `user`'s — a `user:<id>` reference, the addressee of the form the name
567
+ * answered — their card-less seat first, else their first seat; with none,
568
+ * a name opens a card-less seat for them, as the hand-set name does. The
569
+ * host refuses a seat for somebody who is neither the owner nor a playing
570
+ * guest, and a blank name (this outlet never clears one).
571
+ *
572
+ * `seat` is the seat as a participant reference — `player-seat:<id>` for a
573
+ * card-less seat, `character:<id>` for a seat with a card — and `seats` the
574
+ * same as a one-item list, the shape `resolve-state-changes@1`'s `owners`
575
+ * takes, so the seat's own stats can be written in the same run.
576
+ *
577
+ * 🚧 `retire` (Dungeon Crawler's new character after a death, owner ruling
578
+ * 2026-10-18): one of `user`'s own seats, by reference. That seat leaves the
579
+ * table — its lines keep its name, its state stays where it was filed — and
580
+ * the name opens a NEW card-less seat for them, which `seat` then names. A
581
+ * seat that is not theirs, or not live, is refused. `@1` evolves in place.
582
+ * @experimental
583
+ */
584
+ export const setSeatName = pin(describeOutletDefinition({
585
+ id: 'core:outlet/set-seat-name@1',
586
+ i18n: { name: { en: 'Name a player seat' } },
587
+ effects: 'write',
588
+ reviewDefault: 'off',
589
+ review: { fields: ['name'] },
590
+ timeoutMs: 2000,
591
+ ports: {
592
+ in: {
593
+ /** Whose seat: `user:<id>`. */
594
+ user: S.participantRef,
595
+ /** The character's name in this session. */
596
+ name: S.text,
597
+ /**
598
+ * 🚧 A seat of theirs this name replaces (`player-seat:<id>` or
599
+ * `character:<id>`): retired, and a new seat opened. JSON, so a
600
+ * script's part may name it (absent or null: none).
601
+ */
602
+ retire: S.json,
603
+ },
604
+ out: {
605
+ main: S.writeResult,
606
+ seat: S.participantRef,
607
+ seats: S.participantRefs,
608
+ },
609
+ },
610
+ }));
611
+ /**
612
+ * 🚧 **Open or close the composer** on a channel lane (owner ruling
613
+ * 2026-10-15): the genre's switch for whether a person may write there. The
614
+ * state is the session row's (`sessions.composer_states`, SDK
615
+ * `ComposerStatesV1`); core opens and closes nothing on its own, so a
616
+ * composer a genre closed stays closed until a pipeline opens it.
617
+ *
618
+ * - `channel` — a slug, a canonical lane (`parley:2`; the bare slug is lane
619
+ * 1 alone), or `*` for every channel;
620
+ * - `open` — `true` to open, `false` to close;
621
+ * - `reason` — optional: what the composer is waiting on, as a sentence
622
+ * the person reads ("Make your character on the Planner tab first.").
623
+ * Shown in place of the placeholder and repeated in the refusal of a send
624
+ * the widget let through. Named `reason`, never `message`: a message is a
625
+ * session's row;
626
+ * - `person` — optional: whose composer, `user:<id>`; absent is everyone,
627
+ * the session's owner included.
628
+ *
629
+ * Opening for everyone clears the lane's every closure; opening for one
630
+ * person clears theirs, and never overrides a close for everyone. The send
631
+ * door (`sessionMessages:sendPersonaMessage`, and `message-offered`'s offer)
632
+ * refuses a line on a closed composer; turn controls (Continue) are the
633
+ * round's, not the composer's, and are not touched. Every member's page is
634
+ * told at once.
635
+ *
636
+ * `main` is the write; `states` the whole document after it.
637
+ * @experimental
638
+ */
639
+ export const setComposerState = pin(describeOutletDefinition({
640
+ id: 'core:outlet/set-composer-state@1',
641
+ i18n: { name: { en: 'Open or close the composer' } },
642
+ effects: 'write',
643
+ reviewDefault: 'off',
644
+ review: { fields: ['reason'] },
645
+ timeoutMs: 2000,
646
+ ports: {
647
+ in: {
648
+ /** A slug, a canonical lane (`parley:2`), or `*`. */
649
+ channel: S.text,
650
+ /** `true` opens, `false` closes. */
651
+ open: S.json,
652
+ /** What the composer waits on — a sentence. Optional. */
653
+ reason: S.text,
654
+ /**
655
+ * Whose composer: `user:<id>`, a participant reference as text.
656
+ * Optional; absent is everyone. `json`, as `set-stat-config@1`'s
657
+ * `owner` is: a genre wires it from a script's text, and the
658
+ * host parses the reference (a typed port refused that wire,
659
+ * 2026-10-18).
660
+ */
661
+ person: S.json,
662
+ },
663
+ out: {
664
+ main: S.writeResult,
665
+ states: S.json,
666
+ },
667
+ },
668
+ }));
669
+ /**
670
+ * 🚧 **Suggest a new scene** (pass 7, R-i, sprint 2, 2026-10-25): the judged scene check's
671
+ * answer — "the story moved on; the next scene begins at this line, because …" — recorded as a
672
+ * **scene cue** with trigger `judged` (`JUDGED_SCENE_TRIGGER`) and the model's words as its
673
+ * reason. From there the session's scene mode decides, as for any boundary trigger: Suggested —
674
+ * the *New scene?* chip; Automatic — the boundary is placed (unless `ask`); Manual — nothing.
675
+ * The host re-checks the judged check's conditions at commit and skips, with a note, when they
676
+ * no longer hold or `at` is not one of its lines. Never held at the review gate: a cue's review
677
+ * is the chip.
678
+ *
679
+ * ⚠ Not a scene write (a person's *Start scene here*) and not a state proposal.
680
+ * @experimental
681
+ * @ruling R-i (2026-10-24)
682
+ */
683
+ export const proposeSceneCue = pin(describeOutletDefinition({
684
+ id: 'core:outlet/propose-scene-cue@1',
685
+ i18n: { name: { en: 'Suggest a new scene' } },
686
+ effects: 'write',
687
+ reviewDefault: 'off',
688
+ review: { fields: ['reason'] },
689
+ timeoutMs: 2000,
690
+ slots: {
691
+ params: {
692
+ kind: 'parameters',
693
+ facet: 'behavior',
694
+ schema: {
695
+ ask: {
696
+ type: 'boolean',
697
+ default: false,
698
+ label: { en: 'Always ask' },
699
+ description: {
700
+ en: 'Offer the new scene as a suggestion even when this session starts scenes on its own (Automatic). Off: the scene setting decides.',
701
+ },
702
+ },
703
+ },
704
+ },
705
+ },
706
+ ports: {
707
+ in: {
708
+ /**
709
+ * The line the next scene would open at — a message id, as the
710
+ * sweep's sort gives it. `json`, as `set-composer-state@1`'s
711
+ * `person` is: wired from a script's output.
712
+ */
713
+ at: S.json,
714
+ /** The channel lane `at` is on, any spelling (canonicalised); absent or blank: `main`. */
715
+ channel: S.text,
716
+ /** Why, in the model's few words — the chip's reason ("the party left the inn"). */
717
+ reason: S.text,
718
+ },
719
+ out: {
720
+ main: S.writeResult,
721
+ /** A `ProposedSceneCue`. */
722
+ cue: S.json,
723
+ },
724
+ },
725
+ }));
726
+ /**
727
+ * 🚧 **Configure a stat** for one owner in this session (owner ruling
728
+ * 2026-10-15): the pipeline door to an owner's **stat configuration** — the
729
+ * deviations from an attribute slot's own config that one owner carries,
730
+ * `{ max: 26 }` on a seat's health. Stored as an `attribute_configs` row
731
+ * through the same writer a person's `state:configure` takes, so the bar,
732
+ * the write's bound and every prompt read the same maximum.
733
+ *
734
+ * The three in-ports are one `StatConfigDocument` (SDK `attributes.ts`) —
735
+ * the format a card or session editor sends too:
736
+ *
737
+ * - `owner` — whose: `player-seat:<id>`, `character:<id>` (that card's
738
+ * session layer) or `world`;
739
+ * - `slot` — the attribute slot id, `core:slot/hp@1`;
740
+ * - `config` — only the keys the slot's stat shape bounds
741
+ * (`statConfigKeys`): a number's `min`/`max`, a choice's `of`, a list's
742
+ * `maxItems` and `of`/`maxLength`, a line's `maxLength`, and every
743
+ * slot's `descriptor`.
744
+ *
745
+ * Refused, halting the run with the sentence: a slot nothing declares or
746
+ * the session does not track, a key the shape does not bound or a value it
747
+ * cannot be, a `min` above the `max` once merged, an owner that is not this
748
+ * session's. Anchored like a value — the owner's open anchor, or `worldRow`
749
+ * for a seat or the world — so a retake or a swipe takes it back.
750
+ *
751
+ * `main` is `{ configId, owner, slot, before, config }`: the row, and the
752
+ * configuration in force before and after it.
753
+ * @experimental
754
+ */
755
+ export const setStatConfig = pin(describeOutletDefinition({
756
+ id: 'core:outlet/set-stat-config@1',
757
+ i18n: { name: { en: 'Configure a stat' } },
758
+ effects: 'write',
759
+ reviewDefault: 'off',
760
+ review: { fields: ['config'] },
761
+ timeoutMs: 2000,
762
+ ports: {
763
+ in: {
764
+ /** Whose: a participant reference, `world`, or `location:<id>` (a place's lore entry). */
765
+ owner: S.json,
766
+ /** The attribute slot: `core:slot/hp@1`. */
767
+ slot: S.text,
768
+ /**
769
+ * The deviations: `{ max: 26 }`. 🚧 One universal key
770
+ * (2026-10-17): `lock` — `none` · `people` (no hand edit; the
771
+ * dice and the session's owner still write) · `all` (nothing
772
+ * writes until unlocked). The host refuses a locked write with
773
+ * its own sentence; widgets draw the slot without edit controls.
774
+ */
775
+ config: S.json,
776
+ /** The row a seat's or the world's configuration is filed at — `set-state@1`'s `worldRow`. Optional. */
777
+ worldRow: S.writeResult,
778
+ },
779
+ out: { main: S.json },
780
+ },
781
+ }));
480
782
  /**
481
783
  * Set one **annex field** (2026-09-26): the write behind every
482
784
  * `annexField()` a package declares — core's one pipeline for them all,
@@ -499,7 +801,7 @@ export const setAnnexField = pin(describeOutletDefinition({
499
801
  effects: 'write',
500
802
  causesEvent: 'core:event/annex-changed@1',
501
803
  reviewDefault: 'off',
502
- /** The payload was judged at the door and is judged again here — approve or refuse, never rewrite (R-15 review fields). */
804
+ /** The payload was judged at the door and is judged again here — approve or refuse, never rewrite. */
503
805
  review: { fields: [] },
504
806
  timeoutMs: 2000,
505
807
  ports: {
@@ -630,6 +932,42 @@ export const branchSession = pin(describeOutletDefinition({
630
932
  out: { main: S.writeResult, sessionId: S.writeResult },
631
933
  },
632
934
  }));
935
+ // ── Backdrop (DESIGN-image-generation §6.4, ruling §9.4; 2026-10-12) ───────
936
+ /**
937
+ * 🚧 Set the session's **backdrop**: `sessions.backdropMediaId`, the picture
938
+ * the Backdrop widget shows behind or beside the Stage — session state, a
939
+ * role pointer like a card's avatar, never a message part.
940
+ *
941
+ * `media` is a media list (what `core:oracle/generate-image@1` publishes);
942
+ * the host takes the FIRST image in it, keyed or not, and refuses a file
943
+ * that belongs to neither this session nor the user the run acts as (the
944
+ * rule `create-message`'s media keeps). A list with no image in it writes
945
+ * nothing, causes no event and publishes a null `mediaId` — it never
946
+ * clears: a person clears a backdrop, a pipeline replaces it. Runs in the
947
+ * session scope the run was started in.
948
+ *
949
+ * Causes `core:event/backdrop-set@1` when the pointer moved. Publishes the
950
+ * write result on `main` and the file id now set on `mediaId` (null when
951
+ * nothing was written).
952
+ *
953
+ * ⚠ Not the app background (`user_settings.background_media_id`), not a
954
+ * message attachment, and not the retired *scene image* pins.
955
+ * @experimental
956
+ */
957
+ export const setBackdrop = pin(describeOutletDefinition({
958
+ id: 'core:outlet/set-backdrop@1',
959
+ i18n: { name: { en: 'Set backdrop' } },
960
+ effects: 'write',
961
+ causesEvent: 'core:event/backdrop-set@1',
962
+ reviewDefault: 'off',
963
+ /** A reference to a picture the run rendered; nothing to retype. */
964
+ review: { fields: [] },
965
+ timeoutMs: 5000,
966
+ ports: {
967
+ in: { media: S.mediaList },
968
+ out: { main: S.writeResult, mediaId: S.json },
969
+ },
970
+ }));
633
971
  // ── Sprites (DESIGN-sprites §5, 2026-09-24; in-pipeline 2026-10-05) ─────────
634
972
  /**
635
973
  * Record a line's **shown sprite**. Writes it on the line's ACTIVE swipe
@@ -687,6 +1025,100 @@ export const showSprite = pin(describeOutletDefinition({
687
1025
  },
688
1026
  },
689
1027
  }));
1028
+ /**
1029
+ * 🚧 File pictures as a card's **sprites** — the end of the Sprite set fill.
1030
+ *
1031
+ * For every item of `media` that carries a series `key`: a `sprites` row in
1032
+ * the set named `setName` (the card's default set when the name is blank or
1033
+ * gone), under the sprite label that key was drawn for, with
1034
+ * `source: 'generated'` and the picture as its file. The label comes from
1035
+ * `series` (each item's `vars.label`); with no series the key is the label.
1036
+ *
1037
+ * - An **empty sprite** waiting under the label is filled first.
1038
+ * - Otherwise the picture is added beside what is there — a **variant** —
1039
+ * so a second picture under one key, or a run that redraws a label, never
1040
+ * replaces a sprite.
1041
+ * - An item with **no key** (surplus the host kept) is ignored.
1042
+ * - A key in `series` that brought no picture is reported on `missing`.
1043
+ *
1044
+ * The picture becomes the card's file (provenance: `files.character_id`), so
1045
+ * it carries the card's visibility and stays out of the card's gallery like
1046
+ * every sprite. Refused unless the run's person owns the card or is an admin.
1047
+ *
1048
+ * Causes `core:event/sprites-attached@1` when at least one row was written.
1049
+ * About a card, not a session: it writes no session row.
1050
+ * @experimental
1051
+ */
1052
+ export const attachSprite = pin(describeOutletDefinition({
1053
+ id: 'core:outlet/attach-sprite@1',
1054
+ i18n: { name: { en: 'Attach as sprites' } },
1055
+ effects: 'write',
1056
+ causesEvent: 'core:event/sprites-attached@1',
1057
+ reviewDefault: 'off',
1058
+ /** References to pictures the run drew; nothing to retype. */
1059
+ review: { fields: [] },
1060
+ timeoutMs: 15000,
1061
+ ports: {
1062
+ in: {
1063
+ media: S.mediaList,
1064
+ characterId: S.rowIds,
1065
+ setName: S.text,
1066
+ /** The series the pictures were drawn for — the key → sprite label map. */
1067
+ series: S.imageSeries,
1068
+ },
1069
+ out: {
1070
+ main: S.writeResult,
1071
+ /** `[{ label, spriteId }]`, one per row written, in media order. */
1072
+ attached: S.json,
1073
+ /** Sprite labels the series asked for that came back with no picture. */
1074
+ missing: S.json,
1075
+ },
1076
+ },
1077
+ }));
1078
+ /**
1079
+ * 🚧 **Offer** pictures to a card — put them in the card's **gallery** for a
1080
+ * person to pick from (the end of Portrait).
1081
+ *
1082
+ * Each image in `media` becomes a picture of the card's gallery, after the
1083
+ * pictures already there, in media order. Nothing is chosen for the person:
1084
+ * the avatar and the likeness image are left as they are. *Use as avatar*
1085
+ * and *Use as likeness image* on the gallery tile are the person's, later.
1086
+ *
1087
+ * - An item that is not an image is skipped.
1088
+ * - A picture must be the run person's own file or already the card's — a
1089
+ * media reference is an address anyone could type, and the gallery would
1090
+ * re-publish whatever it names under the card's visibility.
1091
+ * - A picture that is already one of the card's files stays where it is.
1092
+ *
1093
+ * `offered` is `[{ mediaId, key }]`, one per picture placed, with the series
1094
+ * key it was drawn for (`null` for surplus the host kept unkeyed). Refused
1095
+ * unless the run's person owns the card or is an admin.
1096
+ *
1097
+ * Causes `core:event/media-offered@1` when at least one picture was placed.
1098
+ * About a card, not a session: it writes no session row.
1099
+ * @experimental
1100
+ */
1101
+ export const offerMedia = pin(describeOutletDefinition({
1102
+ id: 'core:outlet/offer-media@1',
1103
+ i18n: { name: { en: 'Offer to the gallery' } },
1104
+ effects: 'write',
1105
+ causesEvent: 'core:event/media-offered@1',
1106
+ reviewDefault: 'off',
1107
+ /** References to pictures the run drew; nothing to retype. */
1108
+ review: { fields: [] },
1109
+ timeoutMs: 15000,
1110
+ ports: {
1111
+ in: {
1112
+ media: S.mediaList,
1113
+ characterId: S.rowIds,
1114
+ },
1115
+ out: {
1116
+ main: S.writeResult,
1117
+ /** `[{ mediaId, key }]`, one per picture placed, in media order. */
1118
+ offered: S.json,
1119
+ },
1120
+ },
1121
+ }));
690
1122
  // ── The story clock (DESIGN-story-time P3, 2026-09-28) ──────────────────────
691
1123
  /**
692
1124
  * Move a session's **story clock** — the session's own story now — by `by` of
@@ -696,14 +1128,22 @@ export const showSprite = pin(describeOutletDefinition({
696
1128
  *
697
1129
  * Moves the session's clock only, never the book's or its line's present. A
698
1130
  * session with no clock of its own starts from its line's present. Refused
699
- * with a sentence — the run halts — when the session has no lorebook, when
700
- * there is no present to start from, and when the result does not land in
701
- * the book's calendar; never clamped, never a silent no-op.
1131
+ * with a sentence — the run halts, unless the spec says `onRefusal: 'skip'`
1132
+ * — when the session has no lorebook, when there is no present to start
1133
+ * from, and when the result does not land in the book's calendar; never
1134
+ * clamped, never a silent no-op.
702
1135
  *
703
1136
  * `by` and `unit` in-ports, when wired, win over the parameters. To advance
704
1137
  * once per reply, place it in a spec bound to the reply's event, which runs
705
1138
  * after the reply is saved. (No ordering-only in-port: an unread port is a
706
1139
  * declared control no run consults — `declaredReads`.)
1140
+ *
1141
+ * 🚧 Every move it makes is written to the session's state ledger, anchored
1142
+ * where the world's changes are (live scenes §15 G5, 2026-10-13): the person
1143
+ * reads it under the message ("Time passes: 3 hours (… → …)"), and a delete,
1144
+ * swipe or regenerate of that message takes it back as it takes values back.
1145
+ * Why the clock moved is the spec's to say (`cause`), never inferred from
1146
+ * the run's inlet.
707
1147
  * @experimental
708
1148
  */
709
1149
  export const advanceStoryClock = pin(describeOutletDefinition({
@@ -750,11 +1190,49 @@ export const advanceStoryClock = pin(describeOutletDefinition({
750
1190
  by: S.json,
751
1191
  /** One of the units; wins over the `unit` parameter when wired. */
752
1192
  unit: S.text,
1193
+ /**
1194
+ * 🚧 **Why the clock moves** (live scenes §15 G4, 2026-10-13),
1195
+ * a literal: `'action'` — a person's press (*Time passes…*);
1196
+ * `'keeper'` — the state-keeper's move under Trust the
1197
+ * narrator; `'tick'` — a reply's fixed tick. An action's and
1198
+ * the keeper's move are **time actions** the boundary watcher
1199
+ * may begin a new scene at; a tick never is. Unwired reads as
1200
+ * `'action'`.
1201
+ *
1202
+ * ## A port, not a parameter, and the call site is what decides
1203
+ *
1204
+ * As `show-sprite@1`'s `source`: a literal in the node's
1205
+ * config, because why a step moves the clock is a structural
1206
+ * fact of the document, not a knob for the panel. It was the
1207
+ * host's to infer from the run's inlet until 2026-10-13, and a
1208
+ * keeper's move on a reply turn was then never a time action.
1209
+ * It also decides what a swipe or a regenerate takes back: a
1210
+ * tick stands (the re-driven reply never ticks again), every
1211
+ * other move goes with the reply.
1212
+ */
1213
+ cause: S.text,
1214
+ /**
1215
+ * 🚧 **What a refusal does** (live scenes §15 G7), a literal:
1216
+ * `'halt'` (unwired) stops the run with the sentence;
1217
+ * `'skip'` moves nothing, puts the sentence on `skipped` and
1218
+ * on the session's state ledger, and lets the run finish — for
1219
+ * a step that runs after other changes already landed, which
1220
+ * a halt would leave looking like a failed turn. Every core
1221
+ * spec's skips: Adventure's keeper steps and its *Time
1222
+ * passes…*, Chat's reply tick, and Chat's and the Lair's *Time
1223
+ * passes…* (live scenes §15 G12).
1224
+ */
1225
+ onRefusal: S.text,
753
1226
  },
754
1227
  out: {
755
1228
  main: S.writeResult,
756
1229
  /** The session's story clock as it now stands: `{ year, month?, day?, hour?, minute? }`. */
757
1230
  clock: S.json,
1231
+ /**
1232
+ * 🚧 Why the clock did not move, under `onRefusal: 'skip'` —
1233
+ * the sentence the person reads; empty when it moved.
1234
+ */
1235
+ skipped: S.text,
758
1236
  /** It spelled through the book's calendar. */
759
1237
  label: S.text,
760
1238
  },
@@ -782,16 +1260,16 @@ export const answerForm = pin(describeOutletDefinition({
782
1260
  i18n: { name: { en: 'Answer the form' } },
783
1261
  effects: 'write',
784
1262
  reviewDefault: 'off',
785
- /** The answer may be corrected at the gate; which form, and who answers, may not (R-15 review fields). */
1263
+ /** The answer may be corrected at the gate; which form, and who answers, may not. */
786
1264
  review: { fields: ['answer'] },
787
1265
  /**
788
- * A write's timeout, not a run's (was 600000 until 2026-09-17, U5d
789
- * review W2): the commit checks the answer, asks the cycle caps and
1266
+ * A write's timeout, not a run's (was 600000 until
1267
+ * 2026-09-17): the commit checks the answer, asks the cycle caps and
790
1268
  * **collects** the fire — the action's run is dispatched by the host
791
1269
  * after this run's receipt is saved, outside any node timeout, as
792
1270
  * this run's child. A grandchild parked at review parks nothing here.
793
1271
  *
794
- * Thirty seconds rather than a write's usual five (U5d review S-a,
1272
+ * Thirty seconds rather than a write's usual five (changed
795
1273
  * the same day): the commit does database work of its own — the
796
1274
  * block off the row, the session, the routing, a cap refusal's
797
1275
  * receipt — and under PGlite contention (a full test run, a busy
@@ -827,7 +1305,7 @@ export const answerForm = pin(describeOutletDefinition({
827
1305
  export const attachAudio = pin(describeOutletDefinition({
828
1306
  id: 'core:outlet/attach-audio@1',
829
1307
  effects: 'write',
830
- /** A reference to rendered audio; nothing to retype (R-15 review fields). */
1308
+ /** A reference to rendered audio; nothing to retype. */
831
1309
  review: { fields: [] },
832
1310
  timeoutMs: 5000,
833
1311
  causesEvent: 'core:event/message-updated@1',
@@ -837,7 +1315,7 @@ export const attachAudio = pin(describeOutletDefinition({
837
1315
  /**
838
1316
  * Write the finished entry. Gate-eligible, so it publishes a write result.
839
1317
  *
840
- * ## Which kind of entry — the pipeline's decision, at last (L3, 2026-09-17)
1318
+ * ## Which kind of entry — the pipeline's decision, at last (2026-09-17)
841
1319
  *
842
1320
  * The host's commit case has said since the four summarize namespaces were
843
1321
  * written that *which kind of entry comes from the pipeline that ran*. It did
@@ -861,7 +1339,7 @@ export const attachAudio = pin(describeOutletDefinition({
861
1339
  * ## `links`, or a second write
862
1340
  *
863
1341
  * Linking a new entry takes one of two shapes, and both exist on purpose.
864
- * (A pipeline may write many times — F7 limits only the live row — so
1342
+ * (A pipeline may write many times — only the live row is limited to one — so
865
1343
  * `core:outlet/link-lore-entries@1` may also follow this outlet in the same
866
1344
  * run, each its own transaction.)
867
1345
  *
@@ -876,9 +1354,23 @@ export const attachAudio = pin(describeOutletDefinition({
876
1354
  *
877
1355
  * Each entry of `links` is a name or an entry id, or a `LoreLinkInput` —
878
1356
  * `{ to, linkType?, reverseLinkType?, name?, description? }` — for one that
879
- * says more (places plan B2, 2026-09-29). Absent on nearly every write, and an
1357
+ * says more (2026-09-29). Absent on nearly every write, and an
880
1358
  * empty list is the same as none. A link the list states twice, or one the
881
1359
  * session already reads, is written once: see `linkLoreEntries` on idempotence.
1360
+ *
1361
+ * ## `fields` — the entry type's own half (🚧 2026-10-21, Lair rewrite D2)
1362
+ *
1363
+ * The typed fields the entry type declares (`EntryShape.fields` — a place's
1364
+ * category; a derived entry type's piece fields, a weapon's damage), as one
1365
+ * object keyed by field. Its title-role field is not among them: that is the
1366
+ * `name` port. Checked against the type named by `entryType` with the SDK's
1367
+ * one checker (`fieldsFindings`) at the review gate and again at the commit:
1368
+ * a misfit — an undeclared key, a value of the wrong kind, a required field
1369
+ * missing — is refused with the field named, never trimmed to fit. A pipeline
1370
+ * asks a model for them with `jsonSchemaOf(entryType)` into
1371
+ * `generate-json@1`'s `schema`, so what is asked and what is checked are one
1372
+ * declaration. Absent: the type's declared defaults, as before. `@1` evolves
1373
+ * in place (pre-release).
882
1374
  * @internal
883
1375
  */
884
1376
  export const createLoreEntry = pin(describeOutletDefinition({
@@ -886,13 +1378,15 @@ export const createLoreEntry = pin(describeOutletDefinition({
886
1378
  i18n: { name: { en: 'Save the lore entry' } },
887
1379
  effects: 'write',
888
1380
  /**
889
- * Both the name and the content may be edited before the entry lands
890
- * (R-15 review fields). `links` is deliberately not among them: the
1381
+ * The name, the content and (🚧 D2) the typed fields may be edited
1382
+ * before the entry lands — the fields are values a reader can retype
1383
+ * (a room's terrain), and an edit that no longer fits the type is
1384
+ * refused at the gate. `links` is deliberately not among them: the
891
1385
  * gate's form edits values a reader can retype, and a list of
892
1386
  * references is not one — a reviewer who disagrees with a room's exits
893
1387
  * refuses the write.
894
1388
  */
895
- review: { fields: ['name', 'content'] },
1389
+ review: { fields: ['name', 'content', 'fields'] },
896
1390
  timeoutMs: 10000,
897
1391
  causesEvent: 'core:event/lore-entry-created@1',
898
1392
  slots: {
@@ -915,15 +1409,88 @@ export const createLoreEntry = pin(describeOutletDefinition({
915
1409
  content: S.text,
916
1410
  /**
917
1411
  * Links to write from this entry in the same commit — see the
918
- * note above on F7. Names, entry ids, or `LoreLinkInput`s.
1412
+ * note above on the live row. Names, entry ids, or `LoreLinkInput`s.
919
1413
  */
920
1414
  links: S.json,
1415
+ /**
1416
+ * 🚧 The entry type's typed fields, one object keyed by field
1417
+ * (the title's field excepted) — checked whole against the
1418
+ * type (`fieldsFindings`); see the note above.
1419
+ */
1420
+ fields: S.json,
1421
+ /**
1422
+ * 🚧 The messages this write was written from. Pass it when the write is a
1423
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1424
+ * session's settle line moves to the newest of them.
1425
+ */
1426
+ sources: S.loreSources,
1427
+ /** 🚧 A `LoreMatch` — how to find the entry this would otherwise create. */
1428
+ match: S.json,
1429
+ /**
1430
+ * 🚧 The cast member this entry is filed under — a `character:<id>` reference, resolved to that
1431
+ * character's cast member in the book the entry lands in (the entry type's `anchor` role).
1432
+ */
1433
+ bind: S.participantRef,
921
1434
  },
922
1435
  out: { main: S.writeResult, entryId: S.writeResult },
923
1436
  },
924
1437
  }));
925
1438
  /**
926
- * Link two lore entries (L2, 2026-09-17).
1439
+ * 🚧 Change an entry of the session's lorebook — its name, its content, its
1440
+ * typed fields (2026-10-21, Lair rewrite D2: *File as a room* on a room that
1441
+ * already exists, a draft's fields laid onto an entry a person wrote).
1442
+ *
1443
+ * `entry` names it as `link-lore-entries@1`'s `to` does: an entry id, the
1444
+ * write result of the write that made it, or a **name** resolved within the
1445
+ * session's own lorebook (case and surrounding space ignored; a name nothing
1446
+ * answers to, or two entries answer to, is refused with a sentence).
1447
+ *
1448
+ * Every in-port but `entry` is optional, and an absent one leaves that part
1449
+ * as it is. `fields` is a **patch**: the keys it names are laid over the
1450
+ * entry's stored fields and the rest kept, `null` clears one; it is checked
1451
+ * against the entry's own type as a patch (`fieldsFindings(type, fields,
1452
+ * { partial: true })`) at the review gate and at the commit, and a misfit is
1453
+ * refused with the field named. The type itself never changes — a room stays
1454
+ * a place.
1455
+ *
1456
+ * How the change lands is the host's: on the session's line, the way the
1457
+ * lorebook's own editor writes an edit there (an amendment where the line
1458
+ * amends). ⚠ It causes no event yet (🚧): `lore-entry-created` means a new
1459
+ * row, and a subscriber that needs edits waits for one of its own.
1460
+ * @internal
1461
+ */
1462
+ export const updateLoreEntry = pin(describeOutletDefinition({
1463
+ id: 'core:outlet/update-lore-entry@1',
1464
+ i18n: { name: { en: 'Change the lore entry' } },
1465
+ effects: 'write',
1466
+ /**
1467
+ * What the change says may be retyped; which entry it changes may not
1468
+ * — that is the run's identity, the rule `delete-message@1` states.
1469
+ */
1470
+ review: { fields: ['name', 'content', 'fields'] },
1471
+ timeoutMs: 10000,
1472
+ ports: {
1473
+ in: {
1474
+ /** The entry to change: an id, a write result, or a name in the session's lorebook. */
1475
+ entry: S.json,
1476
+ /** Its new name. Absent: kept. */
1477
+ name: S.text,
1478
+ /** Its new content. Absent: kept. */
1479
+ content: S.text,
1480
+ /** Typed fields laid over the stored ones, key by key; `null` clears one. Absent: kept. */
1481
+ fields: S.json,
1482
+ /**
1483
+ * 🚧 The messages this write was written from. Pass it when the write is a
1484
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1485
+ * session's settle line moves to the newest of them.
1486
+ */
1487
+ sources: S.loreSources,
1488
+ },
1489
+ out: { main: S.writeResult, entryId: S.writeResult },
1490
+ },
1491
+ }));
1492
+ /**
1493
+ * Link two lore entries (2026-09-17).
927
1494
  *
928
1495
  * ## The gap it closes
929
1496
  *
@@ -938,7 +1505,7 @@ export const createLoreEntry = pin(describeOutletDefinition({
938
1505
  * ## Both ends, and the one scope
939
1506
  *
940
1507
  * `from` is an entry id — or, straight off `create-lore-entry@1`, its
941
- * `entryId` write result, which is assignable to `row-ids@1` (09-B B4). `to`
1508
+ * `entryId` write result, which is assignable to `row-ids@1`. `to`
942
1509
  * is an id **or a name**, resolved within the session's own lorebook, case
943
1510
  * and surrounding space ignored. A name is the half that makes the law below
944
1511
  * survivable, and it is also the half that can be wrong in two ways, so both
@@ -953,14 +1520,14 @@ export const createLoreEntry = pin(describeOutletDefinition({
953
1520
  *
954
1521
  * ## After a create
955
1522
  *
956
- * It may follow `core:outlet/create-lore-entry@1` in the same run (F7 limits
957
- * only the live row), linking by name what that write created — which is why
1523
+ * It may follow `core:outlet/create-lore-entry@1` in the same run (only the
1524
+ * live row is limited to one), linking by name what that write created — which is why
958
1525
  * `to` takes one; a later run can do the same. Each write is its own
959
1526
  * transaction, so a failed link leaves the entry behind. When the entry and
960
1527
  * its links are one thought, `create-lore-entry`'s own `links` in-port writes
961
1528
  * the edges in the row's transaction instead — the shape a room-builder wants.
962
1529
  *
963
- * ## What the link says (places plan B2, 2026-09-29)
1530
+ * ## What the link says (2026-09-29)
964
1531
  *
965
1532
  * The row is a **relationship**, and it carries the relationship's whole
966
1533
  * descriptor — the same four words the lorebook's own link form edits:
@@ -1012,7 +1579,7 @@ export const linkLoreEntries = pin(describeOutletDefinition({
1012
1579
  effects: 'write',
1013
1580
  /**
1014
1581
  * The link itself is what a reviewer judges, so its words both ways,
1015
- * its name and its description may be retyped (R-15 review fields). The
1582
+ * its name and its description may be retyped. The
1016
1583
  * two ends may not: they are the run's own identity, and a reviewer
1017
1584
  * re-aiming them would link a pair nobody judged — the rule
1018
1585
  * `delete-message@1` states.
@@ -1055,6 +1622,12 @@ export const linkLoreEntries = pin(describeOutletDefinition({
1055
1622
  name: S.text,
1056
1623
  /** Its description. Optional. */
1057
1624
  description: S.text,
1625
+ /**
1626
+ * 🚧 The messages this write was written from. Pass it when the write is a
1627
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1628
+ * session's settle line moves to the newest of them.
1629
+ */
1630
+ sources: S.loreSources,
1058
1631
  },
1059
1632
  out: { main: S.writeResult, linkId: S.writeResult },
1060
1633
  },
@@ -1073,12 +1646,20 @@ export const graphProposal = pin(describeOutletDefinition({
1073
1646
  id: 'core:outlet/graph-proposal@1',
1074
1647
  i18n: { name: { en: 'Propose graph changes' } },
1075
1648
  effects: 'write',
1076
- /** The proposal is what the review screen exists to edit (R-15 review fields). */
1649
+ /** The proposal is what the review screen exists to edit. */
1077
1650
  review: { fields: ['proposal'] },
1078
1651
  timeoutMs: 10000,
1079
1652
  causesEvent: 'core:event/graph-proposal-created@1',
1080
1653
  ports: {
1081
- in: { proposal: S.json },
1654
+ in: {
1655
+ proposal: S.json,
1656
+ /**
1657
+ * 🚧 The messages this write was written from. Pass it when the write is a
1658
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1659
+ * session's settle line moves to the newest of them.
1660
+ */
1661
+ sources: S.loreSources,
1662
+ },
1082
1663
  out: { main: S.writeResult, proposalId: S.writeResult },
1083
1664
  },
1084
1665
  }));