@serene-pub/core-catalog 0.6.0-pr-7 → 0.6.0-pr-9

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.
Files changed (276) hide show
  1. package/README.md +1 -1
  2. package/components/genres/story/authors-note/AuthorsNote.svelte +2 -1
  3. package/components/genres/story/authors-note/AuthorsNoteWidget.svelte +177 -58
  4. package/components/shared/WidgetBoundary.svelte +37 -0
  5. package/components/shared/actions/Actions.svelte +2 -1
  6. package/components/shared/actions/ActionsWidget.svelte +31 -38
  7. package/components/shared/album/Album.svelte +2 -1
  8. package/components/shared/album/AlbumWidget.svelte +1 -7
  9. package/components/shared/annex/Annex.svelte +2 -1
  10. package/components/shared/annex/AnnexWidget.svelte +1 -1
  11. package/components/shared/attendance/Attendance.svelte +2 -1
  12. package/components/shared/attendance/AttendanceWidget.svelte +5 -8
  13. package/components/shared/backdrop/Backdrop.svelte +2 -1
  14. package/components/shared/backdrop/BackdropWidget.svelte +28 -22
  15. package/components/shared/chronicle/Chronicle.svelte +2 -1
  16. package/components/shared/chronicle/ChronicleWidget.svelte +211 -99
  17. package/components/shared/composer/Composer.svelte +25 -0
  18. package/components/shared/composer/ComposerWidget.svelte +146 -0
  19. package/components/shared/composer/composer.ts +10 -0
  20. package/components/shared/composer/settings.ts +59 -0
  21. package/components/shared/composer/target.ts +79 -0
  22. package/components/shared/dialogue-box/DialogueBoxMount.svelte +25 -0
  23. package/components/shared/dialogue-box/DialogueBoxWidget.svelte +207 -0
  24. package/components/shared/dialogue-box/dialogue-box.ts +10 -0
  25. package/components/shared/dialogue-box/settings.ts +25 -0
  26. package/components/shared/lore-entries/LoreEntries.svelte +2 -1
  27. package/components/shared/lore-entries/LoreEntriesWidget.svelte +44 -41
  28. package/components/shared/messages/MessageBlocksView.svelte +1 -1
  29. package/components/shared/messages/MessageControls.svelte +23 -5
  30. package/components/shared/messages/Messages.svelte +2 -1
  31. package/components/shared/messages/MessagesWidget.svelte +82 -191
  32. package/components/shared/messages/NextCharacterBlock.svelte +35 -20
  33. package/components/shared/messages/SceneDivider.svelte +40 -14
  34. package/components/shared/messages/SessionComposer.svelte +178 -123
  35. package/components/shared/messages/SessionContainer.svelte +89 -38
  36. package/components/shared/messages/SessionMessage.svelte +157 -54
  37. package/components/shared/messages/SpokenLine.svelte +57 -16
  38. package/components/shared/messages/StateProposalList.svelte +30 -20
  39. package/components/shared/messages/TurnLine.svelte +258 -66
  40. package/components/shared/messages/conversation.svelte.ts +83 -5
  41. package/components/shared/messages/readingPace.ts +101 -0
  42. package/components/shared/messages/rowFacts.ts +44 -0
  43. package/components/shared/messages/sceneMarks.ts +54 -0
  44. package/components/shared/messages/spokenLine.ts +63 -14
  45. package/components/shared/places/Places.svelte +2 -1
  46. package/components/shared/places/PlacesWidget.svelte +42 -33
  47. package/components/shared/routine-log/RoutineLog.svelte +2 -1
  48. package/components/shared/routine-log/RoutineLogWidget.svelte +0 -4
  49. package/components/shared/routine-log/routineLog.ts +5 -21
  50. package/components/shared/scene-portraits/ScenePortraits.svelte +2 -1
  51. package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +54 -32
  52. package/components/shared/session-runs/SessionRuns.svelte +26 -0
  53. package/components/shared/session-runs/SessionRunsWidget.svelte +270 -0
  54. package/components/shared/session-runs/session-runs.ts +11 -0
  55. package/components/shared/state/PieceCard.svelte +36 -25
  56. package/components/shared/state/SlotControl.svelte +18 -5
  57. package/components/shared/stats/Stats.svelte +2 -1
  58. package/components/shared/stats/StatsWidget.svelte +104 -72
  59. package/components/shared/turn-line/TurnLineMount.svelte +25 -0
  60. package/components/shared/turn-line/TurnLineWidget.svelte +25 -0
  61. package/components/shared/turn-line/settings.ts +31 -0
  62. package/components/shared/turn-line/turn-line.ts +10 -0
  63. package/components/shared/turn-order/TurnOrder.svelte +2 -1
  64. package/components/shared/turn-order/TurnOrderWidget.svelte +1 -6
  65. package/dist/components/actions.js +71 -88
  66. package/dist/components/actions.source.json +1 -1
  67. package/dist/components/album.js +39 -44
  68. package/dist/components/album.source.json +1 -1
  69. package/dist/components/annex.js +17 -8
  70. package/dist/components/annex.source.json +1 -1
  71. package/dist/components/attendance.js +39 -48
  72. package/dist/components/attendance.source.json +1 -1
  73. package/dist/components/authors-note.js +329 -162
  74. package/dist/components/authors-note.source.json +1 -1
  75. package/dist/components/backdrop.js +52 -55
  76. package/dist/components/backdrop.source.json +1 -1
  77. package/dist/components/chronicle.js +798 -559
  78. package/dist/components/chronicle.source.json +1 -1
  79. package/dist/components/composer.js +1639 -0
  80. package/dist/components/composer.source.json +1 -0
  81. package/dist/components/core-ui.json +1 -1
  82. package/dist/components/dialogue-box.js +373 -0
  83. package/dist/components/dialogue-box.source.json +1 -0
  84. package/dist/components/lore-entries.js +134 -122
  85. package/dist/components/lore-entries.source.json +1 -1
  86. package/dist/components/messages.js +1517 -8930
  87. package/dist/components/messages.source.json +1 -1
  88. package/dist/components/places.js +267 -244
  89. package/dist/components/places.source.json +1 -1
  90. package/dist/components/routine-log.js +35 -51
  91. package/dist/components/routine-log.source.json +1 -1
  92. package/dist/components/scene-portraits.js +118 -59
  93. package/dist/components/scene-portraits.source.json +1 -1
  94. package/dist/components/session-runs.js +488 -0
  95. package/dist/components/session-runs.source.json +1 -0
  96. package/dist/components/{shared-7VDIXYAL.js → shared-47J4TNSF.js} +1 -1
  97. package/dist/components/{shared-W3XS5FEL.js → shared-5E4RQYRX.js} +3 -2
  98. package/dist/components/{shared-YDS7HYL6.js → shared-EFMMT76D.js} +57 -4
  99. package/dist/components/{shared-BIWKZFUU.js → shared-FOVKPMSK.js} +3 -3
  100. package/dist/components/{shared-JPG5DQO7.js → shared-HEAKNNZB.js} +92 -17
  101. package/dist/components/shared-JXP6SHKF.js +159 -0
  102. package/dist/components/{shared-XBDUENRA.js → shared-JXYPKSTQ.js} +1 -1
  103. package/dist/components/shared-KJIOSSE3.js +257 -0
  104. package/dist/components/{shared-WV3QTKZT.js → shared-KLURQFWI.js} +13 -9
  105. package/dist/components/shared-MHCNUDUT.js +1680 -0
  106. package/dist/components/{shared-QXF5CJVN.js → shared-NICRJ4Z2.js} +1 -1
  107. package/dist/components/{shared-BBF64YGL.js → shared-W2BBJCNE.js} +22 -16
  108. package/dist/components/shared-YYYXFDZU.js +4354 -0
  109. package/dist/components/stats.js +828 -678
  110. package/dist/components/stats.source.json +1 -1
  111. package/dist/components/turn-line.js +856 -0
  112. package/dist/components/turn-line.source.json +1 -0
  113. package/dist/components/turn-order.js +62 -67
  114. package/dist/components/turn-order.source.json +1 -1
  115. package/dist/factories/answerForm.d.ts +6 -0
  116. package/dist/factories/answerForm.js +104 -96
  117. package/dist/factories/turnOrder.d.ts +98 -105
  118. package/dist/factories/turnOrder.js +120 -136
  119. package/dist/functions/pieces.js +1 -0
  120. package/dist/functions/time.js +2 -0
  121. package/dist/genres/chat/create.js +2 -0
  122. package/dist/genres/chat/memory.js +64 -43
  123. package/dist/genres/chat/respond.d.ts +7 -6
  124. package/dist/genres/chat/respond.js +13 -4
  125. package/dist/genres/chat/turnOrder.d.ts +2 -2
  126. package/dist/genres/chat/turnOrder.js +28 -12
  127. package/dist/genres/defaults.d.ts +28 -6
  128. package/dist/genres/defaults.js +84 -26
  129. package/dist/genres/dungeon-crawler/calls.d.ts +3 -1
  130. package/dist/genres/dungeon-crawler/calls.js +5 -0
  131. package/dist/genres/dungeon-crawler/create.d.ts +9 -6
  132. package/dist/genres/dungeon-crawler/create.js +18 -8
  133. package/dist/genres/dungeon-crawler/death.d.ts +13 -6
  134. package/dist/genres/dungeon-crawler/death.js +26 -12
  135. package/dist/genres/dungeon-crawler/index.d.ts +1 -0
  136. package/dist/genres/dungeon-crawler/index.js +1 -0
  137. package/dist/genres/dungeon-crawler/journal.d.ts +1 -1
  138. package/dist/genres/dungeon-crawler/journal.js +1 -1
  139. package/dist/genres/dungeon-crawler/lore.d.ts +13 -12
  140. package/dist/genres/dungeon-crawler/lore.js +16 -25
  141. package/dist/genres/dungeon-crawler/names.d.ts +10 -3
  142. package/dist/genres/dungeon-crawler/names.js +10 -3
  143. package/dist/genres/dungeon-crawler/preamble.d.ts +5 -4
  144. package/dist/genres/dungeon-crawler/preamble.js +75 -33
  145. package/dist/genres/dungeon-crawler/respond.js +4 -2
  146. package/dist/genres/dungeon-crawler/rest.d.ts +8 -7
  147. package/dist/genres/dungeon-crawler/rest.js +39 -15
  148. package/dist/genres/dungeon-crawler/reveal.js +2 -2
  149. package/dist/genres/dungeon-crawler/roundScript.d.ts +2 -1
  150. package/dist/genres/dungeon-crawler/roundScript.js +23 -5
  151. package/dist/genres/dungeon-crawler/scripts.js +4 -5
  152. package/dist/genres/dungeon-crawler/shape.d.ts +16 -0
  153. package/dist/genres/dungeon-crawler/shape.js +5 -1
  154. package/dist/genres/dungeon-crawler/sheet.d.ts +20 -20
  155. package/dist/genres/dungeon-crawler/story.d.ts +27 -16
  156. package/dist/genres/dungeon-crawler/story.js +175 -46
  157. package/dist/genres/dungeon-crawler/storyScripts.d.ts +2 -2
  158. package/dist/genres/dungeon-crawler/storyScripts.js +109 -14
  159. package/dist/genres/dungeon-crawler/summarizeScene.d.ts +13 -0
  160. package/dist/genres/dungeon-crawler/summarizeScene.js +21 -0
  161. package/dist/genres/dungeon-crawler/turnOrder.d.ts +8 -9
  162. package/dist/genres/dungeon-crawler/turnOrder.js +33 -23
  163. package/dist/genres/guide/create.js +2 -0
  164. package/dist/genres/guide/turnOrder.d.ts +3 -3
  165. package/dist/genres/guide/turnOrder.js +29 -13
  166. package/dist/genres/lair/answerForm.js +4 -1
  167. package/dist/genres/lair/buildRoom.js +4 -3
  168. package/dist/genres/lair/castellanAction.js +160 -154
  169. package/dist/genres/lair/create.js +2 -0
  170. package/dist/genres/lair/fileCurrentRoom.js +13 -10
  171. package/dist/genres/lair/fileRoom.js +4 -3
  172. package/dist/genres/lair/keeper.js +6 -2
  173. package/dist/genres/lair/names.d.ts +2 -0
  174. package/dist/genres/lair/names.js +2 -0
  175. package/dist/genres/lair/reply.js +16 -6
  176. package/dist/genres/lair/roomAnswer.js +4 -3
  177. package/dist/genres/lair/scratchpad.js +9 -7
  178. package/dist/genres/lair/scripts.js +8 -6
  179. package/dist/genres/lair/turnOrder.d.ts +3 -2
  180. package/dist/genres/lair/turnOrder.js +45 -16
  181. package/dist/genres/story/ask.d.ts +4 -0
  182. package/dist/genres/story/ask.js +4 -0
  183. package/dist/genres/story/create.js +15 -0
  184. package/dist/genres/story/index.d.ts +1 -1
  185. package/dist/genres/story/index.js +1 -1
  186. package/dist/genres/story/narrate.js +8 -0
  187. package/dist/genres/story/narrateCharacter.js +8 -0
  188. package/dist/genres/story/reckon.d.ts +5 -19
  189. package/dist/genres/story/reckon.js +53 -40
  190. package/dist/genres/story/reckoning.js +3 -0
  191. package/dist/genres/story/respond.js +17 -28
  192. package/dist/genres/story/sweep.d.ts +1 -1
  193. package/dist/genres/story/sweep.js +1 -1
  194. package/dist/genres/story/turnOrder.d.ts +21 -3
  195. package/dist/genres/story/turnOrder.js +87 -21
  196. package/dist/index.d.ts +3 -0
  197. package/dist/index.js +23 -9
  198. package/dist/loadouts.d.ts +1 -0
  199. package/dist/loadouts.js +17 -1
  200. package/dist/primers/ninth-mile.d.ts +3 -4
  201. package/dist/registry/entries.d.ts +2 -0
  202. package/dist/registry/entries.js +18 -5
  203. package/dist/registry/genres.d.ts +146 -40
  204. package/dist/registry/genres.js +373 -101
  205. package/dist/registry/hostState.d.ts +1 -2
  206. package/dist/registry/hostState.js +2 -4
  207. package/dist/registry/layouts.d.ts +141 -111
  208. package/dist/registry/layouts.js +302 -141
  209. package/dist/registry/slots.d.ts +4 -3
  210. package/dist/registry/slots.js +4 -3
  211. package/dist/registry/widgets.d.ts +12 -2
  212. package/dist/registry/widgets.js +259 -106
  213. package/dist/rulesets/vis-itineris/ruleset.js +8 -5
  214. package/dist/rulesets/wherewithal/ruleset.js +2 -1
  215. package/dist/seed/presets.js +15 -9
  216. package/dist/seed/prompts.js +24 -5
  217. package/dist/seed/scripts.js +3 -0
  218. package/dist/shared/annexField.js +23 -3
  219. package/dist/shared/illustrateScene.d.ts +1 -0
  220. package/dist/shared/illustrateScene.js +29 -1
  221. package/dist/shared/lore.d.ts +13 -0
  222. package/dist/shared/lore.js +37 -1
  223. package/dist/shared/portrait.js +13 -4
  224. package/dist/shared/reckoning.d.ts +8 -2
  225. package/dist/shared/reckoning.js +47 -30
  226. package/dist/shared/roundTick.d.ts +20 -0
  227. package/dist/shared/roundTick.js +76 -0
  228. package/dist/shared/sceneBoundaries.d.ts +7 -0
  229. package/dist/shared/sceneBoundaries.js +62 -0
  230. package/dist/shared/sceneSummaries.d.ts +7 -0
  231. package/dist/shared/sceneSummaries.js +49 -0
  232. package/dist/shared/speakMessage.d.ts +9 -2
  233. package/dist/shared/speakMessage.js +32 -9
  234. package/dist/shared/speechFields.js +4 -0
  235. package/dist/shared/summarize/character.d.ts +1 -1
  236. package/dist/shared/summarize/history.d.ts +1 -1
  237. package/dist/shared/summarize/scene.d.ts +1 -1
  238. package/dist/shared/summarize/summarizeScene.js +1 -0
  239. package/dist/shared/summarize/summarizeSpec.d.ts +1 -1
  240. package/dist/shared/summarize/world.d.ts +1 -1
  241. package/dist/shared/ui/attendance/index.d.ts +3 -2
  242. package/dist/shared/ui/attendance/index.js +3 -7
  243. package/dist/shared/ui/chronicle/index.d.ts +24 -2
  244. package/dist/shared/ui/chronicle/index.js +58 -29
  245. package/dist/shared/ui/conversation/formAnswer.d.ts +16 -2
  246. package/dist/shared/ui/conversation/formAnswer.js +23 -9
  247. package/dist/shared/ui/conversation/index.d.ts +2 -0
  248. package/dist/shared/ui/conversation/index.js +4 -0
  249. package/dist/shared/ui/conversation/itemValues.d.ts +16 -3
  250. package/dist/shared/ui/conversation/itemValues.js +15 -5
  251. package/dist/shared/ui/conversation/messageVerbState.d.ts +17 -2
  252. package/dist/shared/ui/conversation/messageVerbState.js +5 -4
  253. package/dist/shared/ui/conversation/readingPlace.d.ts +40 -0
  254. package/dist/shared/ui/conversation/readingPlace.js +119 -0
  255. package/dist/shared/ui/conversation/rewindStrip.d.ts +13 -4
  256. package/dist/shared/ui/conversation/rewindStrip.js +29 -7
  257. package/dist/shared/ui/conversation/runsInProgress.d.ts +30 -0
  258. package/dist/shared/ui/conversation/runsInProgress.js +47 -0
  259. package/dist/shared/ui/conversation/storyDays.d.ts +7 -1
  260. package/dist/shared/ui/conversation/storyDays.js +8 -0
  261. package/dist/shared/ui/conversation/tableChannel.d.ts +8 -11
  262. package/dist/shared/ui/conversation/tableChannel.js +8 -9
  263. package/dist/shared/ui/places/index.d.ts +3 -2
  264. package/dist/shared/ui/places/index.js +4 -5
  265. package/dist/shared/ui/routine-log/index.d.ts +3 -0
  266. package/dist/shared/ui/routine-log/index.js +22 -0
  267. package/dist/shared/ui/scene-portraits/portraits.d.ts +50 -16
  268. package/dist/shared/ui/scene-portraits/portraits.js +84 -21
  269. package/dist/shared/ui/session-runs/index.d.ts +90 -0
  270. package/dist/shared/ui/session-runs/index.js +143 -0
  271. package/dist/shared/ui/session-state/stateView.d.ts +18 -5
  272. package/dist/shared/ui/session-state/stateView.js +29 -8
  273. package/dist/shared/ui/turn-order/index.d.ts +0 -9
  274. package/dist/shared/ui/turn-order/index.js +1 -2
  275. package/package.json +12 -8
  276. /package/dist/components/{shared-4ME6NFDK.js → shared-LUIF6DW7.js} +0 -0
@@ -15,8 +15,7 @@
15
15
  * a reply and declares for the next round, never lost between the last
16
16
  * reply and this one; every write of the turn is anchored to it, so a
17
17
  * retake or a delete takes it back;
18
- * 1. `fallen`, `log`, `books` — the story turn's own reads (the fallen, the
19
- * Journal folio) and `core:script/dungeon-crawler-books`: the Planner's
18
+ * 1. `log`, `books` — the story turn's own reads (the Journal folio) and `core:script/dungeon-crawler-books`: the Planner's
20
19
  * crib (the preamble's one crib builder — the world as the session's own
21
20
  * lorebook holds it, the goal, the leads, the notes and their Asks, the
22
21
  * story so far) and this round's brief (each player seat, what they
@@ -52,7 +51,7 @@
52
51
  * **table** channel (`stakes.shown.write`), anchored to the Narrator's
53
52
  * row, in no voice;
54
53
  * 7. `ledger` — `core:script/dungeon-crawler-ledger`: the genre's own
55
- * bookkeeping — its fields (fate, the clock, where a newcomer stands, a
54
+ * bookkeeping — its fields (fate, where a newcomer stands, a
56
55
  * level's new full health), death (`death.ts`), the goal (`goal.ts`), the
57
56
  * leads, the journal line and its kinds (`journal.ts`), the world's new
58
57
  * places and people for the session's lorebook (`lore.ts`), the
@@ -60,8 +59,15 @@
60
59
  * 8. `raise.levels.*`, `sheet.changed.*` — the genre fields written, filed at
61
60
  * the Narrator's row (the revealed notes kept in step, A24);
62
61
  * `time.passed.advance` — the handler's **advance** with the turn's
63
- * minutes (A4: durations tick every turn); `lorePlaces` … `loreFallen` —
64
- * the world written; `filed.kept.write` — the bookkeeping and the
62
+ * minutes (A4: durations tick every turn); `time.clock.advance` — the
63
+ * clock is the session's story clock (2026-11-10), moved by the turn's
64
+ * minutes through `advance-story-clock@1`; `lorePlaces`, `lorePeople` —
65
+ * the world written; `deaths` — each seat that died marked `deceased` in
66
+ * the cast (`core:outlet/update-cast-member@1`, tied to the row;
67
+ * 2026-11-10: no lore is written for a death); `companions.fates.*` — a
68
+ * companion's death or revival (bench-L3, ★4 2026-11-10): the seat benched
69
+ * or brought back and its cast member marked, tied to the row;
70
+ * `filed.kept.write` — the bookkeeping and the
65
71
  * journal, one annex write;
66
72
  * 9. `outcomes`, `context` … `say` → `save` — the Narrator, streamed, under
67
73
  * its own prompt row with the brief as `{{turnDirection}}` and the
@@ -82,7 +88,7 @@ import { DUNGEON_CRAWLER_DOOR_SCRIPT } from './dice.js';
82
88
  import { DUNGEON_CRAWLER_DEATH_JS } from './death.js';
83
89
  import { DUNGEON_CRAWLER_GOAL_JS } from './goal.js';
84
90
  import { DUNGEON_CRAWLER_JOURNAL_JS, journalWrites } from './journal.js';
85
- import { DUNGEON_CRAWLER_ENTRY_TYPES, DUNGEON_CRAWLER_WORLD_WRITES_JS, loreWrites } from './lore.js';
91
+ import { DUNGEON_CRAWLER_WORLD_WRITES_JS, loreWrites } from './lore.js';
86
92
  import { deliverSecrets } from './secrets.js';
87
93
  import { DUNGEON_CRAWLER_CRIB_ROUNDS, DUNGEON_CRAWLER_STORY_PREAMBLE, storySeed } from './storyScripts.js';
88
94
  import { DUNGEON_CRAWLER_SHAPE_SCRIPT } from './shape.js';
@@ -97,10 +103,11 @@ import { TABLE_CHANNEL } from '../../shared/ui/conversation/tableChannel.js';
97
103
  */
98
104
  /**
99
105
  * 🚧 `core:script/dungeon-crawler-books`: what a story turn starts from.
100
- * Handed `{ session, state, story, messageId, places, people, fallen, log }`
106
+ * Handed `{ session, state, story, messageId, places, people, log, cast }`
101
107
  * — the settings document, the session's state, the Story's newest rows, the
102
- * inlet's re-driven row, the three listings of the session's lorebook and
103
- * the Journal folio's newest lines. Returns:
108
+ * inlet's re-driven row, the two listings of the session's lorebook, the
109
+ * Journal folio's newest lines and the session's cast read (it carries the
110
+ * session's story time). Returns:
104
111
  *
105
112
  * - `fresh` — plan this turn (not a re-telling, not ended); `redo` — the row
106
113
  * being re-driven is the last turn's, whose `told` brief and outcomes
@@ -110,8 +117,9 @@ import { TABLE_CHANNEL } from '../../shared/ui/conversation/tableChannel.js';
110
117
  * reference, and `location:<entry id>` for each place one stands in;
111
118
  * `actions` — `[{ owner, text }]`, each live seat's declared lines, else
112
119
  * its standing order;
113
- * - `clockBase`, `rules` (`difficulty`), `seats`, `places`, `people` — as
114
- * read; `log` — the Journal's newest lines; `crib` (the preamble's one
120
+ * - `clockBase` (the session's story now, as the cast read carries it), `clockStart` (the crawl's first day, the same way),
121
+ * `clockCalendar` (its calendar, `null` for a free-form book — the Day count runs through it),
122
+ * `rules` (`difficulty`), `seats`, `places`, `people` — as read; `log` — the Journal's newest lines; `crib` (the preamble's one
115
123
  * crib builder), `brief`;
116
124
  * - `rigour` — the session's, as its document carries it (empty when it
117
125
  * carries none: the ruleset handler then reads the stored one);
@@ -142,7 +150,9 @@ var rules = { difficulty: text(w0.difficulty) || "fair" };
142
150
  // 🚧 How the session's ruleset plays (P2-4, P2-6): the kit's own ruleset or
143
151
  // another (Story: words), and Vis Itineris's casting and dying choices.
144
152
  var rs = rulesetOf(v.ruleset);
145
- var clockBase = text(w0["crawl-time"]) || ${JSON.stringify(DUNGEON_CRAWLER_EPOCH)};
153
+ var clockBase = storyNowClock(own(own(v.cast).storyTime).now) || ${JSON.stringify(DUNGEON_CRAWLER_EPOCH)};
154
+ var clockStart = storyStartClock(own(own(v.cast).storyTime).sessionStart) || clockBase;
155
+ var clockCalendar = own(own(v.cast).storyTime).calendar || null;
146
156
  var seats = seatsOf(doc, state);
147
157
  // 🚧 What a level brings to each seat's full health (S4, D9: the genre's
148
158
  // HP_PER_LEVEL retired): its class's kit's level gain, read off the
@@ -162,7 +172,7 @@ function levelHpOf(cls) {
162
172
  for (var lh = 0; lh < seats.length; lh++) seats[lh].levelHp = levelHpOf(seats[lh]["class"]);
163
173
  var heroes = own(progress.heroes);
164
174
  var places = placesOf(v.places);
165
- var people = peopleOf(v.people);
175
+ var people = peopleOf(v.people, progress.fallen);
166
176
  var log = logOf(v.log, CRIB_ROUNDS);
167
177
 
168
178
  // This round's declarations: the person lines on Story since its newest
@@ -172,7 +182,11 @@ var said = {};
172
182
  function seatOfLine(m) {
173
183
  var sp = text(m.speaker);
174
184
  for (var q = 0; q < seats.length; q++) if (seats[q].ref === sp) return seats[q];
175
- if (m.personaId != null) for (var p = 0; p < seats.length; p++) if (seats[p].ref === "character:" + m.personaId) return seats[p];
185
+ // A line stamped with its cast member is matched by it alone when the seats carry theirs (a card id may now be somebody else's); ⏳ else by its card.
186
+ var byMember = false;
187
+ for (var bm = 0; bm < seats.length; bm++) if (seats[bm].castMemberId != null) byMember = true;
188
+ if (m.castMemberId != null && byMember) { for (var cm = 0; cm < seats.length; cm++) if (seats[cm].castMemberId === m.castMemberId) return seats[cm]; }
189
+ else if (m.personaId != null) for (var p = 0; p < seats.length; p++) if (seats[p].ref === "character:" + m.personaId) return seats[p];
176
190
  if (m.userId != null) for (var u = 0; u < seats.length; u++) if (seats[u].user === Number(m.userId)) return seats[u];
177
191
  return seats.length === 1 ? seats[0] : null;
178
192
  }
@@ -189,10 +203,10 @@ function placeNamed(name) {
189
203
  for (var i = 0; i < places.length; i++) if (places[i].name.toLowerCase() === n) return places[i];
190
204
  return null;
191
205
  }
192
- var crib = cribLines(progress, journal, { state: state, places: v.places, people: v.people, fallen: v.fallen, log: log, detail: true });
206
+ var crib = cribLines(progress, journal, { state: state, places: v.places, people: v.people, log: log, detail: true });
193
207
 
194
208
  var brief = [];
195
- brief.push("Difficulty: " + rules.difficulty + ". Time: " + clockLabel(clockBase) + ".");
209
+ brief.push("Difficulty: " + rules.difficulty + ". Time: " + clockLabel(clockBase, clockStart, clockCalendar) + ".");
196
210
  var party = [];
197
211
  // Each live seat's action this round: what it declared, else its standing order.
198
212
  var actions = [];
@@ -230,7 +244,11 @@ if (!anyDeclared && actions.length) brief.push("Nobody new declared this round:
230
244
  // 🚧 The companions are narrative only (owner ruling 2026-10-18, P3-9): no
231
245
  // sheet is kept for them and no change reaches them — said so, by name.
232
246
  var comp = companionNames(doc);
233
- if (comp.length) brief.push("Companions travelling with the party, voiced by the Narrator — narrative only: no sheet keeps their health or their things, so propose no delta for them; tell what befalls them in the brief:\\n- " + comp.join("\\n- "));
247
+ if (comp.length) brief.push("Companions travelling with the party, voiced by the Narrator — narrative only: no sheet keeps their health or their things, so propose no delta for them; tell what befalls them in the brief; if one of them dies this round, name them in fallenCompanions:\\n- " + comp.join("\\n- "));
248
+ // 🚧 The fallen companions the story could bring back (bench-L3, ★4 2026-11-10).
249
+ var lost = [], fl0 = Array.isArray(progress.fallen) ? progress.fallen : [];
250
+ for (var fi = 0; fi < fl0.length; fi++) if (own(fl0[fi]).companion === true && text(own(fl0[fi]).name)) lost.push(text(own(fl0[fi]).name));
251
+ if (lost.length) brief.push("Fallen companions the story could bring back to life (a shrine, a Raise): " + lost.join(", ") + "; name any it does in revivedCompanions.");
234
252
  var owed = Array.isArray(progress.arrivals) ? progress.arrivals : [];
235
253
  for (var oi = 0; oi < owed.length; oi++) {
236
254
  var o = own(owed[oi]);
@@ -246,13 +264,16 @@ return {
246
264
  brief: text(last.brief), outcomes: text(last.outcomes),
247
265
  changes: Array.isArray(last.changes) && last.changes.length ? last.changes : null,
248
266
  raises: Array.isArray(last.raises) && last.raises.length ? last.raises : null,
249
- replay: Array.isArray(last.replay) && last.replay.length ? last.replay : null
267
+ replay: Array.isArray(last.replay) && last.replay.length ? last.replay : null,
268
+ deceased: Array.isArray(last.deceased) && last.deceased.length ? last.deceased : null,
269
+ companionFates: Array.isArray(last.companionFates) && last.companionFates.length ? last.companionFates : null,
270
+ clock: num(last.clock, 0) > 0 ? num(last.clock, 0) : null
250
271
  } : null,
251
272
  base: { progress: progress, journal: journal },
252
273
  owners: owners, actions: actions, rigour: text(doc.rigour),
253
274
  decides: rs.decides, casting: rs.casting, pointsSlot: rs.pointsSlot, fall: rs.fall, deathSaves: rs.deathSaves, rulesetRigour: rs.rigour,
254
275
  conditions: own(v.ruleset).conditions || null,
255
- clockBase: clockBase, rules: rules, seats: seats, places: places, people: people, log: log,
276
+ clockBase: clockBase, clockStart: clockStart, clockCalendar: clockCalendar, rules: rules, seats: seats, places: places, people: people, log: log,
256
277
  crib: crib.join("\\n"), brief: brief.join("\\n")
257
278
  };
258
279
  `);
@@ -297,7 +318,7 @@ var counted = rigour === "mechanics" || rigour === "scripts";
297
318
  var slotLines = [];
298
319
  var seatsF = Array.isArray(own(v.books).seats) ? own(v.books).seats : [];
299
320
  for (var sf = 0; sf < seatsF.length; sf++) {
300
- var sw = slotWords(own(own(own(own(v.state).cast).byId)[stateKeyOf(seatsF[sf].ref)]));
321
+ var sw = slotWords(own(own(own(own(v.state).cast).byId)[stateKeyOf(seatsF[sf].ref, own(own(own(v.state).cast).byId))]));
301
322
  if (sw.length) slotLines.push(seatsF[sf].name + " — spell slots " + sw.join(", ") + ". A spell of a level with none left cannot be cast.");
302
323
  }
303
324
  var sheetText = blockText(blocks.sheet);
@@ -438,7 +459,7 @@ function seatOfRef(ref) {
438
459
  function bagOf(ref) {
439
460
  var m0 = /^location:(\\d+)$/.exec(ref);
440
461
  if (m0) return own(own(own(state.locations).byId)[m0[1]]);
441
- return own(own(own(state.cast).byId)[stateKeyOf(ref)]);
462
+ return own(own(own(state.cast).byId)[stateKeyOf(ref, own(own(state.cast).byId))]);
442
463
  }
443
464
  // The repertoire an owner holds a piece in, by its name or compendium id.
444
465
  function heldIn(ref, piece) {
@@ -461,7 +482,7 @@ function isHealth(slot) { var k = text(slot).toLowerCase(); return k === "hp" ||
461
482
  function healthNow(ref) {
462
483
  var st0 = seatOfRef(ref);
463
484
  if (st0) return st0.hp !== null ? st0.hp : st0.maxHp;
464
- var e0 = own(own(own(state.cast).byId)[stateKeyOf(ref)]);
485
+ var e0 = own(own(own(state.cast).byId)[stateKeyOf(ref, own(own(state.cast).byId))]);
465
486
  return num(e0.hp, null);
466
487
  }
467
488
  // 🚧 Who crosses a way (Q2-1, owner ruling ★6 — no grammar change): the seat
@@ -557,7 +578,7 @@ var spentNow = {};
557
578
  function spendSlot(dl) {
558
579
  var lv = Number((/\\d+/.exec(text(dl.piece)) || [])[0]);
559
580
  var ref = seatRefFor(dl.owner);
560
- var held = own(own(own(state.cast).byId)[stateKeyOf(ref)])["crawl-spell-slots"];
581
+ var held = own(own(own(state.cast).byId)[stateKeyOf(ref, own(own(state.cast).byId))])["crawl-spell-slots"];
561
582
  held = Array.isArray(held) ? held : [];
562
583
  var already = num(spentNow[ref + "|" + lv], 0);
563
584
  for (var i = 0; i < held.length; i++) {
@@ -615,10 +636,11 @@ return {
615
636
  * the state it left (`state`, the turn's own, when it applied nothing),
616
637
  * `row` the Narrator's row. Returns `{ changes, progress, journal, notes,
617
638
  * notesRevealed, brief, narrator, travelogue, journalLines, secrets,
618
- * laneLines, raises, places, people, fallen, replay, advance }` — see the
619
- * file header, step 8. `advance` is the turn's minutes for the handler's
620
- * `advance` (AUDIT A4: durations tick on every story turn, not only on
621
- * Rest). On a re-telling (a swipe), the brief and the outcomes as the turn
639
+ * laneLines, raises, places, people, deceased, companionFates, replay, advance, clock }` —
640
+ * see the file header, step 8. `advance` is the turn's minutes for the
641
+ * handler's `advance` (AUDIT A4: durations tick on every story turn, not only
642
+ * on Rest). `clock` is the minutes the session's story clock moves
643
+ * (`advance-story-clock@1`), or null when the turn moves none. On a re-telling (a swipe), the brief and the outcomes as the turn
622
644
  * first told them, and what it files again (`changes`, `raises`, `replay`:
623
645
  * the host took back what was anchored to the row).
624
646
  * @experimental
@@ -638,7 +660,11 @@ if (b.redo) {
638
660
  raises: Array.isArray(told0.raises) ? told0.raises.map(function (r) { var o = own(r); if (!o.slot) o.slot = SL.hp; return o; }) : null,
639
661
  replay: told0.replay || null,
640
662
  progress: null, journal: null, notes: null, notesRevealed: null, travelogue: null, journalLines: null,
641
- secrets: null, laneLines: null, places: null, people: null, fallen: null, advance: null,
663
+ secrets: null, laneLines: null, places: null, people: null, deceased: told0.deceased || null, advance: null,
664
+ // 🚧 The companions' fates (bench-L3, owner ★4 2026-11-10): the swipe took them back with the row; filed again, once.
665
+ companionFates: told0.companionFates || null,
666
+ // A swipe took the move back with the row: the redo files it again, once.
667
+ clock: told0.clock || null,
642
668
  brief: text(told0.brief) || "Tell this round again from what the players just did.",
643
669
  narrator: (function () {
644
670
  var c0 = text(own(own(v.applied).facts).rigour) || text(b.rulesetRigour), dr = c0 === "mechanics" || c0 === "scripts" ? "yes" : "";
@@ -700,13 +726,15 @@ for (var lu = 0; lu < seats.length; lu++) {
700
726
  changes.push({ owner: was.ref, slot: SL.hp, value: Math.min(top, (is.hp === null ? was.maxHp : is.hp) + gained * perLevel) });
701
727
  }
702
728
 
703
- // The clock: the turn's minutes, from where the turn started.
729
+ // The clock: the turn's minutes, from where the turn started. The session's
730
+ // story clock moves by them (\`advance-story-clock@1\`, the ledger's \`clock\`);
731
+ // the journal's time line reads \`clockNext\`.
704
732
  var clockNext = null;
705
733
  if (plan && plan.clock.minutes > 0) {
706
- clockNext = addMinutes(b.clockBase, plan.clock.minutes);
707
- if (clockNext && clockNext !== b.clockBase) changes.push({ owner: "world", slot: SL.clock, value: clockNext });
708
- else clockNext = null;
734
+ clockNext = addMinutes(b.clockBase, plan.clock.minutes, b.clockCalendar);
735
+ if (!clockNext || clockNext === b.clockBase) clockNext = null;
709
736
  }
737
+ var clockMinutes = clockNext ? Math.round(plan.clock.minutes) : 0;
710
738
 
711
739
  // The world the Planner moved, for the session's own lorebook: new places
712
740
  // with their ways out (a link says the way and how it stands), new people
@@ -714,11 +742,59 @@ if (plan && plan.clock.minutes > 0) {
714
742
  // in this turn's deltas (\`exitDeltas\`, the turn script).
715
743
  var placesNow = Array.isArray(b.places) ? b.places : [];
716
744
  var writes = plan ? worldWrites(placesNow, Array.isArray(b.people) ? b.people : [], plan.world.rooms, plan.world.npcs, counted) : { places: [], people: [] };
717
- var fallenNew = [];
745
+ var deceased = [];
718
746
  ${DUNGEON_CRAWLER_DEATH_JS}
719
747
  // Who is out of the round once this turn lands (the round script's mirror).
720
748
  var outNow = fatesAfter(seatsNow, changes);
721
749
  keepFates(progress, seatsNow, changes);
750
+ // 🚧 The companions' fates (bench-L3, owner ★4 2026-11-10; "seat to benched is
751
+ // something managed by the genre/pipelines, not automatically by core"): a
752
+ // companion the Planner names in \`fallenCompanions\` is benched and its cast
753
+ // member marked deceased; one named in \`revivedCompanions\` is brought back
754
+ // from \`progress.fallen\`. A hero is never touched here (\`death.ts\` owns
755
+ // heroes). The crawl's fallen list moves with it, in this turn's own write.
756
+ var companionFates = [];
757
+ function memberOf(castMemberId, ref) {
758
+ if (castMemberId != null) return "seated-member:" + castMemberId;
759
+ return typeof ref === "string" && ref.indexOf("seated-member:") === 0 ? ref : "";
760
+ }
761
+ if (plan) {
762
+ var cdone = {};
763
+ var cfall = Array.isArray(plan.fallenCompanions) ? plan.fallenCompanions : [];
764
+ var cnow = companionsOf(doc);
765
+ for (var cf = 0; cf < cfall.length; cf++) {
766
+ var cname = text(cfall[cf]).toLowerCase();
767
+ if (!cname || cdone[cname]) continue;
768
+ var cmatch = null;
769
+ for (var cn = 0; cn < cnow.length; cn++) if (cnow[cn].name.toLowerCase() === cname || cnow[cn].ref === text(cfall[cf])) cmatch = cnow[cn];
770
+ if (!cmatch) continue;
771
+ var cmember = memberOf(cmatch.castMemberId, cmatch.ref);
772
+ if (!cmember) continue;
773
+ cdone[cname] = true;
774
+ companionFates.push({ seat: cmatch.ref, benched: true, member: cmember, changes: { nodeState: "deceased" } });
775
+ var cfallen = Array.isArray(progress.fallen) ? progress.fallen.slice() : [];
776
+ cfallen.push({ name: cmatch.name, where: partyPlace(""), seat: cmatch.ref, castMemberId: cmatch.castMemberId != null ? cmatch.castMemberId : null, companion: true });
777
+ progress.fallen = cfallen;
778
+ told.push(cmatch.name + " is dead. Name " + cmatch.name + "'s death plainly, in a sentence of its own, and give it weight.");
779
+ }
780
+ var crev = Array.isArray(plan.revivedCompanions) ? plan.revivedCompanions : [];
781
+ for (var cr = 0; cr < crev.length; cr++) {
782
+ var rname = text(crev[cr]).toLowerCase();
783
+ if (!rname) continue;
784
+ var rlist = Array.isArray(progress.fallen) ? progress.fallen : [];
785
+ var rat = -1;
786
+ for (var rf = 0; rf < rlist.length; rf++) if (own(rlist[rf]).companion === true && text(own(rlist[rf]).name).toLowerCase() === rname) { rat = rf; break; }
787
+ if (rat < 0) continue;
788
+ var rentry = own(rlist[rat]);
789
+ var rmember = memberOf(rentry.castMemberId, rentry.seat);
790
+ if (!rmember) continue;
791
+ companionFates.push({ seat: rentry.seat, benched: false, member: rmember, changes: { nodeState: "active" } });
792
+ var rrest = rlist.slice();
793
+ rrest.splice(rat, 1);
794
+ progress.fallen = rrest;
795
+ told.push(text(rentry.name) + " is alive again: the story brought them back. Tell how, plainly.");
796
+ }
797
+ }
722
798
  // 🚧 Where everybody is (core:slot/location@1, AUDIT A9): a living seat nobody
723
799
  // has placed yet (a newcomer) stands where a living seat of the party stands,
724
800
  // else where its arrival was owed, else the first place of the world.
@@ -806,7 +882,10 @@ for (var op2 = 0; op2 < opened.length; op2++) replay.push(opened[op2]);
806
882
  if (nowOpen.length) outcomesText = (outcomesText ? outcomesText + "\\n\\n" : "") + nowOpen.join(" ");
807
883
  progress.lastTelling = {
808
884
  row: row, brief: briefText, outcomes: outcomesText,
809
- changes: changes.length ? changes : null, raises: raises.length ? raises : null, replay: replay.length ? replay : null
885
+ changes: changes.length ? changes : null, raises: raises.length ? raises : null, replay: replay.length ? replay : null,
886
+ deceased: deceased.length ? deceased : null,
887
+ companionFates: companionFates.length ? companionFates : null,
888
+ clock: clockMinutes > 0 ? clockMinutes : null
810
889
  };
811
890
  return {
812
891
  changes: changes.length ? changes : null,
@@ -827,8 +906,10 @@ return {
827
906
  replay: opened.length ? opened : null,
828
907
  places: writes.places.length ? writes.places : null,
829
908
  people: writes.people.length ? writes.people : null,
830
- fallen: fallenNew.length ? fallenNew : null,
831
- advance: plan && plan.clock.minutes > 0 ? { minutes: plan.clock.minutes } : null
909
+ deceased: deceased.length ? deceased : null,
910
+ companionFates: companionFates.length ? companionFates : null,
911
+ advance: plan && plan.clock.minutes > 0 ? { minutes: plan.clock.minutes } : null,
912
+ clock: clockMinutes > 0 ? clockMinutes : null
832
913
  };
833
914
  `);
834
915
  /**
@@ -854,7 +935,7 @@ const applied = (a) => ({
854
935
  /**
855
936
  * The `channel.story` branch (see the header): the spec's reads — the cast,
856
937
  * the Story's newest rows, the session's lorebook — are the respond spec's
857
- * head (`respond.ts`); the fallen and the Journal folio are its own.
938
+ * head (`respond.ts`); the Journal folio is its own.
858
939
  * @internal
859
940
  */
860
941
  export const storyBranch = (s, w) => {
@@ -866,12 +947,8 @@ export const storyBranch = (s, w) => {
866
947
  w.params.push([replanWrite.fresh, { emptyIsUnreadable: true }]);
867
948
  w.params.push([planWrite.words, { emptyIsUnreadable: true }]);
868
949
  w.params.push([replanWrite.words, { emptyIsUnreadable: true }]);
869
- w.params.push([on(s, 'fallen'), { entryTypes: [DUNGEON_CRAWLER_ENTRY_TYPES.fallen] }]);
870
950
  w.params.push([on(s, 'log'), { channel: TRAVELOGUE_CHANNEL, limit: DUNGEON_CRAWLER_CRIB_ROUNDS }]);
871
951
  const reads = s
872
- .query('fallen', ($) => C.lorebookEntries.v1({ scope: $.input.sessionScope, params: slot.params() }), {
873
- expose: { label: 'The fallen', status: STORY_STATUS.planning },
874
- })
875
952
  .query('log', ($) => C.sessionHistory.v1({ scope: $.input.sessionScope, params: slot.params() }), {
876
953
  expose: { label: 'The journal so far', status: STORY_STATUS.planning },
877
954
  });
@@ -882,10 +959,11 @@ export const storyBranch = (s, w) => {
882
959
  messageId: $.input.messageId,
883
960
  places: $.places.entries,
884
961
  people: $.people.entries,
885
- fallen: $.fallen.entries,
886
962
  log: $.log.messages,
887
963
  // 🚧 The ruleset the session plays and its settings (P2-4, P2-6).
888
964
  ruleset: $.input.ruleset,
965
+ // The session's story time rides on the cast read (2026-11-10).
966
+ cast: $.cast.main,
889
967
  }), "Open the Planner's books", STORY_STATUS.planning), w, 'crib', ($) => $.books.main, 'crib', "The Planner's crib, as text"), w, 'brief', ($) => $.books.main, 'brief', 'This round, as text'), w, 'owners', ($) => $.books.main, 'owners', 'Whose rules are read'), w, 'actions', ($) => $.books.main, 'actions', 'What each one does');
890
968
  // The session's rigour, handed to the handler as the session holds it
891
969
  // (empty: the handler reads the stored rigour itself).
@@ -1132,7 +1210,20 @@ export const storyBranch = (s, w) => {
1132
1210
  rigour: $.channel.story.rigour.text,
1133
1211
  mode: 'advance',
1134
1212
  elapsed: $.elapsed.main,
1135
- }), { expose: { label: "Pass the turn's time under the rules", status: STORY_STATUS.books } })));
1213
+ }), { expose: { label: "Pass the turn's time under the rules", status: STORY_STATUS.books } }))
1214
+ /**
1215
+ * The session's story clock moves by the turn's minutes (owner ruling
1216
+ * 2026-11-10: the crawl keeps no clock of its own). A move the story
1217
+ * cannot take moves nothing (`onRefusal: 'skip'`); a swipe takes it
1218
+ * back with the row, the redo moves it again, once.
1219
+ */
1220
+ .when('clock', { path: (v) => v.clock, truthy: true }, (k) => jsonPart(k, w, 'minutes', ($) => $.channel.story.ledger.main, 'clock', "The round's minutes").outlet('advance', ($) => C.advanceStoryClock.v1({
1221
+ by: $.minutes.main,
1222
+ unit: 'minutes',
1223
+ cause: 'action',
1224
+ onRefusal: 'skip',
1225
+ params: slot.params(),
1226
+ }), { expose: { label: 'Move the story clock', status: STORY_STATUS.books } })));
1136
1227
  /**
1137
1228
  * A swipe's re-filing (the host took back what the turn wrote at its row):
1138
1229
  * the deltas that need no roll, applied again by the handler.
@@ -1146,10 +1237,34 @@ export const storyBranch = (s, w) => {
1146
1237
  rigour: $.channel.story.rigour.text,
1147
1238
  mode: 'apply',
1148
1239
  }), { expose: { label: 'File the rules again' } })));
1149
- // The world the turn moved: new places, ways out, people and cairns, in
1150
- // the session's own lorebook, each anchored to the turn's row (`lore.ts`).
1240
+ // The world the turn moved: new places, ways out and people, in the
1241
+ // session's own lorebook, each anchored to the turn's row (`lore.ts`).
1151
1242
  const worlded = loreWrites(replayed, w, ($) => $.channel.story.ledger.main);
1152
- const filed = worlded.junction('filed', { on: ($) => $.ledger.main }, (j) => j.when('kept', { path: (v) => v.progress, truthy: true }, (k) => jsonPart(jsonPart(k, w, 'progress', ($) => $.channel.story.ledger.main, 'progress', 'The crawl, after the round'), w, 'journal', ($) => $.channel.story.ledger.main, 'journal', 'The journal, after the round').outlet('write', ($) => C.setSessionAnnex.v1({
1243
+ /**
1244
+ * 🚧 A death writes no lore (owner ruling 2026-11-10): each seat that died
1245
+ * has its cast member marked `deceased`, a cast version the host ties to
1246
+ * the Narrator's row — a swipe takes it back (the redo files it again,
1247
+ * once), a retake or a delete takes it back for good.
1248
+ */
1249
+ const deathsFiled = worlded.junction('deaths', { on: ($) => $.ledger.main }, (j) => j.when('deceased', { path: (v) => v.deceased, truthy: true }, (k) => jsonPart(k, w, 'list', ($) => $.channel.story.ledger.main, 'deceased', 'The seats that died').each('member', { over: ($) => $.list.main, max: 8 }, (m) => jsonPart(jsonPart(m, w, 'who', ($) => $[ITEM], 'member', 'Whose cast member'), w, 'changes', ($) => $[ITEM], 'changes', 'Their new state').outlet('write', ($) => C.updateCastMember.v1({ member: $.who.main, changes: $.changes.main }), {
1250
+ expose: { label: 'Mark the fallen deceased' },
1251
+ }))));
1252
+ /**
1253
+ * 🚧 A companion's death or revival (bench-L3, owner ★4 2026-11-10):
1254
+ * the genre, not core, benches the seat (\`set-seat-bench@1\`) and marks its
1255
+ * cast member (\`update-cast-member@1\`), both tied to the Narrator's row. A
1256
+ * swipe takes them back and the redo files them once; a retake or a delete
1257
+ * takes them back for good. A person's later drag back into the seat wins,
1258
+ * in core. Heroes stay with \`deaths\`.
1259
+ */
1260
+ const companionsFiled = deathsFiled.junction('companions', { on: ($) => $.ledger.main }, (j) => j.when('fates', { path: (v) => v.companionFates, truthy: true }, (k) => jsonPart(k, w, 'list', ($) => $.channel.story.ledger.main, 'companionFates', "The companions' fates").each('companion', { over: ($) => $.list.main, max: 8 }, (m) => jsonPart(jsonPart(jsonPart(jsonPart(m, w, 'seat', ($) => $[ITEM], 'seat', 'Which seat'), w, 'benched', ($) => $[ITEM], 'benched', 'Benched or back'), w, 'member', ($) => $[ITEM], 'member', "The companion's cast member"), w, 'changes', ($) => $[ITEM], 'changes', "The companion's new state")
1261
+ .outlet('bench', ($) => C.setSeatBench.v1({ seat: $.seat.main, benched: $.benched.main }), {
1262
+ expose: { label: 'Bench or bring back the companion' },
1263
+ })
1264
+ .outlet('state', ($) => C.updateCastMember.v1({ member: $.member.main, changes: $.changes.main }), {
1265
+ expose: { label: "Mark the companion's state" },
1266
+ }))));
1267
+ const filed = companionsFiled.junction('filed', { on: ($) => $.ledger.main }, (j) => j.when('kept', { path: (v) => v.progress, truthy: true }, (k) => jsonPart(jsonPart(k, w, 'progress', ($) => $.channel.story.ledger.main, 'progress', 'The crawl, after the round'), w, 'journal', ($) => $.channel.story.ledger.main, 'journal', 'The journal, after the round').outlet('write', ($) => C.setSessionAnnex.v1({
1153
1268
  value: {
1154
1269
  [K.progress]: $.progress.main,
1155
1270
  [K.journal]: $.journal.main,
@@ -1182,8 +1297,22 @@ export const storyBranch = (s, w) => {
1182
1297
  templateContext: $.context.templateContext,
1183
1298
  seedName: $.context.seedName,
1184
1299
  continuationPrefill: $.input.continuationPrefill,
1300
+ }), telling)
1301
+ // 🚧 Earlier in the story. The Narrator has no budget and no fit, so
1302
+ // this budget is for its own model's window and sizes only the block's
1303
+ // share; it is not wired into `prompt`, which stays without a fit.
1304
+ .task('sceneBudget', ($) => C.contextBudget.v1({
1305
+ sampling: slot.samplingOf(sibling($.context, 'say')),
1306
+ connection: slot.connectionOf(sibling($.context, 'say')),
1307
+ params: slot.params(),
1308
+ }), telling)
1309
+ .query('earlierScenes', ($) => C.earlierScenes.v1({
1310
+ scope: $.input.sessionScope,
1311
+ budget: $.sceneBudget.available,
1312
+ params: slot.params(),
1185
1313
  }), telling)
1186
1314
  .task('prompt', ($) => C.assemble.v2({
1315
+ earlierScenes: $.earlierScenes.main,
1187
1316
  messages: $.lines.messages,
1188
1317
  templateContext: $.context.templateContext,
1189
1318
  template: slot.template(),
@@ -29,8 +29,8 @@ export declare const DUNGEON_CRAWLER_DELTA_OPS: readonly ["add", "spend", "set",
29
29
  * retired 2026-10-23: what a level brings is the session's rules', the
30
30
  * books' `levelHp`);
31
31
  * `sinceReply(msgs)` — this round's declarations; `fatesAfter` /
32
- * `keepFates` — who is out of the round; the clock (`addMinutes`,
33
- * `clockLabel`); `hooks` — the open leads; the exit model
32
+ * `keepFates` — who is out of the round; the clock (`storyNowClock`,
33
+ * `addMinutes`, `clockLabel`); `hooks` — the open leads; the exit model
34
34
  * (`DUNGEON_CRAWLER_EXITS_JS`); and `checkPlan(raw)` — the Planner's answer
35
35
  * normalised, or `null` when it is unusable (no `narratorBrief`), its deltas
36
36
  * read from the session's rules' grammar (`asDelta`, S1) into the handler's.
@@ -31,8 +31,8 @@ export const DUNGEON_CRAWLER_DELTA_OPS = Object.freeze(['add', 'spend', 'set', '
31
31
  * retired 2026-10-23: what a level brings is the session's rules', the
32
32
  * books' `levelHp`);
33
33
  * `sinceReply(msgs)` — this round's declarations; `fatesAfter` /
34
- * `keepFates` — who is out of the round; the clock (`addMinutes`,
35
- * `clockLabel`); `hooks` — the open leads; the exit model
34
+ * `keepFates` — who is out of the round; the clock (`storyNowClock`,
35
+ * `addMinutes`, `clockLabel`); `hooks` — the open leads; the exit model
36
36
  * (`DUNGEON_CRAWLER_EXITS_JS`); and `checkPlan(raw)` — the Planner's answer
37
37
  * normalised, or `null` when it is unusable (no `narratorBrief`), its deltas
38
38
  * read from the session's rules' grammar (`asDelta`, S1) into the handler's.
@@ -79,27 +79,114 @@ function keepFates(progress, seats, changes) {
79
79
  for (var k in f) { progress.fates = f; return; }
80
80
  if (progress.fates) progress.fates = f;
81
81
  }
82
+ // The fixed month lengths: only the no-calendar fallback (a free-form book,
83
+ // whose cast read delivers no calendar); a declared calendar's months win.
82
84
  var MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
83
85
  function pad(n) { return n < 10 ? "0" + n : String(n); }
84
- function addMinutes(clock, minutes) {
85
- var m = /^(-?\\d+)-(\\d{1,2})-(\\d{1,2})(?:[ T](\\d{1,2}):(\\d{2}))?$/.exec(text(clock));
86
+ function hasMonths(cal) { return Array.isArray(own(cal).months) && own(cal).months.length > 0; }
87
+ // A leap rule's levels in order — the SDK's \`storyLeapLevels\`: \`every\`, \`skipEvery\`,
88
+ // \`keepEvery\`, then \`more\`, stopping at the first absent level.
89
+ function leapLevels(leap) {
90
+ var out = [];
91
+ if (!leap.every) return out;
92
+ out.push(leap.every);
93
+ if (!leap.skipEvery) return out;
94
+ out.push(leap.skipEvery);
95
+ if (!leap.keepEvery) return out;
96
+ out.push(leap.keepEvery);
97
+ if (Array.isArray(leap.more)) {
98
+ for (var i = 0; i < leap.more.length; i++) {
99
+ if (!leap.more[i]) break;
100
+ out.push(leap.more[i]);
101
+ }
102
+ }
103
+ return out;
104
+ }
105
+ // Whether a year has the calendar's leap day — the SDK's \`isLeapYear\`: the
106
+ // leading levels that divide the year, odd in number.
107
+ function leapIn(leap, year) {
108
+ var levels = leapLevels(leap);
109
+ var count = 0;
110
+ for (var i = 0; i < levels.length; i++) {
111
+ if (year % levels[i] !== 0) break;
112
+ count++;
113
+ }
114
+ return count % 2 === 1;
115
+ }
116
+ // A month's length in a year — the SDK's \`storyDaysInMonth\` (the leap day in
117
+ // its month when the year has it); the fixed lengths when there is no calendar.
118
+ function monthDays(year, mo, cal) {
119
+ if (!hasMonths(cal)) return MONTH_DAYS[(mo - 1) % 12];
120
+ return num(own(cal.months[mo - 1]).days, 0) + (own(cal.leap).month === mo && leapIn(own(cal.leap), year) ? 1 : 0);
121
+ }
122
+ function addMinutes(clock, minutes, calendar) {
123
+ var m = /^(-?\\d+)-(\\d+)-(\\d+)(?:[ T](\\d{1,2}):(\\d{2}))?$/.exec(text(clock));
86
124
  if (!m || !(minutes > 0)) return text(clock) || null;
87
125
  var y = Number(m[1]), mo = Number(m[2]), d = Number(m[3]);
88
126
  var t = (m[4] ? Number(m[4]) : 0) * 60 + (m[5] ? Number(m[5]) : 0) + Math.round(minutes);
89
127
  d += Math.floor(t / 1440);
90
128
  t = t % 1440;
91
- while (d > MONTH_DAYS[(mo - 1) % 12]) { d -= MONTH_DAYS[(mo - 1) % 12]; mo++; if (mo > 12) { mo = 1; y++; } }
129
+ var yearMonths = hasMonths(calendar) ? calendar.months.length : 12;
130
+ while (d > monthDays(y, mo, calendar)) { d -= monthDays(y, mo, calendar); mo++; if (mo > yearMonths) { mo = 1; y++; } }
92
131
  return y + "-" + pad(mo) + "-" + pad(d) + " " + pad(Math.floor(t / 60)) + ":" + pad(t % 60);
93
132
  }
94
- // The crawl's clock as the table reads it: the day counted from the
95
- // adventure's first (\`DUNGEON_CRAWLER_EPOCH\` is day 1), and the time —
96
- // "Day 3, 16:30". Stored as the story-time line; said this way.
97
- function clockLabel(clock) {
98
- var m = /^(-?\\d+)-(\\d{1,2})-(\\d{1,2})(?:[ T](\\d{1,2}):(\\d{2}))?$/.exec(text(clock));
99
- if (!m) return text(clock);
100
- var y = Number(m[1]), mo = Number(m[2]), day = Number(m[3]) + (y - 1) * 365;
133
+ // The session's story now, as the cast read carries it (2026-11-10), as the
134
+ // clock line the helpers here read: "<year>-<MM>-<DD>[ HH:MM]" from
135
+ // { year, month?, day?, hour?, minute? } — month and day default to 1, the
136
+ // time only when hour is a number; empty when there is no numeric year.
137
+ function storyNowClock(now) {
138
+ var n = own(now);
139
+ if (typeof n.year !== "number") return "";
140
+ var out = n.year + "-" + pad(typeof n.month === "number" ? n.month : 1) + "-" + pad(typeof n.day === "number" ? n.day : 1);
141
+ if (typeof n.hour === "number") out += " " + pad(n.hour) + ":" + pad(typeof n.minute === "number" ? n.minute : 0);
142
+ return out;
143
+ }
144
+ // The story clock as the table reads it: "Day N" counts from the crawl's
145
+ // first day (the \`start\` clock is day 1; with none it is the clock being
146
+ // labelled), and the time — "Day 3, 16:30". The clock is the session's story
147
+ // clock (2026-11-10); said this way, never as a calendar date.
148
+ function clockDays(clock, calendar) {
149
+ var m = /^(-?\\d+)-(\\d+)-(\\d+)(?:[ T](\\d{1,2}):(\\d{2}))?$/.exec(text(clock));
150
+ if (!m) return null;
151
+ var y = Number(m[1]), mo = Number(m[2]), day = Number(m[3]);
152
+ var cal = own(calendar);
153
+ if (Array.isArray(cal.months) && cal.months.length) return { day: calendarDay(y, mo, day, cal), m: m };
154
+ // No calendar: the crawl requires a timeline, so the cast read's calendar is
155
+ // null only for a free-form book (never because the timeline is off) — a
156
+ // plain 365-day year and the fixed month lengths.
157
+ day += (y - 1) * 365;
101
158
  for (var i = 0; i < mo - 1; i++) day += MONTH_DAYS[i % 12];
102
- return "Day " + day + (m[4] ? ", " + pad(Number(m[4])) + ":" + m[5] : "");
159
+ return { day: day, m: m };
160
+ }
161
+ // A day's ordinal through the book's calendar ({ months: [{ days }], leap? }) —
162
+ // the script's port of the SDK's \`storyDayIndex\` arithmetic: whole years of
163
+ // month days, the leap days before this year, the months before this one
164
+ // (the leap day in its month when this year has it), then the day.
165
+ function calendarDay(y, mo, day, cal) {
166
+ var leap = own(cal.leap);
167
+ var yearDays = 0;
168
+ for (var i = 0; i < cal.months.length; i++) yearDays += num(own(cal.months[i]).days, 0);
169
+ function fd(a, b) { return Math.floor(a / b); }
170
+ var yb = y - 1;
171
+ var levels = leapLevels(leap);
172
+ var total = yb * yearDays;
173
+ // The SDK's \`leapDaysThrough\`: the levels alternate in sign.
174
+ for (var j = 0; j < levels.length; j++) total += (j % 2 === 0 ? 1 : -1) * fd(yb, levels[j]);
175
+ for (var k = 1; k < mo; k++) total += num(own(cal.months[k - 1]).days, 0) + (leap.month === k && leapIn(leap, y) ? 1 : 0);
176
+ return total + day - 1;
177
+ }
178
+ function clockLabel(clock, start, calendar) {
179
+ var c = clockDays(clock, calendar);
180
+ if (!c) return text(clock);
181
+ var s = clockDays(start, calendar);
182
+ var first = s ? s.day : c.day;
183
+ return "Day " + (c.day - first + 1) + (c.m[4] ? ", " + pad(Number(c.m[4])) + ":" + c.m[5] : "");
184
+ }
185
+ // The crawl's first day as the cast read carries it ({ year, month, day }),
186
+ // as a clock line; empty when nothing is stamped yet.
187
+ function storyStartClock(start) {
188
+ var n = own(start);
189
+ return typeof n.year === "number" ? storyNowClock({ year: n.year, month: n.month, day: n.day }) : "";
103
190
  }
104
191
  // The open leads, as hooks: a lead is a short hook the party could follow
105
192
  // ("Find the scepter's second fragment"), never what happened. Anything over
@@ -147,11 +234,19 @@ function checkPlan(raw) {
147
234
  var sec = own(rs[s]);
148
235
  if (text(sec.seat) && text(sec.text)) secrets.push({ seat: text(sec.seat), text: text(sec.text) });
149
236
  }
237
+ // 🚧 Companions the story killed or revived this round (bench-L3, owner
238
+ // ★4 2026-11-10); absent in old answers, so \`[]\`.
239
+ function names(l) {
240
+ var o = [], r = Array.isArray(l) ? l : [];
241
+ for (var k = 0; k < r.length && o.length < 4; k++) if (typeof r[k] === "string" && text(r[k])) o.push(text(r[k]));
242
+ return o;
243
+ }
150
244
  return {
151
245
  deltas: deltas,
152
246
  world: { rooms: roomsOf(w.rooms, 6), npcs: npcs, leads: hooks(w.leads, raw.roundSummary), goalProgress: text(w.goalProgress) || "none", notes: text(w.notes) },
153
247
  clock: { minutes: clamp(Math.round(num(raw.clock && raw.clock.minutes, 10)), 0, 4320) },
154
- narratorBrief: brief, roundSummary: text(raw.roundSummary), secrets: secrets
248
+ narratorBrief: brief, roundSummary: text(raw.roundSummary), secrets: secrets,
249
+ fallenCompanions: names(raw.fallenCompanions), revivedCompanions: names(raw.revivedCompanions)
155
250
  };
156
251
  }
157
252
  `;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 🚧 The Dungeon Crawler's **summarize-scene** (live scenes §13), scenes first
3
+ * (owner ruling 2026-11-10): the crawl turns scenes on, and a day's scenes
4
+ * compile into its one history entry. One story channel, `main`, no asides,
5
+ * and no transcript template of its own (the builder's default is used). A
6
+ * death reaches the scene through the Narrator's own sentence.
7
+ *
8
+ * Registered in the Dungeon Crawler's defaults as its summarize-scene
9
+ * (`summaries(dungeonCrawlerSummarizeSceneSpec())`).
10
+ */
11
+ /** @experimental */
12
+ export declare const dungeonCrawlerSummarizeSceneSpec: () => import("@serene-pub/sdk").CompiledSpec<"close-out" | "summarize-scene">;
13
+ //# sourceMappingURL=summarizeScene.d.ts.map