@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
@@ -57,6 +57,7 @@
57
57
  import { compile, handlebars, slot, spec, coreEvents } from '@serene-pub/sdk';
58
58
  import { CORE_LOADOUT } from '../loadouts.js';
59
59
  import * as C from '@serene-pub/contracts';
60
+ import { applyWiring, jsonPart, wiring } from '../shared/calls.js';
60
61
  /** @internal */
61
62
  export const ANSWER_FORM_VERSION = '1.0.0';
62
63
  /**
@@ -109,101 +110,108 @@ export const ANSWER_FORM_TEMPLATE = `{{#systemBlock}}
109
110
  * answer pipeline from the same graph rather than restating it.
110
111
  * @experimental
111
112
  */
112
- export const answerFormSpec = (id, genre, options = {}) => compile(spec(id, {
113
- version: ANSWER_FORM_VERSION,
114
- taxonomy: { role: 'action' },
115
- })
116
- .inlet('input', C.formAddressed.v1(), { suits: [coreEvents.formAddressed] })
117
- .gather('gather', { mode: 'parallel' }, (b) => b
118
- .chain('history', (c) => c.query('read', ($) => C.sessionHistory.v1({
119
- scope: $.input.sessionScope,
120
- params: slot.params(),
121
- })))
122
- .chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope }))))
123
- /**
124
- * The addressee's card, compiled where a speaker's would be: a
125
- * character by `currentCharacterId`, an envoy by `speaker` (the
126
- * builder reads the envoy's declaration off the cast bundle).
127
- * The instructions are the pool row `answer-form-default`.
128
- */
129
- .task('context', ($) => C.buildTemplateContext.v1({
130
- cast: $.gather.cast.read.cast,
131
- currentCharacterId: $.input.characterId,
132
- speaker: $.input.addressee,
133
- prompts: slot.prompts(),
134
- variables: slot.variables(),
135
- }))
136
- .task('form', ($) => C.formContext.v1({
137
- form: $.input.form,
138
- templateContext: $.context.templateContext,
139
- }))
140
- /**
141
- * Prose, and no seed: the addressee is answering a question, not
142
- * taking a turn, so the transcript ends with nobody's name on an
143
- * open line — the question is the last user turn instead.
144
- */
145
- .task('lines', ($) => C.proseTranscript.v1({
146
- messages: $.gather.history.read.messages,
147
- cast: $.gather.cast.read.cast,
148
- templateContext: $.form.templateContext,
149
- }))
150
- /**
151
- * 🚧 **The transcript's files, placed** (attachments follow-ups,
152
- * owner ruling 2026-10-03) — `respond`'s two steps: the files the
153
- * rows show, then per line what `generate` receives. An image the
154
- * call can read rides its own turn; otherwise it is named
155
- * (`[image: cat.png]`). A transcript with no files passes through
156
- * untouched, so the prompt is byte for byte what it was.
157
- */
158
- .query('attachments', ($) => C.historyAttachments.v1({
159
- messages: $.gather.history.read.messages,
160
- params: slot.params(),
161
- }))
162
- .task('attached', ($) => C.placeAttachments.v1({
163
- messages: $.lines.messages,
164
- attachments: $.attachments.attachments,
165
- connection: slot.connectionOf('generate'),
166
- params: slot.params(),
167
- }))
168
- .task('contextBudget', ($) => C.contextBudget.v1({
169
- sampling: slot.samplingOf('generate'),
170
- connection: slot.connectionOf('generate'),
171
- params: slot.params(),
172
- }))
173
- .task('prompt', ($) => C.assemble.v2({
174
- budget: $.contextBudget.available,
175
- messages: $.attached.messages,
176
- templateContext: $.form.templateContext,
177
- template: slot.template(),
178
- prompts: slot.prompts($.context),
179
- variables: slot.variables(),
180
- params: slot.params(),
181
- connection: slot.connectionOf('generate'),
182
- }))
183
- /** The one oracle: JSON against the form's schema (R-15). */
184
- .oracle('generate', ($) => C.generateJson.v1({
185
- context: $.prompt.context,
186
- schema: $.form.schema,
187
- connection: slot.connection(),
188
- sampling: slot.sampling(),
189
- params: slot.params(),
190
- }), { expose: { status: 'Choosing an answer' } })
191
- .outlet('answer', ($) => C.answerForm.v1({
192
- form: $.input.form,
193
- answer: $.generate.json,
194
- messageId: $.input.messageId,
195
- blockId: $.input.blockId,
196
- addressee: $.input.addressee,
197
- }))
198
- .defaults((p) => {
199
- const templated = p
200
- .template('prompt', {
201
- source: ANSWER_FORM_TEMPLATE,
202
- engine: handlebars.id,
113
+ export const answerFormSpec = (id, genre, options = {}) => {
114
+ const w = wiring();
115
+ const opened = spec(id, {
116
+ version: ANSWER_FORM_VERSION,
117
+ taxonomy: { role: 'action' },
118
+ }).inlet('input', C.formAddressed.v1(), { suits: [coreEvents.formAddressed] });
119
+ const showing = (b, key) => jsonPart(b, w, 'showOutcomes', ($) => $.input.fields, key, 'Show outcomes');
120
+ /** With no `outcomeNumbersFrom` the step is never added, and nothing reads it. */
121
+ const head = (options.outcomeNumbersFrom ? showing(opened, options.outcomeNumbersFrom) : opened);
122
+ return compile(head
123
+ .gather('gather', { mode: 'parallel' }, (b) => b
124
+ .chain('history', (c) => c.query('read', ($) => C.sessionHistory.v1({
125
+ scope: $.input.sessionScope,
126
+ ...(options.outcomeNumbersFrom ? { outcomeNumbers: $.showOutcomes.main } : {}),
127
+ params: slot.params(),
128
+ })))
129
+ .chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope }))))
130
+ /**
131
+ * The addressee's card, compiled where a speaker's would be: a
132
+ * character by `currentCharacterId`, an envoy by `speaker` (the
133
+ * builder reads the envoy's declaration off the cast bundle).
134
+ * The instructions are the pool row `answer-form-default`.
135
+ */
136
+ .task('context', ($) => C.buildTemplateContext.v1({
137
+ cast: $.gather.cast.read.cast,
138
+ currentCharacterId: $.input.characterId,
139
+ speaker: $.input.addressee,
140
+ prompts: slot.prompts(),
141
+ variables: slot.variables(),
142
+ }))
143
+ .task('form', ($) => C.formContext.v1({
144
+ form: $.input.form,
145
+ templateContext: $.context.templateContext,
146
+ }))
147
+ /**
148
+ * Prose, and no seed: the addressee is answering a question, not
149
+ * taking a turn, so the transcript ends with nobody's name on an
150
+ * open line — the question is the last user turn instead.
151
+ */
152
+ .task('lines', ($) => C.proseTranscript.v1({
153
+ messages: $.gather.history.read.messages,
154
+ cast: $.gather.cast.read.cast,
155
+ templateContext: $.form.templateContext,
156
+ }))
157
+ /**
158
+ * 🚧 **The transcript's files, placed** (attachments follow-ups,
159
+ * owner ruling 2026-10-03) — `respond`'s two steps: the files the
160
+ * rows show, then per line what `generate` receives. An image the
161
+ * call can read rides its own turn; otherwise it is named
162
+ * (`[image: cat.png]`). A transcript with no files passes through
163
+ * untouched, so the prompt is byte for byte what it was.
164
+ */
165
+ .query('attachments', ($) => C.historyAttachments.v1({
166
+ messages: $.gather.history.read.messages,
167
+ params: slot.params(),
168
+ }))
169
+ .task('attached', ($) => C.placeAttachments.v1({
170
+ messages: $.lines.messages,
171
+ attachments: $.attachments.attachments,
172
+ connection: slot.connectionOf('generate'),
173
+ params: slot.params(),
174
+ }))
175
+ .task('contextBudget', ($) => C.contextBudget.v1({
176
+ sampling: slot.samplingOf('generate'),
177
+ connection: slot.connectionOf('generate'),
178
+ params: slot.params(),
179
+ }))
180
+ .task('prompt', ($) => C.assemble.v2({
181
+ budget: $.contextBudget.available,
182
+ messages: $.attached.messages,
183
+ templateContext: $.form.templateContext,
184
+ template: slot.template(),
185
+ prompts: slot.prompts($.context),
186
+ variables: slot.variables(),
187
+ params: slot.params(),
188
+ connection: slot.connectionOf('generate'),
189
+ }))
190
+ /** The one oracle: JSON against the form's schema (R-15). */
191
+ .oracle('generate', ($) => C.generateJson.v1({
192
+ context: $.prompt.context,
193
+ schema: $.form.schema,
194
+ connection: slot.connection(),
195
+ sampling: slot.sampling(),
196
+ params: slot.params(),
197
+ }), { expose: { status: 'Choosing an answer' } })
198
+ .outlet('answer', ($) => C.answerForm.v1({
199
+ form: $.input.form,
200
+ answer: $.generate.json,
201
+ messageId: $.input.messageId,
202
+ blockId: $.input.blockId,
203
+ addressee: $.input.addressee,
204
+ }))
205
+ .defaults((p) => {
206
+ const templated = p
207
+ .template('prompt', {
208
+ source: ANSWER_FORM_TEMPLATE,
209
+ engine: handlebars.id,
210
+ })
211
+ // Form answers run on the Reply loadout (I12).
212
+ .loadout('generate', slot.loadout(CORE_LOADOUT.reply));
213
+ return applyWiring(options.prompt ? templated.prompts('context', options.prompt) : templated, w);
203
214
  })
204
- // Form answers run on the Reply loadout (I12).
205
- .loadout('generate', slot.loadout(CORE_LOADOUT.reply));
206
- return options.prompt ? templated.prompts('context', options.prompt) : templated;
207
- })
208
- .build());
215
+ .build());
216
+ };
209
217
  //# sourceMappingURL=answerForm.js.map
@@ -4,57 +4,50 @@
4
4
  *
5
5
  * ## What this spec is
6
6
  *
7
- * One pipeline, bound to every session event a genre cares about, that
7
+ * **One option among a genre's turn order options** on Turn order asked. It
8
8
  * answers the question "whose turn is it" by **writing it down**:
9
9
  *
10
10
  * ```
11
11
  * event ─► history ─► pool ─► mentioned ─► strategy ─► set-turn-order
12
12
  * ```
13
13
  *
14
- * On the rules path it calls no model, writes no message and costs no token
15
- * — five reads and a `jsonb_set`. A genre may add the optional model path
16
- * (R41, `advise`), which asks a model once per recompute when the session's
17
- * `turnMode` is `model`. What it produces is the session's stored turn order:
18
- * the prepared turns, the candidates they were drawn from, and what the
19
- * order answers. Every surface that used to ask "who is next" by running a
20
- * decider now renders that state, and the reply run fires an entry out of
21
- * it (§4.6).
14
+ * On a rules strategy it calls no model, writes no message and costs no token
15
+ * — five reads and a `jsonb_set`. The model option (`modelTurnOrder`) seats an
16
+ * oracle in place of `strategy`, which asks a model once per recompute. What
17
+ * it produces is the session's stored turn order: the prepared turns, the
18
+ * candidates they were drawn from, and what the order answers. Every surface
19
+ * that asks "who is next" renders that state, and the reply run fires an
20
+ * entry out of it (§4.6).
22
21
  *
23
- * ## Why it replaced the decider
22
+ * ## Options, not swaps
24
23
  *
25
- * Until 2026-09-21 the respond spec ran up to a `speaker` node and halted
26
- * when nobody was due. Three things were wrong with that and all three go
27
- * away here: the answer existed only inside a run, so a person could not
28
- * see whose turn it was without starting one; "nobody is due" was a halt,
29
- * which is an error shape for an ordinary state; and the trigger had to
30
- * know about turn-taking to read the halt as quiet. Now the order is a
31
- * document, an empty order is an answer, and the trigger decides nothing.
24
+ * A genre registers one pipeline per option on Turn order asked (R24); the
25
+ * session's choice picks which one runs, and the one marked `default` runs
26
+ * when it chose none. The causes an option answers are its registration's
27
+ * `when` over `event.asked`, never part of the document. A strategy is not
28
+ * swapped into a node: each option pins its own, and keeps its own pool and
29
+ * mention settings.
32
30
  *
33
- * ## One spec per genre (R27, the modder pass, 2026-09-23)
31
+ * ## One document per option (R27)
34
32
  *
35
- * `turnOrderSpec()` below is the **public** builder: core calls it four
36
- * times, one per genre (`core:spec/<genre>-turn-order`), and a plugin genre
37
- * calls the same function. One document serves one genre — the preset check
38
- * refuses a preset binding a spec whose lock names another genre (24 §4) —
39
- * so the two shared slugs this file shipped at A6 (`core:spec/turn-order`,
40
- * `core:spec/turn-order-narrator`) are retired.
41
- *
42
- * A cast genre pins round robin; a planner genre (Adventure, the Lair)
43
- * pins `turn-narrator`, so it gets exactly one narrator turn per send —
44
- * Adventure's pool admits nobody; the Lair's admits its delvers, for the
45
- * character turns a standing turn plan names. What a session may pick instead is
46
- * the `strategy` node's `expose.swaps` (R28) — chat lists the other five
47
- * core strategies; the rest list none, so they render no control.
33
+ * `turnOrderSpec()` below is the **public** builder, with one ready-made
34
+ * builder per core strategy: `roundRobinTurnOrder`, `byUserTurnOrder`,
35
+ * `randomTurnOrder`, `narratorTurnOrder` and `modelTurnOrder`. One document
36
+ * serves one genre — the preset check refuses a preset binding a spec whose
37
+ * lock names another genre (24 §4) — so an option's id is taken, never derived.
48
38
  */
49
39
  import { S } from '@serene-pub/sdk';
50
- import type { Descriptor, GenreDecl, SpecDocument } from '@serene-pub/sdk';
40
+ import type { ConditionDecl, Descriptor, GenreDecl, SpecDocument } from '@serene-pub/sdk';
51
41
  /**
52
42
  * 🚧 `core:script/unprompted-modes` (2026-10-20): the genre's voices settings
53
43
  * — its fields `sideCast` and `narratorInterjections`, read off the settings
54
44
  * document a turn-order spec's inlet carries — as `core:task/turn-unprompted@1`
55
45
  * reads them: `{ 'side-cast', 'narrator-interjections' }`, each `full` or
56
- * `off`. A field set `true` (or a stored `full` / `review`) is on. Seeded by
57
- * core (`CORE_SCRIPTS`); a turn-order spec with `unprompted` runs it.
46
+ * `off`, plus `narrator-every` (1, 2 or 3; present only when the narrator is
47
+ * on). `sideCast` set `true` (or a stored `full` / `review`) is on.
48
+ * `narratorInterjections` reads `true`, `full`, `review` and `every-round` as
49
+ * every round, `every-2nd-round` as 2, `every-3rd-round` as 3; anything else
50
+ * is off (2026-11-04, playtest ruling item 7). Seeded by core (`CORE_SCRIPTS`); a turn-order spec with `unprompted` runs it.
58
51
  * @experimental
59
52
  */
60
53
  export declare const UNPROMPTED_MODES_SCRIPT: Readonly<{
@@ -67,31 +60,6 @@ export declare const UNPROMPTED_MODES_SCRIPT: Readonly<{
67
60
  }>;
68
61
  /** @experimental */
69
62
  export declare const TURN_ORDER_VERSION = "1.0.0";
70
- /**
71
- * The nine events a cast genre recomputes on (§4.5).
72
- *
73
- * Every one of them can change who should speak next: a row landing, a row
74
- * leaving, a seat being switched off, a setting moving, a branch being
75
- * born. There is no gating (R1) — the list is what the genre declares and
76
- * the inlet locks, and a genre that wants fewer binds fewer.
77
- * @public
78
- */
79
- export declare const TURN_ORDER_EVENTS: readonly ["core:event/message-completed@1", "core:event/message-edited@1", "core:event/message-deleted@1", "core:event/message-hidden@1", "core:event/member-added@1", "core:event/member-removed@1", "core:event/cast-changed@1", "core:event/session-updated@1", "core:event/session-branched@1"];
80
- /**
81
- * The four events a planner genre recomputes on: a row landing, a row
82
- * leaving (deleted, or hidden and shown again), and a branch's birth. Its
83
- * order is one narrator entry or none — decided by whether the newest
84
- * visible row is a person's — so exactly the events that change which row
85
- * is newest move it. A cast change or a settings save cannot, and
86
- * recomputing on them would be reads for a document that cannot differ.
87
- *
88
- * Delete and hide are here (lair pass F6/B9, 2026-09-27) so the order stays
89
- * honest after a person removes the narrator's last reply: the line they
90
- * wrote is newest again, and the narrator is ready. Both carry an `edit`
91
- * cause, which auto-advance never fires on.
92
- * @experimental
93
- */
94
- export declare const TURN_ORDER_NARRATOR_EVENTS: readonly ["core:event/message-completed@1", "core:event/message-deleted@1", "core:event/message-hidden@1", "core:event/session-branched@1"];
95
63
  /**
96
64
  * A pin a turn-order spec may seat as `strategy`: a task over `candidates`
97
65
  * and `messages` that publishes `turn-entries@1` on `main` and `order`.
@@ -109,7 +77,7 @@ type TurnStrategyDescriptor = Descriptor<{
109
77
  /**
110
78
  * A pin at any type version (`@1`, `@2` …): only `id` and `descriptor` are
111
79
  * read, and the node is built from the descriptor. The ports are also checked
112
- * at build — by the swap fit for a swap, by the spec's edges for the pin.
80
+ * by the spec's edges.
113
81
  * @public
114
82
  */
115
83
  export type TurnStrategyPin = {
@@ -126,10 +94,10 @@ type TurnAdviseDescriptor = Descriptor<{
126
94
  kind: 'oracle';
127
95
  };
128
96
  /**
129
- * A pin a turn-order spec may seat as `advise` (R41): an oracle over
130
- * `candidates` and `messages` publishing `turn-entries@1` on `main` and
97
+ * A pin a turn-order spec may seat as its model strategy (R41): an oracle
98
+ * over `candidates` and `messages` publishing `turn-entries@1` on `main` and
131
99
  * `order`, with a model's `connection`, `sampling` and `prompts` slots —
132
- * `core:oracle/turn-advise@1`, or a plugin's own.
100
+ * `core:oracle/turn-advise@1`, or a plugin's own. Its node key is `advise`.
133
101
  * @experimental
134
102
  */
135
103
  export type TurnAdvisePin = {
@@ -144,37 +112,35 @@ export interface TurnPoolParams {
144
112
  envoySlugs?: string[];
145
113
  }
146
114
  /**
147
- * **The turn-order spec for one genre** (R27). Core's four and every plugin
148
- * genre's come from this one call:
115
+ * **One turn order option for one genre** (R27). Core's and every plugin
116
+ * genre's come from this one call, or from the ready-made builder of the
117
+ * strategy:
149
118
  *
150
119
  * ```ts
151
- * const tavernTurnOrder = turnOrderSpec({
152
- * id: 'acme.rp:spec/tavern-turn-order',
153
- * genre: tavern,
154
- * events: [...TURN_ORDER_EVENTS, sessionEvents.annexChanged],
155
- * strategy: C.turnRoundRobin,
156
- * swaps: [C.turnRandom, myStrategy],
120
+ * const tavernRoundRobin = roundRobinTurnOrder(tavern, { id: 'acme.rp:spec/tavern-turn-order' })
121
+ * register(coreEvents.turnOrderAsked, tavernRoundRobin, {
122
+ * label: 'Round robin',
123
+ * when: { on: 'event.asked', in: [sessionEvents.messageCompleted] },
124
+ * default: true,
157
125
  * })
158
126
  * ```
159
127
  *
160
- * `id` is taken, never derived (R26). `strategy` is the pin — the default
161
- * the Turn order control shows, offered first; `swaps` is what a session may
162
- * pick instead, and none means no control. `pool` is the author preset on
163
- * the pool node, the one road configuration takes: declared default, the
164
- * author's preset over it, an administrator's deviation, a session's
165
- * override last. A preset binds the result like any spec: `bindings: [tavernTurnOrder, …]`.
128
+ * `id` is taken, never derived (R26). `strategy` is the pin — a task pin is a
129
+ * rule (node key `strategy`), an oracle pin asks a model (node key `advise`).
130
+ * `pool` is the author preset on the pool node, the one road configuration
131
+ * takes: declared default, the author's preset over it, an administrator's
132
+ * deviation, a session's override last. A preset binds the result like any
133
+ * spec: `bindings: [tavernRoundRobin, …]`.
166
134
  *
167
- * With `swaps`, `pool`, `mentioned` and `strategy` are marked for session
168
- * settings (§4.11, R42): who is eligible, the mention rule's lookback, and
169
- * the strategy. Without, the spec shows no turn control at all.
135
+ * With `sessionSettings`, `pool` and `mentioned` are marked for session
136
+ * settings (§4.11, R42): who is eligible and the mention rule's lookback.
137
+ * Without, the spec shows no turn control at all.
170
138
  * @public
171
139
  */
172
140
  export declare function turnOrderSpec(opts: {
173
141
  id: string;
174
142
  genre: GenreDecl;
175
- events: readonly string[];
176
- strategy: TurnStrategyPin;
177
- swaps?: readonly TurnStrategyPin[];
143
+ strategy: TurnStrategyPin | TurnAdvisePin;
178
144
  pool?: TurnPoolParams;
179
145
  /**
180
146
  * Which channel the `history` node reads (lair re-plan R6) — the author
@@ -184,15 +150,6 @@ export declare function turnOrderSpec(opts: {
184
150
  * person's (R5): the Lair's Sanctum line is answered on the Sanctum.
185
151
  */
186
152
  historyChannel?: string;
187
- /**
188
- * The optional model path (R41, M4): the oracle that asks a model who
189
- * speaks. Given, the spec branches after `mentioned` on the genre field
190
- * `turnMode` — `model` runs this oracle, anything else runs `strategy` —
191
- * and the node keys become `decide.model.advise` / `decide.rules.strategy`
192
- * (`turnStrategyNode` answers which). The genre declares `turnMode`
193
- * (`TURN_MODE_FIELD`) so a session can choose. Absent, no branch.
194
- */
195
- advise?: TurnAdvisePin;
196
153
  /**
197
154
  * 🚧 Script chains on the `strategy` node, by interior point and seed key
198
155
  * (`PresetBuilder.scripts`) — `{ select: [{ seedKey }] }` for
@@ -215,28 +172,64 @@ export declare function turnOrderSpec(opts: {
215
172
  unprompted?: {
216
173
  narrate?: string;
217
174
  };
175
+ /**
176
+ * 🚧 **Nobody can take a turn** (owner ruling 2026-11-08): after the
177
+ * write, the `main` composer is closed with `reason` while the pool has
178
+ * no candidate at all — no character, persona or envoy seated — and
179
+ * opened again once it has one. The session's own answer to "who could
180
+ * reply?", read off `pool`, never a count a genre keeps. Absent: the
181
+ * composer is left as it is. (`emptyCastClosure` closes the same way at
182
+ * create, where no turn order runs yet.)
183
+ */
184
+ emptyCast?: {
185
+ reason: string;
186
+ };
187
+ /** Marks `pool` and `mentioned` for session settings (§4.11, R42). Absent: no turn control. */
188
+ sessionSettings?: true;
189
+ /**
190
+ * 🚧 The key of the genre's field that carries Show outcomes: the
191
+ * `history` read wires it as `session-history@1`'s `outcomeNumbers`.
192
+ * Absent: the read wires nothing.
193
+ */
194
+ outcomeNumbersFrom?: string;
218
195
  version?: string;
219
196
  }): SpecDocument;
220
- /** The key of the node a turn-order spec's Turn order control swaps (M4): `strategy`, or `decide.rules.strategy` with a model path. @experimental */
221
- export declare const turnStrategyNode: (opts: {
222
- advise?: unknown;
223
- }) => "decide.rules.strategy" | "strategy";
197
+ /** What each builder takes: `turnOrderSpec`'s options but the genre and the strategy it pins. */
198
+ type TurnOrderOptions = Omit<Parameters<typeof turnOrderSpec>[0], 'genre' | 'strategy'>;
199
+ /** **Round robin** option: each in the pool speaks in turn. @experimental */
200
+ export declare const roundRobinTurnOrder: (genre: GenreDecl, opts: TurnOrderOptions) => SpecDocument;
201
+ /** **By user** option: round robin split by the person each seat belongs to. @experimental */
202
+ export declare const byUserTurnOrder: (genre: GenreDecl, opts: TurnOrderOptions) => SpecDocument;
203
+ /** **Random** option: the next speaker is drawn at random from the pool. @experimental */
204
+ export declare const randomTurnOrder: (genre: GenreDecl, opts: TurnOrderOptions) => SpecDocument;
205
+ /** **Narrator replies** option: one narrator turn per person's line. @experimental */
206
+ export declare const narratorTurnOrder: (genre: GenreDecl, opts: TurnOrderOptions) => SpecDocument;
207
+ /** **Model** option: a model decides who speaks (R41); its node key is `advise`. @experimental */
208
+ export declare const modelTurnOrder: (genre: GenreDecl, opts: TurnOrderOptions) => SpecDocument;
224
209
  /**
225
- * One core genre's turn-order spec, by value (R26): the document, the node its
226
- * Turn order control swaps, and the events it is bound on. A plugin offering
227
- * a strategy on it hands `build()` and `strategyNode` to `swaps` — no spec id,
228
- * no lookup.
210
+ * One core genre's turn order, by value (R26): its default option's document
211
+ * and every option the genre registers on Turn order asked.
229
212
  * @experimental
230
213
  */
231
214
  export interface TurnOrderHandle {
232
215
  genre: GenreDecl;
233
- /** The spec's id — what core's presets bind and `CORE_SPECS` publishes under. */
216
+ /** The default option's spec id — what core's presets bind and `CORE_SPECS` publishes it under. */
234
217
  spec: string;
235
- events: readonly string[];
236
- /** The spec document, built once. */
218
+ /** The default option's document, built once. */
237
219
  build: () => SpecDocument;
238
- /** The node key the genre's Turn order control swaps — read this, never assume `strategy` (R26, M4). */
239
- strategyNode: string;
220
+ /** Every option, the default first. */
221
+ options: ReadonlyArray<{
222
+ /** The option's spec id. */
223
+ spec: string;
224
+ /** The option's document, built once. */
225
+ build: () => SpecDocument;
226
+ label: string;
227
+ /** The definition id the option's strategy step pins (`C.turnRandom.id`, `C.turnAdvise.id` …). */
228
+ strategy: string;
229
+ /** The causes the option answers: `{ on: 'event.asked', in: [...] }`. */
230
+ when: ConditionDecl;
231
+ default?: true;
232
+ }>;
240
233
  }
241
234
  export {};
242
235
  //# sourceMappingURL=turnOrder.d.ts.map