@serene-pub/core-catalog 0.6.0-pr-2 → 0.6.0-pr-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/components/{sessions → genres/chat}/authors-note/AuthorsNote.svelte +1 -1
- package/components/{sessions → genres/chat}/authors-note/AuthorsNoteWidget.svelte +1 -1
- package/components/{sessions/world-state/WorldState.svelte → shared/actions/Actions.svelte} +5 -5
- package/components/shared/actions/ActionsWidget.svelte +118 -0
- package/components/shared/actions/actions.ts +11 -0
- package/components/shared/album/Album.svelte +24 -0
- package/components/shared/album/AlbumWidget.svelte +163 -0
- package/components/shared/album/album.ts +10 -0
- package/components/shared/annex/Annex.svelte +24 -0
- package/components/shared/annex/AnnexWidget.svelte +151 -0
- package/components/shared/annex/annex.ts +10 -0
- package/components/shared/attendance/Attendance.svelte +24 -0
- package/components/shared/attendance/AttendanceWidget.svelte +136 -0
- package/components/shared/attendance/attendance.ts +12 -0
- package/components/shared/backdrop/Backdrop.svelte +24 -0
- package/components/shared/backdrop/BackdropWidget.svelte +345 -0
- package/components/shared/backdrop/backdrop.ts +10 -0
- package/components/shared/chronicle/Chronicle.svelte +36 -0
- package/components/shared/chronicle/ChronicleWidget.svelte +569 -0
- package/components/shared/chronicle/chronicle.ts +11 -0
- package/components/{sessions → shared}/lore-entries/LoreEntries.svelte +1 -1
- package/components/{sessions → shared}/lore-entries/LoreEntriesWidget.svelte +3 -3
- package/components/shared/map-canvas/MapCanvas.svelte +171 -0
- package/components/shared/map-canvas/index.ts +390 -0
- package/components/{sessions → shared}/messages/MessageComposer.svelte +1 -1
- package/components/{sessions → shared}/messages/MessageControls.svelte +42 -0
- package/components/{sessions → shared}/messages/MessageStateLedger.svelte +19 -8
- package/components/{sessions → shared}/messages/Messages.svelte +1 -1
- package/components/{sessions → shared}/messages/MessagesWidget.svelte +126 -40
- package/components/{sessions → shared}/messages/NextCharacterBlock.svelte +17 -14
- package/components/shared/messages/SceneCueChip.svelte +82 -0
- package/components/shared/messages/SceneDivider.svelte +399 -0
- package/components/{sessions → shared}/messages/SessionComposer.svelte +33 -9
- package/components/shared/messages/SessionContainer.svelte +651 -0
- package/components/{sessions → shared}/messages/SessionMessage.svelte +52 -7
- package/components/shared/messages/TurnLine.svelte +254 -0
- package/components/{sessions → shared}/messages/conversation.svelte.ts +191 -2
- package/components/shared/messages/sceneMarks.ts +397 -0
- package/components/shared/places/Places.svelte +24 -0
- package/components/shared/places/PlacesWidget.svelte +290 -0
- package/components/shared/places/places.ts +11 -0
- package/components/{sessions → shared}/scene-portraits/ScenePortraits.svelte +1 -1
- package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +404 -0
- package/components/{sessions → shared}/state/SlotControl.svelte +9 -1
- package/components/{sessions → shared}/stats/Stats.svelte +1 -1
- package/components/shared/stats/StatsWidget.svelte +350 -0
- package/components/{sessions → shared}/stats/stats.ts +3 -2
- package/components/shared/turn-order/TurnOrder.svelte +24 -0
- package/components/shared/turn-order/TurnOrderWidget.svelte +167 -0
- package/components/shared/turn-order/turn-order.ts +11 -0
- package/components/{sessions/shared → shared}/widgetRef.svelte.ts +9 -2
- package/components/shared/world-state/WorldState.svelte +33 -0
- package/components/shared/world-state/world-state.ts +10 -0
- package/components/tsconfig.json +2 -2
- package/dist/components/actions.js +294 -0
- package/dist/components/actions.source.json +1 -0
- package/dist/components/album.js +386 -0
- package/dist/components/album.source.json +1 -0
- package/dist/components/annex.js +457 -0
- package/dist/components/annex.source.json +1 -0
- package/dist/components/attendance.js +353 -0
- package/dist/components/attendance.source.json +1 -0
- package/dist/components/authors-note.js +5 -5
- package/dist/components/authors-note.source.json +1 -1
- package/dist/components/backdrop.js +561 -0
- package/dist/components/backdrop.source.json +1 -0
- package/dist/components/chronicle.js +1141 -0
- package/dist/components/chronicle.source.json +1 -0
- package/dist/components/core-ui.json +1 -1
- package/dist/components/lore-entries.js +5 -5
- package/dist/components/lore-entries.source.json +1 -1
- package/dist/components/messages.js +3014 -2489
- package/dist/components/messages.source.json +1 -1
- package/dist/components/places.js +1133 -0
- package/dist/components/places.source.json +1 -0
- package/dist/components/scene-portraits.js +514 -345
- package/dist/components/scene-portraits.source.json +1 -1
- package/dist/components/shared-3K7SOGH7.js +16 -0
- package/dist/components/shared-452PIS46.js +156 -0
- package/dist/components/shared-GEDAMORM.js +45 -0
- package/dist/components/{shared-TCQZXBE3.js → shared-GXTL5G2H.js} +4 -3
- package/dist/components/shared-ITSLBJB5.js +478 -0
- package/dist/components/shared-NK7QSVMU.js +400 -0
- package/dist/components/shared-TDWKI2QV.js +58 -0
- package/dist/components/{shared-UAQVMZZK.js → shared-XBPH6USH.js} +586 -18
- package/dist/components/{shared-AINANAIA.js → shared-XISPHAKY.js} +502 -98
- package/dist/components/stats.js +8 -208
- package/dist/components/stats.source.json +1 -1
- package/dist/components/turn-order.js +461 -0
- package/dist/components/turn-order.source.json +1 -0
- package/dist/components/world-state.js +14 -202
- package/dist/components/world-state.source.json +1 -1
- package/dist/{answerForm.d.ts → factories/answerForm.d.ts} +4 -30
- package/dist/{answerForm.js → factories/answerForm.js} +10 -39
- package/dist/factories/once.d.ts +7 -0
- package/dist/factories/once.js +9 -0
- package/dist/{turnOrder.d.ts → factories/turnOrder.d.ts} +0 -22
- package/dist/{turnOrder.js → factories/turnOrder.js} +4 -104
- package/dist/genres/adventure/advanceTime.d.ts +18 -0
- package/dist/genres/adventure/advanceTime.js +24 -0
- package/dist/genres/adventure/answer.d.ts +23 -0
- package/dist/genres/adventure/answer.js +59 -0
- package/dist/genres/adventure/answerForm.d.ts +9 -0
- package/dist/genres/adventure/answerForm.js +11 -0
- package/dist/genres/adventure/ask.d.ts +73 -0
- package/dist/genres/adventure/ask.js +157 -0
- package/dist/genres/adventure/create.d.ts +36 -0
- package/dist/genres/adventure/create.js +62 -0
- package/dist/genres/adventure/illustrateScene.d.ts +7 -0
- package/dist/genres/adventure/illustrateScene.js +19 -0
- package/dist/genres/adventure/index.d.ts +45 -0
- package/dist/genres/adventure/index.js +45 -0
- package/dist/genres/adventure/keeperAction.d.ts +43 -0
- package/dist/genres/adventure/keeperAction.js +217 -0
- package/dist/genres/adventure/look.d.ts +45 -0
- package/dist/genres/adventure/look.js +209 -0
- package/dist/{adventure.d.ts → genres/adventure/respond.d.ts} +74 -65
- package/dist/{adventure.js → genres/adventure/respond.js} +125 -65
- package/dist/genres/adventure/rest.d.ts +10 -0
- package/dist/genres/adventure/rest.js +16 -0
- package/dist/genres/adventure/summarizeScene.d.ts +7 -0
- package/dist/genres/adventure/summarizeScene.js +14 -0
- package/dist/genres/adventure/turnOrder.d.ts +10 -0
- package/dist/genres/adventure/turnOrder.js +27 -0
- package/dist/genres/chat/advanceTime.d.ts +7 -0
- package/dist/genres/chat/advanceTime.js +17 -0
- package/dist/genres/chat/answerForm.d.ts +9 -0
- package/dist/genres/chat/answerForm.js +11 -0
- package/dist/genres/chat/create.d.ts +7 -0
- package/dist/{createChat.js → genres/chat/create.js} +6 -6
- package/dist/genres/chat/generateImage.d.ts +7 -0
- package/dist/{generateImage.js → genres/chat/generateImage.js} +26 -22
- package/dist/genres/chat/illustrateScene.d.ts +8 -0
- package/dist/genres/chat/illustrateScene.js +19 -0
- package/dist/genres/chat/index.d.ts +18 -0
- package/dist/genres/chat/index.js +19 -0
- package/dist/{narrate.d.ts → genres/chat/narrate.d.ts} +3 -3
- package/dist/{narrate.js → genres/chat/narrate.js} +37 -12
- package/dist/{narrateCharacter.d.ts → genres/chat/narrateCharacter.d.ts} +2 -2
- package/dist/{narrateCharacter.js → genres/chat/narrateCharacter.js} +39 -17
- package/dist/genres/chat/respond.d.ts +25 -0
- package/dist/{respond.js → genres/chat/respond.js} +91 -23
- package/dist/genres/chat/summarizeScene.d.ts +7 -0
- package/dist/genres/chat/summarizeScene.js +14 -0
- package/dist/genres/chat/turnOrder.d.ts +9 -0
- package/dist/genres/chat/turnOrder.js +28 -0
- package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.d.ts +1 -1
- package/dist/genres/guide/answerForm.d.ts +9 -0
- package/dist/genres/guide/answerForm.js +11 -0
- package/dist/genres/guide/create.d.ts +24 -0
- package/dist/genres/guide/create.js +58 -0
- package/dist/genres/guide/index.d.ts +10 -0
- package/dist/genres/guide/index.js +10 -0
- package/dist/{guide.d.ts → genres/guide/respond.d.ts} +1 -20
- package/dist/{guide.js → genres/guide/respond.js} +32 -61
- package/dist/genres/guide/summarizeScene.d.ts +7 -0
- package/dist/genres/guide/summarizeScene.js +14 -0
- package/dist/genres/guide/turnOrder.d.ts +10 -0
- package/dist/genres/guide/turnOrder.js +27 -0
- package/dist/genres/index.d.ts +14 -0
- package/dist/genres/index.js +41 -0
- package/dist/genres/lair/advanceTime.d.ts +7 -0
- package/dist/genres/lair/advanceTime.js +17 -0
- package/dist/genres/lair/answerForm.d.ts +17 -0
- package/dist/genres/lair/answerForm.js +19 -0
- package/dist/genres/lair/buildRoom.d.ts +64 -0
- package/dist/genres/lair/buildRoom.js +244 -0
- package/dist/genres/lair/castellanAction.d.ts +27 -0
- package/dist/genres/lair/castellanAction.js +177 -0
- package/dist/genres/lair/create.d.ts +28 -0
- package/dist/genres/lair/create.js +69 -0
- package/dist/genres/lair/fileRoom.d.ts +53 -0
- package/dist/genres/lair/fileRoom.js +288 -0
- package/dist/genres/lair/index.d.ts +62 -0
- package/dist/genres/lair/index.js +63 -0
- package/dist/genres/lair/nudge.d.ts +25 -0
- package/dist/genres/lair/nudge.js +78 -0
- package/dist/{lair.d.ts → genres/lair/respond.d.ts} +46 -59
- package/dist/{lair.js → genres/lair/respond.js} +55 -76
- package/dist/genres/lair/reveal.d.ts +10 -0
- package/dist/genres/lair/reveal.js +18 -0
- package/dist/genres/lair/roomAnswer.d.ts +86 -0
- package/dist/genres/lair/roomAnswer.js +378 -0
- package/dist/genres/lair/summarizeScene.d.ts +39 -0
- package/dist/genres/lair/summarizeScene.js +51 -0
- package/dist/genres/lair/trap.d.ts +11 -0
- package/dist/genres/lair/trap.js +24 -0
- package/dist/genres/lair/turnOrder.d.ts +9 -0
- package/dist/genres/lair/turnOrder.js +36 -0
- package/dist/genres/lair/whisper.d.ts +35 -0
- package/dist/genres/lair/whisper.js +90 -0
- package/dist/index.d.ts +52 -29
- package/dist/index.js +192 -86
- package/dist/loadouts.d.ts +37 -0
- package/dist/loadouts.js +105 -0
- package/dist/{entries.d.ts → registry/entries.d.ts} +1 -1
- package/dist/{genres.js → registry/genres.js} +40 -6
- package/dist/{ui/sessions → registry}/layouts.d.ts +41 -27
- package/dist/{ui/sessions → registry}/layouts.js +90 -49
- package/dist/{ui/sessions → registry}/widgets.d.ts +22 -0
- package/dist/registry/widgets.js +1294 -0
- package/dist/{presets.js → seed/presets.js} +28 -13
- package/dist/{prompts.d.ts → seed/prompts.d.ts} +10 -5
- package/dist/{prompts.js → seed/prompts.js} +225 -176
- package/dist/{annexField.d.ts → shared/annexField.d.ts} +12 -8
- package/dist/{annexField.js → shared/annexField.js} +16 -15
- package/dist/shared/builtins/branch.d.ts +8 -0
- package/dist/shared/builtins/branch.js +13 -0
- package/dist/{builtins.d.ts → shared/builtins/builtIn.d.ts} +16 -21
- package/dist/{builtins.js → shared/builtins/builtIn.js} +3 -37
- package/dist/shared/builtins/delete.d.ts +8 -0
- package/dist/shared/builtins/delete.js +13 -0
- package/dist/shared/builtins/edit.d.ts +8 -0
- package/dist/shared/builtins/edit.js +13 -0
- package/dist/shared/builtins/hide.d.ts +8 -0
- package/dist/shared/builtins/hide.js +13 -0
- package/dist/shared/builtins/index.d.ts +11 -0
- package/dist/shared/builtins/index.js +11 -0
- package/dist/shared/builtins/swipe.d.ts +8 -0
- package/dist/shared/builtins/swipe.js +17 -0
- package/dist/shared/describeLikeness.d.ts +14 -0
- package/dist/shared/describeLikeness.js +65 -0
- package/dist/shared/illustrateScene.d.ts +28 -0
- package/dist/shared/illustrateScene.js +181 -0
- package/dist/shared/portrait.d.ts +21 -0
- package/dist/shared/portrait.js +101 -0
- package/dist/shared/spriteFill.d.ts +14 -0
- package/dist/shared/spriteFill.js +107 -0
- package/dist/shared/sprites.d.ts +34 -0
- package/dist/shared/sprites.js +98 -0
- package/dist/shared/summarize/character.d.ts +9 -0
- package/dist/shared/summarize/character.js +10 -0
- package/dist/shared/summarize/history.d.ts +9 -0
- package/dist/shared/summarize/history.js +10 -0
- package/dist/shared/summarize/index.d.ts +12 -0
- package/dist/shared/summarize/index.js +12 -0
- package/dist/shared/summarize/scene.d.ts +38 -0
- package/dist/shared/summarize/scene.js +42 -0
- package/dist/shared/summarize/sceneIds.d.ts +17 -0
- package/dist/shared/summarize/sceneIds.js +17 -0
- package/dist/shared/summarize/summarizeScene.d.ts +113 -0
- package/dist/shared/summarize/summarizeScene.js +234 -0
- package/dist/shared/summarize/summarizeSpec.d.ts +54 -0
- package/dist/{summarize.js → shared/summarize/summarizeSpec.js} +23 -53
- package/dist/shared/summarize/world.d.ts +8 -0
- package/dist/shared/summarize/world.js +9 -0
- package/dist/shared/timePasses.d.ts +56 -0
- package/dist/shared/timePasses.js +86 -0
- package/dist/{toolLoop.d.ts → shared/toolLoop.d.ts} +25 -3
- package/dist/{toolLoop.js → shared/toolLoop.js} +70 -14
- package/dist/shared/ui/actions/index.d.ts +117 -0
- package/dist/shared/ui/actions/index.js +154 -0
- package/dist/shared/ui/album/index.d.ts +115 -0
- package/dist/shared/ui/album/index.js +178 -0
- package/dist/shared/ui/annex/index.d.ts +163 -0
- package/dist/shared/ui/annex/index.js +273 -0
- package/dist/shared/ui/attendance/index.d.ts +97 -0
- package/dist/shared/ui/attendance/index.js +89 -0
- package/dist/shared/ui/backdrop/index.d.ts +78 -0
- package/dist/shared/ui/backdrop/index.js +98 -0
- package/dist/shared/ui/chronicle/index.d.ts +230 -0
- package/dist/shared/ui/chronicle/index.js +249 -0
- package/dist/shared/ui/conversation/dossier.d.ts +33 -0
- package/dist/shared/ui/conversation/dossier.js +31 -0
- package/dist/{ui/sessions → shared/ui}/conversation/index.d.ts +2 -1
- package/dist/{ui/sessions → shared/ui}/conversation/index.js +3 -1
- package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.d.ts +1 -1
- package/dist/shared/ui/conversation/storyDays.d.ts +21 -0
- package/dist/shared/ui/conversation/storyDays.js +23 -0
- package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.d.ts +1 -1
- package/dist/{ui/sessions → shared/ui}/coreWidgetsEntry.js +1 -1
- package/dist/{ui/sessions → shared/ui}/lore-entries/index.d.ts +2 -2
- package/dist/shared/ui/places/index.d.ts +148 -0
- package/dist/shared/ui/places/index.js +249 -0
- package/dist/{ui/sessions → shared/ui}/scene-portraits/index.d.ts +1 -1
- package/dist/{ui/sessions → shared/ui}/scene-portraits/index.js +1 -1
- package/dist/shared/ui/scene-portraits/portraits.d.ts +191 -0
- package/dist/shared/ui/scene-portraits/portraits.js +223 -0
- package/dist/shared/ui/session-state/index.d.ts +16 -0
- package/dist/shared/ui/session-state/index.js +16 -0
- package/dist/{ui/sessions → shared/ui}/session-state/shapes.d.ts +2 -2
- package/dist/shared/ui/session-state/stateView.d.ts +249 -0
- package/dist/shared/ui/session-state/stateView.js +247 -0
- package/dist/shared/ui/turn-order/index.d.ts +146 -0
- package/dist/shared/ui/turn-order/index.js +257 -0
- package/dist/{ui/sessions → shared/ui}/widgetContext.d.ts +19 -10
- package/package.json +69 -30
- package/components/sessions/messages/SessionContainer.svelte +0 -459
- package/components/sessions/scene-portraits/ScenePortraitsWidget.svelte +0 -249
- package/components/sessions/stats/StatsWidget.svelte +0 -112
- package/components/sessions/world-state/WorldStateWidget.svelte +0 -112
- package/components/sessions/world-state/world-state.ts +0 -10
- package/dist/adventureActions.d.ts +0 -169
- package/dist/adventureActions.js +0 -599
- package/dist/createChat.d.ts +0 -7
- package/dist/generateImage.d.ts +0 -7
- package/dist/lairActions.d.ts +0 -296
- package/dist/lairActions.js +0 -1287
- package/dist/respond.d.ts +0 -24
- package/dist/sprites.d.ts +0 -24
- package/dist/sprites.js +0 -102
- package/dist/summarize.d.ts +0 -76
- package/dist/ui/sessions/conversation/dossier.d.ts +0 -328
- package/dist/ui/sessions/conversation/dossier.js +0 -31
- package/dist/ui/sessions/scene-portraits/portraits.d.ts +0 -95
- package/dist/ui/sessions/scene-portraits/portraits.js +0 -115
- package/dist/ui/sessions/session-state/index.d.ts +0 -15
- package/dist/ui/sessions/session-state/index.js +0 -15
- package/dist/ui/sessions/session-state/stateView.d.ts +0 -155
- package/dist/ui/sessions/session-state/stateView.js +0 -141
- package/dist/ui/sessions/widgets.js +0 -567
- package/components/{sessions → genres/chat}/authors-note/authors-note.ts +0 -0
- package/components/{sessions/shared → shared}/context.ts +0 -0
- package/components/{sessions → shared}/lore-entries/lore-entries.ts +0 -0
- package/components/{sessions → shared}/messages/MessageBlocksView.svelte +0 -0
- package/components/{sessions → shared}/messages/MessageMediaStrip.svelte +0 -0
- package/components/{sessions → shared}/messages/MessagePartsView.svelte +0 -0
- package/components/{sessions → shared}/messages/StateProposalList.svelte +0 -0
- package/components/{sessions → shared}/messages/mediaStrip.ts +0 -0
- package/components/{sessions → shared}/messages/messages.ts +0 -0
- package/components/{sessions → shared}/scene-portraits/StatBars.svelte +0 -0
- package/components/{sessions → shared}/scene-portraits/scene-portraits.ts +0 -0
- package/components/{sessions → shared}/state/entryFinder.ts +0 -0
- package/components/{sessions → shared}/state/slotWriter.svelte.ts +0 -0
- package/dist/components/{shared-RJDGOAVC.js → shared-FTRGUE7G.js} +78 -78
- /package/dist/{ui/sessions → genres/chat/ui}/authors-note/index.js +0 -0
- /package/dist/{entries.js → registry/entries.js} +0 -0
- /package/dist/{genres.d.ts → registry/genres.d.ts} +0 -0
- /package/dist/{slots.d.ts → registry/slots.d.ts} +0 -0
- /package/dist/{slots.js → registry/slots.js} +0 -0
- /package/dist/{statShapes.d.ts → registry/statShapes.d.ts} +0 -0
- /package/dist/{statShapes.js → registry/statShapes.js} +0 -0
- /package/dist/{guideMascotImage.d.ts → seed/guideMascotImage.d.ts} +0 -0
- /package/dist/{guideMascotImage.js → seed/guideMascotImage.js} +0 -0
- /package/dist/{presets.d.ts → seed/presets.d.ts} +0 -0
- /package/dist/{graphBuild.d.ts → shared/graphBuild.d.ts} +0 -0
- /package/dist/{graphBuild.js → shared/graphBuild.js} +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/actionsDisclosure.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/composerTray.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/formAnswer.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/itemValues.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageOrder.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageSpeaker.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/messageVerbState.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/slashPalette.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/text.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/conversation/text.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/lore-entries/index.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/barMath.d.ts +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/barMath.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/session-state/shapes.js +0 -0
- /package/dist/{ui/sessions → shared/ui}/widgetContext.js +0 -0
package/dist/lairActions.js
DELETED
|
@@ -1,1287 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The **Lair** genre's actions — what the dungeon's master does between turns
|
|
3
|
-
* (plans/genres-and-showcase-plugins §3, "Room building").
|
|
4
|
-
*
|
|
5
|
-
* `session-action` is an OPEN event, so each of these is its own small
|
|
6
|
-
* pipeline contributing its own button, and removing one from a preset takes
|
|
7
|
-
* the button with it and breaks nothing. Three shapes:
|
|
8
|
-
*
|
|
9
|
-
* - **Build room**, **Answer the door** and **File as a room** write a
|
|
10
|
-
* *lorebook entry*. They are the three actions here that reach outside the
|
|
11
|
-
* story, so they are the three declared `effects: 'world'` — owner-only,
|
|
12
|
-
* and never named by a block. *File as a room* lives on a message's ⋮ (the
|
|
13
|
-
* row it files is its subject, R11); the other two live in the composer
|
|
14
|
-
* and are nameable only by a message block **addressed to the owner**
|
|
15
|
-
* (R-15 *The line*; L1, ruled 2026-09-17). The knock's block is exactly
|
|
16
|
-
* that block, which is what makes its options real writes rather than
|
|
17
|
-
* narration.
|
|
18
|
-
* - **Whisper** and **Nudge** write *state* and no message: a standing
|
|
19
|
-
* instruction for the delvers the master picks (R10), and one for the
|
|
20
|
-
* Castellan. Neither calls a model. Pressing Nudge
|
|
21
|
-
* produces nothing visible in the log, which looks like a bug the first
|
|
22
|
-
* time you see it and is the same thing Adventure's Rest does.
|
|
23
|
-
* - **Trigger trap** and **Reveal** write a *message* and change nothing:
|
|
24
|
-
* the Castellan's turns with a fixed instruction, Adventure's Look with a
|
|
25
|
-
* different sentence in its prompt — one streamed row under the
|
|
26
|
-
* Castellan's name (lair pass B17, owner D7a; R8).
|
|
27
|
-
*
|
|
28
|
-
* ## Why the two steering actions write slots rather than messages
|
|
29
|
-
*
|
|
30
|
-
* A directive that produces no message still has to reach the next turn, and a
|
|
31
|
-
* session has exactly three places a fact can live: the transcript, the
|
|
32
|
-
* lorebook and the state. A nudge is not a line anybody said and not a fact
|
|
33
|
-
* about the world, so it is state — `core:slot/direction@1` for the Castellan,
|
|
34
|
-
* `core:slot/whisper@1` per delver — and the planner and the voices already
|
|
35
|
-
* take `state` on a port, which makes the note a control something *reads*
|
|
36
|
-
* rather than a second store nothing walks. (The planner reads the direction;
|
|
37
|
-
* a whisper is heard by its holder's voice alone — earshot, R1.)
|
|
38
|
-
*
|
|
39
|
-
* ⚠ **The channel route was the other candidate and does not work.** A hidden
|
|
40
|
-
* message on a `whispers` channel is one node to write and unreadable
|
|
41
|
-
* afterwards: `core:query/session-history@1` reads exactly one channel, and no
|
|
42
|
-
* core node merges two transcripts into the one `messages` port `assemble`
|
|
43
|
-
* takes. It would have been a button wired to nothing.
|
|
44
|
-
*/
|
|
45
|
-
import { compile, slot, spec, sessionEvents } from '@serene-pub/sdk';
|
|
46
|
-
import * as C from '@serene-pub/contracts';
|
|
47
|
-
import { LAIR_CASTELLAN_KEY, POST_HISTORY_TOKEN_TRIGGER, SANCTUM_CHANNEL, lairGenre } from './genres.js';
|
|
48
|
-
/**
|
|
49
|
-
* The Castellan's reference — who says a room is already filed.
|
|
50
|
-
*
|
|
51
|
-
* ⚠ **A room draft reads the book's public half and nothing else** (plan
|
|
52
|
-
* A28): the world-lore and history lanes, never character lore. A room entry
|
|
53
|
-
* is public lore — every delver's voice reads it, and so does every session
|
|
54
|
-
* on the book. Character lore is private whoever reads it: read with no
|
|
55
|
-
* speaker it is the omniscient narrator's (a background member's entries and
|
|
56
|
-
* every unbound one), and read as anybody it still carries the private lore
|
|
57
|
-
* of a persona someone plays in the session, which every voice of that
|
|
58
|
-
* session may read. Either way a secret keyed on the conversation could be
|
|
59
|
-
* drafted into a room anybody reads, so the drafts read no character lore
|
|
60
|
-
* at all. *Build room* reads world lore alone.
|
|
61
|
-
*/
|
|
62
|
-
const CASTELLAN = `envoy:${LAIR_CASTELLAN_KEY}`;
|
|
63
|
-
/* ── Build room ─────────────────────────────────────────────────────────── */
|
|
64
|
-
/** @internal */
|
|
65
|
-
export const LAIR_BUILD_ROOM_SPEC_ID = 'core:spec/lair-build-room';
|
|
66
|
-
// ⚠ Every Lair action that ranks (build room, answer the door, file as a
|
|
67
|
-
// room, and the Castellan's whisper/trap/reveal builder), edited in place
|
|
68
|
-
// (lorebooks C2, 2026-10-02): a `presences` read and an `eligible` step
|
|
69
|
-
// (`core:task/eligibility@1`) between `lore` and `rank`; and Build room,
|
|
70
|
-
// Answer the door and File as a room, which show the party's room under
|
|
71
|
-
// `{{locationEntry}}`, take the room rule — a `place` step wired into `rank`
|
|
72
|
-
// as `shownElsewhere`. Content-addressed; `specHashes.test.ts` records the
|
|
73
|
-
// moves.
|
|
74
|
-
/** @internal */
|
|
75
|
-
export const LAIR_BUILD_ROOM_VERSION = '1.0.0';
|
|
76
|
-
/**
|
|
77
|
-
* The layout a drafted room's body takes — its `Exits:` line among it — and
|
|
78
|
-
* why that line is still prose beside the graph.
|
|
79
|
-
*
|
|
80
|
-
* **The ways between rooms are relationships now** (places plan, 2026-09-29):
|
|
81
|
-
* one `narrative_relationships` row per way, read both ways when it has a
|
|
82
|
-
* reverse wording, drawn on the Places lens or in a place's own Links, and
|
|
83
|
-
* written by a pipeline through `core:outlet/link-lore-entries@1`. The Lair's
|
|
84
|
-
* rooms listing asks for them (`withLinks`), so `{{locationEntry}}` says a
|
|
85
|
-
* room's ways out under its body as "From here:" — that, not this line, is
|
|
86
|
-
* what the planner reads the ways on from. *Answer the door* links the room it
|
|
87
|
-
* writes to the room the party stand in (B6).
|
|
88
|
-
*
|
|
89
|
-
* ⚠ **The drafted `Exits:` line stays** (plan §11; how the map should grow is
|
|
90
|
-
* the owner's open Q4). A draft names ways out to rooms that may not exist
|
|
91
|
-
* yet, and nothing in the bound catalogue turns a line of prose into a list
|
|
92
|
-
* of names; parsing it at write time, with stub rooms for the names nothing
|
|
93
|
-
* answers, would change what a knock means. So the line is the room's own
|
|
94
|
-
* words — a reader still reads it, and an older room has only it — and the
|
|
95
|
-
* master turns it into links by hand, or with the place editor's *Read links
|
|
96
|
-
* from the Exits line* (B7). It stays a fixed line so a parser can take it
|
|
97
|
-
* apart.
|
|
98
|
-
* @internal
|
|
99
|
-
*/
|
|
100
|
-
export const LAIR_ROOM_CONTENT_SHAPE = [
|
|
101
|
-
'Exits: <direction> → <room>, <direction> → <room>',
|
|
102
|
-
'Contents: …',
|
|
103
|
-
'Hazards: …',
|
|
104
|
-
'Occupants: …',
|
|
105
|
-
].join('\n');
|
|
106
|
-
/**
|
|
107
|
-
* **Build room**: the master writes a room into the dungeon.
|
|
108
|
-
*
|
|
109
|
-
* The collected text (R3) is the room's **name** — the one thing a person always
|
|
110
|
-
* knows when they press this — and the model writes the body against the lore,
|
|
111
|
-
* the party's position and the fixed layout above. The name reaches the draft
|
|
112
|
-
* as `{{turnDirection}}`, and every room the dungeon already has as
|
|
113
|
-
* `{{knownLocations}}` (the rooms listing, plan A28) — the prompt's "name only
|
|
114
|
-
* rooms this dungeon already has" with the rooms in front of it. The world
|
|
115
|
-
* lore it reads carries no private entries. The write then parks at the
|
|
116
|
-
* review gate: `core:outlet/create-lore-entry@1` declares
|
|
117
|
-
* `review: { fields: ['name', 'content'] }`, and the preset below turns the
|
|
118
|
-
* gate ON — without that line `resolvePosition` defaults an undeclared position
|
|
119
|
-
* to `off` and this docblock's promise would be false, which it was until
|
|
120
|
-
* 2026-09-17. The gate IS the Build room form, with the name and the whole body
|
|
121
|
-
* editable before anything lands.
|
|
122
|
-
*
|
|
123
|
-
* **The entry is a location** (L3, contracts batch 2, 2026-09-17): the preset
|
|
124
|
-
* sets `entryType: 'core:entry/location'`, so a room files as a place rather
|
|
125
|
-
* than as world lore whose content happens to be laid out, and "which rows are
|
|
126
|
-
* the map" becomes a question a reader can ask. It is written with no links:
|
|
127
|
-
* a room built ahead of the party stands nowhere yet, and its drafted `Exits:`
|
|
128
|
-
* line is prose the master links by hand — see `LAIR_ROOM_CONTENT_SHAPE`.
|
|
129
|
-
*
|
|
130
|
-
* ⚠ **`effects: 'world'`** (R-15 *The line*): the result is lorebook data, so
|
|
131
|
-
* this action is the owner's, lives in the composer, and no message block may
|
|
132
|
-
* name it. That last rule is why the knock's form cannot save a room itself.
|
|
133
|
-
* @internal
|
|
134
|
-
*/
|
|
135
|
-
export const lairBuildRoomSpec = () => compile(spec(LAIR_BUILD_ROOM_SPEC_ID, {
|
|
136
|
-
version: LAIR_BUILD_ROOM_VERSION,
|
|
137
|
-
taxonomy: { role: 'action' },
|
|
138
|
-
contributes: {
|
|
139
|
-
actions: [
|
|
140
|
-
{
|
|
141
|
-
key: 'build-room',
|
|
142
|
-
venue: { kind: 'composer' },
|
|
143
|
-
quick: true,
|
|
144
|
-
icon: 'hammer',
|
|
145
|
-
/** The room's name is the whole instruction (R3): nothing to do without it. */
|
|
146
|
-
collects: { text: { need: 'required', label: { en: 'Room name' } } },
|
|
147
|
-
effects: 'world',
|
|
148
|
-
/** The owner's, and stated rather than inherited — see the note above. */
|
|
149
|
-
audience: { see: ['participant'], act: ['owner'] },
|
|
150
|
-
label: { en: 'Build room' },
|
|
151
|
-
description: {
|
|
152
|
-
en: "Write a room into the dungeon. Name it, and edit what the narrator drafts before it's saved.",
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
})
|
|
158
|
-
.inlet('input', C.userMessage.v1(), {
|
|
159
|
-
genre: lairGenre,
|
|
160
|
-
event: sessionEvents.sessionAction,
|
|
161
|
-
})
|
|
162
|
-
.gather('gather', { mode: 'parallel' }, (b) => b
|
|
163
|
-
.chain('history', (c) => c.query('read', ($) => C.sessionHistory.v1({
|
|
164
|
-
scope: $.input.sessionScope,
|
|
165
|
-
params: slot.params(),
|
|
166
|
-
})))
|
|
167
|
-
/** The world as the lore tells it, ranked against the conversation. */
|
|
168
|
-
.chain('lore', (c) => c.query('read', ($) => C.worldLore.v1({
|
|
169
|
-
scope: $.input.sessionScope,
|
|
170
|
-
params: slot.params(),
|
|
171
|
-
})))
|
|
172
|
-
.chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope })))
|
|
173
|
-
.chain('state', (c) => c.query('read', ($) => C.sessionState.v1({ scope: $.input.sessionScope })))
|
|
174
|
-
/**
|
|
175
|
-
* Every room the dungeon holds (location entries, the
|
|
176
|
-
* preset), by listing rather than by rank — what this room
|
|
177
|
-
* has to join onto, named to the draft whatever the
|
|
178
|
-
* ranker admitted.
|
|
179
|
-
*/
|
|
180
|
-
.chain('rooms', (c) => c.query('read', ($) => C.lorebookEntries.v1({
|
|
181
|
-
scope: $.input.sessionScope,
|
|
182
|
-
params: slot.params(),
|
|
183
|
-
}))))
|
|
184
|
-
.task('contextBudget', ($) => C.contextBudget.v1({
|
|
185
|
-
sampling: slot.samplingOf('write'),
|
|
186
|
-
connection: slot.connectionOf('write'),
|
|
187
|
-
params: slot.params(),
|
|
188
|
-
}))
|
|
189
|
-
.task('lore', ($) => C.concatCandidates.v1({
|
|
190
|
-
sources: [$.gather.history.read.band, $.gather.lore.read.main],
|
|
191
|
-
}))
|
|
192
|
-
// The room `{{locationEntry}}` shows (the room rule, 2026-10-02):
|
|
193
|
-
// the world's location at `world.location` (the preset's `path`),
|
|
194
|
-
// by the one room rule; the ranker leaves it out of the lore.
|
|
195
|
-
.task('place', ($) => C.undescribedName.v1({
|
|
196
|
-
name: $.gather.state.read.state,
|
|
197
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
198
|
-
params: slot.params(),
|
|
199
|
-
}), { expose: { label: 'The current place' } })
|
|
200
|
-
// Who is in the world at the session's moment (R4), for `eligible`.
|
|
201
|
-
.query('presences', ($) => C.castPresences.v1({ scope: $.input.sessionScope }))
|
|
202
|
-
// The hard gates before the ranker (C2; R2, R4): selective-logic
|
|
203
|
-
// exclusions from the keyword lanes, and the presence gate.
|
|
204
|
-
.task('eligible', ($) => C.eligibility.v1({
|
|
205
|
-
candidates: $.lore.candidates,
|
|
206
|
-
exclusions: $.gather.lore.read.exclusions,
|
|
207
|
-
presences: $.presences.main,
|
|
208
|
-
at: $.presences.at,
|
|
209
|
-
}))
|
|
210
|
-
.task('rank', ($) => C.rankHybrid.v1({
|
|
211
|
-
candidates: $.eligible.candidates,
|
|
212
|
-
budget: $.contextBudget.available,
|
|
213
|
-
shownElsewhere: $.place.entryId,
|
|
214
|
-
params: slot.params(),
|
|
215
|
-
}))
|
|
216
|
-
.task('context', ($) => C.buildTemplateContext.v1({
|
|
217
|
-
cast: $.gather.cast.read.cast,
|
|
218
|
-
state: $.gather.state.read.state,
|
|
219
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
220
|
-
// The room's name, as the master typed it.
|
|
221
|
-
turnDirection: $.input.text,
|
|
222
|
-
prompts: slot.prompts(),
|
|
223
|
-
variables: slot.variables(),
|
|
224
|
-
}))
|
|
225
|
-
/** Prose and no seed: a room is drafted, not spoken. */
|
|
226
|
-
.task('lines', ($) => C.proseTranscript.v1({
|
|
227
|
-
messages: $.gather.history.read.messages,
|
|
228
|
-
cast: $.gather.cast.read.cast,
|
|
229
|
-
templateContext: $.context.templateContext,
|
|
230
|
-
}))
|
|
231
|
-
/**
|
|
232
|
-
* 🚧 **The transcript's files, placed** (attachments follow-ups, owner
|
|
233
|
-
* ruling 2026-10-03) — `respond`'s two steps: the files the rows show,
|
|
234
|
-
* then per line what `write` receives (an image it can read rides its
|
|
235
|
-
* own turn; otherwise its name). A transcript with no files passes
|
|
236
|
-
* through untouched, so the prompt is byte for byte what it was.
|
|
237
|
-
*/
|
|
238
|
-
.query('attachments', ($) => C.historyAttachments.v1({
|
|
239
|
-
messages: $.gather.history.read.messages,
|
|
240
|
-
params: slot.params(),
|
|
241
|
-
}))
|
|
242
|
-
.task('attached', ($) => C.placeAttachments.v1({
|
|
243
|
-
messages: $.lines.messages,
|
|
244
|
-
attachments: $.attachments.attachments,
|
|
245
|
-
connection: slot.connectionOf('write'),
|
|
246
|
-
params: slot.params(),
|
|
247
|
-
}))
|
|
248
|
-
.task('prompt', ($) => C.assemble.v2({
|
|
249
|
-
candidates: $.rank.candidates,
|
|
250
|
-
decisions: $.rank.decisions,
|
|
251
|
-
groups: $.rank.groups,
|
|
252
|
-
budget: $.contextBudget.available,
|
|
253
|
-
messages: $.attached.messages,
|
|
254
|
-
templateContext: $.context.templateContext,
|
|
255
|
-
template: slot.template(),
|
|
256
|
-
prompts: slot.prompts({ node: 'context' }),
|
|
257
|
-
variables: slot.variables(),
|
|
258
|
-
params: slot.params(),
|
|
259
|
-
connection: slot.connectionOf('write'),
|
|
260
|
-
}))
|
|
261
|
-
.oracle('write', ($) => C.generateText.v1({
|
|
262
|
-
context: $.prompt.context,
|
|
263
|
-
connection: slot.connection(),
|
|
264
|
-
sampling: slot.sampling(),
|
|
265
|
-
params: slot.params(),
|
|
266
|
-
}), { expose: { status: 'Building the room' } })
|
|
267
|
-
/**
|
|
268
|
-
* The name is what the master typed, never what the model wrote: a
|
|
269
|
-
* room the person named is a room they can find again, and the gate
|
|
270
|
-
* lets them fix it if the composer was empty.
|
|
271
|
-
*/
|
|
272
|
-
.outlet('save', ($) => C.createLoreEntry.v1({
|
|
273
|
-
name: $.input.text,
|
|
274
|
-
content: $.write.text,
|
|
275
|
-
// Named so the entry-kind setting is live rather than
|
|
276
|
-
// rendered and unread (L3); the preset below sets it to a
|
|
277
|
-
// location. `links` is left unwired: a room built ahead of
|
|
278
|
-
// the party joins nothing yet, and its drafted exits are
|
|
279
|
-
// prose the master links (see `LAIR_ROOM_CONTENT_SHAPE`).
|
|
280
|
-
params: slot.params(),
|
|
281
|
-
}))
|
|
282
|
-
/**
|
|
283
|
-
* ⚠ **The gate is the point, not a precaution** — and this preset is
|
|
284
|
-
* what makes it true. `resolvePosition` defaults an undeclared review
|
|
285
|
-
* position to `off`, so until this line the drafted room landed unseen
|
|
286
|
-
* while the docblock above promised a form. *Answer the door* has
|
|
287
|
-
* carried the same two lines since L1; this is the pair.
|
|
288
|
-
*/
|
|
289
|
-
.preset('lair', { label: 'Lair', default: true }, (p) => p
|
|
290
|
-
.settings('save', { review: 'on' })
|
|
291
|
-
// A room is a place (L3) — bare id, the way a listing spells
|
|
292
|
-
// them; the version is the row's own column.
|
|
293
|
-
.params('save', { entryType: 'core:entry/location' })
|
|
294
|
-
// The rooms the draft is shown: the dungeon's places.
|
|
295
|
-
.params('gather.rooms.read', { entryTypes: ['core:entry/location'] })
|
|
296
|
-
// The room the place slot shows (the room rule).
|
|
297
|
-
.params('place', { path: 'world.location' }))
|
|
298
|
-
.build());
|
|
299
|
-
/* ── The party knocks: the answer ───────────────────────────────────────── */
|
|
300
|
-
/** @internal */
|
|
301
|
-
export const LAIR_ROOM_ANSWER_SPEC_ID = 'core:spec/lair-room-answer';
|
|
302
|
-
/** @internal */
|
|
303
|
-
export const LAIR_ROOM_ANSWER_VERSION = '1.0.0';
|
|
304
|
-
/**
|
|
305
|
-
* **What the knock's option fires** — the other half of the respond spec's
|
|
306
|
-
* `door.knock` branch (R-15 *Forms*), and the composer's *Answer the door*
|
|
307
|
-
* (`/room`) while a knock is open.
|
|
308
|
-
*
|
|
309
|
-
* **The knock asks for a description** (lair re-plan R9, owner rulings 2 + 6,
|
|
310
|
-
* 2026-09-28). The action collects optional text (R3's collect modal, or S2's
|
|
311
|
-
* slash argument — `/room <text>`), and a junction on it decides:
|
|
312
|
-
*
|
|
313
|
-
* - **typed** — the text IS the room: a location entry named after the door
|
|
314
|
-
* the party knocked at, its content **the typed text, verbatim**, and **no
|
|
315
|
-
* review gate**. It is the master's own words; a gate would ask them to
|
|
316
|
-
* approve what they just typed.
|
|
317
|
-
* - **drafted** — nothing typed: the Castellan drafts the room in the
|
|
318
|
-
* dungeon's layout (`LAIR_ROOM_CONTENT_SHAPE`, the form *Build room* drafts
|
|
319
|
-
* into, the `lair-knock-build` prompt), and the master edits it at
|
|
320
|
-
* `create-lore-entry`'s **review gate** before it lands.
|
|
321
|
-
*
|
|
322
|
-
* Retired with the two-option knock: *I will build it* and *Let the Castellan
|
|
323
|
-
* improvise it* (`KNOCK_OPTIONS`), and the improvise branch's narration
|
|
324
|
-
* (its `lair-improvise` prompt row). An empty answer drafts and gates exactly
|
|
325
|
-
* as either used to.
|
|
326
|
-
*
|
|
327
|
-
* **A rejected draft re-opens the knock** (owner F5; R9). Not this spec's
|
|
328
|
-
* rule: a core one in the app's review gate — an answer rejected at review
|
|
329
|
-
* that wrote nothing is no answer, so the form is not marked answered, its
|
|
330
|
-
* row is re-announced and its open-form notification raised again. The room
|
|
331
|
-
* is still undescribed, the story still waits, and *Describe <room>…* and
|
|
332
|
-
* `/room` are offered again.
|
|
333
|
-
*
|
|
334
|
-
* Writing a lore entry is `effects: 'world'`, and the rule that used to stop a
|
|
335
|
-
* block naming one is the effects line's one exception (L1, ruled 2026-09-17):
|
|
336
|
-
* `worldBlockFunctions` refuses any block naming a world action **unless the
|
|
337
|
-
* block is addressed to the owner**, and the knock's block is addressed to
|
|
338
|
-
* `owner` precisely because the dungeon's master is the only person it could
|
|
339
|
-
* sensibly be put to. So this action is declared `world` and lives in the
|
|
340
|
-
* `composer` venue — the `form` venue stays fiction-only, because a venue is
|
|
341
|
-
* declared and an addressee is decided at run time (see `sdk/src/actions.ts`).
|
|
342
|
-
*
|
|
343
|
-
* **The room's name travels on the block** (lair pass B12, 2026-09-27). The
|
|
344
|
-
* knock's `choices` block carries the checked name as its `referent`,
|
|
345
|
-
* `read-answer@1` hands it back, and it is the entry's `name`. A press that
|
|
346
|
-
* carries no form never gets that far: `answer` halts (*nothing to answer*),
|
|
347
|
-
* which is why the action is present only while a knock is open (W-GATE D3,
|
|
348
|
-
* `presentWhen`), and a composer press while it is open is addressed to that
|
|
349
|
-
* knock by the host.
|
|
350
|
-
*
|
|
351
|
-
* **The new room joins the room the party stand in** (places plan B6,
|
|
352
|
-
* 2026-09-29). The party knocked from somewhere: the world's `location` stat,
|
|
353
|
-
* else the room the knock's planner named (the block's `vantage`, plan A27).
|
|
354
|
-
* `here` resolves it against the rooms the dungeon lists — the Lair's name
|
|
355
|
-
* rule, `undescribed-name@1` reading the name at `world.location` inside the
|
|
356
|
-
* session's state (a location set to a place entry is that entry, by id) —
|
|
357
|
-
* and, once the room has landed, the `link` junction writes ONE relationship
|
|
358
|
-
* from the new room to that one, `leads to` both ways
|
|
359
|
-
* (`core:outlet/link-lore-entries@1`). The next turn's planner reads it under
|
|
360
|
-
* the room as "From here:".
|
|
361
|
-
*
|
|
362
|
-
* ⚠ **Invariant: the door never fails because the party's location names no
|
|
363
|
-
* room** (plan §3 #11). The location is usually words, and `create-lore-entry`'s
|
|
364
|
-
* own `links` refuses a name nothing answers to inside the entry's transaction
|
|
365
|
-
* — which would fail the room with it. So the link is its own write, after the
|
|
366
|
-
* room's, in a junction that fires only when `here` found a room: otherwise
|
|
367
|
-
* the room is saved unlinked. A rejected draft ends the run before either. The
|
|
368
|
-
* link is not gated (the master judged the room; the way back to where the
|
|
369
|
-
* party stand is not a second question) and the outlet is idempotent, so a
|
|
370
|
-
* repeat stacks nothing.
|
|
371
|
-
*
|
|
372
|
-
* **Then the story goes on.** Once the room lands, the master's own line —
|
|
373
|
-
* *The party go on into The Drowned Hall* — is written under their name, the
|
|
374
|
-
* way a send is: the turn order prepares the Castellan's turn, auto-advance
|
|
375
|
-
* fires it as it would after any send, and the planner, which now lists the
|
|
376
|
-
* room, walks the party in. A rejected draft ends the run at the gate, so
|
|
377
|
-
* nothing is said and the knock is open again.
|
|
378
|
-
* @internal
|
|
379
|
-
*/
|
|
380
|
-
export const lairRoomAnswerSpec = () => compile(spec(LAIR_ROOM_ANSWER_SPEC_ID, {
|
|
381
|
-
version: LAIR_ROOM_ANSWER_VERSION,
|
|
382
|
-
taxonomy: { role: 'action' },
|
|
383
|
-
contributes: {
|
|
384
|
-
actions: [
|
|
385
|
-
{
|
|
386
|
-
key: 'room',
|
|
387
|
-
/**
|
|
388
|
-
* ⚠ **`composer`, and it was `form`** (changed
|
|
389
|
-
* 2026-09-17 with L1). This action writes a lorebook
|
|
390
|
-
* entry, which is `effects: 'world'`, and F41 refuses a
|
|
391
|
-
* world action in the `form` venue at construction —
|
|
392
|
-
* deliberately, because a venue is declared and an
|
|
393
|
-
* addressee is decided at run time, so that check can
|
|
394
|
-
* never see the one fact that makes this safe. The
|
|
395
|
-
* block still reaches it: an owner-addressed block may
|
|
396
|
-
* name a `composer`-venue world action, and the press is
|
|
397
|
-
* held to the addressee.
|
|
398
|
-
*
|
|
399
|
-
* **So it is present only while a knock is open** —
|
|
400
|
-
* `presentWhen` below, hidden rather than grey (W-GATE
|
|
401
|
-
* D3, 2026-09-27). The host publishes the session's open
|
|
402
|
-
* form as `session.openForm` (unanswered, not overtaken)
|
|
403
|
-
* with the action it is answered by; the knock's block
|
|
404
|
-
* names this one. Present is answerable: the host
|
|
405
|
-
* addresses a composer press of this action to the open
|
|
406
|
-
* knock (`fireAction`), so it walks the knock's own
|
|
407
|
-
* button road.
|
|
408
|
-
*/
|
|
409
|
-
venue: { kind: 'composer' },
|
|
410
|
-
presentWhen: {
|
|
411
|
-
on: 'session.openForm.action',
|
|
412
|
-
equals: `${LAIR_ROOM_ANSWER_SPEC_ID}#room`,
|
|
413
|
-
/** Said only at the door: a listing hides it instead. */
|
|
414
|
-
reason: { en: 'There is no door to answer — the party have not knocked.' },
|
|
415
|
-
},
|
|
416
|
-
/**
|
|
417
|
-
* **The description** (R9): optional, because an empty
|
|
418
|
-
* answer has a meaning — the Castellan drafts the room
|
|
419
|
-
* for review. Typed, it is saved as written.
|
|
420
|
-
*/
|
|
421
|
-
collects: {
|
|
422
|
-
text: {
|
|
423
|
-
need: 'optional',
|
|
424
|
-
label: { en: 'Describe the room' },
|
|
425
|
-
ifEmpty: { en: 'The Castellan drafts it for you to review.' },
|
|
426
|
-
},
|
|
427
|
-
},
|
|
428
|
-
/**
|
|
429
|
-
* ⚠ Lore data, so the result is outside the story
|
|
430
|
-
* (R-15 *The line*) — the same declaration *Build
|
|
431
|
-
* room* carries, for the same write.
|
|
432
|
-
*/
|
|
433
|
-
effects: 'world',
|
|
434
|
-
/**
|
|
435
|
-
* The dungeon's master answers this and nobody else —
|
|
436
|
-
* the block is addressed to `owner`, and the audience
|
|
437
|
-
* says the same thing where a listing would ask. It is
|
|
438
|
-
* also what a `world` action is allowed to say
|
|
439
|
-
* (`WORLD_ACTION_ACTORS`).
|
|
440
|
-
*/
|
|
441
|
-
audience: { see: ['participant'], act: ['owner'] },
|
|
442
|
-
icon: 'door-open',
|
|
443
|
-
label: { en: 'Answer the door' },
|
|
444
|
-
description: {
|
|
445
|
-
en: 'Describe the room the party just found. What you write is saved as the room; leave it empty and the Castellan drafts it for you to edit before it is saved.',
|
|
446
|
-
},
|
|
447
|
-
},
|
|
448
|
-
],
|
|
449
|
-
},
|
|
450
|
-
})
|
|
451
|
-
.inlet('input', C.userMessage.v1(), {
|
|
452
|
-
genre: lairGenre,
|
|
453
|
-
event: sessionEvents.sessionAction,
|
|
454
|
-
})
|
|
455
|
-
.task('answer', ($) => C.readAnswer.v1({ payload: $.input.payload, form: $.input.form }))
|
|
456
|
-
.gather('gather', { mode: 'parallel' }, (b) => b
|
|
457
|
-
.chain('history', (c) => c.query('read', ($) => C.sessionHistory.v1({
|
|
458
|
-
scope: $.input.sessionScope,
|
|
459
|
-
params: slot.params(),
|
|
460
|
-
})))
|
|
461
|
-
/** The book's public half — world lore and history, never character lore (see the note on `CASTELLAN`). */
|
|
462
|
-
.chain('worldLore', (c) => c.query('read', ($) => C.worldLore.v1({
|
|
463
|
-
scope: $.input.sessionScope,
|
|
464
|
-
params: slot.params(),
|
|
465
|
-
})))
|
|
466
|
-
.chain('historyEntries', (c) => c.query('read', ($) => C.historyEntries.v1({
|
|
467
|
-
scope: $.input.sessionScope,
|
|
468
|
-
params: slot.params({ node: 'gather.worldLore.read' }),
|
|
469
|
-
})))
|
|
470
|
-
.chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope })))
|
|
471
|
-
.chain('state', (c) => c.query('read', ($) => C.sessionState.v1({ scope: $.input.sessionScope })))
|
|
472
|
-
/**
|
|
473
|
-
* The rooms the dungeon holds (location entries, the
|
|
474
|
-
* preset) — what `here` resolves the party's location
|
|
475
|
-
* against (B6), and what the draft is told already exists
|
|
476
|
-
* (plan A28).
|
|
477
|
-
*/
|
|
478
|
-
.chain('rooms', (c) => c.query('read', ($) => C.lorebookEntries.v1({
|
|
479
|
-
scope: $.input.sessionScope,
|
|
480
|
-
params: slot.params(),
|
|
481
|
-
}))))
|
|
482
|
-
.task('contextBudget', ($) => C.contextBudget.v1({
|
|
483
|
-
sampling: slot.samplingOf('room.drafted.write'),
|
|
484
|
-
connection: slot.connectionOf('room.drafted.write'),
|
|
485
|
-
params: slot.params(),
|
|
486
|
-
}))
|
|
487
|
-
.task('lore', ($) => C.concatCandidates.v1({
|
|
488
|
-
sources: [
|
|
489
|
-
$.gather.history.read.band,
|
|
490
|
-
$.gather.worldLore.read.main,
|
|
491
|
-
$.gather.historyEntries.read.main,
|
|
492
|
-
],
|
|
493
|
-
}))
|
|
494
|
-
// The room `{{locationEntry}}` shows (the room rule, 2026-10-02):
|
|
495
|
-
// the world's location at `world.location` (the preset's `path`),
|
|
496
|
-
// by the one room rule; the ranker leaves it out of the lore.
|
|
497
|
-
.task('place', ($) => C.undescribedName.v1({
|
|
498
|
-
name: $.gather.state.read.state,
|
|
499
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
500
|
-
params: slot.params(),
|
|
501
|
-
}), { expose: { label: 'The current place' } })
|
|
502
|
-
// Who is in the world at the session's moment (R4), for `eligible`.
|
|
503
|
-
.query('presences', ($) => C.castPresences.v1({ scope: $.input.sessionScope }))
|
|
504
|
-
// The hard gates before the ranker (C2; R2, R4): selective-logic
|
|
505
|
-
// exclusions from the keyword lanes, and the presence gate.
|
|
506
|
-
.task('eligible', ($) => C.eligibility.v1({
|
|
507
|
-
candidates: $.lore.candidates,
|
|
508
|
-
exclusions: [$.gather.worldLore.read.exclusions, $.gather.historyEntries.read.exclusions],
|
|
509
|
-
presences: $.presences.main,
|
|
510
|
-
at: $.presences.at,
|
|
511
|
-
}))
|
|
512
|
-
.task('rank', ($) => C.rankHybrid.v1({
|
|
513
|
-
candidates: $.eligible.candidates,
|
|
514
|
-
budget: $.contextBudget.available,
|
|
515
|
-
shownElsewhere: $.place.entryId,
|
|
516
|
-
params: slot.params(),
|
|
517
|
-
}))
|
|
518
|
-
/**
|
|
519
|
-
* 🚧 **The files those rows show** (attachments follow-ups, owner
|
|
520
|
-
* ruling 2026-10-03), read once on the spine; the drafting arm below
|
|
521
|
-
* places them for `room.drafted.write` — an image it can read rides its own
|
|
522
|
-
* turn, otherwise its name. No files, and the arm's prompt is byte for
|
|
523
|
-
* byte what it was.
|
|
524
|
-
*/
|
|
525
|
-
.query('attachments', ($) => C.historyAttachments.v1({
|
|
526
|
-
messages: $.gather.history.read.messages,
|
|
527
|
-
params: slot.params(),
|
|
528
|
-
}))
|
|
529
|
-
/**
|
|
530
|
-
* **Typed, or left to the Castellan** (R9). The model call is in
|
|
531
|
-
* the branch that needs one: a typed room costs nothing. Each
|
|
532
|
-
* branch files the room itself — a location (L3), set in the
|
|
533
|
-
* preset below, exactly as *Build room* files one — named after
|
|
534
|
-
* the door the party knocked at (the block's `referent`).
|
|
535
|
-
*
|
|
536
|
-
* `links` is unwired on purpose: it would fail the room with a
|
|
537
|
-
* name nothing answers to. The way back to where the party stand
|
|
538
|
-
* is the `link` junction below, after the room (B6); the drafted
|
|
539
|
-
* `Exits:` line stays prose (`LAIR_ROOM_CONTENT_SHAPE`).
|
|
540
|
-
*/
|
|
541
|
-
.junction('room', { on: ($) => $.input.text }, (r) => r
|
|
542
|
-
.when('typed', { truthy: true }, (c) => c.outlet('save', ($) => C.createLoreEntry.v1({
|
|
543
|
-
name: $.answer.referent,
|
|
544
|
-
// The master's own words, as they wrote them.
|
|
545
|
-
content: $.input.text,
|
|
546
|
-
params: slot.params(),
|
|
547
|
-
}), { expose: { label: 'Save the room as typed' } }))
|
|
548
|
-
/**
|
|
549
|
-
* The room drafted in the dungeon's layout for the master
|
|
550
|
-
* to finish (B12) — *Build room*'s layout, its own prompt
|
|
551
|
-
* row: the room is the one the party just knocked at,
|
|
552
|
-
* named by the last line of the conversation.
|
|
553
|
-
*/
|
|
554
|
-
.otherwise('drafted', (c) => c
|
|
555
|
-
.task('context', ($) => C.buildTemplateContext.v1({
|
|
556
|
-
cast: $.gather.cast.read.cast,
|
|
557
|
-
state: $.gather.state.read.state,
|
|
558
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
559
|
-
prompts: slot.prompts(),
|
|
560
|
-
variables: slot.variables(),
|
|
561
|
-
}))
|
|
562
|
-
.task('lines', ($) => C.proseTranscript.v1({
|
|
563
|
-
messages: $.gather.history.read.messages,
|
|
564
|
-
cast: $.gather.cast.read.cast,
|
|
565
|
-
templateContext: $.room.drafted.context.templateContext,
|
|
566
|
-
}))
|
|
567
|
-
.task('attached', ($) => C.placeAttachments.v1({
|
|
568
|
-
messages: $.room.drafted.lines.messages,
|
|
569
|
-
attachments: $.attachments.attachments,
|
|
570
|
-
connection: slot.connectionOf('room.drafted.write'),
|
|
571
|
-
params: slot.params(),
|
|
572
|
-
}))
|
|
573
|
-
.task('prompt', ($) => C.assemble.v2({
|
|
574
|
-
candidates: $.rank.candidates,
|
|
575
|
-
decisions: $.rank.decisions,
|
|
576
|
-
groups: $.rank.groups,
|
|
577
|
-
budget: $.contextBudget.available,
|
|
578
|
-
messages: $.room.drafted.attached.messages,
|
|
579
|
-
templateContext: $.room.drafted.context.templateContext,
|
|
580
|
-
template: slot.template(),
|
|
581
|
-
prompts: slot.prompts({ node: 'room.drafted.context' }),
|
|
582
|
-
variables: slot.variables(),
|
|
583
|
-
params: slot.params(),
|
|
584
|
-
connection: slot.connectionOf('room.drafted.write'),
|
|
585
|
-
}))
|
|
586
|
-
.oracle('write', ($) => C.generateText.v1({
|
|
587
|
-
context: $.room.drafted.prompt.context,
|
|
588
|
-
connection: slot.connection(),
|
|
589
|
-
sampling: slot.sampling(),
|
|
590
|
-
params: slot.params(),
|
|
591
|
-
}), { expose: { status: 'The Castellan drafts the room' } })
|
|
592
|
-
.outlet('save', ($) => C.createLoreEntry.v1({
|
|
593
|
-
name: $.answer.referent,
|
|
594
|
-
content: $.room.drafted.write.text,
|
|
595
|
-
params: slot.params(),
|
|
596
|
-
}), { expose: { label: 'Save the drafted room' } })))
|
|
597
|
-
/**
|
|
598
|
-
* **Where the party stand** (B6): the world's `location`, read at
|
|
599
|
-
* `world.location` inside the session's state (the preset's
|
|
600
|
-
* `path`), else the knock's `vantage` — the room its planner said
|
|
601
|
-
* the party stood in (A27) — resolved against the rooms by the
|
|
602
|
-
* Lair's name rule. The world's value first and the plan's hint
|
|
603
|
-
* second is the order `{{locationEntry}}` reads them in on a play
|
|
604
|
-
* turn; the hint here is the knock turn's own, which no prompt in
|
|
605
|
-
* that turn showed. A location set to a place entry is that entry.
|
|
606
|
-
* `entryId` is the room, or null when nothing the dungeon lists
|
|
607
|
-
* answers — words naming no room, or neither a location nor a hint.
|
|
608
|
-
*/
|
|
609
|
-
.task('here', ($) => C.undescribedName.v1({
|
|
610
|
-
name: $.gather.state.read.state,
|
|
611
|
-
fallbackName: $.answer.vantage,
|
|
612
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
613
|
-
params: slot.params(),
|
|
614
|
-
}))
|
|
615
|
-
/**
|
|
616
|
-
* **The way between them** (B6): one relationship from the room
|
|
617
|
-
* just written to the room the party stand in, `leads to` both
|
|
618
|
-
* ways (the preset) — only when `here` found one. The junction
|
|
619
|
-
* publishes whichever `save` ran as `room.entryId`. Nothing fires
|
|
620
|
-
* otherwise: the room stays saved, unlinked, and the story goes on.
|
|
621
|
-
*/
|
|
622
|
-
.junction('link', { on: ($) => $.here.entryId }, (r) => r.when('resolved', { truthy: true }, (c) => c.outlet('write', ($) => C.linkLoreEntries.v1({
|
|
623
|
-
from: $.room.entryId,
|
|
624
|
-
to: $.here.entryId,
|
|
625
|
-
params: slot.params(),
|
|
626
|
-
}))))
|
|
627
|
-
/**
|
|
628
|
-
* The master's line that sends the party on (B12) — after the
|
|
629
|
-
* room's write, so it is said only once the room exists. Written
|
|
630
|
-
* as the person who pressed (`presser`, `user:<id>`: a user row,
|
|
631
|
-
* their own line), which is what makes it a send: the turn order
|
|
632
|
-
* prepares the Castellan's turn and auto-advance takes it, as
|
|
633
|
-
* after any send.
|
|
634
|
-
*/
|
|
635
|
-
.task('onward', ($) => C.joinText.v1({
|
|
636
|
-
items: ['The party go on into', $.answer.referent],
|
|
637
|
-
params: slot.params(),
|
|
638
|
-
}))
|
|
639
|
-
.outlet('resume', ($) => C.createMessage.v1({
|
|
640
|
-
text: $.onward.text,
|
|
641
|
-
speaker: $.input.presser,
|
|
642
|
-
}))
|
|
643
|
-
/**
|
|
644
|
-
* ⚠ **The draft's gate is the point, not a precaution.**
|
|
645
|
-
* `create-lore-entry` declares `review: { fields: ['name',
|
|
646
|
-
* 'content'] }` and `resolvePosition` defaults an undeclared
|
|
647
|
-
* position to `off`, so without this line the Castellan's draft
|
|
648
|
-
* would land unseen. On, the run parks and the master gets the
|
|
649
|
-
* *Build room* form with the draft already in it. The typed room
|
|
650
|
-
* is `off` by name: the master wrote it (R9).
|
|
651
|
-
*/
|
|
652
|
-
.preset('lair', { label: 'Lair', default: true }, (p) => p
|
|
653
|
-
.settings('room.typed.save', { review: 'off' })
|
|
654
|
-
.settings('room.drafted.save', { review: 'on' })
|
|
655
|
-
// A room is a place (L3), however it was written.
|
|
656
|
-
.params('room.typed.save', { entryType: 'core:entry/location' })
|
|
657
|
-
.params('room.drafted.save', { entryType: 'core:entry/location' })
|
|
658
|
-
// Plain names, one sentence (B12).
|
|
659
|
-
.params('onward', { path: '', separator: ' ' })
|
|
660
|
-
// B6: the rooms, where the party stand, and the way
|
|
661
|
-
// between — one row, read the same from either end.
|
|
662
|
-
.params('gather.rooms.read', { entryTypes: ['core:entry/location'] })
|
|
663
|
-
.params('here', { path: 'world.location' })
|
|
664
|
-
// The room the place slot shows (the room rule) — the world's
|
|
665
|
-
// location alone, where `here` also falls back to the vantage.
|
|
666
|
-
.params('place', { path: 'world.location' })
|
|
667
|
-
.params('link.resolved.write', { linkType: 'leads to', reverseLinkType: 'leads to' }))
|
|
668
|
-
.build());
|
|
669
|
-
/* ── File as a room ─────────────────────────────────────────────────────── */
|
|
670
|
-
/** @internal */
|
|
671
|
-
export const LAIR_FILE_ROOM_SPEC_ID = 'core:spec/lair-file-room';
|
|
672
|
-
/** @internal */
|
|
673
|
-
export const LAIR_FILE_ROOM_VERSION = '1.0.0';
|
|
674
|
-
/**
|
|
675
|
-
* **File as a room** — a room described in a message reaches the lorebook
|
|
676
|
-
* (lair re-plan R11, 2026-09-28; owner ruling 1: the Sanctum is where the map
|
|
677
|
-
* is laid out ahead of time, and a planned room reaches the lorebook only
|
|
678
|
-
* through a review-gated write).
|
|
679
|
-
*
|
|
680
|
-
* The rooms worth filing are written in prose first: the master narrates the
|
|
681
|
-
* party into one on `main` (the person is the narrator, F2), plans one with the
|
|
682
|
-
* Castellan in the Sanctum, or the Castellan narrates one when it is fired. So
|
|
683
|
-
* this lives on the **message** — a row's ⋮ — and acts on that row: its text is
|
|
684
|
-
* read by id (`session-history@1`'s `messageId`, the inlet's), never sent by
|
|
685
|
-
* the client.
|
|
686
|
-
*
|
|
687
|
-
* **Whose rows.** The person's and the Castellan's — any row that is not a
|
|
688
|
-
* character's line (`item.characterLine equals false`, the grammar's one
|
|
689
|
-
* condition: *the person's or the Castellan's* is exactly *not a delver's*). A
|
|
690
|
-
* delver naming a door is not the dungeon's plan, which is the same rule the
|
|
691
|
-
* room check applies to prose (`undescribed-name@1`, R7). Greyed there with
|
|
692
|
-
* the sentence, and refused at the door with the same one.
|
|
693
|
-
*
|
|
694
|
-
* **The name is collected** (R3's collect modal): required, because it is what
|
|
695
|
-
* the person can find the room by again (*Build room*'s rule), because a
|
|
696
|
-
* message may describe more than one room and the name says which, and
|
|
697
|
-
* because it is what the duplicate check runs on — before any model call, so
|
|
698
|
-
* a room already in the book costs nothing. It stays editable at the review
|
|
699
|
-
* gate, where the draft is.
|
|
700
|
-
*
|
|
701
|
-
* **Then, R9's drafted path.** A room already in the book by the SDK's name
|
|
702
|
-
* rule (`undescribed-name@1` over the location entries, then the whole book;
|
|
703
|
-
* no prose read — the row itself is prose) is not filed twice: the Castellan
|
|
704
|
-
* says so on the Sanctum, and nothing is written. Otherwise the Castellan
|
|
705
|
-
* drafts the entry from that one row in *Build room*'s layout
|
|
706
|
-
* (`LAIR_ROOM_CONTENT_SHAPE`, `Exits:` when the message names them) and
|
|
707
|
-
* `create-lore-entry`'s **review gate** holds it — even from the person's own
|
|
708
|
-
* row, because the row may say more than the room. Approved, it lands as a
|
|
709
|
-
* **location**; rejected, nothing is written.
|
|
710
|
-
*
|
|
711
|
-
* ⚠ **`effects: 'world'` in the `message` venue.** A row's ⋮ is the owner's
|
|
712
|
-
* side of the effects line since this action (`WORLD_ACTION_VENUES`, R11):
|
|
713
|
-
* the owner's own press, the row its subject. `act` stays `owner`; no block
|
|
714
|
-
* names it; no answer pipeline presses it.
|
|
715
|
-
* @internal
|
|
716
|
-
*/
|
|
717
|
-
export const lairFileRoomSpec = () => compile(spec(LAIR_FILE_ROOM_SPEC_ID, {
|
|
718
|
-
version: LAIR_FILE_ROOM_VERSION,
|
|
719
|
-
taxonomy: { role: 'action' },
|
|
720
|
-
contributes: {
|
|
721
|
-
actions: [
|
|
722
|
-
{
|
|
723
|
-
key: 'file',
|
|
724
|
-
venue: { kind: 'message' },
|
|
725
|
-
icon: 'map',
|
|
726
|
-
/** The room's name (R3): which room, what it is found by, what the duplicate check reads. */
|
|
727
|
-
collects: {
|
|
728
|
-
text: {
|
|
729
|
-
need: 'required',
|
|
730
|
-
label: { en: 'Room name' },
|
|
731
|
-
placeholder: { en: 'The Sunken Vault' },
|
|
732
|
-
},
|
|
733
|
-
},
|
|
734
|
-
enabledWhen: [
|
|
735
|
-
{
|
|
736
|
-
on: 'item.characterLine',
|
|
737
|
-
equals: false,
|
|
738
|
-
reason: {
|
|
739
|
-
en: "a delver's line is theirs, not the dungeon's plan — file a room from your own lines or the Castellan's",
|
|
740
|
-
},
|
|
741
|
-
},
|
|
742
|
-
{
|
|
743
|
-
on: 'item.hidden',
|
|
744
|
-
equals: false,
|
|
745
|
-
reason: { en: 'unhide it first — a hidden message is left out of what the Castellan reads' },
|
|
746
|
-
},
|
|
747
|
-
{ on: 'item.generating', equals: false, reason: { en: 'wait for the message to finish' } },
|
|
748
|
-
],
|
|
749
|
-
/** Lorebook data: outside the story (R-15 *The line*), the owner's alone. */
|
|
750
|
-
effects: 'world',
|
|
751
|
-
audience: { see: ['participant'], act: ['owner'] },
|
|
752
|
-
label: { en: 'File as a room' },
|
|
753
|
-
description: {
|
|
754
|
-
en: 'Save the room this message describes to the lorebook. Name it; the Castellan drafts the entry from the message, and you edit it before it is saved.',
|
|
755
|
-
},
|
|
756
|
-
},
|
|
757
|
-
],
|
|
758
|
-
},
|
|
759
|
-
})
|
|
760
|
-
.inlet('input', C.userMessage.v1(), {
|
|
761
|
-
genre: lairGenre,
|
|
762
|
-
event: sessionEvents.sessionAction,
|
|
763
|
-
})
|
|
764
|
-
.gather('gather', { mode: 'parallel' }, (b) => b
|
|
765
|
-
/** The message the press was made on — one row, by id. */
|
|
766
|
-
.chain('row', (c) => c.query('read', ($) => C.sessionHistory.v1({
|
|
767
|
-
scope: $.input.sessionScope,
|
|
768
|
-
messageId: $.input.messageId,
|
|
769
|
-
params: slot.params(),
|
|
770
|
-
})))
|
|
771
|
-
/** The book's public half — world lore and history, never character lore (see the note on `CASTELLAN`). */
|
|
772
|
-
.chain('worldLore', (c) => c.query('read', ($) => C.worldLore.v1({
|
|
773
|
-
scope: $.input.sessionScope,
|
|
774
|
-
params: slot.params(),
|
|
775
|
-
})))
|
|
776
|
-
.chain('historyEntries', (c) => c.query('read', ($) => C.historyEntries.v1({
|
|
777
|
-
scope: $.input.sessionScope,
|
|
778
|
-
params: slot.params({ node: 'gather.worldLore.read' }),
|
|
779
|
-
})))
|
|
780
|
-
/** The dungeon's rooms (location entries, the preset): checked first, and named to the draft. */
|
|
781
|
-
.chain('rooms', (c) => c.query('read', ($) => C.lorebookEntries.v1({
|
|
782
|
-
scope: $.input.sessionScope,
|
|
783
|
-
params: slot.params(),
|
|
784
|
-
}), { expose: { label: 'Rooms' } }))
|
|
785
|
-
/** The whole book, any entry type — a room is filed when ANY entry answers to its name (R7). */
|
|
786
|
-
.chain('lorebook', (c) => c.query('read', ($) => C.lorebookEntries.v1({
|
|
787
|
-
scope: $.input.sessionScope,
|
|
788
|
-
params: slot.params(),
|
|
789
|
-
})))
|
|
790
|
-
.chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope })))
|
|
791
|
-
.chain('state', (c) => c.query('read', ($) => C.sessionState.v1({ scope: $.input.sessionScope }))))
|
|
792
|
-
/**
|
|
793
|
-
* Is the name already in the book — the SDK's name rule, entries
|
|
794
|
-
* only (`messages` unwired: the row being filed is prose, and would
|
|
795
|
-
* describe the room it describes). `undescribed` is the name,
|
|
796
|
-
* trimmed, when nothing answers to it.
|
|
797
|
-
*/
|
|
798
|
-
.task('check', ($) => C.undescribedName.v1({
|
|
799
|
-
name: $.input.text,
|
|
800
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
801
|
-
entries: $.gather.lorebook.read.entries,
|
|
802
|
-
params: slot.params(),
|
|
803
|
-
}))
|
|
804
|
-
.task('contextBudget', ($) => C.contextBudget.v1({
|
|
805
|
-
sampling: slot.samplingOf('room.new.write'),
|
|
806
|
-
connection: slot.connectionOf('room.new.write'),
|
|
807
|
-
params: slot.params(),
|
|
808
|
-
}))
|
|
809
|
-
.task('lore', ($) => C.concatCandidates.v1({
|
|
810
|
-
sources: [
|
|
811
|
-
$.gather.row.read.band,
|
|
812
|
-
$.gather.worldLore.read.main,
|
|
813
|
-
$.gather.historyEntries.read.main,
|
|
814
|
-
],
|
|
815
|
-
}))
|
|
816
|
-
// The room `{{locationEntry}}` shows (the room rule, 2026-10-02):
|
|
817
|
-
// the world's location at `world.location` (the preset's `path`),
|
|
818
|
-
// by the one room rule; the ranker leaves it out of the lore.
|
|
819
|
-
.task('place', ($) => C.undescribedName.v1({
|
|
820
|
-
name: $.gather.state.read.state,
|
|
821
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
822
|
-
params: slot.params(),
|
|
823
|
-
}), { expose: { label: 'The current place' } })
|
|
824
|
-
// Who is in the world at the session's moment (R4), for `eligible`.
|
|
825
|
-
.query('presences', ($) => C.castPresences.v1({ scope: $.input.sessionScope }))
|
|
826
|
-
// The hard gates before the ranker (C2; R2, R4): selective-logic
|
|
827
|
-
// exclusions from the keyword lanes, and the presence gate.
|
|
828
|
-
.task('eligible', ($) => C.eligibility.v1({
|
|
829
|
-
candidates: $.lore.candidates,
|
|
830
|
-
exclusions: [$.gather.worldLore.read.exclusions, $.gather.historyEntries.read.exclusions],
|
|
831
|
-
presences: $.presences.main,
|
|
832
|
-
at: $.presences.at,
|
|
833
|
-
}))
|
|
834
|
-
.task('rank', ($) => C.rankHybrid.v1({
|
|
835
|
-
candidates: $.eligible.candidates,
|
|
836
|
-
budget: $.contextBudget.available,
|
|
837
|
-
shownElsewhere: $.place.entryId,
|
|
838
|
-
params: slot.params(),
|
|
839
|
-
}))
|
|
840
|
-
/**
|
|
841
|
-
* 🚧 **The files those rows show** (attachments follow-ups, owner
|
|
842
|
-
* ruling 2026-10-03), read once on the spine; the drafting arm below
|
|
843
|
-
* places them for `room.new.write` — an image it can read rides its own
|
|
844
|
-
* turn, otherwise its name. No files, and the arm's prompt is byte for
|
|
845
|
-
* byte what it was.
|
|
846
|
-
*/
|
|
847
|
-
.query('attachments', ($) => C.historyAttachments.v1({
|
|
848
|
-
messages: $.gather.row.read.messages,
|
|
849
|
-
params: slot.params(),
|
|
850
|
-
}))
|
|
851
|
-
.junction('room', { on: ($) => $.check.undescribed }, (r) => r
|
|
852
|
-
/**
|
|
853
|
-
* Not in the book: the Castellan drafts it from the row, in
|
|
854
|
-
* the dungeon's layout, and the master edits it at the gate.
|
|
855
|
-
* The name is the one typed (trimmed); the other rooms are
|
|
856
|
-
* named to the draft so its exits can point at them.
|
|
857
|
-
*/
|
|
858
|
-
.when('new', { truthy: true }, (c) => c
|
|
859
|
-
.task('context', ($) => C.buildTemplateContext.v1({
|
|
860
|
-
cast: $.gather.cast.read.cast,
|
|
861
|
-
state: $.gather.state.read.state,
|
|
862
|
-
locationEntries: $.gather.rooms.read.entries,
|
|
863
|
-
turnDirection: $.check.undescribed,
|
|
864
|
-
prompts: slot.prompts(),
|
|
865
|
-
variables: slot.variables(),
|
|
866
|
-
}))
|
|
867
|
-
/** The one row, as prose: the draft is written from it and nothing else said. */
|
|
868
|
-
.task('lines', ($) => C.proseTranscript.v1({
|
|
869
|
-
messages: $.gather.row.read.messages,
|
|
870
|
-
cast: $.gather.cast.read.cast,
|
|
871
|
-
templateContext: $.room.new.context.templateContext,
|
|
872
|
-
}))
|
|
873
|
-
.task('attached', ($) => C.placeAttachments.v1({
|
|
874
|
-
messages: $.room.new.lines.messages,
|
|
875
|
-
attachments: $.attachments.attachments,
|
|
876
|
-
connection: slot.connectionOf('room.new.write'),
|
|
877
|
-
params: slot.params(),
|
|
878
|
-
}))
|
|
879
|
-
.task('prompt', ($) => C.assemble.v2({
|
|
880
|
-
candidates: $.rank.candidates,
|
|
881
|
-
decisions: $.rank.decisions,
|
|
882
|
-
groups: $.rank.groups,
|
|
883
|
-
budget: $.contextBudget.available,
|
|
884
|
-
messages: $.room.new.attached.messages,
|
|
885
|
-
templateContext: $.room.new.context.templateContext,
|
|
886
|
-
template: slot.template(),
|
|
887
|
-
prompts: slot.prompts({ node: 'room.new.context' }),
|
|
888
|
-
variables: slot.variables(),
|
|
889
|
-
params: slot.params(),
|
|
890
|
-
connection: slot.connectionOf('room.new.write'),
|
|
891
|
-
}))
|
|
892
|
-
.oracle('write', ($) => C.generateText.v1({
|
|
893
|
-
context: $.room.new.prompt.context,
|
|
894
|
-
connection: slot.connection(),
|
|
895
|
-
sampling: slot.sampling(),
|
|
896
|
-
params: slot.params(),
|
|
897
|
-
}), { expose: { status: 'The Castellan drafts the room' } })
|
|
898
|
-
.outlet('save', ($) => C.createLoreEntry.v1({
|
|
899
|
-
name: $.check.undescribed,
|
|
900
|
-
content: $.room.new.write.text,
|
|
901
|
-
params: slot.params(),
|
|
902
|
-
})))
|
|
903
|
-
/**
|
|
904
|
-
* Already in the book: nothing is filed twice. The Castellan
|
|
905
|
-
* says so at its own table — a plain line, no model call —
|
|
906
|
-
* so the press is answered rather than silent.
|
|
907
|
-
*/
|
|
908
|
-
.otherwise('exists', (c) => c
|
|
909
|
-
.task('note', ($) => C.joinText.v1({
|
|
910
|
-
items: [
|
|
911
|
-
$.input.text,
|
|
912
|
-
'is already in the lorebook, so nothing new was filed. Edit that entry to change it.',
|
|
913
|
-
],
|
|
914
|
-
params: slot.params(),
|
|
915
|
-
}))
|
|
916
|
-
.outlet('said', ($) => C.createMessage.v1({
|
|
917
|
-
text: $.room.exists.note.text,
|
|
918
|
-
speaker: CASTELLAN,
|
|
919
|
-
channel: SANCTUM_CHANNEL,
|
|
920
|
-
}))))
|
|
921
|
-
/**
|
|
922
|
-
* ⚠ **The gate is the point** — `resolvePosition` defaults an
|
|
923
|
-
* undeclared review position to `off`, so without this line the
|
|
924
|
-
* draft would land unseen. A room is a place (L3).
|
|
925
|
-
*/
|
|
926
|
-
.preset('lair', { label: 'Lair', default: true }, (p) => p
|
|
927
|
-
.settings('room.new.save', { review: 'on' })
|
|
928
|
-
.params('room.new.save', { entryType: 'core:entry/location' })
|
|
929
|
-
.params('gather.rooms.read', { entryTypes: ['core:entry/location'] })
|
|
930
|
-
.params('room.exists.note', { path: '', separator: ' ' })
|
|
931
|
-
// The room the place slot shows (the room rule).
|
|
932
|
-
.params('place', { path: 'world.location' }))
|
|
933
|
-
.build());
|
|
934
|
-
/* ── The two steering actions that write state ──────────────────────────── */
|
|
935
|
-
/** @internal */
|
|
936
|
-
export const LAIR_NUDGE_SPEC_ID = 'core:spec/lair-nudge';
|
|
937
|
-
/** @internal */
|
|
938
|
-
export const LAIR_NUDGE_VERSION = '1.0.0';
|
|
939
|
-
/**
|
|
940
|
-
* **Nudge**: a directive to the Castellan's planner that produces no message.
|
|
941
|
-
*
|
|
942
|
-
* The shortest pipeline in the catalog that does anything: no model call, no
|
|
943
|
-
* retrieval, no transcript. The collected text (R3) becomes
|
|
944
|
-
* `core:slot/direction@1` on the world, the planner takes `state` on its own
|
|
945
|
-
* port, and the note is in the next turn's prompt.
|
|
946
|
-
*
|
|
947
|
-
* ⚠ **`apply`, not `propose`** — the one place in this genre where a state
|
|
948
|
-
* write skips the review the state-keeper's changes get. The argument for
|
|
949
|
-
* `propose` is that a *model* is not authoritative about the fiction
|
|
950
|
-
* (`set-state`'s own header). Here the writer is the person who owns the
|
|
951
|
-
* session, typing into their own composer, and asking them to accept their own
|
|
952
|
-
* instruction would be a dialog asking "did you mean what you just typed".
|
|
953
|
-
* @internal
|
|
954
|
-
*/
|
|
955
|
-
export const lairNudgeSpec = () => compile(spec(LAIR_NUDGE_SPEC_ID, {
|
|
956
|
-
version: LAIR_NUDGE_VERSION,
|
|
957
|
-
taxonomy: { role: 'action' },
|
|
958
|
-
contributes: {
|
|
959
|
-
actions: [
|
|
960
|
-
{
|
|
961
|
-
key: 'nudge',
|
|
962
|
-
venue: { kind: 'composer' },
|
|
963
|
-
quick: true,
|
|
964
|
-
icon: 'compass',
|
|
965
|
-
/** The direction is the whole instruction (R3): nothing to do without it. */
|
|
966
|
-
collects: {
|
|
967
|
-
text: { need: 'required', label: { en: 'Direction the party should feel' } },
|
|
968
|
-
},
|
|
969
|
-
label: { en: 'Nudge' },
|
|
970
|
-
description: {
|
|
971
|
-
en: 'Tell the Castellan what you want next. It writes no message — the next turn just follows it.',
|
|
972
|
-
},
|
|
973
|
-
},
|
|
974
|
-
],
|
|
975
|
-
},
|
|
976
|
-
})
|
|
977
|
-
.inlet('input', C.userMessage.v1(), {
|
|
978
|
-
genre: lairGenre,
|
|
979
|
-
event: sessionEvents.sessionAction,
|
|
980
|
-
})
|
|
981
|
-
.query('state', ($) => C.sessionState.v1({ scope: $.input.sessionScope }))
|
|
982
|
-
/**
|
|
983
|
-
* A literal change with the collected text in it. A nested literal
|
|
984
|
-
* is how one port takes a reference (`concat-candidates`' `sources`
|
|
985
|
-
* is the same construction), and this node is here rather than
|
|
986
|
-
* `set-state` alone because it is what turns the word `world` into
|
|
987
|
-
* a row and `direction` into `core:slot/direction@1` — and what
|
|
988
|
-
* refuses a note longer than the slot accepts, with a sentence.
|
|
989
|
-
*/
|
|
990
|
-
.query('resolve', ($) => C.resolveStateChanges.v1({
|
|
991
|
-
changes: [
|
|
992
|
-
{ owner: 'world', slot: 'direction', value: $.input.text },
|
|
993
|
-
],
|
|
994
|
-
scope: $.input.sessionScope,
|
|
995
|
-
base: $.state.version,
|
|
996
|
-
}))
|
|
997
|
-
.task('apply', ($) => C.setState.v1({
|
|
998
|
-
changes: $.resolve.changes,
|
|
999
|
-
scope: $.input.sessionScope,
|
|
1000
|
-
base: $.state.version,
|
|
1001
|
-
params: slot.params(),
|
|
1002
|
-
}))
|
|
1003
|
-
.preset('lair', { label: 'Lair', default: true }, (p) => p.params('apply', { mode: 'apply' }))
|
|
1004
|
-
.build());
|
|
1005
|
-
/** @internal */
|
|
1006
|
-
export const LAIR_WHISPER_SPEC_ID = 'core:spec/lair-whisper';
|
|
1007
|
-
/** @internal */
|
|
1008
|
-
export const LAIR_WHISPER_VERSION = '1.0.0';
|
|
1009
|
-
/**
|
|
1010
|
-
* **Whisper**: a private instruction to the delvers the master picks, which
|
|
1011
|
-
* writes no message (lair re-plan R10, owner ruling 5, 2026-09-28).
|
|
1012
|
-
*
|
|
1013
|
-
* The press collects **who hears it** (`collects.recipients`, the session's
|
|
1014
|
-
* enabled cast, validated by the host) and **what it says**
|
|
1015
|
-
* (`collects.text`), and the run writes that line on
|
|
1016
|
-
* `core:slot/whisper@1` of each recipient — `resolve-state-changes@1`'s
|
|
1017
|
-
* `owners` port makes the one change once per recipient. **Pure:** no model
|
|
1018
|
-
* call. The model step that read a name off the typed line ("Verity: hold
|
|
1019
|
-
* the line") and its "Lair whisper" prompt row are retired: the modal asks
|
|
1020
|
-
* who, so nothing has to guess.
|
|
1021
|
-
*
|
|
1022
|
-
* **Heard by the recipients alone** (earshot, lair pass R1): the slot
|
|
1023
|
-
* declares `earshot: 'holder'`, so each recipient's own voice reads it and no
|
|
1024
|
-
* other prompt does — not another delver's, and none of the Castellan's
|
|
1025
|
-
* (planner, keeper, narration, Sanctum talk). A whispered delver acts on it
|
|
1026
|
-
* when they next speak; **Pick who speaks** gives them the floor now.
|
|
1027
|
-
*
|
|
1028
|
-
* ⚠ One standing note per delver, not a queue: a slot holds one value, so a
|
|
1029
|
-
* new whisper REPLACES a recipient's old one, and a delver it does not name
|
|
1030
|
-
* keeps theirs. The modal shows each delver's current whisper
|
|
1031
|
-
* (`recipients.overwrites`), so the overwrite is visible before it happens.
|
|
1032
|
-
* @internal
|
|
1033
|
-
*/
|
|
1034
|
-
export const lairWhisperSpec = () => compile(spec(LAIR_WHISPER_SPEC_ID, {
|
|
1035
|
-
version: LAIR_WHISPER_VERSION,
|
|
1036
|
-
taxonomy: { role: 'action' },
|
|
1037
|
-
contributes: {
|
|
1038
|
-
actions: [
|
|
1039
|
-
{
|
|
1040
|
-
key: 'whisper',
|
|
1041
|
-
venue: { kind: 'composer' },
|
|
1042
|
-
quick: true,
|
|
1043
|
-
icon: 'ear',
|
|
1044
|
-
/** Who hears it and what it says (R3, R10): nothing to do without either. */
|
|
1045
|
-
collects: {
|
|
1046
|
-
recipients: {
|
|
1047
|
-
label: { en: 'Who hears it' },
|
|
1048
|
-
min: 1,
|
|
1049
|
-
overwrites: 'core:slot/whisper@1',
|
|
1050
|
-
},
|
|
1051
|
-
text: { need: 'required', label: { en: 'What do you whisper?' } },
|
|
1052
|
-
},
|
|
1053
|
-
label: { en: 'Whisper' },
|
|
1054
|
-
description: {
|
|
1055
|
-
en: 'Tell the delvers you pick something only they hear. Nobody else does — not the rest of the party, and not the Castellan.',
|
|
1056
|
-
},
|
|
1057
|
-
},
|
|
1058
|
-
],
|
|
1059
|
-
},
|
|
1060
|
-
})
|
|
1061
|
-
.inlet('input', C.userMessage.v1(), {
|
|
1062
|
-
genre: lairGenre,
|
|
1063
|
-
event: sessionEvents.sessionAction,
|
|
1064
|
-
})
|
|
1065
|
-
.query('state', ($) => C.sessionState.v1({ scope: $.input.sessionScope }))
|
|
1066
|
-
/**
|
|
1067
|
-
* One change naming no owner, made once per recipient: the
|
|
1068
|
-
* `owners` port is what turns `character:<id>` into that seated
|
|
1069
|
-
* delver's row, and the slot's own validation is what refuses a
|
|
1070
|
-
* line longer than it accepts, with a sentence.
|
|
1071
|
-
*/
|
|
1072
|
-
.query('resolve', ($) => C.resolveStateChanges.v1({
|
|
1073
|
-
changes: [{ slot: 'whisper', value: $.input.text }],
|
|
1074
|
-
owners: $.input.recipients,
|
|
1075
|
-
scope: $.input.sessionScope,
|
|
1076
|
-
base: $.state.version,
|
|
1077
|
-
}))
|
|
1078
|
-
/** Applied rather than proposed — the master's own instruction; see Nudge. */
|
|
1079
|
-
.task('apply', ($) => C.setState.v1({
|
|
1080
|
-
changes: $.resolve.changes,
|
|
1081
|
-
scope: $.input.sessionScope,
|
|
1082
|
-
base: $.state.version,
|
|
1083
|
-
params: slot.params(),
|
|
1084
|
-
}))
|
|
1085
|
-
.preset('lair', { label: 'Lair', default: true }, (p) => p.params('apply', { mode: 'apply' }))
|
|
1086
|
-
.build());
|
|
1087
|
-
/* ── The Castellan's two turns ──────────────────────────────────────────── */
|
|
1088
|
-
/**
|
|
1089
|
-
* Trigger trap and Reveal are one graph with two sets of instructions, and
|
|
1090
|
-
* saying so in a builder is more honest than writing it twice — Adventure's
|
|
1091
|
-
* `keeperAction` makes the same call for the same reason.
|
|
1092
|
-
*
|
|
1093
|
-
* Both are Adventure's *Look*: the Castellan describes something from the lore
|
|
1094
|
-
* and the world state, changes nothing, and writes one message. They are
|
|
1095
|
-
* separate SPECS rather than one spec with a parameter because a shipped
|
|
1096
|
-
* prompt is resolved per (pool, spec) — two specs is what gives the trap its
|
|
1097
|
-
* own instructions and the reveal its own, in the same pool, each editable
|
|
1098
|
-
* without touching the other.
|
|
1099
|
-
*/
|
|
1100
|
-
const castellanAction = (id, version, trigger) => compile(spec(id, {
|
|
1101
|
-
version,
|
|
1102
|
-
taxonomy: { role: 'action' },
|
|
1103
|
-
contributes: {
|
|
1104
|
-
actions: [
|
|
1105
|
-
{
|
|
1106
|
-
key: trigger.key,
|
|
1107
|
-
venue: { kind: 'composer' },
|
|
1108
|
-
quick: true,
|
|
1109
|
-
icon: trigger.icon,
|
|
1110
|
-
/** What the master says rides as the turn's instructions — or nothing, and the room decides (R3). */
|
|
1111
|
-
collects: {
|
|
1112
|
-
text: { need: 'optional', label: { en: trigger.ask }, ifEmpty: { en: 'The room decides.' } },
|
|
1113
|
-
},
|
|
1114
|
-
label: { en: trigger.label },
|
|
1115
|
-
description: { en: trigger.description },
|
|
1116
|
-
},
|
|
1117
|
-
],
|
|
1118
|
-
},
|
|
1119
|
-
})
|
|
1120
|
-
.inlet('input', C.userMessage.v1(), {
|
|
1121
|
-
genre: lairGenre,
|
|
1122
|
-
event: sessionEvents.sessionAction,
|
|
1123
|
-
})
|
|
1124
|
-
/**
|
|
1125
|
-
* The row, opened before anything is read — the Castellan's, by
|
|
1126
|
-
* name (R8, owner F2 2026-09-28: Trap and Reveal are the
|
|
1127
|
-
* Castellan's). Not `narration`: a trap is the Castellan taking a
|
|
1128
|
-
* turn, not a side note beside one. It streams while `write` runs
|
|
1129
|
-
* (`expose.stream`) and `save` finishes it. What the master typed
|
|
1130
|
-
* is stored beside it as the turn's instructions — never as its
|
|
1131
|
-
* text.
|
|
1132
|
-
*/
|
|
1133
|
-
.outlet('placeholder', ($) => C.createMessage.v1({
|
|
1134
|
-
generating: true,
|
|
1135
|
-
speaker: `envoy:${LAIR_CASTELLAN_KEY}`,
|
|
1136
|
-
instructions: $.input.text,
|
|
1137
|
-
}))
|
|
1138
|
-
// Before the reads (history window, 2026-10-03): the history read
|
|
1139
|
-
// is sized by this budget, so it is computed first. It reads only
|
|
1140
|
-
// config, never a step, so moving it changes no value.
|
|
1141
|
-
.task('contextBudget', ($) => C.contextBudget.v1({
|
|
1142
|
-
sampling: slot.samplingOf('write'),
|
|
1143
|
-
connection: slot.connectionOf('write'),
|
|
1144
|
-
params: slot.params(),
|
|
1145
|
-
}))
|
|
1146
|
-
.gather('gather', { mode: 'parallel' }, (b) => b
|
|
1147
|
-
.chain('history', (c) => c.query('read', ($) => C.sessionHistory.v1({
|
|
1148
|
-
scope: $.input.sessionScope,
|
|
1149
|
-
// Sized by the window (history window, 2026-10-03).
|
|
1150
|
-
budget: $.contextBudget.available,
|
|
1151
|
-
params: slot.params(),
|
|
1152
|
-
})))
|
|
1153
|
-
.chain('lore', (c) => c.query('read', ($) => C.lorebookTriggers.v1({
|
|
1154
|
-
scope: $.input.sessionScope,
|
|
1155
|
-
params: slot.params(),
|
|
1156
|
-
})))
|
|
1157
|
-
.chain('cast', (c) => c.query('read', ($) => C.sessionCast.v1({ scope: $.input.sessionScope })))
|
|
1158
|
-
.chain('state', (c) => c.query('read', ($) => C.sessionState.v1({ scope: $.input.sessionScope }))))
|
|
1159
|
-
.task('lore', ($) => C.concatCandidates.v1({
|
|
1160
|
-
sources: [$.gather.history.read.band, $.gather.lore.read.main],
|
|
1161
|
-
}))
|
|
1162
|
-
// Who is in the world at the session's moment (R4), for `eligible`.
|
|
1163
|
-
.query('presences', ($) => C.castPresences.v1({ scope: $.input.sessionScope }))
|
|
1164
|
-
// The hard gates before the ranker (C2; R2, R4): selective-logic
|
|
1165
|
-
// exclusions from the keyword lanes, and the presence gate.
|
|
1166
|
-
.task('eligible', ($) => C.eligibility.v1({
|
|
1167
|
-
candidates: $.lore.candidates,
|
|
1168
|
-
exclusions: $.gather.lore.read.exclusions,
|
|
1169
|
-
presences: $.presences.main,
|
|
1170
|
-
at: $.presences.at,
|
|
1171
|
-
}))
|
|
1172
|
-
.task('rank', ($) => C.rankHybrid.v1({
|
|
1173
|
-
candidates: $.eligible.candidates,
|
|
1174
|
-
budget: $.contextBudget.available,
|
|
1175
|
-
params: slot.params(),
|
|
1176
|
-
}))
|
|
1177
|
-
/**
|
|
1178
|
-
* `build-template-context@1` rather than the narrator builder,
|
|
1179
|
-
* builder, for the one port that decides it: `state`. A trap that
|
|
1180
|
-
* did not know which floor the party is on, and a reveal that did
|
|
1181
|
-
* not know where they are standing, would be describing a dungeon
|
|
1182
|
-
* in general.
|
|
1183
|
-
*/
|
|
1184
|
-
.task('context', ($) => C.buildTemplateContext.v1({
|
|
1185
|
-
cast: $.gather.cast.read.cast,
|
|
1186
|
-
state: $.gather.state.read.state,
|
|
1187
|
-
/**
|
|
1188
|
-
* What the master typed — *"the floor gives way"* — as
|
|
1189
|
-
* what to spring or reveal (B17). The prompt renders it as
|
|
1190
|
-
* `{{turnDirection}}`; blank, the room decides.
|
|
1191
|
-
*/
|
|
1192
|
-
turnDirection: $.input.text,
|
|
1193
|
-
prompts: slot.prompts(),
|
|
1194
|
-
variables: slot.variables(),
|
|
1195
|
-
}))
|
|
1196
|
-
.task('lines', ($) => C.processMessages.v1({
|
|
1197
|
-
messages: $.gather.history.read.messages,
|
|
1198
|
-
cast: $.gather.cast.read.cast,
|
|
1199
|
-
templateContext: $.context.templateContext,
|
|
1200
|
-
seedName: $.context.seedName,
|
|
1201
|
-
}))
|
|
1202
|
-
/**
|
|
1203
|
-
* 🚧 **The transcript's files, placed** (attachments follow-ups, owner
|
|
1204
|
-
* ruling 2026-10-03) — `respond`'s two steps: the files the rows show,
|
|
1205
|
-
* then per line what `write` receives (an image it can read rides its
|
|
1206
|
-
* own turn; otherwise its name). A transcript with no files passes
|
|
1207
|
-
* through untouched, so the prompt is byte for byte what it was.
|
|
1208
|
-
*/
|
|
1209
|
-
.query('attachments', ($) => C.historyAttachments.v1({
|
|
1210
|
-
messages: $.gather.history.read.messages,
|
|
1211
|
-
params: slot.params(),
|
|
1212
|
-
}))
|
|
1213
|
-
.task('attached', ($) => C.placeAttachments.v1({
|
|
1214
|
-
messages: $.lines.messages,
|
|
1215
|
-
attachments: $.attachments.attachments,
|
|
1216
|
-
connection: slot.connectionOf('write'),
|
|
1217
|
-
params: slot.params(),
|
|
1218
|
-
}))
|
|
1219
|
-
.task('prompt', ($) => C.assemble.v2({
|
|
1220
|
-
candidates: $.rank.candidates,
|
|
1221
|
-
decisions: $.rank.decisions,
|
|
1222
|
-
groups: $.rank.groups,
|
|
1223
|
-
budget: $.contextBudget.available,
|
|
1224
|
-
messages: $.attached.messages,
|
|
1225
|
-
templateContext: $.context.templateContext,
|
|
1226
|
-
template: slot.template(),
|
|
1227
|
-
prompts: slot.prompts({ node: 'context' }),
|
|
1228
|
-
variables: slot.variables(),
|
|
1229
|
-
params: slot.params(),
|
|
1230
|
-
connection: slot.connectionOf('write'),
|
|
1231
|
-
}))
|
|
1232
|
-
.oracle('write', ($) => C.generateText.v1({
|
|
1233
|
-
context: $.prompt.context,
|
|
1234
|
-
connection: slot.connection(),
|
|
1235
|
-
sampling: slot.sampling(),
|
|
1236
|
-
params: slot.params(),
|
|
1237
|
-
}), { expose: { stream: true, status: trigger.status } })
|
|
1238
|
-
/**
|
|
1239
|
-
* The placeholder, finished: the prose, and the Castellan's
|
|
1240
|
-
* reasoning folded as the row's Reasoning (the B5 pattern — absent
|
|
1241
|
-
* when the model gave none, and the port is skipped).
|
|
1242
|
-
*/
|
|
1243
|
-
.outlet('save', ($) => C.updateMessage.v1({
|
|
1244
|
-
target: $.placeholder.messageId,
|
|
1245
|
-
text: $.write.text,
|
|
1246
|
-
reasoning: $.write.reasoning,
|
|
1247
|
-
}))
|
|
1248
|
-
/**
|
|
1249
|
-
* What this step ships with: the post-history reminder's trigger
|
|
1250
|
-
* (`POST_HISTORY_TOKEN_TRIGGER`), because the prompt renders the
|
|
1251
|
-
* session's growing history and the reminder only earns its place
|
|
1252
|
-
* once there is enough of it to drift from.
|
|
1253
|
-
*/
|
|
1254
|
-
.preset('default', { label: 'Default', default: true }, (p) => p.params('prompt', { postHistoryTokenTrigger: POST_HISTORY_TOKEN_TRIGGER }))
|
|
1255
|
-
.build());
|
|
1256
|
-
// ⚠ Trap and Reveal, edited in place (history window, 2026-10-03) —
|
|
1257
|
-
// content-addressed; `specHashes.test.ts` records the move. The shared
|
|
1258
|
-
// `castellanAction` computes `contextBudget` before the reads and its history
|
|
1259
|
-
// read takes the `budget`, so the transcript fit, not the newest 100 rows,
|
|
1260
|
-
// decides where the conversation starts.
|
|
1261
|
-
/** @internal */
|
|
1262
|
-
export const LAIR_TRAP_SPEC_ID = 'core:spec/lair-trap';
|
|
1263
|
-
/** @internal */
|
|
1264
|
-
export const LAIR_TRAP_VERSION = '1.0.0';
|
|
1265
|
-
/** Spring something the party walked into. The Castellan tells them what it cost. @internal */
|
|
1266
|
-
export const lairTrapSpec = () => castellanAction(LAIR_TRAP_SPEC_ID, LAIR_TRAP_VERSION, {
|
|
1267
|
-
key: 'trap',
|
|
1268
|
-
icon: 'zap',
|
|
1269
|
-
label: 'Trigger trap',
|
|
1270
|
-
description: 'Springs a trap in the room the party are in, and the Castellan tells what it cost them. Say what the trap is, or leave it to the room.',
|
|
1271
|
-
status: 'Springing a trap',
|
|
1272
|
-
ask: 'What is the trap?',
|
|
1273
|
-
});
|
|
1274
|
-
/** @internal */
|
|
1275
|
-
export const LAIR_REVEAL_SPEC_ID = 'core:spec/lair-reveal';
|
|
1276
|
-
/** @internal */
|
|
1277
|
-
export const LAIR_REVEAL_VERSION = '1.0.0';
|
|
1278
|
-
/** Show the party something that was already there. @internal */
|
|
1279
|
-
export const lairRevealSpec = () => castellanAction(LAIR_REVEAL_SPEC_ID, LAIR_REVEAL_VERSION, {
|
|
1280
|
-
key: 'reveal',
|
|
1281
|
-
icon: 'eye',
|
|
1282
|
-
label: 'Reveal',
|
|
1283
|
-
description: 'Uncovers something hidden in the room the party are in — a detail that was there all along. Say what they notice, or leave it to the room.',
|
|
1284
|
-
status: 'Revealing',
|
|
1285
|
-
ask: 'What do they notice?',
|
|
1286
|
-
});
|
|
1287
|
-
//# sourceMappingURL=lairActions.js.map
|