@serene-pub/core-catalog 0.6.0-pr-7 โ 0.6.0-pr-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/components/genres/story/authors-note/AuthorsNote.svelte +2 -1
- package/components/genres/story/authors-note/AuthorsNoteWidget.svelte +177 -58
- package/components/shared/WidgetBoundary.svelte +37 -0
- package/components/shared/actions/Actions.svelte +2 -1
- package/components/shared/actions/ActionsWidget.svelte +31 -38
- package/components/shared/album/Album.svelte +2 -1
- package/components/shared/album/AlbumWidget.svelte +1 -7
- package/components/shared/annex/Annex.svelte +2 -1
- package/components/shared/annex/AnnexWidget.svelte +1 -1
- package/components/shared/attendance/Attendance.svelte +2 -1
- package/components/shared/attendance/AttendanceWidget.svelte +5 -8
- package/components/shared/backdrop/Backdrop.svelte +2 -1
- package/components/shared/backdrop/BackdropWidget.svelte +28 -22
- package/components/shared/chronicle/Chronicle.svelte +2 -1
- package/components/shared/chronicle/ChronicleWidget.svelte +211 -99
- package/components/shared/composer/Composer.svelte +25 -0
- package/components/shared/composer/ComposerWidget.svelte +146 -0
- package/components/shared/composer/composer.ts +10 -0
- package/components/shared/composer/settings.ts +59 -0
- package/components/shared/composer/target.ts +79 -0
- package/components/shared/dialogue-box/DialogueBoxMount.svelte +25 -0
- package/components/shared/dialogue-box/DialogueBoxWidget.svelte +207 -0
- package/components/shared/dialogue-box/dialogue-box.ts +10 -0
- package/components/shared/dialogue-box/settings.ts +25 -0
- package/components/shared/lore-entries/LoreEntries.svelte +2 -1
- package/components/shared/lore-entries/LoreEntriesWidget.svelte +44 -41
- package/components/shared/messages/MessageBlocksView.svelte +1 -1
- package/components/shared/messages/MessageControls.svelte +23 -5
- package/components/shared/messages/Messages.svelte +2 -1
- package/components/shared/messages/MessagesWidget.svelte +82 -191
- package/components/shared/messages/NextCharacterBlock.svelte +35 -20
- package/components/shared/messages/SceneDivider.svelte +40 -14
- package/components/shared/messages/SessionComposer.svelte +178 -123
- package/components/shared/messages/SessionContainer.svelte +89 -38
- package/components/shared/messages/SessionMessage.svelte +157 -54
- package/components/shared/messages/SpokenLine.svelte +57 -16
- package/components/shared/messages/StateProposalList.svelte +30 -20
- package/components/shared/messages/TurnLine.svelte +258 -66
- package/components/shared/messages/conversation.svelte.ts +83 -5
- package/components/shared/messages/readingPace.ts +101 -0
- package/components/shared/messages/rowFacts.ts +44 -0
- package/components/shared/messages/sceneMarks.ts +54 -0
- package/components/shared/messages/spokenLine.ts +63 -14
- package/components/shared/places/Places.svelte +2 -1
- package/components/shared/places/PlacesWidget.svelte +42 -33
- package/components/shared/routine-log/RoutineLog.svelte +2 -1
- package/components/shared/routine-log/RoutineLogWidget.svelte +0 -4
- package/components/shared/routine-log/routineLog.ts +5 -21
- package/components/shared/scene-portraits/ScenePortraits.svelte +2 -1
- package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +54 -32
- package/components/shared/session-runs/SessionRuns.svelte +26 -0
- package/components/shared/session-runs/SessionRunsWidget.svelte +270 -0
- package/components/shared/session-runs/session-runs.ts +11 -0
- package/components/shared/state/PieceCard.svelte +36 -25
- package/components/shared/state/SlotControl.svelte +18 -5
- package/components/shared/stats/Stats.svelte +2 -1
- package/components/shared/stats/StatsWidget.svelte +104 -72
- package/components/shared/turn-line/TurnLineMount.svelte +25 -0
- package/components/shared/turn-line/TurnLineWidget.svelte +25 -0
- package/components/shared/turn-line/settings.ts +31 -0
- package/components/shared/turn-line/turn-line.ts +10 -0
- package/components/shared/turn-order/TurnOrder.svelte +2 -1
- package/components/shared/turn-order/TurnOrderWidget.svelte +1 -6
- package/dist/components/actions.js +71 -88
- package/dist/components/actions.source.json +1 -1
- package/dist/components/album.js +39 -44
- package/dist/components/album.source.json +1 -1
- package/dist/components/annex.js +17 -8
- package/dist/components/annex.source.json +1 -1
- package/dist/components/attendance.js +39 -48
- package/dist/components/attendance.source.json +1 -1
- package/dist/components/authors-note.js +329 -162
- package/dist/components/authors-note.source.json +1 -1
- package/dist/components/backdrop.js +52 -55
- package/dist/components/backdrop.source.json +1 -1
- package/dist/components/chronicle.js +798 -559
- package/dist/components/chronicle.source.json +1 -1
- package/dist/components/composer.js +1639 -0
- package/dist/components/composer.source.json +1 -0
- package/dist/components/core-ui.json +1 -1
- package/dist/components/dialogue-box.js +373 -0
- package/dist/components/dialogue-box.source.json +1 -0
- package/dist/components/lore-entries.js +134 -122
- package/dist/components/lore-entries.source.json +1 -1
- package/dist/components/messages.js +1517 -8930
- package/dist/components/messages.source.json +1 -1
- package/dist/components/places.js +267 -244
- package/dist/components/places.source.json +1 -1
- package/dist/components/routine-log.js +35 -51
- package/dist/components/routine-log.source.json +1 -1
- package/dist/components/scene-portraits.js +118 -59
- package/dist/components/scene-portraits.source.json +1 -1
- package/dist/components/session-runs.js +488 -0
- package/dist/components/session-runs.source.json +1 -0
- package/dist/components/{shared-7VDIXYAL.js โ shared-47J4TNSF.js} +1 -1
- package/dist/components/{shared-W3XS5FEL.js โ shared-5E4RQYRX.js} +3 -2
- package/dist/components/{shared-YDS7HYL6.js โ shared-EFMMT76D.js} +57 -4
- package/dist/components/{shared-BIWKZFUU.js โ shared-FOVKPMSK.js} +3 -3
- package/dist/components/{shared-JPG5DQO7.js โ shared-HEAKNNZB.js} +92 -17
- package/dist/components/shared-JXP6SHKF.js +159 -0
- package/dist/components/{shared-XBDUENRA.js โ shared-JXYPKSTQ.js} +1 -1
- package/dist/components/shared-KJIOSSE3.js +257 -0
- package/dist/components/{shared-WV3QTKZT.js โ shared-KLURQFWI.js} +13 -9
- package/dist/components/shared-MHCNUDUT.js +1680 -0
- package/dist/components/{shared-QXF5CJVN.js โ shared-NICRJ4Z2.js} +1 -1
- package/dist/components/{shared-BBF64YGL.js โ shared-W2BBJCNE.js} +22 -16
- package/dist/components/shared-YYYXFDZU.js +4354 -0
- package/dist/components/stats.js +828 -678
- package/dist/components/stats.source.json +1 -1
- package/dist/components/turn-line.js +856 -0
- package/dist/components/turn-line.source.json +1 -0
- package/dist/components/turn-order.js +62 -67
- package/dist/components/turn-order.source.json +1 -1
- package/dist/factories/answerForm.d.ts +6 -0
- package/dist/factories/answerForm.js +104 -96
- package/dist/factories/turnOrder.d.ts +98 -105
- package/dist/factories/turnOrder.js +120 -136
- package/dist/functions/pieces.js +1 -0
- package/dist/functions/time.js +2 -0
- package/dist/genres/chat/create.js +2 -0
- package/dist/genres/chat/memory.js +64 -43
- package/dist/genres/chat/respond.d.ts +7 -6
- package/dist/genres/chat/respond.js +13 -4
- package/dist/genres/chat/turnOrder.d.ts +2 -2
- package/dist/genres/chat/turnOrder.js +28 -12
- package/dist/genres/defaults.d.ts +28 -6
- package/dist/genres/defaults.js +84 -26
- package/dist/genres/dungeon-crawler/calls.d.ts +3 -1
- package/dist/genres/dungeon-crawler/calls.js +5 -0
- package/dist/genres/dungeon-crawler/create.d.ts +9 -6
- package/dist/genres/dungeon-crawler/create.js +18 -8
- package/dist/genres/dungeon-crawler/death.d.ts +13 -6
- package/dist/genres/dungeon-crawler/death.js +26 -12
- package/dist/genres/dungeon-crawler/index.d.ts +1 -0
- package/dist/genres/dungeon-crawler/index.js +1 -0
- package/dist/genres/dungeon-crawler/journal.d.ts +1 -1
- package/dist/genres/dungeon-crawler/journal.js +1 -1
- package/dist/genres/dungeon-crawler/lore.d.ts +13 -12
- package/dist/genres/dungeon-crawler/lore.js +16 -25
- package/dist/genres/dungeon-crawler/names.d.ts +10 -3
- package/dist/genres/dungeon-crawler/names.js +10 -3
- package/dist/genres/dungeon-crawler/preamble.d.ts +5 -4
- package/dist/genres/dungeon-crawler/preamble.js +75 -33
- package/dist/genres/dungeon-crawler/respond.js +4 -2
- package/dist/genres/dungeon-crawler/rest.d.ts +8 -7
- package/dist/genres/dungeon-crawler/rest.js +39 -15
- package/dist/genres/dungeon-crawler/reveal.js +2 -2
- package/dist/genres/dungeon-crawler/roundScript.d.ts +2 -1
- package/dist/genres/dungeon-crawler/roundScript.js +23 -5
- package/dist/genres/dungeon-crawler/scripts.js +4 -5
- package/dist/genres/dungeon-crawler/shape.d.ts +16 -0
- package/dist/genres/dungeon-crawler/shape.js +5 -1
- package/dist/genres/dungeon-crawler/sheet.d.ts +20 -20
- package/dist/genres/dungeon-crawler/story.d.ts +27 -16
- package/dist/genres/dungeon-crawler/story.js +175 -46
- package/dist/genres/dungeon-crawler/storyScripts.d.ts +2 -2
- package/dist/genres/dungeon-crawler/storyScripts.js +109 -14
- package/dist/genres/dungeon-crawler/summarizeScene.d.ts +13 -0
- package/dist/genres/dungeon-crawler/summarizeScene.js +21 -0
- package/dist/genres/dungeon-crawler/turnOrder.d.ts +8 -9
- package/dist/genres/dungeon-crawler/turnOrder.js +33 -23
- package/dist/genres/guide/create.js +2 -0
- package/dist/genres/guide/turnOrder.d.ts +3 -3
- package/dist/genres/guide/turnOrder.js +29 -13
- package/dist/genres/lair/answerForm.js +4 -1
- package/dist/genres/lair/buildRoom.js +4 -3
- package/dist/genres/lair/castellanAction.js +160 -154
- package/dist/genres/lair/create.js +2 -0
- package/dist/genres/lair/fileCurrentRoom.js +13 -10
- package/dist/genres/lair/fileRoom.js +4 -3
- package/dist/genres/lair/keeper.js +6 -2
- package/dist/genres/lair/names.d.ts +2 -0
- package/dist/genres/lair/names.js +2 -0
- package/dist/genres/lair/reply.js +16 -6
- package/dist/genres/lair/roomAnswer.js +4 -3
- package/dist/genres/lair/scratchpad.js +9 -7
- package/dist/genres/lair/scripts.js +8 -6
- package/dist/genres/lair/turnOrder.d.ts +3 -2
- package/dist/genres/lair/turnOrder.js +45 -16
- package/dist/genres/story/ask.d.ts +4 -0
- package/dist/genres/story/ask.js +4 -0
- package/dist/genres/story/create.js +15 -0
- package/dist/genres/story/index.d.ts +1 -1
- package/dist/genres/story/index.js +1 -1
- package/dist/genres/story/narrate.js +8 -0
- package/dist/genres/story/narrateCharacter.js +8 -0
- package/dist/genres/story/reckon.d.ts +5 -19
- package/dist/genres/story/reckon.js +53 -40
- package/dist/genres/story/reckoning.js +3 -0
- package/dist/genres/story/respond.js +17 -28
- package/dist/genres/story/sweep.d.ts +1 -1
- package/dist/genres/story/sweep.js +1 -1
- package/dist/genres/story/turnOrder.d.ts +21 -3
- package/dist/genres/story/turnOrder.js +87 -21
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -9
- package/dist/loadouts.d.ts +1 -0
- package/dist/loadouts.js +17 -1
- package/dist/primers/ninth-mile.d.ts +3 -4
- package/dist/registry/entries.d.ts +2 -0
- package/dist/registry/entries.js +18 -5
- package/dist/registry/genres.d.ts +146 -40
- package/dist/registry/genres.js +373 -101
- package/dist/registry/hostState.d.ts +1 -2
- package/dist/registry/hostState.js +2 -4
- package/dist/registry/layouts.d.ts +141 -111
- package/dist/registry/layouts.js +302 -141
- package/dist/registry/slots.d.ts +4 -3
- package/dist/registry/slots.js +4 -3
- package/dist/registry/widgets.d.ts +12 -2
- package/dist/registry/widgets.js +259 -106
- package/dist/rulesets/vis-itineris/ruleset.js +8 -5
- package/dist/rulesets/wherewithal/ruleset.js +2 -1
- package/dist/seed/presets.js +15 -9
- package/dist/seed/prompts.js +24 -5
- package/dist/seed/scripts.js +3 -0
- package/dist/shared/annexField.js +23 -3
- package/dist/shared/illustrateScene.d.ts +1 -0
- package/dist/shared/illustrateScene.js +29 -1
- package/dist/shared/lore.d.ts +13 -0
- package/dist/shared/lore.js +37 -1
- package/dist/shared/portrait.js +13 -4
- package/dist/shared/reckoning.d.ts +8 -2
- package/dist/shared/reckoning.js +47 -30
- package/dist/shared/roundTick.d.ts +20 -0
- package/dist/shared/roundTick.js +76 -0
- package/dist/shared/sceneBoundaries.d.ts +7 -0
- package/dist/shared/sceneBoundaries.js +62 -0
- package/dist/shared/sceneSummaries.d.ts +7 -0
- package/dist/shared/sceneSummaries.js +49 -0
- package/dist/shared/speakMessage.d.ts +9 -2
- package/dist/shared/speakMessage.js +32 -9
- package/dist/shared/speechFields.js +4 -0
- package/dist/shared/summarize/character.d.ts +1 -1
- package/dist/shared/summarize/history.d.ts +1 -1
- package/dist/shared/summarize/scene.d.ts +1 -1
- package/dist/shared/summarize/summarizeScene.js +1 -0
- package/dist/shared/summarize/summarizeSpec.d.ts +1 -1
- package/dist/shared/summarize/world.d.ts +1 -1
- package/dist/shared/ui/attendance/index.d.ts +3 -2
- package/dist/shared/ui/attendance/index.js +3 -7
- package/dist/shared/ui/chronicle/index.d.ts +24 -2
- package/dist/shared/ui/chronicle/index.js +58 -29
- package/dist/shared/ui/conversation/formAnswer.d.ts +16 -2
- package/dist/shared/ui/conversation/formAnswer.js +23 -9
- package/dist/shared/ui/conversation/index.d.ts +2 -0
- package/dist/shared/ui/conversation/index.js +4 -0
- package/dist/shared/ui/conversation/itemValues.d.ts +16 -3
- package/dist/shared/ui/conversation/itemValues.js +15 -5
- package/dist/shared/ui/conversation/messageVerbState.d.ts +17 -2
- package/dist/shared/ui/conversation/messageVerbState.js +5 -4
- package/dist/shared/ui/conversation/readingPlace.d.ts +40 -0
- package/dist/shared/ui/conversation/readingPlace.js +119 -0
- package/dist/shared/ui/conversation/rewindStrip.d.ts +13 -4
- package/dist/shared/ui/conversation/rewindStrip.js +29 -7
- package/dist/shared/ui/conversation/runsInProgress.d.ts +30 -0
- package/dist/shared/ui/conversation/runsInProgress.js +47 -0
- package/dist/shared/ui/conversation/storyDays.d.ts +7 -1
- package/dist/shared/ui/conversation/storyDays.js +8 -0
- package/dist/shared/ui/conversation/tableChannel.d.ts +8 -11
- package/dist/shared/ui/conversation/tableChannel.js +8 -9
- package/dist/shared/ui/places/index.d.ts +3 -2
- package/dist/shared/ui/places/index.js +4 -5
- package/dist/shared/ui/routine-log/index.d.ts +3 -0
- package/dist/shared/ui/routine-log/index.js +22 -0
- package/dist/shared/ui/scene-portraits/portraits.d.ts +50 -16
- package/dist/shared/ui/scene-portraits/portraits.js +84 -21
- package/dist/shared/ui/session-runs/index.d.ts +90 -0
- package/dist/shared/ui/session-runs/index.js +143 -0
- package/dist/shared/ui/session-state/stateView.d.ts +18 -5
- package/dist/shared/ui/session-state/stateView.js +29 -8
- package/dist/shared/ui/turn-order/index.d.ts +0 -9
- package/dist/shared/ui/turn-order/index.js +1 -2
- package/package.json +12 -8
- /package/dist/components/{shared-4ME6NFDK.js โ shared-LUIF6DW7.js} +0 -0
|
@@ -5,15 +5,27 @@
|
|
|
5
5
|
* combined"): ONE row between the log and the composer, in two halves.
|
|
6
6
|
*
|
|
7
7
|
* - **Left, what the last run is doing** (`messages.turn-line-run`): a
|
|
8
|
-
* status pill read off the newest reply in this log โ *
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* status pill read off the newest reply in this log โ *Last run
|
|
9
|
+
* failed*, the row's error as the pill's title โ then *Review N changes* when proposals
|
|
10
|
+
* wait for the viewer. While a reply streams it says nothing: the row
|
|
11
|
+
* says it beside the name, and the run's card above the composer names the
|
|
12
|
+
* run and leaves the status to the row (owner, 2026-11-13). At rest it says nothing (polish parity L1,
|
|
12
13
|
* 2026-10-24: one control row under the log): *Wren replied ยท 6.2 s*,
|
|
13
14
|
* *Last run stopped* and *Inspect run* are the newest reply's โฎ menu's
|
|
14
15
|
* (`MessageControls`), and the pill is *Review N changes* alone when
|
|
15
|
-
* something waits.
|
|
16
|
-
*
|
|
16
|
+
* something waits. When none of those holds the left half, background
|
|
17
|
+
* work in this session says so in one short line (*Summarizing <scene>*,
|
|
18
|
+
* *<routine> is running*, or a count with the list in its tooltip); a
|
|
19
|
+
* failed run and Review always win it, and it stays quiet while a reply
|
|
20
|
+
* streams. It informs: no Stop.
|
|
21
|
+
* - **Background runs** (`turn-line.runs`): the session's actions,
|
|
22
|
+
* routines and summaries in progress (`dossier.runsInProgress`), one
|
|
23
|
+
* item each โ name, status words, elapsed, **Stop** where the viewer may
|
|
24
|
+
* stop it (`stop-run`); *waiting for review* with no Stop when parked;
|
|
25
|
+
* past three, a count button expands the rest in place. A run that ends
|
|
26
|
+
* stays a moment as *โนnameโบ finished*. One polite live region announces
|
|
27
|
+
* arrivals. Never a reply's run, never a line-bound run.
|
|
28
|
+
* - **Right, who is next** (`messages.turn-line-next`): who is typing (the
|
|
17
29
|
* page's `session-banners` view), then `NextCharacterBlock` exactly as
|
|
18
30
|
* it always drew โ or **Stop** while the reply streams, or **Try again**
|
|
19
31
|
* (the reply's `retry` verb, the error row's own Retry) after it failed.
|
|
@@ -22,11 +34,21 @@
|
|
|
22
34
|
*
|
|
23
35
|
* In a narrow box the pill is all of the left half: its links live in the
|
|
24
36
|
* pill's own panel (`sp-popover`), which the pill opens at every width.
|
|
37
|
+
* The notice place (`turn-line.notice`) shows *Time limits off* while the
|
|
38
|
+
* dossier's `stepTimeLimitsOff` is set, unless a `notice` snippet fills it.
|
|
39
|
+
*
|
|
25
40
|
* Reads only the conversation (its rows, its dossier, its events); acts
|
|
26
41
|
* only through its verbs and requests.
|
|
27
42
|
*/
|
|
28
|
-
import type
|
|
29
|
-
import
|
|
43
|
+
import { untrack, type Snippet } from "svelte"
|
|
44
|
+
import {
|
|
45
|
+
RUNS_SHOWN_BEFORE_COUNT,
|
|
46
|
+
runElapsedWords,
|
|
47
|
+
runItemWords,
|
|
48
|
+
runTickMs
|
|
49
|
+
} from "@serene-pub/core-catalog/conversation"
|
|
50
|
+
import { composerSendShown, composerSendShownOf } from "../composer/target"
|
|
51
|
+
import type { NextUp } from "../turn-line/settings"
|
|
30
52
|
import NextCharacterBlock from "./NextCharacterBlock.svelte"
|
|
31
53
|
import StateProposalList from "./StateProposalList.svelte"
|
|
32
54
|
import { useConversation } from "./conversation.svelte"
|
|
@@ -34,9 +56,11 @@
|
|
|
34
56
|
interface Props {
|
|
35
57
|
/** The `nextUp` setting: what the right half shows; `hidden`, none of it. */
|
|
36
58
|
nextUp: NextUp
|
|
59
|
+
/** ๐ง Fills the notice place; when absent it shows *Time limits off* while the dossier's `stepTimeLimitsOff` is set. */
|
|
60
|
+
notice?: Snippet
|
|
37
61
|
}
|
|
38
62
|
|
|
39
|
-
let { nextUp }: Props = $props()
|
|
63
|
+
let { nextUp, notice }: Props = $props()
|
|
40
64
|
|
|
41
65
|
const conv = useConversation()
|
|
42
66
|
const dossier = $derived(conv.dossier)
|
|
@@ -54,11 +78,17 @@
|
|
|
54
78
|
}
|
|
55
79
|
const rows = $derived(conv.rows as Row[])
|
|
56
80
|
/**
|
|
57
|
-
* ๐ง The
|
|
58
|
-
*
|
|
59
|
-
*
|
|
81
|
+
* ๐ง The Composer beside this line draws Send: the host's answer for the
|
|
82
|
+
* setting (`dossier.composer.sendShown`, absent reads as shown), and at the
|
|
83
|
+
* compact width always, as the Composer reads it (`composerSendShown`).
|
|
84
|
+
*/
|
|
85
|
+
const sendShown = $derived(composerSendShown(composerSendShownOf(dossier), conv.ctx.layout?.v1?.tier))
|
|
86
|
+
/**
|
|
87
|
+
* ๐ง The composer under this line already offers Stop (it shows Send and its
|
|
88
|
+
* newest row is generating): this line does not offer a second. With Send
|
|
89
|
+
* hidden, or no Composer beside, this line always offers the reply's Stop.
|
|
60
90
|
*/
|
|
61
|
-
const composerStops = $derived(!!rows[rows.length - 1]?.isGenerating)
|
|
91
|
+
const composerStops = $derived(sendShown && !!rows[rows.length - 1]?.isGenerating)
|
|
62
92
|
/** A reply some run wrote: a greeting opens the session, no run wrote it. */
|
|
63
93
|
const isReply = (m: Row) =>
|
|
64
94
|
(!!m.characterId || !!m.isNarratorResponse || !!m.isGenerating) && !m.metadata?.isGreeting
|
|
@@ -80,32 +110,25 @@
|
|
|
80
110
|
return "done"
|
|
81
111
|
})
|
|
82
112
|
|
|
83
|
-
/** Who wrote the reply, as the page named the line. */
|
|
84
|
-
const speaker = $derived.by((): string | null => {
|
|
85
|
-
if (!reply) return null
|
|
86
|
-
const named = dossier?.lines[reply.id]?.speaker.name
|
|
87
|
-
if (named) return named
|
|
88
|
-
if (reply.speakerLabel) return reply.speakerLabel
|
|
89
|
-
if (reply.isNarratorResponse) return dossier?.turn.ownVoiceName || "The narrator"
|
|
90
|
-
return null
|
|
91
|
-
})
|
|
92
|
-
|
|
93
113
|
/**
|
|
94
|
-
* The pill while something
|
|
95
|
-
*
|
|
96
|
-
*
|
|
114
|
+
* The pill while something needs saying here: the last run failed. A reply
|
|
115
|
+
* being written says nothing on this line: its own row says *Wren is
|
|
116
|
+
* typing* beside the name, and the run's card above the composer names the
|
|
117
|
+
* run and leaves the status to the row; a second copy here was noise
|
|
118
|
+
* (owner, 2026-11-13). A
|
|
119
|
+
* finished or stopped run says nothing either: its reply's โฎ menu says it.
|
|
97
120
|
*/
|
|
98
121
|
const status = $derived.by((): string => {
|
|
99
122
|
if (!reply || !turnState) return ""
|
|
100
|
-
if (turnState === "
|
|
101
|
-
return (
|
|
102
|
-
conv.statusText(reply.generationStatus as StatusText | null | undefined) ||
|
|
103
|
-
`${speaker ?? "The reply"} is thinking`
|
|
104
|
-
)
|
|
105
|
-
if (turnState === "failed") return `Last run failed ยท ${reply.error!.message}`
|
|
123
|
+
if (turnState === "failed") return "Last run failed"
|
|
106
124
|
return ""
|
|
107
125
|
})
|
|
108
126
|
|
|
127
|
+
/** The failed run's reason, the pill's title; empty when the run did not fail. */
|
|
128
|
+
const statusReason = $derived(
|
|
129
|
+
reply && turnState === "failed" ? (reply.error?.message ?? "") : ""
|
|
130
|
+
)
|
|
131
|
+
|
|
109
132
|
const waiting = $derived(dossier?.state.waiting ?? [])
|
|
110
133
|
/**
|
|
111
134
|
* ๐ง What waits ON the viewer, and the viewer's own offers waiting on
|
|
@@ -136,15 +159,92 @@
|
|
|
136
159
|
/** The link beside the pill: Review, only when the pill is not already it. */
|
|
137
160
|
const hasSideLinks = $derived(waiting.length > 0 && !!status)
|
|
138
161
|
let panelOpen = $state(false)
|
|
162
|
+
/** The background list's own open state: Review's popover and this one are two popovers, and one opening must not open the other when the line changes hands. */
|
|
163
|
+
let backgroundOpen = $state(false)
|
|
139
164
|
|
|
140
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Background work for this session: scene summaries under way (the
|
|
167
|
+
* owner's scene list is the one kept current) then the routines the host
|
|
168
|
+
* names as running.
|
|
169
|
+
*/
|
|
170
|
+
const backgroundItems = $derived.by((): string[] => {
|
|
171
|
+
const items: string[] = []
|
|
172
|
+
if (dossier?.isOwner)
|
|
173
|
+
for (const scene of dossier.scenes)
|
|
174
|
+
if (scene.summaryStatus === "running") items.push(scene.name?.trim() ? `Summarizing ${scene.name.trim()}` : "Summarizing a scene")
|
|
175
|
+
for (const name of dossier?.runningRoutineNames ?? []) items.push(`${name} is running`)
|
|
176
|
+
return items
|
|
177
|
+
})
|
|
178
|
+
/**
|
|
179
|
+
* ๐ง Background runs in progress. Present: this list is the background
|
|
180
|
+
* line (the host sent it). Absent (an older host): the scenes' summary
|
|
181
|
+
* state and `runningRoutineNames` above are read instead.
|
|
182
|
+
*/
|
|
183
|
+
const runs = $derived(dossier?.runsInProgress)
|
|
184
|
+
/** The left half's text for background work: nothing while a reply, a failure or Review holds it. */
|
|
185
|
+
const backgroundLine = $derived(
|
|
186
|
+
runs || !backgroundItems.length || status || hasLinks || turnState === "live"
|
|
187
|
+
? ""
|
|
188
|
+
: backgroundItems.length === 1
|
|
189
|
+
? backgroundItems[0]
|
|
190
|
+
: `${backgroundItems.length} things are running in the background`
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
/** ๐ง With Send hidden Continue stays reachable here, even under `hidden`. */
|
|
194
|
+
const nextShown = $derived(nextUp !== "hidden" || !sendShown)
|
|
195
|
+
const nextMode = $derived<NextUp>(nextUp === "hidden" ? "head" : nextUp)
|
|
196
|
+
const showNext = $derived(nextShown && !!dossier && !dossier.readOnly)
|
|
197
|
+
|
|
198
|
+
let runsOpen = $state(false)
|
|
199
|
+
const runsShown = $derived(runs ? (runsOpen ? runs : runs.slice(0, RUNS_SHOWN_BEFORE_COUNT)) : [])
|
|
200
|
+
const runsMore = $derived(runs ? Math.max(0, runs.length - RUNS_SHOWN_BEFORE_COUNT) : 0)
|
|
201
|
+
|
|
202
|
+
/** Elapsed words tick once a second; once a minute under reduced motion. */
|
|
203
|
+
let now = $state(Date.now())
|
|
204
|
+
$effect(() => {
|
|
205
|
+
if (!runs?.length) return
|
|
206
|
+
now = Date.now()
|
|
207
|
+
const reduced = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
208
|
+
const timer = setInterval(() => (now = Date.now()), runTickMs(reduced))
|
|
209
|
+
return () => clearInterval(timer)
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
/** How long a finished run stays on the line. */
|
|
213
|
+
const FINISHED_MOMENT_MS = 4000
|
|
214
|
+
let finished = $state<{ id: string; name: string }[]>([])
|
|
215
|
+
let seen = new Map<string, string>()
|
|
216
|
+
const finishTimers = new Set<ReturnType<typeof setTimeout>>()
|
|
217
|
+
$effect(() => {
|
|
218
|
+
const current = runs
|
|
219
|
+
untrack(() => {
|
|
220
|
+
if (!current) {
|
|
221
|
+
seen = new Map()
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
const ids = new Set(current.map((r) => r.id))
|
|
225
|
+
for (const [id, name] of seen) {
|
|
226
|
+
if (ids.has(id)) continue
|
|
227
|
+
finished = [...finished.filter((f) => f.id !== id), { id, name }]
|
|
228
|
+
const timer = setTimeout(() => {
|
|
229
|
+
finishTimers.delete(timer)
|
|
230
|
+
finished = finished.filter((f) => f.id !== id)
|
|
231
|
+
}, FINISHED_MOMENT_MS)
|
|
232
|
+
finishTimers.add(timer)
|
|
233
|
+
}
|
|
234
|
+
finished = finished.filter((f) => !ids.has(f.id))
|
|
235
|
+
seen = new Map(current.map((r) => [r.id, r.name]))
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
$effect(() => () => {
|
|
239
|
+
for (const t of finishTimers) clearTimeout(t)
|
|
240
|
+
})
|
|
141
241
|
</script>
|
|
142
242
|
|
|
143
243
|
<!-- The turn line's parts (`messages.turn-line*`, STYLE-GUIDE ยง6.16): no
|
|
144
244
|
look here; the default widget stylesheet draws them. -->
|
|
145
|
-
<div data-widget-part="messages.turn-line" data-turn-state={turnState ?? undefined}>
|
|
146
|
-
{#if status || hasLinks}
|
|
147
|
-
<div data-widget-part="messages.turn-line-run">
|
|
245
|
+
<div data-widget-part="messages.turn-line turn-line.turn-line" data-turn-state={turnState ?? undefined}>
|
|
246
|
+
{#if status || hasLinks || backgroundLine}
|
|
247
|
+
<div data-widget-part="messages.turn-line-run turn-line.run">
|
|
148
248
|
{#if hasLinks}
|
|
149
249
|
<!-- `sp-popover` (ยง3.5): the pill is the trigger; its panel holds
|
|
150
250
|
the links, which is all a narrow box shows of them. -->
|
|
@@ -157,47 +257,75 @@
|
|
|
157
257
|
<button
|
|
158
258
|
slot="trigger"
|
|
159
259
|
type="button"
|
|
160
|
-
data-widget-part="messages.turn-line-status"
|
|
260
|
+
data-widget-part="messages.turn-line-status turn-line.status"
|
|
161
261
|
data-turn-state={turnState ?? undefined}
|
|
162
|
-
title={
|
|
262
|
+
title={statusReason || reviewLabel}
|
|
163
263
|
>
|
|
164
|
-
<span data-widget-part="messages.turn-line-status-text">{status || reviewLabel}</span>
|
|
165
|
-
<sp-icon name="chevron-up" size="12" data-widget-part="messages.turn-line-status-more"></sp-icon>
|
|
264
|
+
<span data-widget-part="messages.turn-line-status-text turn-line.status-text">{status || reviewLabel}</span>
|
|
265
|
+
<sp-icon name="chevron-up" size="12" data-widget-part="messages.turn-line-status-more turn-line.status-more"></sp-icon>
|
|
166
266
|
</button>
|
|
167
|
-
<div data-widget-part="messages.turn-line-panel">
|
|
267
|
+
<div data-widget-part="messages.turn-line-panel turn-line.panel">
|
|
168
268
|
{#if toDecide.length}
|
|
169
|
-
<header data-widget-part="messages.ledger-review-title">
|
|
269
|
+
<header data-widget-part="messages.ledger-review-title turn-line.ledger-review-title">
|
|
170
270
|
<sp-icon name="clipboard-check" size="14"></sp-icon>
|
|
171
271
|
<span>Waiting for you</span>
|
|
172
272
|
</header>
|
|
173
|
-
<p data-widget-part="messages.ledger-review-note">{decideNote}</p>
|
|
174
|
-
<StateProposalList proposals={toDecide} showAnchor />
|
|
273
|
+
<p data-widget-part="messages.ledger-review-note turn-line.ledger-review-note">{decideNote}</p>
|
|
274
|
+
<StateProposalList proposals={toDecide} showAnchor alias="turn-line" />
|
|
175
275
|
{/if}
|
|
176
276
|
{#if ownOffers.length}
|
|
177
|
-
<header data-widget-part="messages.ledger-review-title">
|
|
277
|
+
<header data-widget-part="messages.ledger-review-title turn-line.ledger-review-title">
|
|
178
278
|
<sp-icon name="hourglass" size="14"></sp-icon>
|
|
179
279
|
<span>{ownOffers.length === 1 ? "Your offer" : "Your offers"}</span>
|
|
180
280
|
</header>
|
|
181
|
-
<p data-widget-part="messages.ledger-review-note">
|
|
281
|
+
<p data-widget-part="messages.ledger-review-note turn-line.ledger-review-note">
|
|
182
282
|
Nothing moves until it is accepted. You can take an offer back.
|
|
183
283
|
</p>
|
|
184
|
-
<StateProposalList proposals={ownOffers} />
|
|
284
|
+
<StateProposalList proposals={ownOffers} alias="turn-line" />
|
|
185
285
|
{/if}
|
|
186
286
|
</div>
|
|
187
287
|
</sp-popover>
|
|
288
|
+
{:else if backgroundLine && backgroundItems.length > 1}
|
|
289
|
+
<sp-popover
|
|
290
|
+
placement="top-start"
|
|
291
|
+
label="Running in the background"
|
|
292
|
+
open={backgroundOpen}
|
|
293
|
+
onopen-change={(e: CustomEvent<{ open: boolean }>) => (backgroundOpen = e.detail.open)}
|
|
294
|
+
>
|
|
295
|
+
<button
|
|
296
|
+
slot="trigger"
|
|
297
|
+
type="button"
|
|
298
|
+
data-widget-part="messages.turn-line-status turn-line.status"
|
|
299
|
+
title={backgroundItems.join("\n")}
|
|
300
|
+
>
|
|
301
|
+
<span data-widget-part="messages.turn-line-status-text turn-line.status-text">{backgroundLine}</span>
|
|
302
|
+
<sp-icon name="chevron-up" size="12" data-widget-part="messages.turn-line-status-more turn-line.status-more"></sp-icon>
|
|
303
|
+
</button>
|
|
304
|
+
<div data-widget-part="messages.turn-line-panel turn-line.panel">
|
|
305
|
+
<ul data-widget-part="turn-line.background-list">
|
|
306
|
+
{#each backgroundItems as item, i (i)}
|
|
307
|
+
<li>{item}</li>
|
|
308
|
+
{/each}
|
|
309
|
+
</ul>
|
|
310
|
+
</div>
|
|
311
|
+
</sp-popover>
|
|
312
|
+
{:else if backgroundLine}
|
|
313
|
+
<span data-widget-part="messages.turn-line-status turn-line.status" title={backgroundLine}>
|
|
314
|
+
<span data-widget-part="messages.turn-line-status-text turn-line.status-text">{backgroundLine}</span>
|
|
315
|
+
</span>
|
|
188
316
|
{:else}
|
|
189
|
-
<span data-widget-part="messages.turn-line-status" data-turn-state={turnState ?? undefined} title={
|
|
190
|
-
<span data-widget-part="messages.turn-line-status-text">{status}</span>
|
|
317
|
+
<span data-widget-part="messages.turn-line-status turn-line.status" data-turn-state={turnState ?? undefined} title={statusReason || undefined}>
|
|
318
|
+
<span data-widget-part="messages.turn-line-status-text turn-line.status-text">{status}</span>
|
|
191
319
|
</span>
|
|
192
320
|
{/if}
|
|
193
321
|
{#if hasSideLinks}
|
|
194
322
|
<!-- The same link, beside the pill where the box has room. Not
|
|
195
323
|
when the pill already says it (no status): one Review per
|
|
196
324
|
screen, never two side by side. -->
|
|
197
|
-
<span data-widget-part="messages.turn-line-links">
|
|
325
|
+
<span data-widget-part="messages.turn-line-links turn-line.links">
|
|
198
326
|
<button
|
|
199
327
|
type="button"
|
|
200
|
-
data-widget-part="messages.turn-line-review"
|
|
328
|
+
data-widget-part="messages.turn-line-review turn-line.review"
|
|
201
329
|
onclick={() => (panelOpen = true)}
|
|
202
330
|
>
|
|
203
331
|
<sp-icon name="clipboard-check" size="12"></sp-icon>
|
|
@@ -207,16 +335,72 @@
|
|
|
207
335
|
{/if}
|
|
208
336
|
</div>
|
|
209
337
|
{/if}
|
|
338
|
+
{#if runs}
|
|
339
|
+
<!-- One polite live region for the list: arrivals are announced here,
|
|
340
|
+
never per item. Drawn whenever the dossier carries the list, empty when no run is in progress. -->
|
|
341
|
+
<div data-widget-part="turn-line.runs" aria-live="polite" aria-relevant="additions text">
|
|
342
|
+
{#each runsShown as run (run.id)}
|
|
343
|
+
{@const words = runItemWords(run)}
|
|
344
|
+
<span data-widget-part="turn-line.run-item" data-run-kind={run.kind} data-parked={run.parked ? "" : undefined}>
|
|
345
|
+
<span data-widget-part="turn-line.run-name">{run.name}</span>
|
|
346
|
+
{#if words.length}
|
|
347
|
+
<span data-widget-part="turn-line.run-status">{words.join(" ยท ")}</span>
|
|
348
|
+
{/if}
|
|
349
|
+
{#if run.since !== undefined}
|
|
350
|
+
<span data-widget-part="turn-line.run-since" aria-hidden="true">{runElapsedWords(run.since, now)}</span>
|
|
351
|
+
{/if}
|
|
352
|
+
{#if run.mayStop && !run.parked}
|
|
353
|
+
<button
|
|
354
|
+
type="button"
|
|
355
|
+
data-widget-part="turn-line.run-stop"
|
|
356
|
+
aria-label={`Stop ${run.name}`}
|
|
357
|
+
onclick={() => void conv.request("stop-run", { id: run.id })}
|
|
358
|
+
>
|
|
359
|
+
<sp-icon name="square" size="12"></sp-icon>
|
|
360
|
+
<span>Stop</span>
|
|
361
|
+
</button>
|
|
362
|
+
{/if}
|
|
363
|
+
</span>
|
|
364
|
+
{/each}
|
|
365
|
+
{#if runsMore > 0}
|
|
366
|
+
<button
|
|
367
|
+
type="button"
|
|
368
|
+
data-widget-part="turn-line.runs-more"
|
|
369
|
+
aria-expanded={runsOpen}
|
|
370
|
+
onclick={() => (runsOpen = !runsOpen)}
|
|
371
|
+
>
|
|
372
|
+
{runsOpen ? "Show fewer" : `${runsMore} more`}
|
|
373
|
+
</button>
|
|
374
|
+
{/if}
|
|
375
|
+
{#each finished as done (done.id)}
|
|
376
|
+
<span data-widget-part="turn-line.run-item" data-finished="">
|
|
377
|
+
<span data-widget-part="turn-line.run-name">{done.name}</span>
|
|
378
|
+
<span data-widget-part="turn-line.run-status">finished</span>
|
|
379
|
+
</span>
|
|
380
|
+
{/each}
|
|
381
|
+
</div>
|
|
382
|
+
{/if}
|
|
383
|
+
{#if notice}
|
|
384
|
+
<div data-widget-part="turn-line.notice">{@render notice()}</div>
|
|
385
|
+
{:else if dossier?.stepTimeLimitsOff === true}
|
|
386
|
+
<div data-widget-part="turn-line.notice">
|
|
387
|
+
<span
|
|
388
|
+
data-widget-part="turn-line.limits-off"
|
|
389
|
+
title="Step time limits are off in Admin โบ Diagnostics. A stuck step waits until someone stops it."
|
|
390
|
+
>Time limits off</span
|
|
391
|
+
>
|
|
392
|
+
</div>
|
|
393
|
+
{/if}
|
|
210
394
|
{#if showNext && dossier}
|
|
211
|
-
<div data-widget-part="messages.turn-line-next messages.next-up">
|
|
395
|
+
<div data-widget-part="messages.turn-line-next turn-line.next messages.next-up turn-line.next-up">
|
|
212
396
|
<!-- Who else is writing (the page's view): a pill, when someone is. -->
|
|
213
|
-
<span data-widget-part="messages.turn-line-typing"><sp-host-view name="session-banners"></sp-host-view></span>
|
|
397
|
+
<span data-widget-part="messages.turn-line-typing turn-line.typing"><sp-host-view name="session-banners"></sp-host-view></span>
|
|
214
398
|
{#if turnState === "live"}
|
|
215
399
|
<!-- ๐ง Live with the composer's own Stop right under it: nothing here. -->
|
|
216
400
|
{#if !composerStops}
|
|
217
401
|
<button
|
|
218
402
|
type="button"
|
|
219
|
-
data-widget-part="messages.turn-line-stop"
|
|
403
|
+
data-widget-part="messages.turn-line-stop turn-line.stop"
|
|
220
404
|
title="Stop"
|
|
221
405
|
aria-label="Stop generating"
|
|
222
406
|
onclick={() => conv.invoke("stop")}
|
|
@@ -226,32 +410,40 @@
|
|
|
226
410
|
</button>
|
|
227
411
|
{/if}
|
|
228
412
|
{:else if turnState === "failed" && replyIsLast && reply}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
413
|
+
<!-- Absent unless the viewer may rerun this line (`rerunnable`); a line with no verdict keeps it. -->
|
|
414
|
+
{#if conv.line(reply.id).rerunnable !== false}
|
|
415
|
+
<button
|
|
416
|
+
type="button"
|
|
417
|
+
data-widget-part="messages.turn-line-retry turn-line.retry"
|
|
418
|
+
title="Write this reply again"
|
|
419
|
+
onclick={() => conv.invoke("retry", reply)}
|
|
420
|
+
>
|
|
421
|
+
<sp-icon name="refresh-cw" size="14"></sp-icon>
|
|
422
|
+
<span>Try again</span>
|
|
423
|
+
</button>
|
|
424
|
+
{/if}
|
|
238
425
|
{:else}
|
|
239
426
|
<NextCharacterBlock
|
|
240
427
|
order={dossier.turn.order}
|
|
241
428
|
candidates={dossier.turn.candidates}
|
|
242
|
-
mode={
|
|
429
|
+
mode={nextMode}
|
|
243
430
|
shouldShow={dossier.turn.show && conv.edit.id === null}
|
|
244
|
-
avatarFor={(ref) =>
|
|
431
|
+
avatarFor={(ref) =>
|
|
432
|
+
// ๐ง `seated-member:` resolves to a face as `character:` does. Not `player-seat:`: the page's
|
|
433
|
+
// `sp-avatar` lookup has no face for it, and a ref returned here draws the blank avatar
|
|
434
|
+
// where a card-less seat draws nothing today.
|
|
435
|
+
ref.startsWith("character:") || ref.startsWith("seated-member:") ? ref : undefined}
|
|
245
436
|
canChooseSomeoneElse={dossier.turn.canChoose}
|
|
246
437
|
viewerUserId={conv.ctx.viewer.v1.userId}
|
|
247
438
|
waitingFor={dossier.turn.waitingFor ?? []}
|
|
248
439
|
viewerIsOwner={!!dossier.isOwner}
|
|
440
|
+
standstill={dossier.turn.standstill}
|
|
249
441
|
onContinue={(channel) => void conv.request("fire-turn", { channel })}
|
|
250
442
|
onSomeoneElse={() => void conv.request("pick-turn", {})}
|
|
251
443
|
/>
|
|
252
444
|
{/if}
|
|
253
445
|
</div>
|
|
254
446
|
{:else}
|
|
255
|
-
<span data-widget-part="messages.turn-line-typing"><sp-host-view name="session-banners"></sp-host-view></span>
|
|
447
|
+
<span data-widget-part="messages.turn-line-typing turn-line.typing"><sp-host-view name="session-banners"></sp-host-view></span>
|
|
256
448
|
{/if}
|
|
257
449
|
</div>
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* The conversation widget's own model (C0b): what its parts read, derived
|
|
3
3
|
* from the widget context alone, and what they do, through its verbs alone.
|
|
4
4
|
*
|
|
5
|
-
* `MessagesWidget` creates one and provides it
|
|
6
|
-
*
|
|
5
|
+
* `MessagesWidget` creates one and provides it (so do the Composer and Turn
|
|
6
|
+
* line, each its own: they share no state, only the host's dossier); the log,
|
|
7
|
+
* each message, its controls and the composer read it (`useConversation`) instead of taking the
|
|
7
8
|
* page's callbacks as props. So the widget's state โ which line is being
|
|
8
9
|
* edited, whose menu is open, what is selected for a summary โ is the
|
|
9
10
|
* widget's, and every effect is an `invoke` (core's verbs, a contributed
|
|
@@ -28,9 +29,14 @@ import {
|
|
|
28
29
|
} from "@serene-pub/core-catalog/conversation"
|
|
29
30
|
import { setStatusTextResolver, statusTextIn } from "@serene-pub/core-catalog/conversation"
|
|
30
31
|
import type { RequestDeclineCode, StatusText } from "@serene-pub/sdk/component"
|
|
32
|
+
import { composerTargetOf } from "../composer/target"
|
|
31
33
|
import { boundaryOffer, laneOf, markedRun, type BoundaryOffer, type SceneMarkRow } from "./sceneMarks"
|
|
34
|
+
import { anyGenerating, indexRowsById, rowWithId, scenedSetOf } from "./rowFacts"
|
|
32
35
|
import { interleaveByAnchor, interleaveMode, interleaveSlug, isInterleavedRow, rowKindOf, rowKindsOf, rowsByKind } from "./interleave"
|
|
33
36
|
|
|
37
|
+
/** A seat's participant reference, as the conversation cast carries it. */
|
|
38
|
+
type SeatRef = NonNullable<ConversationDossierV1["cast"]["sessionPersonas"][number]["ref"]>
|
|
39
|
+
|
|
34
40
|
const KEY = Symbol("sp-conversation")
|
|
35
41
|
|
|
36
42
|
export type Conversation = ReturnType<typeof createConversation>
|
|
@@ -61,7 +67,27 @@ export function isUnmountDecline(e: unknown): boolean {
|
|
|
61
67
|
return /\bunmounted\b/.test(message)
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
/** What differs between the Messages copy and the widgets beside it (owner R8 2026-11-05). */
|
|
71
|
+
export interface ConversationOptions {
|
|
72
|
+
/**
|
|
73
|
+
* Composer and Turn line only: the lane is the one the target Messages copy
|
|
74
|
+
* shows (`dossier.composer.target.channel`), not a choice of this mount's
|
|
75
|
+
* own, and `lane.set` does nothing. Without a target, or without this
|
|
76
|
+
* option, the lane is the first writable channel as ever.
|
|
77
|
+
*/
|
|
78
|
+
followTarget?: boolean
|
|
79
|
+
/**
|
|
80
|
+
* ๐ง Dialogue box only (PLAN-visual-novel-layout ยง6 answer 1): no selection
|
|
81
|
+
* for a summary โ `select.start` does nothing and a row's menu leaves out
|
|
82
|
+
* *Select for summary* โ since the selection bar, the only way out of a
|
|
83
|
+
* selection, is MessagesWidget's (2026-11-05 D7).
|
|
84
|
+
*/
|
|
85
|
+
noSelection?: boolean
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function createConversation(widget: WidgetContextRef, options: ConversationOptions = {}) {
|
|
89
|
+
const followTarget = !!options.followTarget
|
|
90
|
+
const noSelection = !!options.noSelection
|
|
65
91
|
const ctx = () => widget.current
|
|
66
92
|
const warn = (what: string) => (e: unknown) => {
|
|
67
93
|
if (isUnmountDecline(e)) return
|
|
@@ -164,6 +190,17 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
164
190
|
return rowsByKind(anchored as Array<(typeof anchored)[number] & { metadata?: unknown }>, rowKinds)
|
|
165
191
|
})
|
|
166
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Facts the rows read off the whole list, once per list change: whether
|
|
195
|
+
* any row is being written, each row by id (the first on a duplicate), the
|
|
196
|
+
* lines a scene has captured, and the count. A row reads these O(1) instead
|
|
197
|
+
* of scanning the list on every streamed token.
|
|
198
|
+
*/
|
|
199
|
+
const generatingNow = $derived(anyGenerating(ctx().messages.v1))
|
|
200
|
+
const rowIndex = $derived(indexRowsById(ctx().messages.v1))
|
|
201
|
+
const scenedSet = $derived(scenedSetOf(dossier?.scened))
|
|
202
|
+
const messageTotal = $derived(ctx().messages.v1.length)
|
|
203
|
+
|
|
167
204
|
// The host's summary finished: the selection it was handed ends.
|
|
168
205
|
let summaryEnded: number | null = null
|
|
169
206
|
$effect(() => {
|
|
@@ -264,6 +301,23 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
264
301
|
)
|
|
265
302
|
},
|
|
266
303
|
|
|
304
|
+
/**
|
|
305
|
+
* ๐ง The cast lookup: a cast member id โ that seat's `ref`, off the
|
|
306
|
+
* conversation cast row (either list) whose `castMemberId` matches; null on
|
|
307
|
+
* a miss or a host that fills none (โณ the card form is then read). The
|
|
308
|
+
* optional `seatKind` prefers a seat of that kind (`'character-seat'` looks
|
|
309
|
+
* in the character seats first; `'player-seat'` or none, the player seats
|
|
310
|
+
* first) and falls back to the other, so it changes identity only.
|
|
311
|
+
*/
|
|
312
|
+
refOfMember(castMemberId: number, seatKind?: "character-seat" | "player-seat"): SeatRef | null {
|
|
313
|
+
const cast = dossier?.cast
|
|
314
|
+
const players = cast?.sessionPersonas ?? []
|
|
315
|
+
const characters = cast?.sessionCharacters ?? []
|
|
316
|
+
for (const row of seatKind === "character-seat" ? [...characters, ...players] : [...players, ...characters])
|
|
317
|
+
if (row?.castMemberId === castMemberId && row.ref) return row.ref
|
|
318
|
+
return null
|
|
319
|
+
},
|
|
320
|
+
|
|
267
321
|
// โโ verbs โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
268
322
|
invoke,
|
|
269
323
|
/** A reply swiped: to the newer alternative (right) or the older (left). */
|
|
@@ -315,6 +369,22 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
315
369
|
get rows() {
|
|
316
370
|
return rows
|
|
317
371
|
},
|
|
372
|
+
/** Whether any line of the host's log is being written. */
|
|
373
|
+
get anyGenerating() {
|
|
374
|
+
return generatingNow
|
|
375
|
+
},
|
|
376
|
+
/** A line of the host's log by id; the first on a duplicate id, as `find` answers. */
|
|
377
|
+
rowById(id: unknown) {
|
|
378
|
+
return rowWithId(rowIndex, id)
|
|
379
|
+
},
|
|
380
|
+
/** Whether a scene has already captured this line. */
|
|
381
|
+
isScened(id: number): boolean {
|
|
382
|
+
return scenedSet.has(id)
|
|
383
|
+
},
|
|
384
|
+
/** How many lines the host's log holds. */
|
|
385
|
+
get messageCount() {
|
|
386
|
+
return messageTotal
|
|
387
|
+
},
|
|
318
388
|
/** The channels this copy shows, or `null` for every channel. */
|
|
319
389
|
get channels() {
|
|
320
390
|
return channels
|
|
@@ -389,6 +459,8 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
389
459
|
*/
|
|
390
460
|
lane: {
|
|
391
461
|
get current() {
|
|
462
|
+
const followed = followTarget ? composerTargetOf(dossier).target : null
|
|
463
|
+
if (followed) return canonicalListedChannel(followed.channel)
|
|
392
464
|
if (!channels) return lane
|
|
393
465
|
// A listed lane is written and compared in its canonical form
|
|
394
466
|
// (`parley:1` is the row stored `parley`); the no-lane marker is
|
|
@@ -399,6 +471,7 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
399
471
|
return canonicalListedChannel(pick)
|
|
400
472
|
},
|
|
401
473
|
set(next: string) {
|
|
474
|
+
if (followTarget) return
|
|
402
475
|
lane = next || "main"
|
|
403
476
|
}
|
|
404
477
|
},
|
|
@@ -627,7 +700,12 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
627
700
|
get ids() {
|
|
628
701
|
return selected
|
|
629
702
|
},
|
|
703
|
+
/** Whether this copy offers selecting lines for a summary; false only for a Dialogue box. */
|
|
704
|
+
get offered() {
|
|
705
|
+
return !noSelection
|
|
706
|
+
},
|
|
630
707
|
start(subject?: Subject) {
|
|
708
|
+
if (noSelection) return
|
|
631
709
|
selecting = true
|
|
632
710
|
selected.clear()
|
|
633
711
|
if (subject) selected.add(subject.id)
|
|
@@ -639,7 +717,7 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
639
717
|
},
|
|
640
718
|
toggle(subject: Subject) {
|
|
641
719
|
// A line a scene already captured cannot join another.
|
|
642
|
-
if (
|
|
720
|
+
if (scenedSet.has(subject.id)) return
|
|
643
721
|
if (selected.has(subject.id)) selected.delete(subject.id)
|
|
644
722
|
else selected.add(subject.id)
|
|
645
723
|
},
|
|
@@ -654,7 +732,7 @@ export function createConversation(widget: WidgetContextRef) {
|
|
|
654
732
|
range(index: number, toward: "above" | "below") {
|
|
655
733
|
// The log's own rows: `index` counts the lines this copy draws.
|
|
656
734
|
const list = rows
|
|
657
|
-
const taken =
|
|
735
|
+
const taken = scenedSet
|
|
658
736
|
const step = toward === "above" ? -1 : 1
|
|
659
737
|
for (let i = index; i >= 0 && i < list.length; i += step) {
|
|
660
738
|
const id = list[i].id
|