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

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 (501) hide show
  1. package/components/shared/annex/AnnexWidget.svelte +15 -1
  2. package/components/shared/chronicle/ChronicleWidget.svelte +3 -0
  3. package/components/shared/messages/MessageBlocksView.svelte +294 -0
  4. package/components/shared/messages/MessageControls.svelte +173 -4
  5. package/components/shared/messages/MessageMediaStrip.svelte +41 -1
  6. package/components/shared/messages/MessagePartsView.svelte +8 -2
  7. package/components/shared/messages/MessageStateLedger.svelte +27 -39
  8. package/components/shared/messages/MessagesWidget.svelte +173 -15
  9. package/components/shared/messages/NextCharacterBlock.svelte +57 -6
  10. package/components/shared/messages/SceneDivider.svelte +104 -68
  11. package/components/shared/messages/SessionComposer.svelte +245 -157
  12. package/components/shared/messages/SessionContainer.svelte +212 -60
  13. package/components/shared/messages/SessionMessage.svelte +257 -26
  14. package/components/shared/messages/SpokenLine.svelte +273 -0
  15. package/components/shared/messages/StateProposalList.svelte +45 -0
  16. package/components/shared/messages/TurnLine.svelte +87 -84
  17. package/components/shared/messages/conversation.svelte.ts +223 -12
  18. package/components/shared/messages/interleave.ts +178 -0
  19. package/components/shared/messages/mediaStrip.ts +29 -5
  20. package/components/shared/messages/spokenLine.ts +177 -0
  21. package/components/shared/routine-log/RoutineLog.svelte +33 -0
  22. package/components/shared/routine-log/RoutineLogWidget.svelte +168 -0
  23. package/components/shared/routine-log/routine-log.ts +12 -0
  24. package/components/shared/routine-log/routineLog.ts +111 -0
  25. package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +35 -2
  26. package/components/shared/state/ListEditor.svelte +128 -0
  27. package/components/shared/state/LorePicker.svelte +163 -0
  28. package/components/shared/state/PieceCard.svelte +257 -0
  29. package/components/shared/state/PieceForm.svelte +199 -0
  30. package/components/shared/state/PieceList.svelte +143 -0
  31. package/components/shared/state/SlotControl.svelte +297 -395
  32. package/components/shared/state/StoryTimeEditor.svelte +108 -0
  33. package/components/shared/state/slotWriter.svelte.ts +30 -20
  34. package/components/shared/stats/StatsWidget.svelte +774 -119
  35. package/dist/components/actions.js +7 -7
  36. package/dist/components/actions.source.json +1 -1
  37. package/dist/components/album.js +2 -4
  38. package/dist/components/album.source.json +1 -1
  39. package/dist/components/annex.js +81 -35
  40. package/dist/components/annex.source.json +1 -1
  41. package/dist/components/attendance.js +1 -1
  42. package/dist/components/attendance.source.json +1 -1
  43. package/dist/components/authors-note.js +5 -5
  44. package/dist/components/authors-note.source.json +1 -1
  45. package/dist/components/backdrop.js +7 -7
  46. package/dist/components/backdrop.source.json +1 -1
  47. package/dist/components/chronicle.js +94 -79
  48. package/dist/components/chronicle.source.json +1 -1
  49. package/dist/components/core-ui.json +1 -1
  50. package/dist/components/lore-entries.js +1 -1
  51. package/dist/components/lore-entries.source.json +1 -1
  52. package/dist/components/messages.js +4269 -2031
  53. package/dist/components/messages.source.json +1 -1
  54. package/dist/components/places.js +6 -4
  55. package/dist/components/places.source.json +1 -1
  56. package/dist/components/routine-log.js +382 -0
  57. package/dist/components/routine-log.source.json +1 -0
  58. package/dist/components/scene-portraits.js +316 -214
  59. package/dist/components/scene-portraits.source.json +1 -1
  60. package/dist/components/shared-4ME6NFDK.js +277 -0
  61. package/dist/components/shared-7VDIXYAL.js +106 -0
  62. package/dist/components/{shared-ITSLBJB5.js → shared-BBF64YGL.js} +24 -20
  63. package/dist/components/shared-BIWKZFUU.js +584 -0
  64. package/dist/components/{shared-XBPH6USH.js → shared-JPG5DQO7.js} +627 -7
  65. package/dist/components/{shared-NK7QSVMU.js → shared-QXF5CJVN.js} +39 -58
  66. package/dist/components/{shared-TDWKI2QV.js → shared-W3XS5FEL.js} +3 -2
  67. package/dist/components/shared-WV3QTKZT.js +402 -0
  68. package/dist/components/{shared-3K7SOGH7.js → shared-XBDUENRA.js} +1 -1
  69. package/dist/components/shared-YDS7HYL6.js +708 -0
  70. package/dist/components/stats.js +4224 -6
  71. package/dist/components/stats.source.json +1 -1
  72. package/dist/components/turn-order.js +12 -8
  73. package/dist/components/turn-order.source.json +1 -1
  74. package/dist/factories/answerForm.d.ts +1 -1
  75. package/dist/factories/answerForm.js +4 -7
  76. package/dist/factories/turnOrder.d.ts +41 -2
  77. package/dist/factories/turnOrder.js +67 -20
  78. package/dist/functions/asking.d.ts +10 -0
  79. package/dist/functions/asking.js +22 -0
  80. package/dist/functions/atZeroHealth.d.ts +60 -0
  81. package/dist/functions/atZeroHealth.js +155 -0
  82. package/dist/functions/body.d.ts +207 -0
  83. package/dist/functions/body.js +259 -0
  84. package/dist/functions/changing.d.ts +62 -0
  85. package/dist/functions/changing.js +332 -0
  86. package/dist/functions/deciding.d.ts +90 -0
  87. package/dist/functions/deciding.js +542 -0
  88. package/dist/functions/index.d.ts +55 -0
  89. package/dist/functions/index.js +39 -0
  90. package/dist/functions/outcomeMoves.d.ts +3 -0
  91. package/dist/functions/outcomeMoves.js +71 -0
  92. package/dist/functions/pieces.d.ts +46 -0
  93. package/dist/functions/pieces.js +191 -0
  94. package/dist/functions/progression.d.ts +31 -0
  95. package/dist/functions/progression.js +162 -0
  96. package/dist/functions/scopes.d.ts +27 -0
  97. package/dist/functions/scopes.js +111 -0
  98. package/dist/functions/time.d.ts +53 -0
  99. package/dist/functions/time.js +252 -0
  100. package/dist/functions/values.d.ts +59 -0
  101. package/dist/functions/values.js +216 -0
  102. package/dist/genres/chat/answerForm.d.ts +6 -4
  103. package/dist/genres/chat/answerForm.js +6 -4
  104. package/dist/genres/chat/create.d.ts +3 -3
  105. package/dist/genres/chat/create.js +28 -49
  106. package/dist/genres/chat/index.d.ts +5 -11
  107. package/dist/genres/chat/index.js +6 -12
  108. package/dist/genres/chat/memory.d.ts +36 -0
  109. package/dist/genres/chat/memory.js +117 -0
  110. package/dist/genres/chat/respond.d.ts +46 -17
  111. package/dist/genres/chat/respond.js +342 -1087
  112. package/dist/genres/chat/turnOrder.d.ts +7 -4
  113. package/dist/genres/chat/turnOrder.js +13 -12
  114. package/dist/genres/defaults.d.ts +456 -0
  115. package/dist/genres/defaults.js +366 -0
  116. package/dist/genres/dungeon-crawler/answerForm.d.ts +11 -0
  117. package/dist/genres/dungeon-crawler/answerForm.js +13 -0
  118. package/dist/genres/dungeon-crawler/calls.d.ts +32 -0
  119. package/dist/genres/dungeon-crawler/calls.js +77 -0
  120. package/dist/genres/dungeon-crawler/create.d.ts +71 -0
  121. package/dist/genres/dungeon-crawler/create.js +213 -0
  122. package/dist/genres/dungeon-crawler/death.d.ts +50 -0
  123. package/dist/genres/dungeon-crawler/death.js +168 -0
  124. package/dist/genres/dungeon-crawler/dice.d.ts +53 -0
  125. package/dist/genres/dungeon-crawler/dice.js +270 -0
  126. package/dist/genres/dungeon-crawler/fromRuleset.d.ts +147 -0
  127. package/dist/genres/dungeon-crawler/fromRuleset.js +162 -0
  128. package/dist/genres/dungeon-crawler/genesis.d.ts +38 -0
  129. package/dist/genres/dungeon-crawler/genesis.js +155 -0
  130. package/dist/genres/dungeon-crawler/goal.d.ts +76 -0
  131. package/dist/genres/dungeon-crawler/goal.js +321 -0
  132. package/dist/genres/dungeon-crawler/index.d.ts +59 -0
  133. package/dist/genres/dungeon-crawler/index.js +69 -0
  134. package/dist/genres/dungeon-crawler/interview.d.ts +874 -0
  135. package/dist/genres/dungeon-crawler/interview.js +404 -0
  136. package/dist/genres/dungeon-crawler/journal.d.ts +71 -0
  137. package/dist/genres/dungeon-crawler/journal.js +160 -0
  138. package/dist/genres/dungeon-crawler/kits.d.ts +153 -0
  139. package/dist/genres/dungeon-crawler/kits.js +228 -0
  140. package/dist/genres/dungeon-crawler/lore.d.ts +158 -0
  141. package/dist/genres/dungeon-crawler/lore.js +321 -0
  142. package/dist/genres/dungeon-crawler/names.d.ts +166 -0
  143. package/dist/genres/dungeon-crawler/names.js +160 -0
  144. package/dist/genres/dungeon-crawler/parley.d.ts +36 -0
  145. package/dist/genres/dungeon-crawler/parley.js +171 -0
  146. package/dist/genres/dungeon-crawler/preamble.d.ts +66 -0
  147. package/dist/genres/dungeon-crawler/preamble.js +648 -0
  148. package/dist/genres/dungeon-crawler/respond.d.ts +86 -0
  149. package/dist/genres/dungeon-crawler/respond.js +78 -0
  150. package/dist/genres/dungeon-crawler/rest.d.ts +82 -0
  151. package/dist/genres/dungeon-crawler/rest.js +287 -0
  152. package/dist/genres/dungeon-crawler/reveal.d.ts +38 -0
  153. package/dist/genres/dungeon-crawler/reveal.js +129 -0
  154. package/dist/genres/dungeon-crawler/round.d.ts +56 -0
  155. package/dist/genres/dungeon-crawler/round.js +45 -0
  156. package/dist/genres/dungeon-crawler/roundScript.d.ts +80 -0
  157. package/dist/genres/dungeon-crawler/roundScript.js +148 -0
  158. package/dist/genres/dungeon-crawler/scripts.d.ts +211 -0
  159. package/dist/genres/dungeon-crawler/scripts.js +946 -0
  160. package/dist/genres/dungeon-crawler/secrets.d.ts +63 -0
  161. package/dist/genres/dungeon-crawler/secrets.js +125 -0
  162. package/dist/genres/dungeon-crawler/shape.d.ts +257 -0
  163. package/dist/genres/dungeon-crawler/shape.js +268 -0
  164. package/dist/genres/dungeon-crawler/sheet.d.ts +504 -0
  165. package/dist/genres/dungeon-crawler/sheet.js +154 -0
  166. package/dist/genres/dungeon-crawler/story.d.ts +222 -0
  167. package/dist/genres/dungeon-crawler/story.js +1230 -0
  168. package/dist/genres/dungeon-crawler/storyScripts.d.ts +41 -0
  169. package/dist/genres/dungeon-crawler/storyScripts.js +158 -0
  170. package/dist/genres/dungeon-crawler/turnOrder.d.ts +31 -0
  171. package/dist/genres/dungeon-crawler/turnOrder.js +59 -0
  172. package/dist/genres/guide/answerForm.d.ts +1 -1
  173. package/dist/genres/guide/create.d.ts +1 -1
  174. package/dist/genres/guide/create.js +3 -6
  175. package/dist/genres/guide/respond.d.ts +1 -1
  176. package/dist/genres/guide/respond.js +45 -14
  177. package/dist/genres/guide/summarizeScene.d.ts +1 -1
  178. package/dist/genres/index.d.ts +7 -3
  179. package/dist/genres/index.js +28 -18
  180. package/dist/genres/lair/answerForm.d.ts +4 -4
  181. package/dist/genres/lair/answerForm.js +3 -3
  182. package/dist/genres/lair/buildRoom.d.ts +18 -49
  183. package/dist/genres/lair/buildRoom.js +183 -216
  184. package/dist/genres/lair/castellanAction.d.ts +1 -1
  185. package/dist/genres/lair/castellanAction.js +7 -8
  186. package/dist/genres/lair/create.d.ts +1 -1
  187. package/dist/genres/lair/create.js +3 -6
  188. package/dist/genres/lair/fileCurrentRoom.d.ts +7 -0
  189. package/dist/genres/lair/fileCurrentRoom.js +118 -0
  190. package/dist/genres/lair/fileRoom.d.ts +5 -3
  191. package/dist/genres/lair/fileRoom.js +236 -221
  192. package/dist/genres/lair/index.d.ts +39 -41
  193. package/dist/genres/lair/index.js +39 -42
  194. package/dist/genres/lair/keeper.d.ts +7 -0
  195. package/dist/genres/lair/keeper.js +52 -0
  196. package/dist/genres/lair/names.d.ts +112 -0
  197. package/dist/genres/lair/names.js +203 -0
  198. package/dist/genres/lair/nudge.d.ts +1 -1
  199. package/dist/genres/lair/nudge.js +3 -7
  200. package/dist/genres/lair/reply.d.ts +53 -0
  201. package/dist/genres/lair/reply.js +887 -0
  202. package/dist/genres/lair/reveal.d.ts +1 -1
  203. package/dist/genres/lair/roll.d.ts +24 -0
  204. package/dist/genres/lair/roll.js +85 -0
  205. package/dist/genres/lair/rollAnswer.d.ts +37 -0
  206. package/dist/genres/lair/rollAnswer.js +107 -0
  207. package/dist/genres/lair/roomAnswer.d.ts +7 -5
  208. package/dist/genres/lair/roomAnswer.js +318 -292
  209. package/dist/genres/lair/scratchpad.d.ts +7 -0
  210. package/dist/genres/lair/scratchpad.js +79 -0
  211. package/dist/genres/lair/scripts.d.ts +128 -0
  212. package/dist/genres/lair/scripts.js +439 -0
  213. package/dist/genres/lair/summarizeScene.d.ts +1 -22
  214. package/dist/genres/lair/summarizeScene.js +5 -16
  215. package/dist/genres/lair/trap.d.ts +1 -1
  216. package/dist/genres/lair/turnOrder.js +9 -1
  217. package/dist/genres/lair/welcome.d.ts +7 -0
  218. package/dist/genres/lair/welcome.js +38 -0
  219. package/dist/genres/lair/whisper.d.ts +1 -1
  220. package/dist/genres/lair/whisper.js +5 -8
  221. package/dist/genres/story/advanceTime.d.ts +7 -0
  222. package/dist/genres/story/advanceTime.js +17 -0
  223. package/dist/genres/story/afterRest.d.ts +7 -0
  224. package/dist/genres/story/afterRest.js +53 -0
  225. package/dist/genres/{adventure → story}/answer.d.ts +4 -4
  226. package/dist/genres/{adventure → story}/answer.js +7 -11
  227. package/dist/genres/story/answerForm.d.ts +9 -0
  228. package/dist/genres/story/answerForm.js +11 -0
  229. package/dist/genres/{adventure → story}/ask.d.ts +7 -7
  230. package/dist/genres/{adventure → story}/ask.js +14 -18
  231. package/dist/genres/story/create.d.ts +7 -0
  232. package/dist/genres/story/create.js +65 -0
  233. package/dist/genres/story/generateImage.d.ts +7 -0
  234. package/dist/genres/{chat → story}/generateImage.js +11 -17
  235. package/dist/genres/story/illustrateScene.d.ts +23 -0
  236. package/dist/genres/story/illustrateScene.js +38 -0
  237. package/dist/genres/story/index.d.ts +35 -0
  238. package/dist/genres/story/index.js +38 -0
  239. package/dist/genres/story/keeperAction.d.ts +144 -0
  240. package/dist/genres/story/keeperAction.js +301 -0
  241. package/dist/genres/{adventure → story}/look.d.ts +5 -5
  242. package/dist/genres/{adventure → story}/look.js +17 -17
  243. package/dist/genres/{chat → story}/narrate.d.ts +4 -4
  244. package/dist/genres/{chat → story}/narrate.js +30 -16
  245. package/dist/genres/{chat → story}/narrateCharacter.d.ts +3 -3
  246. package/dist/genres/{chat → story}/narrateCharacter.js +32 -17
  247. package/dist/genres/story/reckon.d.ts +265 -0
  248. package/dist/genres/story/reckon.js +433 -0
  249. package/dist/genres/story/reckoning.d.ts +8 -0
  250. package/dist/genres/story/reckoning.js +40 -0
  251. package/dist/genres/story/respond.d.ts +27 -0
  252. package/dist/genres/story/respond.js +1331 -0
  253. package/dist/genres/story/rest.d.ts +10 -0
  254. package/dist/genres/story/rest.js +16 -0
  255. package/dist/genres/story/summarizeScene.d.ts +7 -0
  256. package/dist/genres/story/summarizeScene.js +14 -0
  257. package/dist/genres/story/sweep.d.ts +70 -0
  258. package/dist/genres/story/sweep.js +58 -0
  259. package/dist/genres/story/turnOrder.d.ts +10 -0
  260. package/dist/genres/story/turnOrder.js +33 -0
  261. package/dist/genres/{chat → story}/ui/authors-note/index.d.ts +1 -1
  262. package/dist/index.d.ts +71 -9
  263. package/dist/index.js +194 -84
  264. package/dist/loadouts.d.ts +3 -1
  265. package/dist/loadouts.js +26 -1
  266. package/dist/primers/ninth-mile.d.ts +16 -0
  267. package/dist/primers/ninth-mile.js +68 -0
  268. package/dist/registry/entries.d.ts +47 -9
  269. package/dist/registry/entries.js +93 -31
  270. package/dist/registry/genres.d.ts +232 -49
  271. package/dist/registry/genres.js +858 -338
  272. package/dist/registry/hostState.d.ts +39 -0
  273. package/dist/registry/hostState.js +58 -0
  274. package/dist/registry/layouts.d.ts +118 -22
  275. package/dist/registry/layouts.js +234 -167
  276. package/dist/registry/primers.d.ts +10 -0
  277. package/dist/registry/primers.js +36 -0
  278. package/dist/registry/retired.d.ts +43 -0
  279. package/dist/registry/retired.js +81 -0
  280. package/dist/registry/rulesets.d.ts +1602 -0
  281. package/dist/registry/rulesets.js +271 -0
  282. package/dist/registry/slots.d.ts +590 -43
  283. package/dist/registry/slots.js +313 -80
  284. package/dist/registry/widgets.d.ts +3 -1
  285. package/dist/registry/widgets.js +347 -64
  286. package/dist/rulesets/archetypes/cardGame.d.ts +5 -0
  287. package/dist/rulesets/archetypes/cardGame.js +49 -0
  288. package/dist/rulesets/archetypes/functionIds.d.ts +48 -0
  289. package/dist/rulesets/archetypes/functionIds.js +35 -0
  290. package/dist/rulesets/archetypes/index.d.ts +16 -0
  291. package/dist/rulesets/archetypes/index.js +12 -0
  292. package/dist/rulesets/archetypes/romance.d.ts +5 -0
  293. package/dist/rulesets/archetypes/romance.js +54 -0
  294. package/dist/rulesets/archetypes/sliceOfLife.d.ts +5 -0
  295. package/dist/rulesets/archetypes/sliceOfLife.js +46 -0
  296. package/dist/rulesets/archetypes/workplace.d.ts +5 -0
  297. package/dist/rulesets/archetypes/workplace.js +52 -0
  298. package/dist/rulesets/rulesAction.d.ts +7 -0
  299. package/dist/rulesets/rulesAction.js +51 -0
  300. package/dist/rulesets/sections.d.ts +74 -0
  301. package/dist/rulesets/sections.js +137 -0
  302. package/dist/rulesets/templates/d20Style.d.ts +4 -0
  303. package/dist/rulesets/templates/d20Style.js +60 -0
  304. package/dist/rulesets/templates/dicePool.d.ts +4 -0
  305. package/dist/rulesets/templates/dicePool.js +58 -0
  306. package/dist/rulesets/templates/dicelessPools.d.ts +4 -0
  307. package/dist/rulesets/templates/dicelessPools.js +59 -0
  308. package/dist/rulesets/templates/index.d.ts +25 -0
  309. package/dist/rulesets/templates/index.js +17 -0
  310. package/dist/rulesets/templates/slots.d.ts +145 -0
  311. package/dist/rulesets/templates/slots.js +34 -0
  312. package/dist/rulesets/vis-itineris/compendium/LICENSE-CC-BY-4.0.md +3 -0
  313. package/dist/rulesets/vis-itineris/compendium/armour.json +108 -0
  314. package/dist/rulesets/vis-itineris/compendium/classes.json +401 -0
  315. package/dist/rulesets/vis-itineris/compendium/conditions.json +100 -0
  316. package/dist/rulesets/vis-itineris/compendium/consumables.json +85 -0
  317. package/dist/rulesets/vis-itineris/compendium/feats.json +71 -0
  318. package/dist/rulesets/vis-itineris/compendium/gear.json +138 -0
  319. package/dist/rulesets/vis-itineris/compendium/index.d.ts +31 -0
  320. package/dist/rulesets/vis-itineris/compendium/index.js +31 -0
  321. package/dist/rulesets/vis-itineris/compendium/spells.json +429 -0
  322. package/dist/rulesets/vis-itineris/compendium/weapons.json +331 -0
  323. package/dist/rulesets/vis-itineris/conventions.d.ts +92 -0
  324. package/dist/rulesets/vis-itineris/conventions.js +325 -0
  325. package/dist/rulesets/vis-itineris/index.d.ts +29 -0
  326. package/dist/rulesets/vis-itineris/index.js +27 -0
  327. package/dist/rulesets/vis-itineris/primer/calendar.json +71 -0
  328. package/dist/rulesets/vis-itineris/primer/cast.json +375 -0
  329. package/dist/rulesets/vis-itineris/primer/entries.json +154 -0
  330. package/dist/rulesets/vis-itineris/primer/index.d.ts +17 -0
  331. package/dist/rulesets/vis-itineris/primer/index.js +27 -0
  332. package/dist/rulesets/vis-itineris/primer/leads.json +54 -0
  333. package/dist/rulesets/vis-itineris/primer/places.json +347 -0
  334. package/dist/rulesets/vis-itineris/primer/relationships.json +54 -0
  335. package/dist/rulesets/vis-itineris/repertoires.d.ts +49 -0
  336. package/dist/rulesets/vis-itineris/repertoires.js +491 -0
  337. package/dist/rulesets/vis-itineris/rules.d.ts +62 -0
  338. package/dist/rulesets/vis-itineris/rules.js +67 -0
  339. package/dist/rulesets/vis-itineris/ruleset.d.ts +27 -0
  340. package/dist/rulesets/vis-itineris/ruleset.js +136 -0
  341. package/dist/rulesets/vis-itineris/slots.d.ts +637 -0
  342. package/dist/rulesets/vis-itineris/slots.js +263 -0
  343. package/dist/rulesets/wherewithal/index.d.ts +79 -0
  344. package/dist/rulesets/wherewithal/index.js +252 -0
  345. package/dist/rulesets/wherewithal/ruleset.d.ts +23 -0
  346. package/dist/rulesets/wherewithal/ruleset.js +75 -0
  347. package/dist/rulesets/wherewithal/slots.d.ts +73 -0
  348. package/dist/rulesets/wherewithal/slots.js +32 -0
  349. package/dist/seed/presets.d.ts +25 -14
  350. package/dist/seed/presets.js +233 -188
  351. package/dist/seed/prompts.d.ts +58 -0
  352. package/dist/seed/prompts.js +435 -241
  353. package/dist/seed/scripts.d.ts +5 -0
  354. package/dist/seed/scripts.js +63 -0
  355. package/dist/seed/speechTemplates.d.ts +106 -0
  356. package/dist/seed/speechTemplates.js +201 -0
  357. package/dist/seed/visItinerisScripts.d.ts +65 -0
  358. package/dist/seed/visItinerisScripts.js +241 -0
  359. package/dist/seed/wherewithalScripts.d.ts +26 -0
  360. package/dist/seed/wherewithalScripts.js +90 -0
  361. package/dist/shared/annexField.d.ts +11 -4
  362. package/dist/shared/annexField.js +160 -4
  363. package/dist/shared/builtins/branch.d.ts +1 -1
  364. package/dist/shared/builtins/builtIn.d.ts +1 -1
  365. package/dist/shared/builtins/delete.d.ts +1 -1
  366. package/dist/shared/builtins/edit.d.ts +1 -1
  367. package/dist/shared/builtins/hide.d.ts +1 -1
  368. package/dist/shared/builtins/swipe.d.ts +1 -1
  369. package/dist/shared/calls.d.ts +135 -0
  370. package/dist/shared/calls.js +187 -0
  371. package/dist/shared/chains.d.ts +112 -0
  372. package/dist/shared/chains.js +65 -0
  373. package/dist/shared/characterReachesOut.d.ts +14 -0
  374. package/dist/shared/characterReachesOut.js +66 -0
  375. package/dist/shared/deltas.d.ts +17 -0
  376. package/dist/shared/deltas.js +45 -0
  377. package/dist/shared/describeLikeness.d.ts +1 -1
  378. package/dist/shared/graphBuild.d.ts +1 -1
  379. package/dist/shared/graphBuild.js +4 -4
  380. package/dist/shared/illustrateScene.d.ts +14 -6
  381. package/dist/shared/illustrateScene.js +106 -104
  382. package/dist/shared/lore.d.ts +62 -0
  383. package/dist/shared/lore.js +56 -0
  384. package/dist/shared/portrait.d.ts +1 -1
  385. package/dist/shared/portrait.js +1 -3
  386. package/dist/shared/reckoning.d.ts +338 -0
  387. package/dist/shared/reckoning.js +677 -0
  388. package/dist/shared/saveMessage.d.ts +29 -0
  389. package/dist/shared/saveMessage.js +42 -0
  390. package/dist/shared/scriptSeed.d.ts +34 -0
  391. package/dist/shared/scriptSeed.js +43 -0
  392. package/dist/shared/speakMessage.d.ts +12 -0
  393. package/dist/shared/speakMessage.js +157 -0
  394. package/dist/shared/speechFields.d.ts +37 -0
  395. package/dist/shared/speechFields.js +83 -0
  396. package/dist/shared/spriteFill.d.ts +1 -1
  397. package/dist/shared/spriteFill.js +1 -3
  398. package/dist/shared/sprites.d.ts +3 -3
  399. package/dist/shared/sprites.js +5 -4
  400. package/dist/shared/summarize/character.d.ts +1 -1
  401. package/dist/shared/summarize/history.d.ts +1 -1
  402. package/dist/shared/summarize/scene.d.ts +1 -1
  403. package/dist/shared/summarize/sceneIds.d.ts +1 -3
  404. package/dist/shared/summarize/sceneIds.js +1 -3
  405. package/dist/shared/summarize/summarizeScene.d.ts +1 -1
  406. package/dist/shared/summarize/summarizeScene.js +40 -23
  407. package/dist/shared/summarize/summarizeSpec.d.ts +30 -1
  408. package/dist/shared/summarize/summarizeSpec.js +77 -27
  409. package/dist/shared/summarize/world.d.ts +1 -1
  410. package/dist/shared/timePasses.d.ts +8 -9
  411. package/dist/shared/timePasses.js +9 -13
  412. package/dist/shared/toolLoop.d.ts +1 -1
  413. package/dist/shared/toolLoop.js +13 -9
  414. package/dist/shared/ui/annex/index.d.ts +7 -0
  415. package/dist/shared/ui/annex/index.js +5 -1
  416. package/dist/shared/ui/backdrop/index.d.ts +2 -2
  417. package/dist/shared/ui/backdrop/index.js +3 -3
  418. package/dist/shared/ui/chronicle/index.d.ts +2 -0
  419. package/dist/shared/ui/chronicle/index.js +1 -0
  420. package/dist/shared/ui/conversation/channelLanes.d.ts +24 -0
  421. package/dist/shared/ui/conversation/channelLanes.js +58 -0
  422. package/dist/shared/ui/conversation/channelTabs.d.ts +34 -0
  423. package/dist/shared/ui/conversation/channelTabs.js +79 -0
  424. package/dist/shared/ui/conversation/composerTray.d.ts +2 -2
  425. package/dist/shared/ui/conversation/composerTray.js +35 -5
  426. package/dist/shared/ui/conversation/diceLine.d.ts +36 -0
  427. package/dist/shared/ui/conversation/diceLine.js +70 -0
  428. package/dist/shared/ui/conversation/formAnswer.d.ts +12 -2
  429. package/dist/shared/ui/conversation/formAnswer.js +14 -3
  430. package/dist/shared/ui/conversation/index.d.ts +6 -0
  431. package/dist/shared/ui/conversation/index.js +13 -0
  432. package/dist/shared/ui/conversation/itemValues.d.ts +6 -4
  433. package/dist/shared/ui/conversation/itemValues.js +5 -6
  434. package/dist/shared/ui/conversation/messageVerbState.d.ts +24 -2
  435. package/dist/shared/ui/conversation/messageVerbState.js +17 -7
  436. package/dist/shared/ui/conversation/rewindStrip.d.ts +59 -0
  437. package/dist/shared/ui/conversation/rewindStrip.js +33 -0
  438. package/dist/shared/ui/conversation/tableChannel.d.ts +12 -0
  439. package/dist/shared/ui/conversation/tableChannel.js +10 -0
  440. package/dist/shared/ui/scene-portraits/portraits.d.ts +51 -1
  441. package/dist/shared/ui/scene-portraits/portraits.js +41 -2
  442. package/dist/shared/ui/session-state/barMath.js +5 -2
  443. package/dist/shared/ui/session-state/index.d.ts +6 -4
  444. package/dist/shared/ui/session-state/index.js +6 -4
  445. package/dist/shared/ui/session-state/pieces.d.ts +153 -0
  446. package/dist/shared/ui/session-state/pieces.js +468 -0
  447. package/dist/shared/ui/session-state/shapes.d.ts +44 -2
  448. package/dist/shared/ui/session-state/shapes.js +77 -5
  449. package/dist/shared/ui/session-state/stateView.d.ts +227 -68
  450. package/dist/shared/ui/session-state/stateView.js +370 -45
  451. package/dist/shared/ui/session-state/timeFormat.d.ts +88 -0
  452. package/dist/shared/ui/session-state/timeFormat.js +144 -0
  453. package/dist/shared/ui/turn-order/index.js +20 -4
  454. package/dist/shared/ui/widgetContext.d.ts +2 -2
  455. package/dist/shared/weather.d.ts +16 -0
  456. package/dist/shared/weather.js +86 -0
  457. package/package.json +34 -11
  458. package/components/shared/world-state/WorldState.svelte +0 -33
  459. package/components/shared/world-state/world-state.ts +0 -10
  460. package/dist/components/shared-452PIS46.js +0 -156
  461. package/dist/components/shared-FTRGUE7G.js +0 -422
  462. package/dist/components/shared-GEDAMORM.js +0 -45
  463. package/dist/components/shared-GXTL5G2H.js +0 -209
  464. package/dist/components/shared-XISPHAKY.js +0 -1378
  465. package/dist/components/world-state.js +0 -38
  466. package/dist/components/world-state.source.json +0 -1
  467. package/dist/genres/adventure/advanceTime.d.ts +0 -18
  468. package/dist/genres/adventure/advanceTime.js +0 -24
  469. package/dist/genres/adventure/answerForm.d.ts +0 -9
  470. package/dist/genres/adventure/answerForm.js +0 -11
  471. package/dist/genres/adventure/create.d.ts +0 -36
  472. package/dist/genres/adventure/create.js +0 -62
  473. package/dist/genres/adventure/illustrateScene.d.ts +0 -7
  474. package/dist/genres/adventure/illustrateScene.js +0 -19
  475. package/dist/genres/adventure/index.d.ts +0 -45
  476. package/dist/genres/adventure/index.js +0 -45
  477. package/dist/genres/adventure/keeperAction.d.ts +0 -43
  478. package/dist/genres/adventure/keeperAction.js +0 -217
  479. package/dist/genres/adventure/respond.d.ts +0 -232
  480. package/dist/genres/adventure/respond.js +0 -1194
  481. package/dist/genres/adventure/rest.d.ts +0 -10
  482. package/dist/genres/adventure/rest.js +0 -16
  483. package/dist/genres/adventure/summarizeScene.d.ts +0 -7
  484. package/dist/genres/adventure/summarizeScene.js +0 -14
  485. package/dist/genres/adventure/turnOrder.d.ts +0 -10
  486. package/dist/genres/adventure/turnOrder.js +0 -27
  487. package/dist/genres/chat/advanceTime.d.ts +0 -7
  488. package/dist/genres/chat/advanceTime.js +0 -17
  489. package/dist/genres/chat/generateImage.d.ts +0 -7
  490. package/dist/genres/chat/illustrateScene.d.ts +0 -8
  491. package/dist/genres/chat/illustrateScene.js +0 -19
  492. package/dist/genres/chat/summarizeScene.d.ts +0 -7
  493. package/dist/genres/chat/summarizeScene.js +0 -14
  494. package/dist/genres/lair/advanceTime.d.ts +0 -7
  495. package/dist/genres/lair/advanceTime.js +0 -17
  496. package/dist/genres/lair/respond.d.ts +0 -310
  497. package/dist/genres/lair/respond.js +0 -1784
  498. /package/components/genres/{chat → story}/authors-note/AuthorsNote.svelte +0 -0
  499. /package/components/genres/{chat → story}/authors-note/AuthorsNoteWidget.svelte +0 -0
  500. /package/components/genres/{chat → story}/authors-note/authors-note.ts +0 -0
  501. /package/dist/genres/{chat → story}/ui/authors-note/index.js +0 -0
@@ -1,1101 +1,356 @@
1
1
  /**
2
- * Core's answer-a-message pipeline: Chat's reply.
2
+ * 🚧 Chat's reply — `core:spec/assistant-respond` (2026-10-19,
3
+ * PLAN-genre-restructure §1, R4): the Assistant answers as itself.
3
4
  *
4
- * One file per spec — every pipeline core ships is its own module, under its
5
- * genre's folder (`genres/<genre>/`) or `shared/` — because a pipeline is
6
- * content and content grows: the summarize and graph-build specs are several
7
- * nodes each with their own step prompts, and a single module holding all of
8
- * them would be a merge conflict waiting for the first person to add a sixth.
5
+ * The spine is the Guide's — placeholder, budget, (history, cast, the
6
+ * lorebook), rank, context, lines — with the Assistant as the speaker and
7
+ * its instructions read through the envoy (`slot.prompts({ envoy:
8
+ * 'assistant' })`), so an administrator tunes them in the Pipelines panel as
9
+ * deviations. Then one junction on the session's **tools** field:
10
+ *
11
+ * - `basic` (no tools — the Basic preset, and any session that switched them
12
+ * all off): assemble, generate once, streamed, save. **One call a turn.**
13
+ * - `agentic` (any tool on — the Agentic preset): the reference tool loop
14
+ * (`shared/toolLoop.ts`) locked to Chat — the tools the session switched
15
+ * on (`available-tools@1`'s `kinds`), advertised; up to four passes of
16
+ * prompt → generate → parse → tool (★D: the cap is 4); the answer the loop
17
+ * settled on, saved. R53 holds: no tool sees a connection.
18
+ *
19
+ * A fresh spec id: the roleplay Chat's reply (`core:spec/chat-respond`) is
20
+ * Story's (`story-respond`), and config rows follow a spec id (§2-7 a).
21
+ *
22
+ * 🚧 *Read the lorebook* (2026-10-20, PLAN-layering §4, A6) is a reply
23
+ * setting: the lorebook's lane (`gather.worldLore.read`, an optional query)
24
+ * is switched on or off in session settings, and off it asks for nothing —
25
+ * no excerpt reaches the prompt and the call count holds. *Remember things*
26
+ * (★K) left the reply: it is a routine of its own
27
+ * (`core:spec/assistant-memory`, `memory.ts`), registered Off in Chat's
28
+ * defaults. Was Chat's background tasks (`CHAT_TASKS`, retired).
29
+ * @experimental
9
30
  */
10
- import { compile, spec, slot, sessionEvents } from '@serene-pub/sdk';
31
+ import { compile, handlebars, slot, spec, coreEvents } from '@serene-pub/sdk';
11
32
  import { CORE_LOADOUT } from '../../loadouts.js';
12
33
  import * as C from '@serene-pub/contracts';
13
- import { chatGenre, POST_HISTORY_TOKEN_TRIGGER } from '../../registry/genres.js';
14
- /** The spec a session turn runs. @experimental */
15
- export const CHAT_RESPOND_SPEC_ID = 'core:spec/chat-respond';
16
- // 1.1.0: one authored prompt, not three. The context builder owns the
17
- // `prompts` slot; assemble and generate read it by reference (13 §12 finding
18
- // i, closed) — so the panel renders one prompts group and `world.ts` no
19
- // longer writes the same text to two nodes. A published version is
20
- // immutable, so the rewiring is a new version.
21
- //
22
- // 1.2.0: the context builder takes a `variables` slot, so how each part of the
23
- // prompt is laid out is a selection rather than a `JSON.stringify` in
24
- // TypeScript. The shipped layouts reproduce the old output byte for byte —
25
- // this version changes what is *configurable*, not what is produced.
26
- //
27
- // 1.3.0: the same for assembly, whose lore and history are laid out *after* the
28
- // budget decided what fit. A separate bump rather than folding it into 1.2.0:
29
- // an install that already published 1.2.0 would keep its stored document,
30
- // since seeding matches on (slug, semver) — so rewriting a version in place is
31
- // how a pipeline silently ends up without the wiring the code assumes.
32
- //
33
- // 1.4.0: the narrative graph's relationship summary reaches the prompt. It
34
- // always did on the legacy path (`generateResponse.ts` set it on the adapter)
35
- // and never did here, so a user with the graph on lost the block by switching —
36
- // a missing feature rather than a changed one, which is why it lands as a new
37
- // version and not a fix.
38
- // 1.5.0: `narratorName` leaves this pipeline's prompts slot. It was declared on
39
- // the shared context-builder type and read only when there is no speaking
40
- // character — which never happens here — so all twelve shipped reply prompts
41
- // carried an empty box. `0114` strips the key from rows already written.
42
- // 1.6.0 — the ranker stopped carrying an absolute token budget.
43
- //
44
- // `rank` used to be handed `budget: 4096` as a parameter, because nothing
45
- // supplied its `budget` in-port; an absolute count on a node cannot know which
46
- // model it is about to be sent to, so it was free to disagree with the window
47
- // and warn nobody. A `contextBudget` step now derives the number from the
48
- // sampling config the reply is generated against, and `rank` divides *that* by
49
- // the configurable share. A new version because the wiring changed.
50
- // 1.7.0: the four reads move into an `async` block and run together. They were
51
- // sequential only because unblocked nodes are, never because the data required
52
- // it — all four take `input.sessionScope` and none reads another's output, and
53
- // `graphContext` alone makes three round trips.
54
- //
55
- // They stay four distinct nodes. Concurrency is how they run, not a reason to
56
- // collapse them into one box fetching four unrelated things.
57
- //
58
- // The keys inside a block are qualified, so `history` becomes
59
- // `gather.history.read`. `reconcileConfigs` culls values at the old addresses
60
- // and records a notice carrying what each one was.
61
- // 1.8.0: world lore and character lore are separate queries, merged before
62
- // ranking. One query returning both meant one weight, one floor and one share
63
- // for two things that are not alike — character lore is bound to whoever is
64
- // speaking and world lore is not, so "more world, less character" could not be
65
- // said. Retrieval is unchanged: candidates already carried which source they
66
- // came from, so each node is the same scan with one filter.
67
- // 1.9.0: the narrative graph splits into two nodes and two variables —
68
- // `relationshipsPerspectives` (how the speaker regards everyone) and
69
- // `relationshipsKnown` (how everyone regards them, plus the figures the world
70
- // knows of). One node emitted all three sections through one port under one
71
- // "Your relationships:" heading, so opposite claims arrived as one list and
72
- // they shared a layout, a priority and an on/off switch.
73
- //
74
- // ⚠ This is the first deliberate departure from 0.5's prompt bytes. Everything
75
- // before it moved wrappers around without changing them;
76
- // `contextTemplateWrappers.test.ts` records the exception and why.
77
- // 1.10.0: history entries get a lane. ⚠ A **regression fix**: 1.8.0 replaced
78
- // the one lore query with two that each filter the shared scan to their own
79
- // source, and nothing filtered for `history` — so from 1.8.0 until now, dated
80
- // history summaries were retrieved, scored and then dropped, while the ranker
81
- // kept a `history` band and `assemble` kept asking for history blocks. No test
82
- // caught it, because the parity corpus renders through `lorebook-triggers@1`
83
- // rather than through this document. The corpus mirrors the three lanes now.
84
- // 1.11.0: turn-taking becomes a node (19 §5, U-C4). Selection used to happen
85
- // before the run existed — the one decision per turn the receipt could not
86
- // explain. The `speaker` node honors the trigger's explicit pick and records
87
- // it; context and generation take their speaker from its output, so the
88
- // prompt's voice and the stop-string exclusion follow the same recorded
89
- // decision. Pinned to `turn-manual` because the socket still pre-picks every
90
- // turn — the node passes the pick through and today's bytes are unchanged.
91
- // U-C5 retires the pre-pick, and swapping this pin to `turn-round-robin` is
92
- // then a version bump, not a rewiring. **Done 2026-09-21** (edited in place
93
- // under the freeze, content-addressed): the socket pre-picks nothing, the
94
- // node is pinned `turn-round-robin` and seated BEFORE `placeholder`, whose
95
- // row now takes `characterId`/`speaker` from the node's output.
96
- // 1.15.0 (24): the deep genre rename — taxonomy claims `genre:
97
- // core:genre/chat` (the genre's own id, 24 §3) and the input carries the
98
- // usage lock (24 §4). Document fields changed, so the hash moves: a bump.
99
- // 1.16.0: the three lore lanes wire their `params` slot. ⚠ A **regression
100
- // fix**, on the same footing as 1.10.0: `contextBudget`, `rank` and `prompt`
101
- // have always named their slots and these never did, and `resolveInput` only
102
- // resolves slots the node's config already holds — so Scan Depth, Max
103
- // Recursion Depth and Retrieval Mode rendered, validated, stored and resolved
104
- // through the whole scope chain into a value nothing ever read. The bump is
105
- // what makes it reach an install at all: `seedCoreSpecs` matches on (slug,
106
- // semver), so editing 1.15.0 in place would be a silent no-op, and the stored
107
- // declarations a config back-fills from come from the published version.
108
- // 1.17.0: the three lore lanes stop going through
109
- // `core:task/merge-candidates@1`. ⚠ A **regression fix**, and the third of its
110
- // kind in this file. The merge is reciprocal-rank *fusion* — its whole premise
111
- // is two mechanisms ranking the same pool, so an entry both found outranks one either
112
- // found alone — and it stamps a `presetScore` on everything it passes through.
113
- // `select` prefers `presetScore` over the weighted signal sum, so on three
114
- // **disjoint** lists every entry's score collapsed to its position in its own
115
- // list, `keywordQuery` does not sort, and that position is database row order.
116
- // Net effect: `score()`, all nine signal weights and the priority bonus were
117
- // inert on the shipped reply path. `core:task/concat-candidates@1` puts the
118
- // lanes end to end and stamps nothing, which is what leaves the ranker
119
- // something to rank. `session/entity-cooccurrence` in the parity corpus is the
120
- // fixture that could see it, and it moves from held-divergence to gate here.
121
- // 1.18.0: the third retrieval mechanism. `core:query/entity-search@1` runs beside the
122
- // three lore lanes and finds rows because the scene is *naming* what they name —
123
- // no keys, no embedding model. It is wired **last** into `concat-candidates` on
124
- // purpose: that node keeps the first occurrence of a `source:id`, so an entry the
125
- // keyword scan already found keeps its keyword signals and only entries no key
126
- // reached are added. Evidence adds; keys still guarantee.
127
- //
128
- // ⚠ It ships **inert**: `maxEntries` and `maxMessages` both default to 0, which
129
- // is off by the `maxRecursionDepth` / `admitThreshold` convention. The bump is
130
- // what carries the node to an install at all — `seedCoreSpecs` matches on (slug,
131
- // semver) — and until somebody raises one of the two, an upgraded install
132
- // retrieves exactly what it retrieved before.
133
- // 1.19.0: the **fourth** mechanism, and the last one this pipeline was missing.
134
- // `core:query/vector-search@1` has been built, bound and tested since the
135
- // decomposition and was wired into no shipped spec at all — the header below
136
- // said so, and the reason it gave (a spec that halts on a missing model would be
137
- // the first thing a new user saw) is answered here rather than avoided.
138
- //
139
- // It lands as a **score component**, not as a rival ordering. The mechanism attaches
140
- // `signals.semantic` to what it finds and stamps no `presetScore`, so an entry
141
- // both the keyword scan and the semantic mechanism reached keeps its keyword signals
142
- // and gains a semantic one — agreement between two independent mechanisms
143
- // compounds by addition and there is nothing for a fusion step to reconcile.
144
- // That is the whole reason it concatenates rather than merging, and it is the
145
- // same argument 1.17.0 made about the three lore lanes.
146
- //
147
- // ⚠ Its own block rather than a fifth chain inside `gather`, and the reason is
148
- // mechanical rather than aesthetic. Chains in a `parallel` block run under one
149
- // `Promise.all`, so a chain cannot read a sibling's output; the semantic mechanism
150
- // needs the messages `gather.history` reads, and the alternative — a second
151
- // hundred-row read of the same table inside the lane — costs more than the
152
- // block does. It still runs beside the lore lanes in every sense that matters:
153
- // nothing between the two blocks depends on it, and its candidates arrive at the
154
- // same `concat-candidates`. It is a block rather than three spine nodes because
155
- // the debug preview stops at the first Provider **on the spine** — with `embed`
156
- // on the spine the preview would halt on a payload that is a list of query
157
- // strings, which is a correct application of the rule and a useless preview.
158
- //
159
- // ⚠ It ships **Automatic**: `query-windows.searchByMeaning` defaults to `auto`,
160
- // on the chain's **first** node, which searches whenever an embedding model is
161
- // set up — local or a service billed per request, alike — and not when there
162
- // is none. (For one day, 2026-09-29, it skipped a service; the owner,
163
- // 2026-09-30: "I never said to skip paid services for retrieval, that's what
164
- // they are there for.") `queries` reads whether one is set up off its own
165
- // embedding connection slot (`slot.connection()`, the install's active
166
- // embedding connection — it was a reference to the embed step's slot until
167
- // `embed-text` stopped declaring one, 2026-10-05); when it does not search it
168
- // cuts
169
- // no probes and `embed-text` makes no call. One switch, not two — the
170
- // `signalSemantic` weight it feeds is *not* zero, and `vector-search.maxEntries`
171
- // is a ceiling that ships at 5, so turning the switch on is the whole of
172
- // turning the mechanism on. And an install with
173
- // no embedding model loses a signal and nothing else: `embed-text` returns no
174
- // vectors under `auto` rather than failing the turn, and `vector-search`
175
- // returns empty with the reason on the receipt. Adding a model may only add
176
- // matches; removing one may only lose them.
177
- //
178
- // ⚠ 2026-09-29 (genre uplift C3): until then the switch was
179
- // `vector-search.maxEntries = 0`, on the chain's **last** node, so the probes
180
- // were embedded before it said nothing was wanted — every turn with an
181
- // embedding model ready, lorebook or not, paid for an embed it threw away, a
182
- // provider call per turn in API mode. No document edit and no version move:
183
- // both are definition defaults, which reach an install through the registry
184
- // sync. F1 (the same day) is a document edit — the `connection` reference on
185
- // `queries` — at the frozen version; `specHashes.test.ts` records the move.
186
- // 1.20.0: the **fifth** mechanism — retrieval by *description*. A second named
187
- // vector space holding one vector per **name** (an entry's title, the aliases
188
- // its body declares, the bound character's names), queried with the descriptive
189
- // references the scene actually used. `core:query/mention-spans@1` finds them,
190
- // `core:oracle/embed-text@1` embeds them, and `core:query/entity-link@1`
191
- // matches them to names — so *"the captain"* reaches Captain Vell and *"the
192
- // order"* reaches The Ashguard Riders. Neither shares a character with its
193
- // target, so keys, trigrams and the gazetteer all miss them, and they are the
194
- // references people actually write.
195
- //
196
- // ⚠ **It may only reorder. It may never admit**, and that is wiring rather than
197
- // a promise. `entity-link` takes the concatenated candidate list on an in-port
198
- // and returns *that list* with `signals.entityVector` attached to whatever
199
- // linked, so there is no id it can emit that some other mechanism did not
200
- // already produce. The reason is that invented proper nouns are where embeddings
201
- // are least reliable — "Vell" has no learned meaning, so its vector comes from
202
- // subword fragments and Vell, Vall and Vela cluster — and a confident wrong link
203
- // is worse than a miss: it would inject wrong lore at high confidence into a
204
- // fixed budget, displacing right lore. Constrained to reordering, the same wrong
205
- // link costs a position and a receipt line naming it.
206
- //
207
- // ⚠ **`loreLinked` is where that constraint is enforced, and its argument order
208
- // is the whole of it.** `concat-candidates` keeps the **first** occurrence of a
209
- // `source:id`, so the mechanism's enriched copies win and the raw `lore.candidates`
210
- // behind them is a pure fallback: switched off, no embedding model, or an error
211
- // the executor recovered as empty all land on exactly the list `rank` would have
212
- // seen without the mechanism. `rank` reads a concatenation either way, which is what
213
- // makes "an unavailable mechanism subtracts a signal and nothing else" true by
214
- // construction rather than by a `try` inside one binding.
215
- //
216
- // ⚠ It ships **off**, and the switch is on the *first* node: `mention-spans`'
217
- // `maxMentions` defaults to 0, so nothing is read, nothing is embedded and the
218
- // mechanism costs literally nothing until somebody raises it. `entity-link.maxLinks`
219
- // is a ceiling and ships at 5, and `signalEntityVector` is 0.2 — one switch, not
220
- // three, so turning the mechanism on with one control does something. The weight sits
221
- // strictly below `signalNameMatch`'s 0.25 on purpose: exact and trigram matching
222
- // own invented names, entity vectors own descriptive references, and a vector
223
- // link must never outrank an entry whose title literally occurred.
224
- //
225
- // ⚠ **1.20.0, edited in place — deliberately, and paired with a migration.**
226
- //
227
- // The `prompt` step gained `connection: slot.connectionOf("generate")`, so the
228
- // render finally learns the wire format it is rendering for. Under the version
229
- // freeze ruled for the 0.6 pre-release ("no SDK spec bumps; all stay a hard 1
230
- // until 0.7.0") this is NOT a new semver — which means seeding, which matches on
231
- // (slug, semver) and skips a match, would never carry it to a database that has
232
- // already booted. Migration 0095 deletes the published `pipeline_spec_versions`
233
- // row for this pin so boot republishes it, and `specHashes.test.ts` records the
234
- // moved hash in the same change. Neither half is optional: without the
235
- // migration the edit reaches no existing install and is invisible on a fresh
236
- // test database, which is exactly the failure `specHashes.test.ts` exists to
237
- // make loud.
238
- //
239
- // ⚠ **1.20.0, edited in place a SECOND time — again deliberately, again paired
240
- // with a migration.**
241
- //
242
- // `lines` gained `continuationPrefill: $.input.continuationPrefill`, so the
243
- // text an extend is carrying on reaches the seed line the model writes from.
244
- // Under the same version freeze, and therefore under the same terms as the
245
- // paragraph above: migration `0106` deletes this pin's published
246
- // `pipeline_spec_versions` row so boot republishes it, and re-projects
247
- // `core:task/process-messages@1` and `core:inlet/user-message@1`, whose port
248
- // declarations moved. `specHashes.test.ts` and `registryHashes.test.ts` record
249
- // the moved hashes in the same change. Without the migration the edit reaches
250
- // no install that has already booted and is invisible on a fresh test database.
251
- //
252
- // ⚠ **1.20.0, edited in place a THIRD time — same terms, same pairing.**
253
- //
254
- // The `history` node wires `params: slot.params()`. It never named the slot, and
255
- // `resolveInput` resolves only the slots a node's config names, so `limit` —
256
- // "How many recent messages are considered for the context" — arrived as
257
- // `undefined` on every run and the binding fell through to a literal 100. The
258
- // panel rendered the control, `reconcileConfigs` stored a value for it, and
259
- // nothing read it: the third time this exact omission has shipped in this
260
- // package.
261
- //
262
- // Behaviour-preserving by construction. The declared default is **100** as of
263
- // the same ruling (2026-09-09) — the number every run has actually used, not a
264
- // retune — and `drizzle/0110_session_history_limit.sql` re-projects the type,
265
- // deletes this pin so boot republishes it, and lifts the stored 40s
266
- // `reconcileConfigs` back-filled from the old declaration. `specHashes.test.ts`
267
- // records the moved hash in the same change; neither half is optional.
268
- //
269
- // ⚠ **1.20.0, edited in place a FOURTH time — same terms, same pairing, and
270
- // two distinct slot shapes at once.** Found by
271
- // `boot/paramsSlotWiring.test.ts`, which walks every declared slot against
272
- // every shipped document and had seventeen of these written down in its
273
- // ledger.
274
- //
275
- // 1. **The `generate` node names `connection` and `sampling`.** It is the
276
- // OWNER of both — `contextBudget` reads `slot.samplingOf("generate")` and
277
- // `prompt` reads `slot.connectionOf("generate")`, so a pick on the reply
278
- // step already moved the budget and the wire format — and it never named
279
- // them itself, so `refId(p.connection)` in `host.ts` read `null` and
280
- // `resolveCapabilityTarget` fell to the instance default. The prompt was
281
- // sized and wrapped for one endpoint and sent to another.
282
- //
283
- // ⚠ This one is NOT behaviour-preserving on an install where somebody set
284
- // the picker, and that is the point: the pick was stored and ignored, and
285
- // the app owner classes the current state as a defect (STATE-2026-09-08 §1,
286
- // "Per-node sampling ignored"). Nothing changes for an install that never
287
- // set one — the slot falls back to the same `connection_defaults` row the
288
- // `capabilityDefault` tier reads, and a session override still outranks it.
289
- //
290
- // 2. **The two relationship reads name `params`.** `bindings.ts` calls
291
- // `capRelationships(section, input?.params?.maxEntries)` and nothing
292
- // supplied it, so the ceiling was `undefined` — which that function reads
293
- // as no ceiling at all. Behaviour-preserving, and the declaration is what
294
- // makes it so: `maxEntries` carries no default now (uncapped is not a
295
- // number `min: 0` can hold), so an untouched install resolves `undefined`
296
- // and stays uncapped.
297
- //
298
- // `drizzle/0111_reply_slots_and_relationship_cap.sql` re-projects the two
299
- // relationship types, deletes this pin so boot republishes it, and lifts the
300
- // stored `12`s `reconcileConfigs` back-filled from the old declaration.
301
- // `specHashes.test.ts` and `registryHashes.test.ts` record the moved hashes in
302
- // the same change; no half is optional.
303
- //
304
- // ⚠ **1.20.0, edited in place a FIFTH time — content-addressed now, so no
305
- // migration deletes the pin: boot publishes the changed document under its new
306
- // hash and moves the pointer (ruling 2026-09-10), and `specHashes.test.ts`
307
- // records the move.** Weights to the source (R-7 P5, 2026-09-16, plans/30
308
- // U3b): the `lore` concat takes `$.gather.history.read.band` first — the
309
- // conversation's **band intent**, alone — so the ranker reserves the
310
- // transcript's slice of the window from `session-history`'s own declaration
311
- // rather than from a `share` map on itself. The three lore lanes and the
312
- // ranked relationship read publish their intents at the head of `main`, which
313
- // this document already wired, so nothing else here moves. Same numbers, same
314
- // prompt; the parity corpus holds it. Migration 0135 moves the stored maps.
315
- // 1.21.0: the `speaker` node moved to `core:spec/turn-order`
316
- // (PLAN-turn-order §4.4, §7). Who speaks is STATE now — the entry being
317
- // fired names them, and it arrives on the inlet — so this spec no longer
318
- // decides anything about turn-taking, and `placeholder` has returned to
319
- // directly after the inlet, where it can make the row before a token is
320
- // spent. A new semver rather than an in-place edit: the node list changed,
321
- // so a stored 1.20.0 document must stay exactly as it is and this must
322
- // re-project (§0 rule 3).
323
- //
324
- // ⚠ **1.21.0, edited in place (2026-10-02, author's note AN1) —
325
- // content-addressed, so boot publishes the changed document under its new
326
- // hash and moves the pointer; `specHashes.test.ts` records the move.** The
327
- // `context` step wires `fields: $.input.fields`, so a genre that declares the
328
- // author's note (Chat) gets it on the template context. Every other genre's
329
- // prompt is the bytes it was: no note, nothing placed.
330
- //
331
- // ⚠ **1.21.0, edited in place (2026-10-02, lorebooks C2) — content-addressed;
332
- // `specHashes.test.ts` records the move.** A `gather.presences` read
333
- // (`core:query/cast-presences@1`) and an `eligible` step
334
- // (`core:task/eligibility@1`) between `loreLinked` and `rank`: exclusions from
335
- // the three keyword lanes, the speaker's secrecy, and presence at the
336
- // session's moment mark candidates ineligible. A book with no selective logic,
337
- // no secrets and no presences ranks exactly what it ranked.
338
- //
339
- // ⚠ **1.21.0, edited in place (2026-10-03, history window) —
340
- // content-addressed; `specHashes.test.ts` records the move.**
341
- // `contextBudget` runs before the reads, and `gather.history.read` takes its
342
- // `budget`: the read is the newest rows up to about twice the window (never
343
- // more than 2000) instead of the newest 100, so the transcript fit's held cut
344
- // decides the prompt's first line once a session passes 100 messages.
345
- //
346
- // ⚠ **1.21.0, edited in place (2026-10-05, sprites in-pipeline) —
347
- // content-addressed; `specHashes.test.ts` records the move.** The sprite step
348
- // is written out after `save` — `spritePick` (`core:oracle/pick-sprite@1`,
349
- // handed the reply's text and speaker) and `spriteShow` — where the retired
350
- // `withSpriteTail` wrapper appended four nodes this source never named; and
351
- // `semantic.arm.queries` wires its own embedding connection
352
- // (`slot.connection()`), since `embed-text` declares none to reference.
353
- //
354
- // ⚠ **1.21.0, edited in place (2026-10-13, live scenes §6) —
355
- // content-addressed; `specHashes.test.ts` records the move.** The reply tick
356
- // after `spriteShow`: a `tick` step (`core:task/clock-step@1`, exposed to the
357
- // session as *Each reply advances the clock by …*, By 0 = off) and a `clock`
358
- // junction holding *Advance story clock*. Off by default, so every session
359
- // replies exactly as it did.
360
- //
361
- // ⚠ **1.21.0, edited in place (2026-10-13, live scenes §15 G12) —
362
- // content-addressed; `specHashes.test.ts` records the move.** The tick's
363
- // *Advance story clock* says `onRefusal: 'skip'`: a story with no clock yet
364
- // skips the tick with a ledger line instead of halting after the reply.
34
+ import { ASSISTANT_ENVOY_KEY, POST_HISTORY_TOKEN_TRIGGER } from '../../registry/genres.js';
35
+ import { applyWiring, jsonPart, wiring } from '../../shared/calls.js';
36
+ /** @experimental */
37
+ export const ASSISTANT_RESPOND_SPEC_ID = 'core:spec/assistant-respond';
365
38
  /** @internal */
366
- export const CHAT_RESPOND_VERSION = '1.21.0';
39
+ // ⚠ Edited in place (2026-10-21, omni O5/O7/O9) — content-addressed;
40
+ // `specHashes.test.ts` records the move. A `heard` step (transcribe-audio)
41
+ // before placement; Basic's `generate` names its speech sampling and its
42
+ // `save` writes the reply's media parts in order.
43
+ export const ASSISTANT_RESPOND_VERSION = '1.0.0';
44
+ /** The most tool passes one turn may take (★D, ruled 2026-10-19). @experimental */
45
+ export const ASSISTANT_TOOL_PASSES = 4;
367
46
  /**
368
- * Core's answer-a-message pipeline.
369
- *
370
- * All five mechanisms since 1.20.0 — keys, names the scene said, meaning,
371
- * names the scene *described*, and the structural signals that order what they
372
- * find. Three of the five need nothing installed; the two that read embeddings
373
- * need a model and both ship switched off, so a first boot runs exactly the
374
- * zero-cost path it always did.
47
+ * 🚧 Basic's assembly template: the Assistant's instructions, the lorebook
48
+ * excerpts when any were retrieved, then the conversation — the Guide's
49
+ * layout without the docs. Triple-stashed: prose going to a model.
50
+ * @experimental
51
+ */
52
+ export const ASSISTANT_RESPOND_TEMPLATE = `{{#systemBlock}}
53
+ {{#if instructions}}
54
+ {{{instructions}}}
55
+ {{/if}}
56
+ {{#if worldLore}}
57
+
58
+ From the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name. When you answer from one, say which entry you used.
59
+ {{{worldLore}}}
60
+ {{/if}}
61
+ {{/systemBlock}}
62
+
63
+ {{#each sessionMessages as |sessionMessage msgIndex|}}
64
+ {{#each (lookup ../injectionsByIndex msgIndex)}}
65
+ {{#if (eq this.role "assistant")}}
66
+ {{#assistantBlock}}
67
+ {{{this.content}}}
68
+ {{/assistantBlock}}
69
+ {{else if (eq this.role "user")}}
70
+ {{#userBlock}}
71
+ {{{this.content}}}
72
+ {{/userBlock}}
73
+ {{else}}
74
+ {{#systemBlock}}
75
+ {{{this.content}}}
76
+ {{/systemBlock}}
77
+ {{/if}}
78
+ {{/each}}
79
+ {{#with ../postHistory}}
80
+ {{#if (and (eq msgIndex targetIndex) hasContent)}}
81
+ {{#systemBlock}}
82
+ {{#if instructions}}
83
+ {{{instructions}}}
84
+ {{/if}}
85
+ {{/systemBlock}}
86
+ {{/if}}
87
+ {{/with}}
88
+ {{#if (eq role "assistant")}}
89
+ {{#assistantBlock}}
90
+ {{{message}}}{{{attachments}}}
91
+ {{/assistantBlock}}
92
+ {{/if}}
93
+ {{#if (eq role "user")}}
94
+ {{#userBlock}}
95
+ {{{message}}}{{{attachments}}}
96
+ {{/userBlock}}
97
+ {{/if}}
98
+ {{/each}}`;
99
+ /**
100
+ * 🚧 Agentic's assembly template: the loop's own opening text (`system`, the
101
+ * `assistant-agentic` row), the tools advertised, the lorebook excerpts, the
102
+ * tools' results so far, the conversation, and the closing reminder
103
+ * (`postHistory`). Triple-stashed, as every shipped context template.
375
104
  * @experimental
376
105
  */
377
- export const respondSpec = () => compile(spec(CHAT_RESPOND_SPEC_ID, {
378
- version: CHAT_RESPOND_VERSION,
379
- /** Catalogue claims (23 §2): the standard chat's main turn. */
380
- taxonomy: {
381
- role: 'primary',
382
- },
383
- })
384
- /** The usage lock (24 §4): this spec answers Chat's primary turn. */
385
- .inlet('input', C.userMessage.v1(), {
386
- genre: chatGenre,
387
- event: sessionEvents.messageRespond,
388
- })
389
- /**
390
- * The reply row, created by the pipeline that fills it (R-17) —
391
- * **directly after the inlet** (PLAN-turn-order §4.4).
392
- *
393
- * It used to wait for the cast and history reads, because a
394
- * `speaker` node between them decided who the row was for. Turn
395
- * order is state now: the entry being fired names the speaker,
396
- * and it arrives on the inlet — so the row can be made in the
397
- * first milliseconds of the run, before anything costs a token.
398
- * This is the placeholder the composer shows while the turn runs,
399
- * the run's live row the oracle's stream lands in, and the row
400
- * Stop finalises with whatever had arrived. `save` at the end
401
- * updates it; the pair is one primary row. A regenerate, swipe or
402
- * extend hands its existing row in on `messageId` and this node
403
- * claims it instead of inserting.
404
- */
405
- .outlet('placeholder', ($) => C.createMessage.v1({
406
- generating: true,
407
- characterId: $.input.characterId,
408
- speaker: $.input.speaker,
409
- row: $.input.messageId,
410
- }))
411
- /**
412
- * How much room the context has, from the window itself.
413
- *
414
- * `samplingOf("generate")` rather than its own slot, and that is
415
- * the whole safety of this step: a budget computed against one
416
- * window and a prompt sent against another is wrong in the
417
- * direction that truncates, silently. Sharing the reference makes
418
- * the two impossible to point apart, rather than documenting that
419
- * they must agree and hoping.
420
- *
421
- * Before the reads (history window, 2026-10-03): the history read
422
- * is sized by this budget, so it is computed first. It reads only
423
- * config, never a step, so moving it changes no value.
424
- */
425
- .task('contextBudget', ($) => C.contextBudget.v1({
426
- sampling: slot.samplingOf('generate'),
427
- // The other half of the same pair, for the model's own
428
- // window (0114). Shared for the same reason, and read by the
429
- // one computation dispatch sizes the request with (R-8).
430
- connection: slot.connectionOf('generate'),
431
- params: slot.params(),
432
- }))
433
- /**
434
- * The four reads, run together.
435
- *
436
- * Every one of them takes `input.sessionScope` and none consumes
437
- * another's output, so nothing about the data required them to
438
- * happen in turn — but unblocked nodes execute sequentially, so a
439
- * turn waited for all four in series. `graphContext` alone makes
440
- * three round trips.
441
- *
442
- * They stay four distinct nodes. Concurrency is a property of how
443
- * they run, not a reason to collapse them into one box that fetches
444
- * four unrelated things — the editor should be able to draw the
445
- * pipeline's real shape.
446
- *
447
- * `mode` is the author's default here and the administrator's
448
- * decision at runtime: four overlapping reads suit a local database
449
- * and may not suit a rate-limited remote one, and the person who
450
- * knows which is not the person who wrote this.
451
- */
452
- .gather('gather', { mode: 'parallel' }, (b) => b
453
- // ⚠ `params` is wired here for the same reason the three
454
- // lore lanes below wire it, and it was missing for longer:
455
- // a slot absent from the node's config is never resolved, so
456
- // `limit` — "How many recent messages are considered for the
457
- // context" — arrived as `undefined` on every run this
458
- // pipeline has ever made. The binding then fell through to a
459
- // literal 100, which is why the declared default is 100 now
460
- // (see `sessionHistory` in the contracts package): the
461
- // control becomes live without moving anybody's window.
462
- //
463
- // `budget` (history window, 2026-10-03): the read is sized
464
- // by the window — about twice what it holds — and `limit`
465
- // is not read, so `prompt`'s transcript fit, not a row
466
- // count, decides where the conversation starts.
467
- .chain('history', (c) => c
468
- .query('read', ($) => C.sessionHistory.v1({
469
- scope: $.input.sessionScope,
470
- budget: $.contextBudget.available,
471
- params: slot.params(),
472
- }))
473
- // 🚧 The files those rows show (PLAN-composer-attachments
474
- // §3.5), one query for the transcript. `attached` below
475
- // decides, per line, what the model receives.
476
- .query('attachments', ($) => C.historyAttachments.v1({
477
- messages: $.gather.history.read.messages,
478
- params: slot.params(),
479
- })))
480
- // Two lore lanes, not one. World lore and character lore
481
- // were a single query sharing a weight, a floor and a
482
- // share of the window, which left "more world, less
483
- // character" unsayable.
484
- //
485
- // ⚠ `params` is wired here for the same reason it is on
486
- // `contextBudget`, `rank` and `prompt`: a slot absent from
487
- // the node's config is never resolved, so the declared
488
- // parameters arrive as `undefined` no matter what the panel
489
- // stored. These three lanes shipped without it from 1.8.0,
490
- // which made Scan Depth, Max Recursion Depth and Retrieval
491
- // Mode controls that rendered, validated and saved without
492
- // ever reaching the scan.
493
- .chain('worldLore', (c) => c.query('read', ($) => C.worldLore.v1({
494
- scope: $.input.sessionScope,
495
- params: slot.params(),
496
- })))
497
- .chain('characterLore', (c) => c.query('read', ($) => C.characterLore.v1({
498
- scope: $.input.sessionScope,
499
- // The settings live on the world-lore lane (R-7 P2, one owner per
500
- // setting per spec): the three lanes declare the same seven knobs,
501
- // and a person tuning them tunes them once.
502
- params: slot.params({ node: 'gather.worldLore.read' }),
503
- })))
504
- // The third lane. It was missing from 1.8.0 to 1.10.0 and
505
- // history was absent from every prompt in that window —
506
- // see `core:query/history-entries@1` for how a split into
507
- // two lanes dropped a third source without failing.
508
- .chain('historyEntries', (c) => c.query('read', ($) => C.historyEntries.v1({
509
- scope: $.input.sessionScope,
510
- // The settings live on the world-lore lane (R-7 P2, one owner per
511
- // setting per spec): the three lanes declare the same seven knobs,
512
- // and a person tuning them tunes them once.
513
- params: slot.params({ node: 'gather.worldLore.read' }),
514
- })))
515
- // The third mechanism (design §13.5). Same scope, same shared
516
- // read of the lorebook — what differs is the index it
517
- // consults: the *entities* a row names rather than the keys
518
- // an author wrote or a vector nobody has computed. It is
519
- // the mechanism a keyless book works by, and the first
520
- // retrieval over conversation history in the product.
521
- //
522
- // ⚠ Its `messages` out-port is deliberately **not** wired
523
- // into `lore` below. It publishes the declared
524
- // `recalledLines` band (2026-09-27), which renders only where
525
- // a context template places `{{{recalledLines}}}` — and no
526
- // shipped template does. Which genre places recalled lines,
527
- // and where, is the compression region's call (design §5);
528
- // wiring the port without a template that places them would
529
- // spend budget on lines the prompt never carries (the
530
- // receipt says so, but the budget is still spent).
531
- .chain('entities', (c) => c.query('read', ($) => C.entitySearch.v1({
532
- scope: $.input.sessionScope,
533
- params: slot.params(),
534
- })))
535
- .chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope })))
536
- // Optional by construction: an install that never opened
537
- // the narrative graph gets an empty string here and the
538
- // template's `{{#if}}` skips the block. Its own node rather
539
- // than a read inside the context Task, because a Task is
540
- // handed no services (F11) — and because a node is
541
- // something a user can see on the receipt and remove
542
- // without editing the context builder.
543
- // Two lanes, as with lore, and for the same reason. One
544
- // node emitted both directions of the graph under a single
545
- // heading — what the speaker thinks of everyone, and what
546
- // everyone thinks of the speaker — which a model reads as
547
- // one list and a user cannot separate.
548
- //
549
- // ⚠ `params` on both, for the fourth time in this file and
550
- // the same one line each: a slot absent from the node's
551
- // config is never resolved, so "Most relationships" arrived
552
- // as `undefined` and `capRelationships` returned every
553
- // relationship the graph holds however small the number the
554
- // panel showed. The declaration carries no default now — see
555
- // `relationshipSlots` in the contracts — so an untouched
556
- // install stays uncapped, which is what it has always been.
557
- .chain('relationshipsPerspectives', (c) => c.query('read', ($) => C.relationshipsPerspectives.v1({
558
- scope: $.input.sessionScope,
559
- params: slot.params(),
560
- })))
561
- .chain('relationshipsKnown', (c) => c.query('read', ($) => C.relationshipsKnown.v1({
562
- scope: $.input.sessionScope,
563
- params: slot.params(),
564
- })))
565
- /**
566
- * The graph as a retrieval **mechanism** (ruling
567
- * 2026-09-10, Q1 — the ruling's word is *arm*; see the
568
- * type's own note for why the id does not spell it).
569
- *
570
- * The two branches above hand the graph to the template as
571
- * three keyed sections, in whatever order the database
572
- * returned the rows, outside the budget entirely. This one
573
- * reads the same three layers as candidates in the
574
- * `relationships` band — the band the ranker, the share
575
- * control and the entry cap have all carried since they were
576
- * written and nothing has ever put anything in — ordered by
577
- * scene presence, then the speaker, then recency.
578
- *
579
- * ⚠ **It replaces neither of them.** Both keep feeding
580
- * `context`; this is what lets the graph compete for the
581
- * window and appear on the retrieval receipt. Which of the
582
- * two paths eventually wins is a rendering question and not
583
- * this document's to decide.
584
- *
585
- * ⚠ **It ships inert, and the off switch is the share.**
586
- * `rank-hybrid`'s `share.relationships` defaults to 0, which
587
- * `select` reads as "leave this source out" — so every
588
- * candidate this produces is excluded with
589
- * `excluded_group_disabled` and the prompt is byte-identical
590
- * until somebody drags that band. That is a *visible*
591
- * off state with a reason on the receipt, which is the shape
592
- * this retrieval surface prefers to a second cap defaulting
593
- * to zero.
594
- *
595
- * A third traversal of the same graph, and it is a real
596
- * cost: the two branches above already walk it once each.
597
- * They are in one `parallel` block, so it is concurrency
598
- * rather than wall-clock, and collapsing three reads into one
599
- * node is the same trade the two lore lanes already refused —
600
- * a node is what a person can see on the receipt and switch
601
- * off.
602
- */
603
- .chain('relationships', (c) => c.query('read', ($) => C.relationshipSearch.v1({
604
- scope: $.input.sessionScope,
605
- params: slot.params(),
606
- })))
607
- /**
608
- * Who is in the world at the session's moment (R4) — the
609
- * presences on its line, for `eligible`'s presence rule.
610
- */
611
- .chain('presences', (c) => c.query('read', ($) => C.castPresences.v1({ scope: $.input.sessionScope }))))
612
- /**
613
- /**
614
- * The fourth mechanism — retrieval by meaning (1.19.0, design phase 2).
615
- *
616
- * Three nodes, and the split is the same one the other mechanisms have:
617
- * a Task decides *what to ask*, a Provider reaches the model
618
- * because a Query may not (16 §1), and a Query does the retrieval.
619
- *
620
- * ⚠ **A block, and after `gather` rather than inside it.** Two
621
- * separate reasons, both mechanical. Inside `gather` this could not
622
- * read `gather.history`'s messages — chains of a `parallel` block
623
- * run under one `Promise.all` and cannot see each other — and the
624
- * only way round that is a second read of the same hundred rows.
625
- * And on the *spine* the debug preview would stop here: it halts at
626
- * the first Provider it reaches, which would show a reader a list
627
- * of query strings instead of a prompt. A block is where the rule
628
- * expects retrieval to be, and the RAG parity harness places its own
629
- * embed calls the same way for the same reason.
630
- *
631
- * Nothing between the two blocks reads this, so it is a sibling of
632
- * the lore lanes in every sense except the source line ordering.
633
- *
634
- * ⚠ It ships **Automatic** — `queries`' `searchByMeaning` is
635
- * `auto`, on the chain's first node: it searches whenever an
636
- * embedding model is set up (`queries`' connection resolves), local
637
- * or a service alike, and otherwise `embed` is handed no texts and
638
- * makes no call; `search`'s `maxEntries` is only
639
- * a ceiling — and an
640
- * install with no embedding model is not a broken install: `embed`
641
- * yields no vectors under its `auto` setting, `search` returns empty
642
- * with the reason on the receipt, and the turn loses a signal rather
643
- * than failing. That is the plan's second governing rule in wiring:
644
- * an unavailable mechanism subtracts a signal, it never disables a
645
- * path.
646
- */
647
- .gather('semantic', { mode: 'parallel' }, (b) => b.chain('arm', (c) => c
648
- // One window, not two. The RAG spec embeds a current and
649
- // a recent window and fuses their ranks, because it is
650
- // producing an *ordering*; this mechanism produces a score
651
- // component, and a second window would need exactly the
652
- // fusion step 1.17.0 removed from this pipeline. The
653
- // recent window is reachable by raising `recentWindow`
654
- // for anybody who wants the wider query.
655
- .task('queries', ($) => C.queryWindows.v1({
656
- messages: $.gather.history.read.messages,
657
- cast: $.gather.cast.read.cast,
658
- // The install's embedding connection, for whether
659
- // one is set up: `searchByMeaning`'s Automatic
660
- // searches whenever it is, wherever the model runs.
661
- connection: slot.connection(),
662
- params: slot.params(),
663
- }))
664
- .oracle('embed', ($) => C.embedText.v1({
665
- texts: $.semantic.arm.queries.current,
666
- params: slot.params(),
667
- }), { expose: { label: 'Embed the recent messages' } })
668
- .query('search', ($) => C.vectorSearch.v1({
669
- scope: $.input.sessionScope,
670
- vectors: $.semantic.arm.embed.vectors,
671
- params: slot.params(),
672
- }))))
673
- // All three lanes reach the ranker, and the count is the point.
674
- // Wiring `rank` to a subset drops the rest silently — the prompt
675
- // simply has no character lore, or no history, in it, and nothing
676
- // anywhere says so. That is not hypothetical: history was left out
677
- // of this list from 1.8.0 to 1.10.0 and every prompt lost it.
678
- //
679
- // ⚠ Concatenation, **not** `merge-candidates`. The three lanes are
680
- // disjoint by construction — an entry is world lore or character
681
- // lore or history, never two — so there is no agreement between them
682
- // for rank fusion to measure. The merge fused them anyway and
683
- // stamped a reciprocal-rank `presetScore` on every candidate, which
684
- // `select` prefers over the weighted signal sum; each entry then
685
- // ranked by its position in its own list, which for an unsorted
686
- // keyword scan is database row order. Ranking across the three is
687
- // `rank-hybrid`'s job, and budgeting between them is what the share
688
- // bands are for.
689
- .task('lore', ($) => C.concatCandidates.v1({
690
- sources: [
106
+ export const ASSISTANT_AGENTIC_TEMPLATE = `{{#systemBlock}}
107
+ {{{system}}}
108
+
109
+ {{{advertisement}}}
110
+ {{#if worldLore}}
111
+
112
+ From the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name.
113
+ {{{worldLore}}}
114
+ {{/if}}
115
+ {{#if results}}
116
+
117
+ What your tools have returned so far:
118
+ {{{results}}}
119
+ {{/if}}
120
+ {{/systemBlock}}
121
+
122
+ {{#each sessionMessages}}
123
+ {{#if (eq role "assistant")}}
124
+ {{#assistantBlock}}
125
+ {{{message}}}{{{attachments}}}
126
+ {{/assistantBlock}}
127
+ {{/if}}
128
+ {{#if (eq role "user")}}
129
+ {{#userBlock}}
130
+ {{{message}}}{{{attachments}}}
131
+ {{/userBlock}}
132
+ {{/if}}
133
+ {{/each}}
134
+
135
+ {{#if postHistory}}
136
+ {{#systemBlock}}
137
+ {{{postHistory}}}
138
+ {{/systemBlock}}
139
+ {{/if}}`;
140
+ /** @experimental */
141
+ export const assistantRespondSpec = () => {
142
+ const w = wiring();
143
+ return compile(spec(ASSISTANT_RESPOND_SPEC_ID, {
144
+ version: ASSISTANT_RESPOND_VERSION,
145
+ taxonomy: { role: 'primary' },
146
+ })
147
+ /** The usage lock (24 §4): this spec answers Chat's primary turn. */
148
+ .inlet('input', C.userMessage.v1(), { suits: [coreEvents.messageRespond] })
149
+ /** The reply row, made first (PLAN-turn-order §4.4) — the Assistant's, from the inlet's speaker. */
150
+ .outlet('placeholder', ($) => C.createMessage.v1({
151
+ generating: true,
152
+ characterId: $.input.characterId,
153
+ speaker: $.input.speaker,
154
+ row: $.input.messageId,
155
+ }))
156
+ .task('contextBudget', ($) => C.contextBudget.v1({
157
+ sampling: slot.samplingOf('mode.basic.generate'),
158
+ connection: slot.connectionOf('mode.basic.generate'),
159
+ params: slot.params(),
160
+ }))
161
+ .gather('gather', { mode: 'parallel' }, (b) => b
162
+ .chain('history', (c) => c
163
+ .query('read', ($) => C.sessionHistory.v1({
164
+ scope: $.input.sessionScope,
165
+ budget: $.contextBudget.available,
166
+ params: slot.params(),
167
+ }))
168
+ .query('attachments', ($) => C.historyAttachments.v1({
169
+ messages: $.gather.history.read.messages,
170
+ params: slot.params(),
171
+ })))
172
+ .chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope })))
173
+ /**
174
+ * The lorebook, when the session has one: by keyword, its own
175
+ * band — no model call. 🚧 *Read the lorebook* (2026-10-20): an
176
+ * optional query, so a session switches it off in its settings
177
+ * and it asks for nothing (`settings.enabled`).
178
+ */
179
+ .chain('worldLore', (c) => c.query('read', ($) => C.worldLore.v1({
180
+ scope: $.input.sessionScope,
181
+ params: slot.params(),
182
+ }), { expose: { session: true, label: 'Read the lorebook' } })))
183
+ .task('lore', ($) => C.concatCandidates.v1({
184
+ sources: [$.gather.history.read.band, $.gather.worldLore.read.main],
185
+ }))
186
+ /** The hard gates; with the lorebook's lane off, the conversation's band alone. */
187
+ .task('eligible', ($) => C.eligibility.v1({
188
+ candidates: $.lore.candidates,
189
+ exclusions: $.gather.worldLore.read.exclusions,
190
+ }))
191
+ .task('rank', ($) => C.rankHybrid.v1({
192
+ candidates: $.eligible.candidates,
193
+ budget: $.contextBudget.available,
194
+ params: slot.params(),
195
+ }))
196
+ /** The Assistant's card and instructions — the envoy's, by address (`envoy:assistant`). */
197
+ .task('context', ($) => C.buildTemplateContext.v1({
198
+ cast: $.gather.cast.read.cast,
199
+ currentCharacterId: $.input.characterId,
200
+ speaker: $.input.speaker,
201
+ prompts: slot.prompts({ envoy: ASSISTANT_ENVOY_KEY }),
202
+ variables: slot.variables(),
203
+ }))
204
+ .task('lines', ($) => C.processMessages.v1({
205
+ messages: $.gather.history.read.messages,
206
+ cast: $.gather.cast.read.cast,
207
+ templateContext: $.context.templateContext,
208
+ seedName: $.context.seedName,
209
+ continuationPrefill: $.input.continuationPrefill,
210
+ }))
211
+ /**
212
+ * 🚧 Audio the reply cannot hear, heard first (O9): the
213
+ * Transcription loadout's model writes down what it says, cached on
214
+ * the file; placement then names it with its words. Nothing to hear
215
+ * — no audio, a reply that hears it itself — sends nothing. No
216
+ * declared status: a declared one shows whenever the step runs,
217
+ * and the step's own *listening* is said only when it hears.
218
+ */
219
+ .oracle('heard', ($) => C.transcribeAudio.v1({
220
+ messages: $.lines.messages,
221
+ attachments: $.gather.history.attachments.attachments,
222
+ hears: $.contextBudget.reads,
223
+ connection: slot.connection(),
224
+ params: slot.params(),
225
+ }), { expose: { label: 'Transcribe audio' } })
226
+ .task('attached', ($) => C.placeAttachments.v1({
227
+ messages: $.lines.messages,
228
+ attachments: $.heard.attachments,
229
+ connection: slot.connectionOf('mode.basic.generate'),
230
+ params: slot.params(),
231
+ }))
691
232
  /**
692
- * The conversation's **band intent** and nothing else
693
- * (R-7 P5): `session-history` ranks no candidates — the
694
- * transcript is built from `lines` — but its `share` is
695
- * what reserves the transcript's slice of the window
696
- * before the lore sources divide the rest. Each lore
697
- * lane's own intent rides at the head of its `main`;
698
- * this one needs a port of its own because `main`
699
- * carries message rows. First, so a reader of the
700
- * receipt sees the bands before the items.
233
+ * Basic or Agentic — the session's **tools** field, never a node
234
+ * parameter: no tool on is Basic, one call; any on is the loop.
701
235
  */
702
- $.gather.history.read.band,
703
- $.gather.worldLore.read.main,
704
- $.gather.characterLore.read.main,
705
- $.gather.historyEntries.read.main,
706
- // ⚠ Last, and the position is the design. Concatenation
707
- // keeps the **first** occurrence of a `source:id`, so an
708
- // entry both mechanisms found keeps the keyword mechanism's full
709
- // signal set and the entity mechanism only ever contributes
710
- // rows no key reached. Put it first instead and every
711
- // keyed entry would arrive scored on entity overlap
712
- // alone.
713
- $.gather.entities.read.main,
714
- // The semantic mechanism, after it, and the ordering matters
715
- // less than it does for the entity mechanism: `concat` merges
716
- // a duplicate's *signals* into the copy it keeps for
717
- // keys that copy does not carry, and `semantic` is a key
718
- // no other mechanism produces. So an entry the keyword scan
719
- // found keeps every keyword signal **and** gains this
720
- // one — which is what "each mechanism contributes to one
721
- // score" means in wiring, and why there is no fusion
722
- // node here to reconcile two incomparable scales.
723
- $.semantic.arm.search.main,
724
- ],
725
- }))
726
- /**
727
- * The fifth mechanism — entries reached by a **description**
728
- * (1.20.0, design phase 4).
729
- *
730
- * Three nodes with the same split the semantic mechanism has: a Query
731
- * decides what to ask, a Provider reaches the model because a Query
732
- * may not (16 §1), and a Query does the retrieval. The difference
733
- * is what is compared — short mention against short *name*, in a
734
- * second vector space, which is the comparison embeddings are most
735
- * reliable at and the one a whole-entry vector cannot make.
736
- *
737
- * ⚠ **After `lore` rather than beside it**, because this mechanism's pool
738
- * *is* `lore`'s output: it may only attach a signal to candidates
739
- * some other mechanism already produced. Everything else about its
740
- * placement is the semantic mechanism's argument unchanged — a block
741
- * rather than spine nodes, so the debug preview does not halt at the
742
- * `embed` Provider and show a reader a list of mention strings
743
- * instead of a prompt.
744
- */
745
- .gather('names', { mode: 'parallel' }, (b) => b.chain('arm', (c) => c
746
- .query('mentions', ($) => C.mentionSpans.v1({
747
- scope: $.input.sessionScope,
748
- params: slot.params(),
749
- }))
750
- .oracle('embed', ($) => C.embedText.v1({
751
- texts: $.names.arm.mentions.texts,
752
- // One `enabled` switch for both embed nodes (R-7 P2): the
753
- // semantic mechanism's embed owns it, this one reads it.
754
- params: slot.params({ node: 'semantic.arm.embed' }),
755
- }), { expose: { label: 'Embed the mentions' } })
756
- .query('link', ($) => C.entityLink.v1({
757
- scope: $.input.sessionScope,
758
- candidates: $.lore.candidates,
759
- mentions: $.names.arm.mentions.mentions,
760
- vectors: $.names.arm.embed.vectors,
761
- params: slot.params(),
762
- }))))
763
- /**
764
- * ⚠ **The enriched list first, the raw list behind it.**
765
- *
766
- * `concat-candidates` keeps the first occurrence of a `source:id`,
767
- * so this is a fallback rather than a merge: when the mechanism produced
768
- * anything, its copies carry `signals.entityVector` and win; when it
769
- * produced nothing — off, no embedding model, an error recovered as
770
- * empty — the second source is exactly what the ranker would have
771
- * seen without it. That is what makes "an unavailable mechanism
772
- * subtracts a signal and never removes a candidate" a property of
773
- * the wiring rather than of a binding's error handling.
774
- *
775
- * `rank` reads this rather than `lore` for the same reason: a node
776
- * whose input is a concatenation cannot be emptied by one of its
777
- * sources going quiet.
778
- */
779
- .task('loreLinked', ($) => C.concatCandidates.v1({
780
- sources: [
781
- $.names.arm.link.main,
782
- $.lore.candidates,
236
+ .junction('mode', { on: ($) => $.input.fields }, (j) => j
237
+ .when('agentic', { path: (v) => v.tools, truthy: true }, (a) => jsonPart(a, w, 'kinds', ($) => $.input.fields, 'tools', 'The tools this session switched on')
238
+ /** The tools the session switched on, as this install serves them. */
239
+ .query('available', ($) => C.availableTools.v1({
240
+ scope: $.input.sessionScope,
241
+ kinds: $.kinds.main,
242
+ params: slot.params(),
243
+ }))
244
+ .task('advertise', ($) => C.advertiseTools.v1({
245
+ tools: $.available.tools,
246
+ params: slot.params(),
247
+ }))
248
+ .loop('tools', { max: ASSISTANT_TOOL_PASSES }, (l) => l
249
+ /** The carry — the results so far; empty on the first pass. */
250
+ .task('results', ($) => C.joinText.v1({
251
+ items: $.mode.agentic.tools.values,
252
+ params: slot.params(),
253
+ }), { expose: { label: 'Carry the tool results' } })
254
+ .task('prompt', ($) => C.assemble.v2({
255
+ candidates: $.rank.candidates,
256
+ decisions: $.rank.decisions,
257
+ groups: $.rank.groups,
258
+ budget: $.contextBudget.available,
259
+ messages: $.attached.messages,
260
+ templateContext: {
261
+ advertisement: $.mode.agentic.advertise.prompt,
262
+ results: $.results.text,
263
+ },
264
+ template: slot.template(),
265
+ prompts: slot.prompts(),
266
+ variables: slot.variables(),
267
+ params: slot.params(),
268
+ connection: slot.connectionOf('mode.agentic.tools.item.generate'),
269
+ }))
270
+ .oracle('generate', ($) => C.generateText.v1({
271
+ context: $.prompt.context,
272
+ connection: slot.connection(),
273
+ sampling: slot.sampling(),
274
+ params: slot.params(),
275
+ // 🚧 O7: the voice a spoken reply speaks in, when `outputs` ask for audio.
276
+ speechSampling: slot.speechSampling(),
277
+ }), {
278
+ expose: {
279
+ status: '{speaker} is thinking',
280
+ label: 'Reply with tools',
281
+ purpose: 'Answers, calling a tool when it needs one, up to four times a turn (Agentic).',
282
+ },
283
+ })
284
+ .task('parse', ($) => C.parseToolCall.v1({
285
+ text: $.generate.text,
286
+ tools: $.mode.agentic.available.tools,
287
+ }))
288
+ /** The one impure step: a failed tool answers the model, never ends the turn. */
289
+ .oracle('tool', ($) => C.runTool.v1({
290
+ call: $.parse.call,
291
+ tools: $.mode.agentic.available.tools,
292
+ text: $.parse.text,
293
+ }), { expose: { status: 'Using a tool' } })
294
+ /** Another pass while the model called a tool. */
295
+ .repeatWhile(($) => $.parse.call))
296
+ .task('answer', ($) => C.joinText.v1({
297
+ items: $.tools.values,
298
+ params: slot.params(),
299
+ }), { expose: { label: 'Take the answer' } })
300
+ .outlet('save', ($) => C.updateMessage.v1({
301
+ target: $.placeholder.messageId,
302
+ text: $.answer.text,
303
+ }), { expose: { label: 'Save the answer' } }))
304
+ .otherwise('basic', (b) => b
305
+ .task('prompt', ($) => C.assemble.v2({
306
+ candidates: $.rank.candidates,
307
+ decisions: $.rank.decisions,
308
+ groups: $.rank.groups,
309
+ budget: $.contextBudget.available,
310
+ messages: $.attached.messages,
311
+ templateContext: $.context.templateContext,
312
+ template: slot.template(),
313
+ prompts: slot.prompts($.context),
314
+ variables: slot.variables(),
315
+ params: slot.params(),
316
+ connection: slot.connectionOf('mode.basic.generate'),
317
+ }))
318
+ .oracle('generate', ($) => C.generateText.v1({
319
+ context: $.prompt.context,
320
+ currentCharacterId: $.input.characterId,
321
+ connection: slot.connection(),
322
+ sampling: slot.sampling(),
323
+ speechSampling: slot.speechSampling(),
324
+ params: slot.params(),
325
+ }), {
326
+ expose: {
327
+ stream: true,
328
+ status: '{speaker} is typing',
329
+ label: 'Reply',
330
+ purpose: 'Answers in one call, with no tools (Basic).',
331
+ },
332
+ })
333
+ .outlet('save', ($) => C.updateMessage.v1({
334
+ target: $.placeholder.messageId,
335
+ text: $.generate.text,
336
+ reasoning: $.generate.reasoning,
337
+ parts: $.generate.parts,
338
+ }), { expose: { label: 'Save the reply' } })))
783
339
  /**
784
- * The relationship mechanism, here rather than in
785
- * `lore`.
786
- *
787
- * `lore` is the entity-vector mechanism's **pool**:
788
- * `entity-link` takes that list on an in-port and may
789
- * only attach a signal to candidates some other
790
- * mechanism already produced. Putting graph edges in it
791
- * would change what that mechanism embeds and compares
792
- * for a signal the `relationships` band weighs at 0 —
793
- * a cost with no effect. Concatenated after it instead,
794
- * so the pool the fifth mechanism sees is byte-identical
795
- * to what it saw before this one existed.
796
- *
797
- * Nothing can collide: `concat` de-duplicates on
798
- * `source:id`, and no other mechanism produces a
799
- * `relationships` candidate.
340
+ * What Chat ships with: the two layouts inline (a reference you
341
+ * can read), the reminder's trigger, the answer's path, and the
342
+ * loadouts — Reply for Basic, Tool calling for the loop (I12).
800
343
  */
801
- $.gather.relationships.read.main,
802
- ],
803
- }))
804
- /**
805
- * **The hard gates, before the ranker** (C2; rulings R2, R4). An
806
- * entry an author's own selective logic ruled out stays out
807
- * whichever mechanism brought it back (`exclusions`, from the
808
- * three keyword lanes); a tie that is someone else's secret is not
809
- * this speaker's; a member not in the world at the session's
810
- * moment has their lore gated. Nothing is dropped — the ranker
811
- * records each as `excluded_ineligible` with the sentence.
812
- */
813
- .task('eligible', ($) => C.eligibility.v1({
814
- candidates: $.loreLinked.candidates,
815
- exclusions: [
816
- $.gather.worldLore.read.exclusions,
817
- $.gather.characterLore.read.exclusions,
818
- $.gather.historyEntries.read.exclusions,
819
- ],
820
- speaker: $.input.speaker,
821
- presences: $.gather.presences.read.main,
822
- at: $.gather.presences.read.at,
823
- }))
824
- .task('rank', ($) => C.rankHybrid.v1({
825
- candidates: $.eligible.candidates,
826
- budget: $.contextBudget.available,
827
- params: slot.params(),
828
- }))
829
- /**
830
- * ⚠ **After the ranker, and that is the whole of what moved.**
831
- *
832
- * It read the two graph branches directly and could sit anywhere
833
- * after `gather`. It reads the *allocated* band now, which does not
834
- * exist until `rank` has selected — so the node follows it. Nothing
835
- * between the two ever read this node: `lines` and `prompt` are
836
- * downstream of both, and the ranker takes candidates rather than a
837
- * context. The one node that declares randomness is still this one
838
- * and still the only consumer of the run's seeded stream, so the
839
- * example dialogue a replay picks is unchanged by the move.
840
- */
841
- .task('context', ($) => C.buildTemplateContext.v1({
842
- cast: $.gather.cast.read.cast,
843
- currentCharacterId: $.input.characterId,
844
- /**
845
- * The narrative graph, both ways it can arrive.
846
- *
847
- * ⚠ **Two keys on one port, not two ports.** The declared
848
- * in-port is `json` and carries the section the template
849
- * renders; what this adds is the *source* it should be built
850
- * from. `band` is `rank`'s inclusions — ranked by scene
851
- * presence, capped by the query, and inside the window the
852
- * budget divided — and `graph` is the traversal's own dump,
853
- * behind it. A nested literal is how a port takes more than
854
- * one reference (`concat-candidates`' `sources` is the same
855
- * construction), and it needs no declaration to move.
856
- *
857
- * ⚠ **The dump is the fallback, per RUN.** With no
858
- * relationship allocated — `share.relationships` is 0 on a
859
- * shipped install, so `select` excludes the whole band with
860
- * `excluded_group_disabled` — the section renders exactly
861
- * the bytes it always did. Raising that share is what moves
862
- * the graph from *dumped whole, outside the budget* to
863
- * *retrieved*: only what ranking selected, in rank order,
864
- * within what the band was allotted.
865
- *
866
- * Both ports carry the same `band` and their own half of the
867
- * graph. The split is by lane on the way out, which is what
868
- * the two sibling queries do to the same traversal.
869
- */
870
- relationshipsPerspectives: {
871
- band: $.rank.candidates,
872
- graph: $.gather.relationshipsPerspectives.read.relationshipsPerspectives,
873
- },
874
- relationshipsKnown: {
875
- band: $.rank.candidates,
876
- graph: $.gather.relationshipsKnown.read.relationshipsKnown,
877
- },
878
- prompts: slot.prompts(),
879
- variables: slot.variables(),
880
- /**
881
- * 🚧 The session's genre fields (2026-10-02, AN1) — for
882
- * the **author's note** a genre may declare
883
- * (`AUTHORS_NOTE_FIELD`; Chat does). The builder carries
884
- * it to Assemble, which places it, and the template
885
- * renders it where it writes `{{#with ../authorsNote}}`.
886
- * A genre that declares no note supplies none, and the
887
- * prompt is the bytes it was. The other Chat fields
888
- * (auto-advance, turn mode, character detail) become
889
- * interpolation variables here, as Adventure's do —
890
- * nothing shipped writes them.
891
- */
892
- fields: $.input.fields,
893
- }))
894
- .task('lines', ($) => C.processMessages.v1({
895
- messages: $.gather.history.read.messages,
896
- cast: $.gather.cast.read.cast,
897
- templateContext: $.context.templateContext,
898
- seedName: $.context.seedName,
899
- /**
900
- * The extend verb, wired (ruling 2026-09-08, D-2; `continue` until 2026-09-28).
901
- *
902
- * ⚠ Wiring it is the whole of it. `process-messages` has put
903
- * `continuationPrefill` on the seed line since the runtime
904
- * was written, and no spec supplied a value — so an extend
905
- * sent an EMPTY seed, got a fresh reply, and the socket
906
- * glued the partial on afterwards. This is the same class of
907
- * omission as 1.16.0's unwired `params`: the mechanism
908
- * existed at both ends and nothing joined them.
909
- *
910
- * Empty on an ordinary turn, and the port carries "" — so
911
- * this pipeline is byte-identical for every turn that is not
912
- * an extend.
913
- */
914
- continuationPrefill: $.input.continuationPrefill,
915
- }))
916
- /**
917
- * 🚧 **Each line's attachments, placed** (PLAN-composer-attachments
918
- * §3.5; D2/D3). An image `generate` can read, within the media
919
- * lookback, rides on its own line's turn; a text file is inlined;
920
- * the rest are named. Judged on `generate`'s pair — the step that
921
- * sends this prompt — through its slot's `metadata.reads`. A
922
- * transcript with no files passes through untouched, so the prompt
923
- * is byte for byte what it was.
924
- */
925
- .task('attached', ($) => C.placeAttachments.v1({
926
- messages: $.lines.messages,
927
- attachments: $.gather.history.attachments.attachments,
928
- connection: slot.connectionOf('generate'),
929
- params: slot.params(),
930
- }))
931
- .task('prompt', ($) => C.assemble.v2({
932
- candidates: $.rank.candidates,
933
- decisions: $.rank.decisions,
934
- /**
935
- * The per-band arithmetic the ranker already did (D-H).
936
- *
937
- * ⚠ **Published by `rank-hybrid` and wired by nobody**,
938
- * for as long as both nodes have existed. `select()`
939
- * returns what each band was allotted, spent and filled,
940
- * the binding has always put it on this out-port, and
941
- * `allocate` has always taken the `?? {}` branch instead —
942
- * two adjacent nodes, one of them computing exactly what
943
- * the other needed, with no edge between them.
944
- *
945
- * ⚠ **It does not move the prompt.** `allocate` copies
946
- * this onto `AllocatedContext.groups` and reads it nowhere
947
- * else; `blocks`, `totalTokens` and `budget` — everything
948
- * the render walks — are the same bytes with it wired or
949
- * not, which is why this lands under a frozen version
950
- * rather than as a retune. What it fills in is the
951
- * RECEIPT: `dispatch.ts` publishes `payload.groups` as the
952
- * run's `sources`, so the budget panel's per-band numbers
953
- * have been an empty object on every run ever recorded.
954
- */
955
- groups: $.rank.groups,
956
- budget: $.contextBudget.available,
957
- messages: $.attached.messages,
958
- templateContext: $.context.templateContext,
959
- template: slot.template(),
960
- // The context builder's authored text, by reference — one
961
- // prompt, written once, read where the template asks for
962
- // `{{systemPrompt}}` (13 §12 finding i).
963
- prompts: slot.prompts({ node: 'context' }),
964
- // Assemble's own layouts — the lore and history *it*
965
- // produced, laid out after the budget decided what fit.
966
- // Its own slot, not the context builder's: no earlier node
967
- // knows the answer.
968
- variables: slot.variables(),
969
- params: slot.params(),
970
- // The connection this prompt is being WRITTEN FOR, shared
971
- // with the step that sends it — the same construction, and
972
- // the same reason, as `contextBudget`'s `samplingOf`
973
- // above: a prompt wrapped for one endpoint and sent to
974
- // another is wrong silently.
975
- //
976
- // Only `metadata.promptFormat` is read from it, and
977
- // assemble calls nothing. Without it `renderers.ts` fell
978
- // back to Vicuna on every run, so every ChatML, Llama-2,
979
- // Alpaca and Claude connection was sent Vicuna markers and
980
- // the receipt reported the format that was NOT used.
981
- connection: slot.connectionOf('generate'),
982
- }))
983
- .oracle('generate', ($) => C.generateText.v1({
984
- context: $.prompt.context,
985
- // The stop-string exclusion follows the speaker node's
986
- // output — the payload-wins seam in the host (19 §5).
987
- currentCharacterId: $.input.characterId,
988
- // ⚠ **The two slots this node has always been the OWNER of,
989
- // and never named.**
990
- //
991
- // `contextBudget` sizes the prompt with
992
- // `slot.samplingOf("generate")` and `prompt` renders it with
993
- // `slot.connectionOf("generate")` — both read
994
- // `config['generate']`, so a pick made on this step already
995
- // decided the window the prompt is cut to and the wire format
996
- // it is wrapped in. What it did not decide was where the
997
- // request went: `resolveInput` resolves only the slots a
998
- // node's config names, so `p.connection` and `p.sampling`
999
- // were `undefined` at the binding, `host.ts`'s
1000
- // `refId(p.connection)` read `null`, and
1001
- // `resolveCapabilityTarget` took that as "the pipeline chose
1002
- // nothing" and fell to the instance default. One window sized
1003
- // the prompt and another received it.
1004
- //
1005
- // So this is a picker becoming live rather than a retune: a
1006
- // person who set it expected it to be used, and every install
1007
- // that never set one keeps resolving the same instance
1008
- // default it always did (`resolveSlot` falls back to
1009
- // `world.activeConnection[kind]`, which `world.ts` projects
1010
- // from the very `connection_defaults` row the
1011
- // `capabilityDefault` tier reads). A session names no
1012
- // connection of its own: the pair is this slot's pick or the
1013
- // capability default, and only a session's SAMPLING rides on
1014
- // top (`PAIR_TIERS` vs `RESOLUTION_TIERS` in
1015
- // `capabilityTarget.ts`).
1016
- connection: slot.connection(),
1017
- sampling: slot.sampling(),
1018
- // ⚠ **The third slot this node owns, and the last half of
1019
- // the stop-sequence ruling (2026-09-10).**
1020
- //
1021
- // `core:oracle/generate-text@1` declares
1022
- // `params.stopSequences` — "sequences that end the reply the
1023
- // moment the model writes one" — the binding reads
1024
- // `input?.params?.stopSequences`, `DispatchRequest` carries
1025
- // it, and `BaseConnectionAdapter.withStops` sends it. Every
1026
- // piece existed except this one: `resolveInput` resolves only
1027
- // the slots a node's config names, so the key was never
1028
- // formed and the reader saw `undefined` on every turn — while
1029
- // the panel rendered the control and stored what people typed
1030
- // into it.
1031
- //
1032
- // Behaviour-preserving to close, and the declaration is what
1033
- // makes it so: `stopSequences` carries no default, so an
1034
- // install that never typed one still resolves `undefined` and
1035
- // sends exactly the stops it always did.
1036
- params: slot.params(),
1037
- // No `prompts` here: `core:oracle/generate-text@1` declares
1038
- // no such slot any more (culled 2026-09-16, R-12) — the
1039
- // instructions travel inside `context`, from `prompt`.
1040
- }), { expose: { stream: true, status: '{speaker} is typing' } })
1041
- /**
1042
- * The reply row, filled. The placeholder above created it; this
1043
- * ends its generation with the text and the trace. One row, one
1044
- * run — see `placeholder`.
1045
- */
1046
- .outlet('save', ($) => C.updateMessage.v1({
1047
- target: $.placeholder.messageId,
1048
- text: $.generate.text,
1049
- reasoning: $.generate.reasoning,
1050
- }))
1051
- /**
1052
- * The line's face (DESIGN-sprites §5), after the save so it never
1053
- * delays the reply: the sprite picker, handed the reply's own text
1054
- * and whose line it is. A session setting — "Choose sprites",
1055
- * stickiness and the floor are the session's to set.
1056
- */
1057
- .oracle('spritePick', ($) => C.pickSprite.v1({
1058
- text: $.generate.text,
1059
- speaker: $.input.speaker,
1060
- scope: $.input.sessionScope,
1061
- params: slot.params(),
1062
- }), { expose: { session: true } })
1063
- /** … recorded on the line. A picker's null pick writes nothing. */
1064
- .outlet('spriteShow', ($) => C.showSprite.v1({
1065
- target: $.save.messageId,
1066
- pick: $.spritePick.main,
1067
- source: 'picker',
1068
- }))
1069
- /**
1070
- * 🚧 **The reply tick** (live scenes §6, 2026-10-13): *Each reply
1071
- * advances the clock by …*, the session's to set and off by default
1072
- * (**By** 0). A fixed tick, never a model's guess: the step reads
1073
- * its own parameters, and *Advance story clock* moves the session's
1074
- * clock behind a junction on `moves`, so the default writes nothing
1075
- * and refuses nothing. A reply that re-drives its row — a
1076
- * regenerate, a swipe, an extend — does not tick again (`unless`).
1077
- * Last, after the line and its face. Says it is a `tick` (live
1078
- * scenes §15 G4): never a time action for the boundary watcher,
1079
- * and a swipe of the reply keeps it, since the re-driven reply
1080
- * does not tick again. 🚧 A story with no clock yet skips the tick
1081
- * (`onRefusal: 'skip'`, live scenes §15 G12): the reply stands,
1082
- * the run finishes, and the ledger under the reply says *not on
1083
- * the clock* and why — never a turn that looks failed.
1084
- */
1085
- .task('tick', ($) => C.clockStep.v1({ unless: $.input.messageId, params: slot.params() }), {
1086
- expose: { session: true, label: 'Each reply advances the clock by' },
1087
- })
1088
- .junction('clock', { on: ($) => $.tick.moves }, (j) => j.when('moves', { truthy: true }, (c) => c.outlet('advance', ($) => C.advanceStoryClock.v1({
1089
- by: $.tick.by,
1090
- unit: $.tick.unit,
1091
- cause: 'tick',
1092
- onRefusal: 'skip',
1093
- params: slot.params(),
1094
- }))))
1095
- /** What Chat ships with: the reminder's trigger (`POST_HISTORY_TOKEN_TRIGGER`). */
1096
- .preset('default', { label: 'Default', default: true }, (p) => p
1097
- .params('prompt', { postHistoryTokenTrigger: POST_HISTORY_TOKEN_TRIGGER })
1098
- // The reply runs on the Reply loadout (I12).
1099
- .loadout('generate', slot.loadout(CORE_LOADOUT.reply)))
1100
- .build());
344
+ .defaults((p) => applyWiring(p
345
+ .template('mode.basic.prompt', { source: ASSISTANT_RESPOND_TEMPLATE, engine: handlebars.id })
346
+ .template('mode.agentic.tools.item.prompt', { source: ASSISTANT_AGENTIC_TEMPLATE, engine: handlebars.id })
347
+ .params('mode.basic.prompt', { postHistoryTokenTrigger: POST_HISTORY_TOKEN_TRIGGER })
348
+ // Agentic answers the same person as Basic: the same post-history trigger (lane 3 finding).
349
+ .params('mode.agentic.tools.item.prompt', { postHistoryTokenTrigger: POST_HISTORY_TOKEN_TRIGGER })
350
+ .params('mode.agentic.answer', { path: 'answer' })
351
+ .loadout('mode.basic.generate', slot.loadout(CORE_LOADOUT.reply))
352
+ .loadout('heard', slot.loadout(CORE_LOADOUT.transcription))
353
+ .loadout('mode.agentic.tools.item.generate', slot.loadout(CORE_LOADOUT.toolCalling)), w))
354
+ .build());
355
+ };
1101
356
  //# sourceMappingURL=respond.js.map