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

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
@@ -500,6 +500,11 @@ export const setTurnOrder = pin(describeOutletDefinition({
500
500
  * ruling, reversing the original "no causesEvent"): a package's state is the annex, and a
501
501
  * genre that wants its turn order to answer that state binds the event in
502
502
  * the open, where the event map draws it — not through a back door.
503
+ *
504
+ * 🚧 Every write that moves the document moves the owner's **annex document
505
+ * version** (a count, 0 before the first): `base` makes the write a
506
+ * compare-and-set on it, so a run that read the document before another run
507
+ * wrote it is refused rather than overwriting that run's write.
503
508
  * @experimental
504
509
  */
505
510
  export const setSessionAnnex = pin(describeOutletDefinition({
@@ -555,8 +560,26 @@ export const setSessionAnnex = pin(describeOutletDefinition({
555
560
  },
556
561
  },
557
562
  ports: {
558
- in: { value: S.json },
559
- out: { main: S.writeResult, annex: S.json },
563
+ in: {
564
+ value: S.json,
565
+ /**
566
+ * 🚧 Compare-and-set (M2a a8): the owner's **annex document
567
+ * version** this run read — `session-annex`'s `version`. When the
568
+ * stored version is another, nothing is written: the write result
569
+ * says `stale: true` (`written: false`, with a receipt note), and
570
+ * `annex` and `version` carry the document as it stands now, to
571
+ * build on again. Absent, the write lands as it always did (the
572
+ * last writer's value wins).
573
+ */
574
+ base: S.json,
575
+ },
576
+ out: {
577
+ main: S.writeResult,
578
+ /** The owner's document as written — or, when `base` was stale, as it stands now. Never core's runtime keys. */
579
+ annex: S.json,
580
+ /** 🚧 The owner's annex document version after this write (unchanged when nothing was written). */
581
+ version: S.json,
582
+ },
560
583
  },
561
584
  }));
562
585
  /**
@@ -608,6 +631,52 @@ export const setSeatName = pin(describeOutletDefinition({
608
631
  },
609
632
  },
610
633
  }));
634
+ /**
635
+ * 🚧 **Bench a seat, or bring it back** (owner ruling 2026-11-10: a seat's
636
+ * status is managed by the genre, never by core on its own). Benched, a seat
637
+ * stays in the session and leaves the turns; brought back, it takes its turns
638
+ * again.
639
+ *
640
+ * Opt-in: a genre declares `writes.seats: true` (absent is off). Without it
641
+ * the host refuses, in words.
642
+ *
643
+ * Tied to the turn: the bench is recorded against the run's turn message.
644
+ * Back and a retake put the seat back as it was, Forward does it again, and a
645
+ * person's later bench or drag wins (the undo only puts back a seat still as
646
+ * this port left it). With no turn message (a person's action) the write is
647
+ * not tied to a turn.
648
+ *
649
+ * A seat already in the asked state is a no-op. Envoys and removed seats are
650
+ * refused. `seat` / `seats` give the seat's reference, as `set-seat-name@1`
651
+ * does.
652
+ *
653
+ * `seat` is `seated-member:<id>`, `player-seat:<id>` or `character:<id>`, and
654
+ * `benched` is `true` to bench or `false` to bring back; both are JSON, as
655
+ * `setSeatName.retire` and `setComposerState.open` are. `@1` evolves in place.
656
+ * @experimental
657
+ */
658
+ export const setSeatBench = pin(describeOutletDefinition({
659
+ id: 'core:outlet/set-seat-bench@1',
660
+ i18n: { name: { en: 'Bench or bring back a seat' } },
661
+ effects: 'write',
662
+ reviewDefault: 'off',
663
+ // Approve or refuse: which seat, and which way, are the write itself (R-15).
664
+ review: { fields: [] },
665
+ timeoutMs: 2000,
666
+ ports: {
667
+ in: {
668
+ /** The seat: `seated-member:<id>`, `player-seat:<id>` or `character:<id>`. */
669
+ seat: S.json,
670
+ /** `true` benches the seat, `false` brings it back. */
671
+ benched: S.json,
672
+ },
673
+ out: {
674
+ main: S.writeResult,
675
+ seat: S.participantRef,
676
+ seats: S.participantRefs,
677
+ },
678
+ },
679
+ }));
611
680
  /**
612
681
  * 🚧 **Open or close the composer** on a channel lane (owner ruling
613
682
  * 2026-10-15): the genre's switch for whether a person may write there. The
@@ -676,6 +745,8 @@ export const setComposerState = pin(describeOutletDefinition({
676
745
  * no longer hold or `at` is not one of its lines. Never held at the review gate: a cue's review
677
746
  * is the chip.
678
747
  *
748
+ * 🚧 An optional `trigger` in-port names the boundary trigger the scene cue is for (absent or blank: `judged`); the scenes routine passes the one that fired at `at`.
749
+ *
679
750
  * ⚠ Not a scene write (a person's *Start scene here*) and not a state proposal.
680
751
  * @experimental
681
752
  * @ruling R-i (2026-10-24)
@@ -715,6 +786,12 @@ export const proposeSceneCue = pin(describeOutletDefinition({
715
786
  channel: S.text,
716
787
  /** Why, in the model's few words — the chip's reason ("the party left the inn"). */
717
788
  reason: S.text,
789
+ /**
790
+ * 🚧 The boundary trigger the scene cue is for. Absent or blank: `judged` (the judged scene check's, as before).
791
+ * The scenes routine (`core:spec/scene-boundaries`) passes the boundary trigger that fired at `at`; a scene cue already at
792
+ * that line for that boundary trigger (a time action's marker) is the one offered or placed.
793
+ */
794
+ trigger: S.text,
718
795
  },
719
796
  out: {
720
797
  main: S.writeResult,
@@ -723,6 +800,74 @@ export const proposeSceneCue = pin(describeOutletDefinition({
723
800
  },
724
801
  },
725
802
  }));
803
+ /**
804
+ * 🚧 **Summarize a finished scene** — the scene summaries routine's outlet
805
+ * (every name here is provisional): starts the session genre's **own** scene
806
+ * summarizer (its summarize-scene pipeline, never a second prompt) for one
807
+ * finished scene, in the background, and returns at once: the summary's model
808
+ * calls are never awaited by the routine's run.
809
+ *
810
+ * Under the routine's **Full** the result is saved by itself (the summary, and
811
+ * the model's name only while the scene still has its automatic name; the known
812
+ * cast stored at the scene's close is left as it is) and marked as saved by the
813
+ * routine; a summary saved this way never settles the story. Under **Review**
814
+ * it waits for a person in the review window, as a pressed *Summarize* does.
815
+ * Its model calls queue as a routine's, after people's replies. The host half
816
+ * is the app's.
817
+ *
818
+ * ⚠ Not `scenes:process` (a person's press) and not *Compile to Entry*.
819
+ * @experimental
820
+ */
821
+ export const summarizeFinishedScene = pin(describeOutletDefinition({
822
+ id: 'core:outlet/summarize-finished-scene@1',
823
+ i18n: { name: { en: 'Summarize a finished scene' } },
824
+ effects: 'write',
825
+ reviewDefault: 'off',
826
+ timeoutMs: 5000,
827
+ ports: {
828
+ in: {
829
+ /** The scene to summarize: a scene id, as `core:query/scene-summary-due@1` names it. Absent or null: nothing is due, and nothing starts. */
830
+ scene: S.json,
831
+ /** The routine inlet's `routine` port (the firing): its `mode` decides what the summary becomes. */
832
+ routine: S.json,
833
+ },
834
+ out: { main: S.writeResult },
835
+ },
836
+ }));
837
+ /**
838
+ * 🚧 **Note it in the scene** (★S4, owner 2026-11-10): adds a note to a scene — a fact that
839
+ * isn't a story line (a death, a treaty, a clock jump). Notes reach the scene's summary and
840
+ * Compile. Never writes history or messages. Refused when the genre writes no scenes, when the
841
+ * scene is another session's, or when no scene is open.
842
+ *
843
+ * Scenes first: a pipeline puts story events into scenes — this outlet, or a story line through
844
+ * `create-message@1` — and a person's Compile files a day's scenes under that day's one history
845
+ * entry. A history write through `create-lore-entry@1` is the second choice.
846
+ *
847
+ * `text` is required. `scene` names a scene by id; absent, the note goes to the run's lane's open
848
+ * scene. `sources` (optional) are the messages the note was written from, the shape the lore
849
+ * writes take. "The genre writes no scenes" is `writes.scenes: false`. The host half is the app's.
850
+ * @experimental
851
+ * @ruling ★S4 (2026-11-10)
852
+ */
853
+ export const noteScene = pin(describeOutletDefinition({
854
+ id: 'core:outlet/note-scene@1',
855
+ i18n: { name: { en: 'Note it in the scene' } },
856
+ effects: 'write',
857
+ review: { fields: ['text'] },
858
+ timeoutMs: 10000,
859
+ ports: {
860
+ in: {
861
+ /** The note, a sentence or two. Required. */
862
+ text: S.text,
863
+ /** A scene id. Optional; absent, the run's lane's open scene. `json`, as `propose-scene-cue@1`'s `at` is. */
864
+ scene: S.json,
865
+ /** 🚧 The messages the note was written from — as the lore writes take them. Optional. */
866
+ sources: S.loreSources,
867
+ },
868
+ out: { main: S.writeResult },
869
+ },
870
+ }));
726
871
  /**
727
872
  * 🚧 **Configure a stat** for one owner in this session (owner ruling
728
873
  * 2026-10-15): the pipeline door to an owner's **stat configuration** — the
@@ -809,6 +954,88 @@ export const setAnnexField = pin(describeOutletDefinition({
809
954
  out: { main: S.writeResult, annex: S.json },
810
955
  },
811
956
  }));
957
+ /**
958
+ * 🚧 Write one owner's document into the **lorebook annex** (M0,
959
+ * SHAPES L9): the `set-session-annex` write at book scope. A write from a
960
+ * session is a change — anchored to the turn, filed as a `lore_imprints` row
961
+ * (subject `annex`), retractable, settled with the stretch — routed like
962
+ * every lore write; a write from a book-level run is lasting at once.
963
+ * @experimental
964
+ */
965
+ export const setLorebookAnnex = pin(describeOutletDefinition({
966
+ id: 'core:outlet/set-lorebook-annex@1',
967
+ i18n: { name: { en: 'Set lorebook annex' } },
968
+ effects: 'write',
969
+ /** The lorebook twin of `annex-changed`, as `set-session-annex` causes that one. */
970
+ causesEvent: 'core:event/lorebook-annex-changed@1',
971
+ reviewDefault: 'off',
972
+ review: { fields: ['value'] },
973
+ timeoutMs: 2000,
974
+ ports: {
975
+ in: {
976
+ value: S.json,
977
+ /**
978
+ * 🚧 Compare-and-set (M2b), as `set-session-annex`'s `base`: the
979
+ * owner's annex document version this run read — `lorebook-annex`'s
980
+ * `version`. Another stored version writes nothing (`written: false`,
981
+ * `stale: true`, a receipt note), and `annex` and `version` carry the
982
+ * document as it stands now. Absent, the last write wins.
983
+ */
984
+ base: S.json,
985
+ },
986
+ out: {
987
+ main: S.writeResult,
988
+ /** The owner's document as written — or, when `base` was stale, as it stands now. */
989
+ annex: S.json,
990
+ /** 🚧 (M2b) The owner's annex document version on the book after this write (unchanged when nothing was written). */
991
+ version: S.json,
992
+ },
993
+ },
994
+ }));
995
+ /**
996
+ * 🚧 Set one annex field declared `annexField({ scope: 'lorebook' })`
997
+ * (M0, SHAPES L9): the `set-annex-field` write at book scope, under the
998
+ * same rules as {@link setLorebookAnnex}.
999
+ * @experimental
1000
+ */
1001
+ export const setLorebookAnnexField = pin(describeOutletDefinition({
1002
+ id: 'core:outlet/set-lorebook-annex-field@1',
1003
+ i18n: { name: { en: 'Set lorebook annex field' } },
1004
+ effects: 'write',
1005
+ causesEvent: 'core:event/lorebook-annex-changed@1',
1006
+ reviewDefault: 'off',
1007
+ /** The payload was judged at the door and is judged again here — approve or refuse, never rewrite. */
1008
+ review: { fields: [] },
1009
+ timeoutMs: 2000,
1010
+ ports: {
1011
+ in: { payload: S.json },
1012
+ out: { main: S.writeResult },
1013
+ },
1014
+ }));
1015
+ /**
1016
+ * 🚧 Move the session's rules to another version of their ruleset (M0,
1017
+ * SHAPES L4 Conversion): built-in and owner-only, also the socket
1018
+ * `sessions:convertRuleset`. Per session it re-keys renamed slots, retracts
1019
+ * removed ones and inserts defaults for added ones — each an anchored change,
1020
+ * retractable — then sets the session's ruleset version to `to`.
1021
+ * @experimental
1022
+ */
1023
+ export const convertRuleset = pin(describeOutletDefinition({
1024
+ id: 'core:outlet/convert-ruleset@1',
1025
+ i18n: { name: { en: 'Convert ruleset' } },
1026
+ effects: 'write',
1027
+ causesEvent: 'core:event/ruleset-converted@1',
1028
+ /** The version is the ruleset's own, and the slots its upgrades name: approve or refuse, never rewrite. */
1029
+ review: { fields: [] },
1030
+ timeoutMs: 5000,
1031
+ ports: {
1032
+ in: {
1033
+ /** The ruleset version to move to (semver). */
1034
+ to: S.text,
1035
+ },
1036
+ out: { main: S.writeResult },
1037
+ },
1038
+ }));
812
1039
  /**
813
1040
  * Record an event your package declared: something happened, and
814
1041
  * pipelines bound to it — plugin listeners, and widgets when the event is
@@ -1045,6 +1272,12 @@ export const showSprite = pin(describeOutletDefinition({
1045
1272
  * it carries the card's visibility and stays out of the card's gallery like
1046
1273
  * every sprite. Refused unless the run's person owns the card or is an admin.
1047
1274
  *
1275
+ * On a run pressed on a **cast member** the host files the pictures as the
1276
+ * member's own sprites (the files become the member's lorebook owner's, the
1277
+ * lorebook as provenance) and ignores nothing silently: a wired `characterId`
1278
+ * must be empty on such a run. Refused unless the run's person may edit the
1279
+ * member's lorebook. The card rule above stays as written.
1280
+ *
1048
1281
  * Causes `core:event/sprites-attached@1` when at least one row was written.
1049
1282
  * About a card, not a session: it writes no session row.
1050
1283
  * @experimental
@@ -1094,6 +1327,12 @@ export const attachSprite = pin(describeOutletDefinition({
1094
1327
  * key it was drawn for (`null` for surplus the host kept unkeyed). Refused
1095
1328
  * unless the run's person owns the card or is an admin.
1096
1329
  *
1330
+ * On a run pressed on a **cast member** the host files the pictures as the
1331
+ * member's own gallery pictures (the files become the member's lorebook
1332
+ * owner's, the lorebook as provenance) and ignores nothing silently: a wired
1333
+ * `characterId` must be empty on such a run. Refused unless the run's person
1334
+ * may edit the member's lorebook. The card rule above stays as written.
1335
+ *
1097
1336
  * Causes `core:event/media-offered@1` when at least one picture was placed.
1098
1337
  * About a card, not a session: it writes no session row.
1099
1338
  * @experimental
@@ -1119,7 +1358,6 @@ export const offerMedia = pin(describeOutletDefinition({
1119
1358
  },
1120
1359
  },
1121
1360
  }));
1122
- // ── The story clock (DESIGN-story-time P3, 2026-09-28) ──────────────────────
1123
1361
  /**
1124
1362
  * Move a session's **story clock** — the session's own story now — by `by` of
1125
1363
  * `unit`, through its lorebook's calendar (`advanceStoryTime`): carried by a
@@ -1190,11 +1428,21 @@ export const advanceStoryClock = pin(describeOutletDefinition({
1190
1428
  by: S.json,
1191
1429
  /** One of the units; wins over the `unit` parameter when wired. */
1192
1430
  unit: S.text,
1431
+ /**
1432
+ * 🚧 **Where the clock moves to** (M0, SHAPES L3), a
1433
+ * `ClockTargetV1` — the second input shape: an absolute moment
1434
+ * within the day ("sleep until 07:00") instead of a relative
1435
+ * `by`. Exactly one of the `by` and `to` in-ports may be wired;
1436
+ * both is refused with a sentence naming both. Wired, the `by`
1437
+ * and `unit` parameters are not read. One ledger move either
1438
+ * way, retractable as every move is.
1439
+ */
1440
+ to: S.clockTarget,
1193
1441
  /**
1194
1442
  * 🚧 **Why the clock moves** (live scenes §15 G4, 2026-10-13),
1195
1443
  * a literal: `'action'` — a person's press (*Time passes…*);
1196
1444
  * `'keeper'` — the state-keeper's move under Trust the
1197
- * narrator; `'tick'` — a reply's fixed tick. An action's and
1445
+ * narrator; `'tick'` — a fixed step, a round's. An action's and
1198
1446
  * the keeper's move are **time actions** the boundary watcher
1199
1447
  * may begin a new scene at; a tick never is. Unwired reads as
1200
1448
  * `'action'`.
@@ -1235,6 +1483,12 @@ export const advanceStoryClock = pin(describeOutletDefinition({
1235
1483
  skipped: S.text,
1236
1484
  /** It spelled through the book's calendar. */
1237
1485
  label: S.text,
1486
+ /**
1487
+ * 🚧 The minutes a `to` move moved the clock (M0, T1) — 0
1488
+ * when it stood where it was or was refused under `skip`, with
1489
+ * no ledger row. Absent on a `by` move.
1490
+ */
1491
+ moved: S.json,
1238
1492
  },
1239
1493
  },
1240
1494
  }));
@@ -1301,7 +1555,15 @@ export const answerForm = pin(describeOutletDefinition({
1301
1555
  },
1302
1556
  },
1303
1557
  }));
1304
- /** The audio twin of `attach-image` — same `target`, same commit, bound the same day. @experimental */
1558
+ /**
1559
+ * The audio twin of `attach-image` — same `target`, same commit, bound the same day.
1560
+ *
1561
+ * 🚧 Speech (seam S3, 2026-10-28): `meta` is the `SpokenMeta` record
1562
+ * `core:oracle/speak@1` publishes, kept in the line's metadata for the swipe
1563
+ * (`spoken`) beside the audio part; `replace` swaps the line's earlier spoken
1564
+ * audio rather than adding a second part — what re-speaking a line does.
1565
+ * @experimental
1566
+ */
1305
1567
  export const attachAudio = pin(describeOutletDefinition({
1306
1568
  id: 'core:outlet/attach-audio@1',
1307
1569
  effects: 'write',
@@ -1309,7 +1571,31 @@ export const attachAudio = pin(describeOutletDefinition({
1309
1571
  review: { fields: [] },
1310
1572
  timeoutMs: 5000,
1311
1573
  causesEvent: 'core:event/message-updated@1',
1312
- ports: { in: { target: S.rowIds, audio: S.audio }, out: { main: S.writeResult } },
1574
+ slots: {
1575
+ params: {
1576
+ kind: 'parameters',
1577
+ facet: 'behavior',
1578
+ schema: {
1579
+ replace: {
1580
+ type: 'boolean',
1581
+ default: false,
1582
+ label: { en: 'Replace earlier speech' },
1583
+ description: {
1584
+ en: "Swap the line's spoken audio for this one instead of adding a second part.",
1585
+ },
1586
+ },
1587
+ },
1588
+ },
1589
+ },
1590
+ ports: {
1591
+ in: {
1592
+ target: S.rowIds,
1593
+ audio: S.audio,
1594
+ /** 🚧 `SpokenMeta` — absent writes the audio part alone. */
1595
+ meta: S.spokenMeta,
1596
+ },
1597
+ out: { main: S.writeResult },
1598
+ },
1313
1599
  }));
1314
1600
  // ── Summarization ───────────────────────────────────────────────────────────
1315
1601
  /**
@@ -1321,14 +1607,12 @@ export const attachAudio = pin(describeOutletDefinition({
1321
1607
  * written that *which kind of entry comes from the pipeline that ran*. It did
1322
1608
  * not: it wrote world lore whatever ran, because nothing on this declaration
1323
1609
  * could say otherwise. `entryType` is that sentence made true — a declared
1324
- * entry type id (`core:entry/world-lore`, `core:entry/history`,
1325
- * `core:entry/location`), bare, the way `core:query/lorebook-entries@1` spells
1610
+ * entry type id (`core:entry/world-lore`, `core:entry/location`), bare, the way `core:query/lorebook-entries@1` spells
1326
1611
  * them; the version is the row's own column.
1327
1612
  *
1328
1613
  * A **param** and not an in-port, because the kind of thing a pipeline writes
1329
- * is a fact about the pipeline rather than about the turn — a summarizer
1330
- * writes history every time it runs, a room-builder writes locations every
1331
- * time — and a param is what a preset can set per session without the spec
1614
+ * is a fact about the pipeline rather than about the turn — a room-builder
1615
+ * writes locations every time it runs — and a param is what a preset can set per session without the spec
1332
1616
  * being rewired. An unknown id is refused at the commit with a sentence
1333
1617
  * naming the declared types, never coerced to world lore: a typo that silently
1334
1618
  * files rooms as world lore is the defect this replaces.
@@ -1336,6 +1620,14 @@ export const attachAudio = pin(describeOutletDefinition({
1336
1620
  * Default world lore, the agnostic shape, so every spec written before this
1337
1621
  * keeps doing exactly what it did.
1338
1622
  *
1623
+ * ## History is compiled, not written (2026-11-10)
1624
+ *
1625
+ * History is compiled, not written. Put events into scenes (`note-scene@1`, or a story line); a person's Compile files them under the day's one entry. A history write here is the second choice: it files onto its day's entry (the session's story day when no date is given), appending a paragraph. The packager warns `W_WRITES_HISTORY` on such a write; a `summarize-request@1` spec is exempt, its save being previewed.
1626
+ *
1627
+ * ## Where the write lands
1628
+ *
1629
+ * For a session whose scenes end by themselves (it runs the *Find where scenes begin* routine, not switched Off, and its scene mode is Automatic) a new entry, a room or a history day is written to the session's own book **whatever the lorebook's write mode (Full too)**, and the result carries `route: "own-book"` and the own book's `lorebookId`. A history write there files onto the day's one entry of the own book, merged onto the lorebook's day at Apply. Any other session writes as before: to the lorebook under Full, to its own book under Review changes, Off or a book someone else owns.
1630
+ *
1339
1631
  * ## `links`, or a second write
1340
1632
  *
1341
1633
  * Linking a new entry takes one of two shapes, and both exist on purpose.
@@ -1398,7 +1690,7 @@ export const createLoreEntry = pin(describeOutletDefinition({
1398
1690
  default: 'core:entry/world-lore',
1399
1691
  quick: true,
1400
1692
  label: { en: 'Kind of entry' },
1401
- 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.',
1693
+ description: 'Which kind of lorebook entry this pipeline writes — world lore or a location. Leave it as world lore for anything that is simply about the world.',
1402
1694
  },
1403
1695
  },
1404
1696
  },
@@ -1421,7 +1713,7 @@ export const createLoreEntry = pin(describeOutletDefinition({
1421
1713
  /**
1422
1714
  * 🚧 The messages this write was written from. Pass it when the write is a
1423
1715
  * 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.
1716
+ * session's settle line moves to the newest of them (not for a session whose scenes end by themselves: its write waits in the own book and Apply settles).
1425
1717
  */
1426
1718
  sources: S.loreSources,
1427
1719
  /** 🚧 A `LoreMatch` — how to find the entry this would otherwise create. */
@@ -1455,8 +1747,16 @@ export const createLoreEntry = pin(describeOutletDefinition({
1455
1747
  *
1456
1748
  * How the change lands is the host's: on the session's line, the way the
1457
1749
  * 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
1750
+ * amends). A change to an entry of the lorebook the session reads is kept in the
1751
+ * session's own book as a held change whatever the lorebook's write mode (**Full**
1752
+ * too), and reaches the lorebook only when it is applied; a change to an entry of the own
1753
+ * book is written there, and the result of a session whose scenes end by themselves
1754
+ * carries `route: "own-book"` and the own book's `lorebookId`. `entry` names an entry the session reads, in the lorebook or
1755
+ * in its own book.
1756
+ * ⚠ It causes no event yet (🚧): `lore-entry-created` means a new
1459
1757
  * row, and a subscriber that needs edits waits for one of its own.
1758
+ *
1759
+ * 🚧 A history entry's re-date (its `year`, `month` or `day` fields) is checked as a person's re-date is: refused, with a sentence, onto a date its line already has a history entry for, or onto a day the line shares with its parent (change that day as an amendment instead).
1460
1760
  * @internal
1461
1761
  */
1462
1762
  export const updateLoreEntry = pin(describeOutletDefinition({
@@ -1482,7 +1782,7 @@ export const updateLoreEntry = pin(describeOutletDefinition({
1482
1782
  /**
1483
1783
  * 🚧 The messages this write was written from. Pass it when the write is a
1484
1784
  * 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.
1785
+ * session's settle line moves to the newest of them (not for a session whose scenes end by themselves: its write waits in the own book and Apply settles).
1486
1786
  */
1487
1787
  sources: S.loreSources,
1488
1788
  },
@@ -1513,10 +1813,22 @@ export const updateLoreEntry = pin(describeOutletDefinition({
1513
1813
  * entries answer to — the second never picks one, because picking would link
1514
1814
  * the wrong room silently and a duplicate name is the author's to resolve.
1515
1815
  *
1516
- * One lorebook, both ends. An edge whose ends live in two books belongs to
1517
- * neither and the row carries one `lorebook_id`, so a cross-book link is
1518
- * refused rather than repaired — the same rule the socket handlers hold, held
1519
- * again here because a pipeline does not come through them.
1816
+ * One lorebook, both ends — except on the own-book route. An edge whose ends
1817
+ * live in two books belongs to neither and the row carries one `lorebook_id`, so
1818
+ * where the write lands in the lorebook the session reads (**Full** for a session
1819
+ * whose scenes do not end by themselves, or a session whose lorebook is its own book alone) a cross-book link is refused rather than
1820
+ * repaired — the same rule the socket handlers hold, held again here because a
1821
+ * pipeline does not come through them. A session that reads a lorebook it may not
1822
+ * write (**Review changes**, **Off**, or a book someone else owns), or whose scenes
1823
+ * end by themselves (the result then carries `route: "own-book"` and the own
1824
+ * book's `lorebookId`, whatever the write mode), keeps the row in
1825
+ * its own book, and an end may be an entry of the own book or an entry of the
1826
+ * lorebook as the session reads it (entries only, never a cast member): an id is
1827
+ * found in the own book, else in the lorebook; a name is looked up in the own book
1828
+ * first, and only when none answers there in the lorebook (two answers refuse
1829
+ * within one book, never across). A link either book already holds is not written
1830
+ * again (`written: false`); an id in neither book is refused. The row is the
1831
+ * session's own: it reaches no other session until applied.
1520
1832
  *
1521
1833
  * ## After a create
1522
1834
  *
@@ -1625,7 +1937,7 @@ export const linkLoreEntries = pin(describeOutletDefinition({
1625
1937
  /**
1626
1938
  * 🚧 The messages this write was written from. Pass it when the write is a
1627
1939
  * 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.
1940
+ * session's settle line moves to the newest of them (not for a session whose scenes end by themselves: its write waits in the own book and Apply settles).
1629
1941
  */
1630
1942
  sources: S.loreSources,
1631
1943
  },
@@ -1656,11 +1968,140 @@ export const graphProposal = pin(describeOutletDefinition({
1656
1968
  /**
1657
1969
  * 🚧 The messages this write was written from. Pass it when the write is a
1658
1970
  * 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.
1971
+ * session's settle line moves to the newest of them (not for a session whose scenes end by themselves: its write waits in the own book and Apply settles).
1660
1972
  */
1661
1973
  sources: S.loreSources,
1662
1974
  },
1663
1975
  out: { main: S.writeResult, proposalId: S.writeResult },
1664
1976
  },
1665
1977
  }));
1978
+ /**
1979
+ * Make a character: write one character card into the acting person's library.
1980
+ *
1981
+ * Takes `card` — a V3 card `{ spec: 'chara_card_v3', data }`, its `data`, or a
1982
+ * plain `{ name, description, personality?, scenario?, first_mes?,
1983
+ * mes_example?, creator_notes?, tags? }`, exactly what the app's card reader
1984
+ * takes. Writes one character row (or, under the person's library write mode,
1985
+ * a proposal for it); `characterId` is the new row's id, or absent while the
1986
+ * write waits.
1987
+ *
1988
+ * ⚠ The app, not the pipeline, judges the write: it finds the person acting
1989
+ * for the run, and their **library write mode** decides whether the card lands
1990
+ * now (Full), waits for them to accept it in the session (Review, the
1991
+ * default), or is refused (Off). A genre must also declare
1992
+ * `writes.library.characters`, or the host refuses the write.
1993
+ * @internal
1994
+ */
1995
+ export const createCharacter = pin(describeOutletDefinition({
1996
+ id: 'core:outlet/create-character@1',
1997
+ i18n: { name: { en: 'Make a character' } },
1998
+ effects: 'write',
1999
+ /** R-15: the card a person may retype before it lands. */
2000
+ review: { fields: ['card'] },
2001
+ timeoutMs: 10000,
2002
+ ports: {
2003
+ in: { card: S.json },
2004
+ out: { main: S.writeResult, characterId: S.writeResult },
2005
+ },
2006
+ }));
2007
+ /**
2008
+ * Change a character: edit the text fields of a character the acting person
2009
+ * may write to.
2010
+ *
2011
+ * Takes `characterId` and `changes` — an object of character profile names:
2012
+ * `name`, `description`, `personality`, `scenario`, `greetings` (`{ text,
2013
+ * groupOnly? }[]` — the whole list, replacing the card's) and
2014
+ * `exampleDialogues` (`string[]`). The change writes the card's **current
2015
+ * version**, those fields and nothing else; the fields it replaced are kept so
2016
+ * Back can restore them. `first_mes` and `mes_example` are no longer accepted
2017
+ * (owner 2026-11-05: new names now, old removed); any other key is refused.
2018
+ * The app judges the person (write rights on the character) and their library
2019
+ * write mode (Full, Review or Off); a genre must declare
2020
+ * `writes.library.characters`.
2021
+ * @internal
2022
+ */
2023
+ export const updateCharacter = pin(describeOutletDefinition({
2024
+ id: 'core:outlet/update-character@1',
2025
+ i18n: { name: { en: 'Change a character' } },
2026
+ effects: 'write',
2027
+ /** R-15: the change a person may retype before it lands. */
2028
+ review: { fields: ['changes'] },
2029
+ timeoutMs: 10000,
2030
+ ports: {
2031
+ in: { characterId: S.json, changes: S.json },
2032
+ out: { main: S.writeResult, characterId: S.writeResult },
2033
+ },
2034
+ }));
2035
+ /**
2036
+ * 🚧 Change a cast member of the session — one or more fields of their
2037
+ * character profile.
2038
+ *
2039
+ * `member` is `seated-member:<castMemberId>`, `player-seat:<seatId>` or a cast
2040
+ * member id, as `core:query/cast-member@1` takes it. `changes` is an object of
2041
+ * character profile fields (`CHARACTER_PROFILE_FIELDS`), each a new value in
2042
+ * the field's own shape or `{ follow: true }` (read that field from the
2043
+ * member's card again; refused for a card-less member). Other keys are
2044
+ * refused, never dropped.
2045
+ *
2046
+ * 🚧 `changes` may also carry `nodeState` — one of `CAST_STATE_WORDS` (`active`, `deceased`, `missing`, `departed`; SDK `ties.ts`) — and `nodeVisibility` — `normal`, `legendary` or `hidden` — beside the profile fields: the member's state and visibility on the graph. Checked against those words (another word is refused, never dropped), and dated at the session's story time and tied to the turn like the profile fields.
2047
+ *
2048
+ * How it lands is the host's: one story write — a cast version dated at the
2049
+ * session's story time and tied to the turn, so Back takes it with the turn; a
2050
+ * second change in the same turn and moment updates that version (coalesces).
2051
+ * The genre's `writes.lore` and the session's lore write mode decide where:
2052
+ * the book's line, or under Review / Off the session's own notes (an overlay
2053
+ * of the member).
2054
+ *
2055
+ * A genre must place it: the Dungeon Crawler places it to mark the fallen
2056
+ * deceased (2026-11-10). ⚠ It causes no event yet
2057
+ * (🚧). `castVersionId` is the cast version written.
2058
+ * @experimental
2059
+ */
2060
+ export const updateCastMember = pin(describeOutletDefinition({
2061
+ id: 'core:outlet/update-cast-member@1',
2062
+ i18n: { name: { en: 'Change a cast member' } },
2063
+ effects: 'write',
2064
+ /**
2065
+ * What the change says may be retyped; which member it changes may not
2066
+ * — that is the run's identity, the rule `update-lore-entry@1` states.
2067
+ */
2068
+ review: { fields: ['changes'] },
2069
+ timeoutMs: 10000,
2070
+ ports: {
2071
+ in: {
2072
+ /** The member to change: `seated-member:<id>`, `player-seat:<id>`, or a cast member id. */
2073
+ member: S.json,
2074
+ /** `{ [profile field]: value | { follow: true } }`, plus `nodeState` / `nodeVisibility` (see above). */
2075
+ changes: S.json,
2076
+ },
2077
+ out: {
2078
+ main: S.writeResult,
2079
+ /** The cast version written. */
2080
+ castVersionId: S.writeResult,
2081
+ },
2082
+ },
2083
+ }));
2084
+ /**
2085
+ * Make a lorebook: write one lorebook into the acting person's library.
2086
+ *
2087
+ * Takes `lorebook` — a lorebook document as Lorebooks › Import reads it (a
2088
+ * SillyTavern world-info JSON is the safe shape: `{ name, description?,
2089
+ * entries }`). Writes a lorebook and its entries (or, under the person's
2090
+ * library write mode, a proposal for them); `lorebookId` is the new book's id.
2091
+ * The app judges the person and their library write mode (Full, Review or
2092
+ * Off); a genre must declare `writes.library.lorebooks`.
2093
+ * @internal
2094
+ */
2095
+ export const createLorebook = pin(describeOutletDefinition({
2096
+ id: 'core:outlet/create-lorebook@1',
2097
+ i18n: { name: { en: 'Make a lorebook' } },
2098
+ effects: 'write',
2099
+ /** R-15: the book a person may retype before it lands. */
2100
+ review: { fields: ['lorebook'] },
2101
+ timeoutMs: 10000,
2102
+ ports: {
2103
+ in: { lorebook: S.json },
2104
+ out: { main: S.writeResult, lorebookId: S.writeResult },
2105
+ },
2106
+ }));
1666
2107
  //# sourceMappingURL=outlets.js.map