@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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import MessageMediaStrip from "./MessageMediaStrip.svelte"
|
|
13
13
|
import { mediaStripItems, viewImageParams } from "./mediaStrip"
|
|
14
14
|
import MessageStateLedger from "./MessageStateLedger.svelte"
|
|
15
|
-
import { useWidgetContext } from "../
|
|
15
|
+
import { useWidgetContext } from "../context"
|
|
16
16
|
import { staleOf } from "@serene-pub/core-catalog/conversation"
|
|
17
17
|
import { untrack } from "svelte"
|
|
18
18
|
import { useConversation } from "./conversation.svelte"
|
|
@@ -34,9 +34,19 @@
|
|
|
34
34
|
* as `--sp-scene`, which the badge below inherits.
|
|
35
35
|
*/
|
|
36
36
|
sceneName?: string | null
|
|
37
|
+
/**
|
|
38
|
+
* Folio (PLAN-core-widgets §3.7): the line is a paragraph of one
|
|
39
|
+
* block of prose. Only its content is drawn — no avatar, identity
|
|
40
|
+
* or controls cell, so no name row, time or swipes (not rendered,
|
|
41
|
+
* never merely hidden) — and its menu, its edit's Save and Cancel,
|
|
42
|
+
* the selection's choices and Stop sit in `messages.folio-controls`
|
|
43
|
+
* at the paragraph's edge. The element, its `#message-<id>` and its
|
|
44
|
+
* `data-msg-*` stay, so j/k, anchors and the state overlays hold.
|
|
45
|
+
*/
|
|
46
|
+
folio?: boolean
|
|
37
47
|
}
|
|
38
48
|
|
|
39
|
-
let { msg, index, isLastMessage, sceneName = null }: Props = $props()
|
|
49
|
+
let { msg, index, isLastMessage, sceneName = null, folio = false }: Props = $props()
|
|
40
50
|
|
|
41
51
|
const conv = useConversation()
|
|
42
52
|
const line = $derived(conv.line(msg.id))
|
|
@@ -368,7 +378,9 @@
|
|
|
368
378
|
content — plus the media strip, a fifth cell under content when the
|
|
369
379
|
message has files — and the `data-msg-*` attributes a pack keys its look off. Every
|
|
370
380
|
element is a widget part (`messages.message-*`, STYLE-GUIDE §6.16): no look
|
|
371
|
-
here; the default widget stylesheet draws them, and a pack restyles them.
|
|
381
|
+
here; the default widget stylesheet draws them, and a pack restyles them.
|
|
382
|
+
Folio draws the content cell alone (and the media strip under it): the
|
|
383
|
+
line is a paragraph, and the stage it sits on says so (`messages.folio`). -->
|
|
372
384
|
<div
|
|
373
385
|
id="message-{msg.id}"
|
|
374
386
|
data-widget-part="messages.message"
|
|
@@ -393,6 +405,7 @@
|
|
|
393
405
|
? '...'
|
|
394
406
|
: ''}"
|
|
395
407
|
>
|
|
408
|
+
{#if !folio}
|
|
396
409
|
<span data-widget-part="messages.message-avatar">
|
|
397
410
|
{#if msg.isNarratorResponse}
|
|
398
411
|
<span
|
|
@@ -513,9 +526,9 @@
|
|
|
513
526
|
</span>
|
|
514
527
|
{/if}
|
|
515
528
|
</div>
|
|
529
|
+
{/if}
|
|
516
530
|
|
|
517
|
-
|
|
518
|
-
{#if isEditing}
|
|
531
|
+
{#snippet editButtons()}
|
|
519
532
|
<button
|
|
520
533
|
data-widget-part="messages.message-cancel"
|
|
521
534
|
title="Cancel edit (Esc)"
|
|
@@ -535,6 +548,12 @@
|
|
|
535
548
|
>
|
|
536
549
|
Save
|
|
537
550
|
</button>
|
|
551
|
+
{/snippet}
|
|
552
|
+
|
|
553
|
+
{#if !folio}
|
|
554
|
+
<div data-widget-part="messages.message-controls">
|
|
555
|
+
{#if isEditing}
|
|
556
|
+
{@render editButtons()}
|
|
538
557
|
{:else}
|
|
539
558
|
{#if messageTime}
|
|
540
559
|
<span data-widget-part="messages.message-time">{messageTime}</span>
|
|
@@ -574,6 +593,14 @@
|
|
|
574
593
|
</div>
|
|
575
594
|
{/if}
|
|
576
595
|
|
|
596
|
+
{@render quickRow()}
|
|
597
|
+
{@render lineMenu()}
|
|
598
|
+
{@render stopButton()}
|
|
599
|
+
{/if}
|
|
600
|
+
</div>
|
|
601
|
+
{/if}
|
|
602
|
+
|
|
603
|
+
{#snippet quickRow()}
|
|
577
604
|
{#if showQuickActions}
|
|
578
605
|
<!-- The icons fade in on hover and focus on a fine pointer and
|
|
579
606
|
stand permanently on a coarse one — see messageLayouts.css,
|
|
@@ -601,7 +628,9 @@
|
|
|
601
628
|
{/each}
|
|
602
629
|
</div>
|
|
603
630
|
{/if}
|
|
631
|
+
{/snippet}
|
|
604
632
|
|
|
633
|
+
{#snippet lineMenu()}
|
|
605
634
|
<div data-widget-part="messages.message-menu">
|
|
606
635
|
{#if isSummarizationMode}
|
|
607
636
|
<!-- Selecting lines for a summary: this line's own choice, and
|
|
@@ -652,7 +681,9 @@
|
|
|
652
681
|
<MessageControls {msg} {isLastMessage} />
|
|
653
682
|
{/if}
|
|
654
683
|
</div>
|
|
684
|
+
{/snippet}
|
|
655
685
|
|
|
686
|
+
{#snippet stopButton()}
|
|
656
687
|
{#if msg.isGenerating}
|
|
657
688
|
<button
|
|
658
689
|
data-widget-part="messages.message-stop"
|
|
@@ -662,10 +693,24 @@
|
|
|
662
693
|
Stop
|
|
663
694
|
</button>
|
|
664
695
|
{/if}
|
|
665
|
-
|
|
666
|
-
</div>
|
|
696
|
+
{/snippet}
|
|
667
697
|
|
|
668
698
|
<div data-widget-part="messages.message-content">
|
|
699
|
+
{#if folio}
|
|
700
|
+
<!-- Folio's controls (PLAN-core-widgets §3.7): what the controls
|
|
701
|
+
cell holds less the time and the swipes, at the paragraph's
|
|
702
|
+
edge — shown on hover and focus (a tap focuses the line), and
|
|
703
|
+
standing while the line is edited, selected or generating. -->
|
|
704
|
+
<div data-widget-part="messages.folio-controls" role="group" aria-label="Line controls">
|
|
705
|
+
{#if isEditing}
|
|
706
|
+
{@render editButtons()}
|
|
707
|
+
{:else}
|
|
708
|
+
{@render quickRow()}
|
|
709
|
+
{@render lineMenu()}
|
|
710
|
+
{@render stopButton()}
|
|
711
|
+
{/if}
|
|
712
|
+
</div>
|
|
713
|
+
{/if}
|
|
669
714
|
<!-- The collapsibles a reply can carry: the Narrator's per-trigger
|
|
670
715
|
focus note, its folded sections (a Plan, B4) and the model's own
|
|
671
716
|
reasoning. All are suppressed when parts render — the section and
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The **turn line** (PLAN-core-widgets §3.16; owner 2026-10-10: "the last
|
|
4
|
+
* run and the next response trigger above the composer should be
|
|
5
|
+
* combined"): ONE row between the log and the composer, in two halves.
|
|
6
|
+
*
|
|
7
|
+
* - **Left, what the last run did** (`messages.turn-line-run`): a status
|
|
8
|
+
* pill read off the newest reply in this log — *Narrator replied ·
|
|
9
|
+
* 6.2 s*, *Wren is thinking* while it streams (the row's own run
|
|
10
|
+
* status), *Last run failed · <the row's error>* — then *Review N
|
|
11
|
+
* changes* when proposals wait for the viewer, then *Inspect run*
|
|
12
|
+
* (administrators, R55). The time is the run as this view saw it, from
|
|
13
|
+
* `generation:start` to `generation:end`: a reply that finished before
|
|
14
|
+
* the page opened has none, and says only that it replied.
|
|
15
|
+
* - **Right, who is next** (`messages.turn-line-next`): who is typing (the
|
|
16
|
+
* page's `session-banners` view), then `NextCharacterBlock` exactly as
|
|
17
|
+
* it always drew — or **Stop** while the reply streams, or **Try again**
|
|
18
|
+
* (the reply's `retry` verb, the error row's own Retry) after it failed.
|
|
19
|
+
* The `nextUp` setting governs this half; `hidden` drops it, and only
|
|
20
|
+
* it — who is typing still shows, at the row's end.
|
|
21
|
+
*
|
|
22
|
+
* In a narrow box the pill is all of the left half: its links live in the
|
|
23
|
+
* pill's own panel (`sp-popover`), which the pill opens at every width.
|
|
24
|
+
* Reads only the conversation (its rows, its dossier, its events); acts
|
|
25
|
+
* only through its verbs and requests.
|
|
26
|
+
*/
|
|
27
|
+
import { untrack } from "svelte"
|
|
28
|
+
import { SvelteMap } from "svelte/reactivity"
|
|
29
|
+
import type { StatusText } from "@serene-pub/sdk/component"
|
|
30
|
+
import type { NextUp } from "./MessagesWidget.svelte"
|
|
31
|
+
import NextCharacterBlock from "./NextCharacterBlock.svelte"
|
|
32
|
+
import StateProposalList from "./StateProposalList.svelte"
|
|
33
|
+
import { useConversation } from "./conversation.svelte"
|
|
34
|
+
|
|
35
|
+
interface Props {
|
|
36
|
+
/** The `nextUp` setting: what the right half shows; `hidden`, none of it. */
|
|
37
|
+
nextUp: NextUp
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let { nextUp }: Props = $props()
|
|
41
|
+
|
|
42
|
+
const conv = useConversation()
|
|
43
|
+
const dossier = $derived(conv.dossier)
|
|
44
|
+
|
|
45
|
+
type Row = {
|
|
46
|
+
id: number
|
|
47
|
+
isGenerating?: boolean
|
|
48
|
+
error?: { message: string; code?: string } | null
|
|
49
|
+
generationOutcome?: string | null
|
|
50
|
+
generationStatus?: unknown
|
|
51
|
+
characterId?: number | null
|
|
52
|
+
isNarratorResponse?: boolean
|
|
53
|
+
speakerLabel?: string | null
|
|
54
|
+
metadata?: { isGreeting?: boolean }
|
|
55
|
+
}
|
|
56
|
+
const rows = $derived(conv.rows as Row[])
|
|
57
|
+
/** A reply some run wrote: a greeting opens the session, no run wrote it. */
|
|
58
|
+
const isReply = (m: Row) =>
|
|
59
|
+
(!!m.characterId || !!m.isNarratorResponse || !!m.isGenerating) && !m.metadata?.isGreeting
|
|
60
|
+
|
|
61
|
+
/** The newest reply in this log: the run the left half is about. */
|
|
62
|
+
const reply = $derived.by((): Row | null => {
|
|
63
|
+
for (let i = rows.length - 1; i >= 0; i--) if (isReply(rows[i])) return rows[i]
|
|
64
|
+
return null
|
|
65
|
+
})
|
|
66
|
+
/** The reply is the log's last line: a retry is still offered on it. */
|
|
67
|
+
const replyIsLast = $derived(!!reply && rows[rows.length - 1]?.id === reply.id)
|
|
68
|
+
|
|
69
|
+
type TurnState = "live" | "failed" | "stopped" | "done"
|
|
70
|
+
const turnState = $derived.by((): TurnState | null => {
|
|
71
|
+
if (!reply) return null
|
|
72
|
+
if (reply.isGenerating) return "live"
|
|
73
|
+
if (reply.error) return "failed"
|
|
74
|
+
if (reply.generationOutcome === "stopped") return "stopped"
|
|
75
|
+
return "done"
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
/** Who wrote the reply, as the page named the line. */
|
|
79
|
+
const speaker = $derived.by((): string | null => {
|
|
80
|
+
if (!reply) return null
|
|
81
|
+
const named = dossier?.lines[reply.id]?.speaker.name
|
|
82
|
+
if (named) return named
|
|
83
|
+
if (reply.speakerLabel) return reply.speakerLabel
|
|
84
|
+
if (reply.isNarratorResponse) return dossier?.turn.ownVoiceName || "The narrator"
|
|
85
|
+
return null
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// How long each run took, as this view saw it: `generation:start` to
|
|
89
|
+
// `generation:end`, per reply. A stopped run keeps no time.
|
|
90
|
+
const startedAt = new Map<number, number>()
|
|
91
|
+
const took = new SvelteMap<number, number>()
|
|
92
|
+
$effect(() =>
|
|
93
|
+
untrack(() => {
|
|
94
|
+
const offStart = conv.ctx.on("generation:start", (e) => {
|
|
95
|
+
if (e.kind === "generation:start" && e.messageId != null) startedAt.set(e.messageId, Date.now())
|
|
96
|
+
})
|
|
97
|
+
const offEnd = conv.ctx.on("generation:end", (e) => {
|
|
98
|
+
if (e.kind !== "generation:end" || e.messageId == null) return
|
|
99
|
+
const t0 = startedAt.get(e.messageId)
|
|
100
|
+
startedAt.delete(e.messageId)
|
|
101
|
+
if (t0 === undefined || e.aborted) took.delete(e.messageId)
|
|
102
|
+
else took.set(e.messageId, (Date.now() - t0) / 1000)
|
|
103
|
+
})
|
|
104
|
+
return () => {
|
|
105
|
+
offStart()
|
|
106
|
+
offEnd()
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
)
|
|
110
|
+
const seconds = (s: number) => `${s < 10 ? s.toFixed(1) : Math.round(s)} s`
|
|
111
|
+
|
|
112
|
+
const status = $derived.by((): string => {
|
|
113
|
+
if (!reply || !turnState) return ""
|
|
114
|
+
if (turnState === "live")
|
|
115
|
+
return (
|
|
116
|
+
conv.statusText(reply.generationStatus as StatusText | null | undefined) ||
|
|
117
|
+
`${speaker ?? "The reply"} is thinking`
|
|
118
|
+
)
|
|
119
|
+
if (turnState === "failed") return `Last run failed · ${reply.error!.message}`
|
|
120
|
+
if (turnState === "stopped") return "Last run stopped"
|
|
121
|
+
const time = took.get(reply.id)
|
|
122
|
+
const said = speaker ? `${speaker} replied` : "Replied"
|
|
123
|
+
return time === undefined ? said : `${said} · ${seconds(time)}`
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const waiting = $derived(dossier?.state.waiting ?? [])
|
|
127
|
+
const reviewLabel = $derived(waiting.length === 1 ? "Review 1 change" : `Review ${waiting.length} changes`)
|
|
128
|
+
/** "Inspect run" (R55: administrators only), on a reply that has finished. */
|
|
129
|
+
const canInspect = $derived(!!conv.ctx.viewer.v1.isAdmin && !!reply && turnState !== "live")
|
|
130
|
+
const hasLinks = $derived(waiting.length > 0 || canInspect)
|
|
131
|
+
let panelOpen = $state(false)
|
|
132
|
+
|
|
133
|
+
const inspect = () => {
|
|
134
|
+
panelOpen = false
|
|
135
|
+
if (reply) void conv.request("inspect-run", { messageId: reply.id })
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const showNext = $derived(nextUp !== "hidden" && !!dossier && !dossier.readOnly)
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<!-- The turn line's parts (`messages.turn-line*`, STYLE-GUIDE §6.16): no
|
|
142
|
+
look here; the default widget stylesheet draws them. -->
|
|
143
|
+
<div data-widget-part="messages.turn-line" data-turn-state={turnState ?? undefined}>
|
|
144
|
+
{#if status || hasLinks}
|
|
145
|
+
<div data-widget-part="messages.turn-line-run">
|
|
146
|
+
{#if hasLinks}
|
|
147
|
+
<!-- `sp-popover` (§3.5): the pill is the trigger; its panel holds
|
|
148
|
+
the links, which is all a narrow box shows of them. -->
|
|
149
|
+
<sp-popover
|
|
150
|
+
placement="top-start"
|
|
151
|
+
label="The last run"
|
|
152
|
+
open={panelOpen}
|
|
153
|
+
onopen-change={(e: CustomEvent<{ open: boolean }>) => (panelOpen = e.detail.open)}
|
|
154
|
+
>
|
|
155
|
+
<button
|
|
156
|
+
slot="trigger"
|
|
157
|
+
type="button"
|
|
158
|
+
data-widget-part="messages.turn-line-status"
|
|
159
|
+
data-turn-state={turnState ?? undefined}
|
|
160
|
+
title={status || reviewLabel}
|
|
161
|
+
>
|
|
162
|
+
<span data-widget-part="messages.turn-line-status-text">{status || reviewLabel}</span>
|
|
163
|
+
<sp-icon name="chevron-up" size="12" data-widget-part="messages.turn-line-status-more"></sp-icon>
|
|
164
|
+
</button>
|
|
165
|
+
<div data-widget-part="messages.turn-line-panel">
|
|
166
|
+
{#if waiting.length}
|
|
167
|
+
<header data-widget-part="messages.ledger-review-title">
|
|
168
|
+
<sp-icon name="clipboard-check" size="14"></sp-icon>
|
|
169
|
+
<span>Waiting for you</span>
|
|
170
|
+
</header>
|
|
171
|
+
<p data-widget-part="messages.ledger-review-note">
|
|
172
|
+
The AI asked for these. Nothing changes until you accept one.
|
|
173
|
+
</p>
|
|
174
|
+
<StateProposalList proposals={waiting} showAnchor />
|
|
175
|
+
{/if}
|
|
176
|
+
{#if canInspect}
|
|
177
|
+
<button type="button" data-widget-part="messages.turn-line-panel-inspect" onclick={inspect}>
|
|
178
|
+
<sp-icon name="receipt" size="14"></sp-icon>
|
|
179
|
+
<span>Inspect run</span>
|
|
180
|
+
</button>
|
|
181
|
+
{/if}
|
|
182
|
+
</div>
|
|
183
|
+
</sp-popover>
|
|
184
|
+
{:else}
|
|
185
|
+
<span data-widget-part="messages.turn-line-status" data-turn-state={turnState ?? undefined} title={status}>
|
|
186
|
+
<span data-widget-part="messages.turn-line-status-text">{status}</span>
|
|
187
|
+
</span>
|
|
188
|
+
{/if}
|
|
189
|
+
{#if hasLinks}
|
|
190
|
+
<!-- The same links, beside the pill where the box has room. -->
|
|
191
|
+
<span data-widget-part="messages.turn-line-links">
|
|
192
|
+
{#if waiting.length}
|
|
193
|
+
<button
|
|
194
|
+
type="button"
|
|
195
|
+
data-widget-part="messages.turn-line-review"
|
|
196
|
+
onclick={() => (panelOpen = true)}
|
|
197
|
+
>
|
|
198
|
+
<sp-icon name="clipboard-check" size="12"></sp-icon>
|
|
199
|
+
<span>{reviewLabel}</span>
|
|
200
|
+
</button>
|
|
201
|
+
{/if}
|
|
202
|
+
{#if canInspect}
|
|
203
|
+
<button type="button" data-widget-part="messages.turn-line-inspect" onclick={inspect}>
|
|
204
|
+
<sp-icon name="receipt" size="12"></sp-icon>
|
|
205
|
+
<span>Inspect run</span>
|
|
206
|
+
</button>
|
|
207
|
+
{/if}
|
|
208
|
+
</span>
|
|
209
|
+
{/if}
|
|
210
|
+
</div>
|
|
211
|
+
{/if}
|
|
212
|
+
{#if showNext && dossier}
|
|
213
|
+
<div data-widget-part="messages.turn-line-next messages.next-up">
|
|
214
|
+
<!-- Who else is writing (the page's view): a pill, when someone is. -->
|
|
215
|
+
<span data-widget-part="messages.turn-line-typing"><sp-host-view name="session-banners"></sp-host-view></span>
|
|
216
|
+
{#if turnState === "live"}
|
|
217
|
+
<button
|
|
218
|
+
type="button"
|
|
219
|
+
data-widget-part="messages.turn-line-stop"
|
|
220
|
+
title="Stop"
|
|
221
|
+
aria-label="Stop generating"
|
|
222
|
+
onclick={() => conv.invoke("stop")}
|
|
223
|
+
>
|
|
224
|
+
<sp-icon name="square" size="14"></sp-icon>
|
|
225
|
+
<span>Stop</span>
|
|
226
|
+
</button>
|
|
227
|
+
{:else if turnState === "failed" && replyIsLast && reply}
|
|
228
|
+
<button
|
|
229
|
+
type="button"
|
|
230
|
+
data-widget-part="messages.turn-line-retry"
|
|
231
|
+
title="Write this reply again"
|
|
232
|
+
onclick={() => conv.invoke("retry", reply)}
|
|
233
|
+
>
|
|
234
|
+
<sp-icon name="refresh-cw" size="14"></sp-icon>
|
|
235
|
+
<span>Try again</span>
|
|
236
|
+
</button>
|
|
237
|
+
{:else}
|
|
238
|
+
<NextCharacterBlock
|
|
239
|
+
order={dossier.turn.order}
|
|
240
|
+
candidates={dossier.turn.candidates}
|
|
241
|
+
mode={nextUp}
|
|
242
|
+
shouldShow={dossier.turn.show && conv.edit.id === null}
|
|
243
|
+
avatarFor={(ref) => (ref.startsWith("character:") ? ref : undefined)}
|
|
244
|
+
canChooseSomeoneElse={dossier.turn.canChoose}
|
|
245
|
+
viewerUserId={conv.ctx.viewer.v1.userId}
|
|
246
|
+
onContinue={(channel) => void conv.request("fire-turn", { channel })}
|
|
247
|
+
onSomeoneElse={() => void conv.request("pick-turn", {})}
|
|
248
|
+
/>
|
|
249
|
+
{/if}
|
|
250
|
+
</div>
|
|
251
|
+
{:else}
|
|
252
|
+
<span data-widget-part="messages.turn-line-typing"><sp-host-view name="session-banners"></sp-host-view></span>
|
|
253
|
+
{/if}
|
|
254
|
+
</div>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { getContext, setContext } from "svelte"
|
|
14
14
|
import { SvelteSet } from "svelte/reactivity"
|
|
15
|
-
import { useWidgetContext } from "../
|
|
15
|
+
import { useWidgetContext } from "../context"
|
|
16
16
|
import type { WidgetContextRef } from "@serene-pub/core-catalog/conversation"
|
|
17
17
|
import {
|
|
18
18
|
NO_LINE,
|
|
@@ -23,6 +23,7 @@ import type { WidgetRequestKind, WidgetRequests } from "@serene-pub/sdk/componen
|
|
|
23
23
|
import { canAnswerForm } from "@serene-pub/core-catalog/conversation"
|
|
24
24
|
import { setStatusTextResolver, statusTextIn } from "@serene-pub/core-catalog/conversation"
|
|
25
25
|
import type { RequestDeclineCode, StatusText } from "@serene-pub/sdk/component"
|
|
26
|
+
import { boundaryOffer, laneOf, markedRun, type BoundaryOffer, type SceneMarkRow } from "./sceneMarks"
|
|
26
27
|
|
|
27
28
|
const KEY = Symbol("sp-conversation")
|
|
28
29
|
|
|
@@ -31,6 +32,13 @@ export type Conversation = ReturnType<typeof createConversation>
|
|
|
31
32
|
/** What a verb's subject is: a message, by id. */
|
|
32
33
|
type Subject = { id: number }
|
|
33
34
|
|
|
35
|
+
/**
|
|
36
|
+
* 🚧 Where a scene write was asked, so its refusal is said there: under a
|
|
37
|
+
* line, in a scene's divider, in the selection bar, or in a scene cue's chip
|
|
38
|
+
* (lane E).
|
|
39
|
+
*/
|
|
40
|
+
type SceneAsk = "line" | "scene" | "selection" | "cue"
|
|
41
|
+
|
|
34
42
|
/**
|
|
35
43
|
* A request declined because the view went away — the page's decline of what
|
|
36
44
|
* it never answered, or the wire's own at `close()`. Expected at every
|
|
@@ -55,6 +63,14 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
55
63
|
}
|
|
56
64
|
|
|
57
65
|
let editingId = $state<number | null>(null)
|
|
66
|
+
/**
|
|
67
|
+
* 🚧 The last scene boundary the host refused, said where it was asked:
|
|
68
|
+
* under a line (*Start scene here*, *End scene here*), in a scene's
|
|
69
|
+
* divider, or in the selection bar (*Mark as scene*). One at a time.
|
|
70
|
+
*/
|
|
71
|
+
let sceneRefusal = $state<{ at: SceneAsk; id: number; text: string } | null>(null)
|
|
72
|
+
/** A scene boundary is being written: its presses wait. */
|
|
73
|
+
let sceneBusy = $state(false)
|
|
58
74
|
let menuFor = $state<number | undefined>(undefined)
|
|
59
75
|
let selecting = $state(false)
|
|
60
76
|
/** The lane the composer writes to, and the log shows (`main` by default). */
|
|
@@ -69,7 +85,7 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
69
85
|
|
|
70
86
|
// Through the context's own type — its scoped keys come from the SDK's
|
|
71
87
|
// one table — so a renamed section fails to compile here.
|
|
72
|
-
const dossier = $derived((ctx().
|
|
88
|
+
const dossier = $derived((ctx().scope("session:full") ?? null) as ConversationDossierV1 | null)
|
|
73
89
|
|
|
74
90
|
/**
|
|
75
91
|
* The channels this copy shows (lair re-plan S1): its composer's, which
|
|
@@ -120,6 +136,26 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
120
136
|
return ctx().request(kind, params).catch(warn(kind))
|
|
121
137
|
}
|
|
122
138
|
|
|
139
|
+
/**
|
|
140
|
+
* 🚧 One scene write (`scene-*`, a scene's `summarize`): its refusal is
|
|
141
|
+
* said where it was asked (`sceneRefusal`), never dropped on stderr —
|
|
142
|
+
* a view going away is no refusal. Resolves with the answer, or null.
|
|
143
|
+
*/
|
|
144
|
+
async function sceneWrite<K extends WidgetRequestKind>(
|
|
145
|
+
where: { at: SceneAsk; id: number },
|
|
146
|
+
kind: K,
|
|
147
|
+
params: WidgetRequests[K]["params"]
|
|
148
|
+
): Promise<WidgetRequests[K]["result"] | null> {
|
|
149
|
+
sceneRefusal = null
|
|
150
|
+
try {
|
|
151
|
+
return await ctx().request(kind, params)
|
|
152
|
+
} catch (e) {
|
|
153
|
+
if (!isUnmountDecline(e))
|
|
154
|
+
sceneRefusal = { ...where, text: e instanceof Error ? e.message : String(e) }
|
|
155
|
+
return null
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
123
159
|
return {
|
|
124
160
|
get ctx() {
|
|
125
161
|
return ctx()
|
|
@@ -194,6 +230,17 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
194
230
|
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
195
231
|
.join(" ")
|
|
196
232
|
},
|
|
233
|
+
/**
|
|
234
|
+
* What a channel IS (`ChannelDecl.role`, PLAN-core-widgets §3.7):
|
|
235
|
+
* `folio` for a manuscript-style channel, else `conversation` — the
|
|
236
|
+
* default every channel has, and the answer while the host says
|
|
237
|
+
* nothing (`composer.channelRoles` absent).
|
|
238
|
+
*/
|
|
239
|
+
channelRole(slug: string): "conversation" | "folio" {
|
|
240
|
+
return dossier?.composer?.channelRoles?.[slug] === "folio"
|
|
241
|
+
? "folio"
|
|
242
|
+
: "conversation"
|
|
243
|
+
},
|
|
197
244
|
|
|
198
245
|
/**
|
|
199
246
|
* The lane the composer writes to; the log shows that lane's rows. It is
|
|
@@ -219,6 +266,148 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
219
266
|
}
|
|
220
267
|
},
|
|
221
268
|
|
|
269
|
+
// ── 🚧 live scenes: the boundaries a person places (§7, §14 C) ─────
|
|
270
|
+
scenes: {
|
|
271
|
+
/** The viewer may place scene boundaries here (the dossier's verdict). */
|
|
272
|
+
get boundaries() {
|
|
273
|
+
return !!dossier?.sceneBoundaries
|
|
274
|
+
},
|
|
275
|
+
/** The last refusal, and where it is said. */
|
|
276
|
+
get refusal() {
|
|
277
|
+
return sceneRefusal
|
|
278
|
+
},
|
|
279
|
+
dismiss() {
|
|
280
|
+
sceneRefusal = null
|
|
281
|
+
},
|
|
282
|
+
/** A boundary write is in flight. */
|
|
283
|
+
get busy() {
|
|
284
|
+
return sceneBusy
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* 🚧 A scene's summary may be asked for here — not when the
|
|
288
|
+
* session's summaries are off (`sceneSummaryMode: 'never'`).
|
|
289
|
+
*/
|
|
290
|
+
get summarizes() {
|
|
291
|
+
return dossier?.sceneSummaryMode !== "never"
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* 🚧 The scene cues waiting at lines — Suggested mode's *New
|
|
295
|
+
* scene?* chips (lane E) — only where the viewer may place a
|
|
296
|
+
* boundary.
|
|
297
|
+
*/
|
|
298
|
+
get cues() {
|
|
299
|
+
return dossier?.sceneBoundaries ? (dossier.sceneCues ?? []) : []
|
|
300
|
+
},
|
|
301
|
+
/** Which boundaries this line's menu offers (none without the verdict). */
|
|
302
|
+
offer(row: SceneMarkRow): BoundaryOffer {
|
|
303
|
+
if (!dossier?.sceneBoundaries) return { start: false, end: null }
|
|
304
|
+
return boundaryOffer(row, dossier.scenes ?? [])
|
|
305
|
+
},
|
|
306
|
+
/** *Start scene here*: a scene opens at this line, on its lane. */
|
|
307
|
+
async startAt(row: SceneMarkRow) {
|
|
308
|
+
if (sceneBusy) return
|
|
309
|
+
sceneBusy = true
|
|
310
|
+
try {
|
|
311
|
+
await sceneWrite({ at: "line", id: row.id }, "scene-open", {
|
|
312
|
+
messageId: row.id,
|
|
313
|
+
channel: laneOf(row.channel)
|
|
314
|
+
})
|
|
315
|
+
} finally {
|
|
316
|
+
sceneBusy = false
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
/** *End scene here* (a line), or *End scene* (its divider: at the lane's newest line). */
|
|
320
|
+
async endAt(sceneId: number, row?: SceneMarkRow) {
|
|
321
|
+
if (sceneBusy) return
|
|
322
|
+
sceneBusy = true
|
|
323
|
+
try {
|
|
324
|
+
await sceneWrite(
|
|
325
|
+
row ? { at: "line", id: row.id } : { at: "scene", id: sceneId },
|
|
326
|
+
"scene-close",
|
|
327
|
+
row ? { sceneId, messageId: row.id } : { sceneId }
|
|
328
|
+
)
|
|
329
|
+
} finally {
|
|
330
|
+
sceneBusy = false
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
/**
|
|
334
|
+
* 🚧 Move where a live scene starts — a divider dragged between
|
|
335
|
+
* lines, or its menu's *Move start up/down one line* (lane E).
|
|
336
|
+
*/
|
|
337
|
+
async moveStart(sceneId: number, openedAt: number) {
|
|
338
|
+
if (sceneBusy) return
|
|
339
|
+
sceneBusy = true
|
|
340
|
+
try {
|
|
341
|
+
await sceneWrite({ at: "scene", id: sceneId }, "scene-move", { sceneId, openedAt })
|
|
342
|
+
} finally {
|
|
343
|
+
sceneBusy = false
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
/** 🚧 *Reopen scene*: a closed scene runs on to its lane's newest line again (lane E). */
|
|
347
|
+
async reopen(sceneId: number) {
|
|
348
|
+
if (sceneBusy) return
|
|
349
|
+
sceneBusy = true
|
|
350
|
+
try {
|
|
351
|
+
await sceneWrite({ at: "scene", id: sceneId }, "scene-move", { sceneId, closedAt: null })
|
|
352
|
+
} finally {
|
|
353
|
+
sceneBusy = false
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
/** 🚧 A scene cue's **Yes** (a scene opens at its line) or **Not here** (lane E). */
|
|
357
|
+
async decideCue(cueId: number, accept: boolean) {
|
|
358
|
+
if (sceneBusy) return
|
|
359
|
+
sceneBusy = true
|
|
360
|
+
try {
|
|
361
|
+
await sceneWrite({ at: "cue", id: cueId }, "decide-scene-cue", { cueId, accept })
|
|
362
|
+
} finally {
|
|
363
|
+
sceneBusy = false
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
/** A divider's name, renamed; whether the host took it. */
|
|
367
|
+
async rename(sceneId: number, name: string | null) {
|
|
368
|
+
const done = await sceneWrite({ at: "scene", id: sceneId }, "scene-rename", { sceneId, name })
|
|
369
|
+
return done !== null
|
|
370
|
+
},
|
|
371
|
+
/** *Remove boundary*: the host asks the person, then removes the scene. */
|
|
372
|
+
async remove(sceneId: number) {
|
|
373
|
+
if (sceneBusy) return
|
|
374
|
+
sceneBusy = true
|
|
375
|
+
try {
|
|
376
|
+
await sceneWrite({ at: "scene", id: sceneId }, "scene-remove", { sceneId })
|
|
377
|
+
} finally {
|
|
378
|
+
sceneBusy = false
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
/** *Summarize* a scene in the host's review. */
|
|
382
|
+
summarize(sceneId: number) {
|
|
383
|
+
void sceneWrite({ at: "scene", id: sceneId }, "summarize", { kind: "scene", sceneId })
|
|
384
|
+
},
|
|
385
|
+
/**
|
|
386
|
+
* *Mark as scene* (the selection bar's boundary path): the picked run
|
|
387
|
+
* becomes one closed live scene — opened at its first line and
|
|
388
|
+
* closed at its last on that lane, in ONE write (`closeAt`, lane E),
|
|
389
|
+
* so any run that overlaps no scene can be marked, an earlier one
|
|
390
|
+
* included — and the selection ends. A refusal keeps it.
|
|
391
|
+
*/
|
|
392
|
+
async markSelection() {
|
|
393
|
+
const run = markedRun(selected, rows as SceneMarkRow[])
|
|
394
|
+
if (!run || sceneBusy) return
|
|
395
|
+
sceneBusy = true
|
|
396
|
+
try {
|
|
397
|
+
const opened = await sceneWrite({ at: "selection", id: run.first }, "scene-open", {
|
|
398
|
+
messageId: run.first,
|
|
399
|
+
channel: run.lane,
|
|
400
|
+
closeAt: run.last
|
|
401
|
+
})
|
|
402
|
+
if (!opened) return
|
|
403
|
+
selecting = false
|
|
404
|
+
selected.clear()
|
|
405
|
+
} finally {
|
|
406
|
+
sceneBusy = false
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
|
|
222
411
|
// ── selecting lines for a summary ────────────────────────────────────
|
|
223
412
|
select: {
|
|
224
413
|
get active() {
|