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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/components/shared/messages/MessageControls.svelte +151 -4
  2. package/components/shared/messages/MessageMediaStrip.svelte +4 -1
  3. package/components/shared/messages/SessionMessage.svelte +185 -12
  4. package/components/shared/messages/SpokenLine.svelte +273 -0
  5. package/components/shared/messages/conversation.svelte.ts +79 -1
  6. package/components/shared/messages/spokenLine.ts +177 -0
  7. package/dist/components/actions.js +6 -7
  8. package/dist/components/actions.source.json +1 -1
  9. package/dist/components/album.js +2 -4
  10. package/dist/components/album.source.json +1 -1
  11. package/dist/components/annex.js +2 -2
  12. package/dist/components/annex.source.json +1 -1
  13. package/dist/components/attendance.js +1 -1
  14. package/dist/components/attendance.source.json +1 -1
  15. package/dist/components/authors-note.js +1 -1
  16. package/dist/components/authors-note.source.json +1 -1
  17. package/dist/components/backdrop.js +4 -5
  18. package/dist/components/backdrop.source.json +1 -1
  19. package/dist/components/chronicle.js +1 -1
  20. package/dist/components/chronicle.source.json +1 -1
  21. package/dist/components/core-ui.json +1 -1
  22. package/dist/components/lore-entries.js +1 -1
  23. package/dist/components/lore-entries.source.json +1 -1
  24. package/dist/components/messages.js +1453 -696
  25. package/dist/components/messages.source.json +1 -1
  26. package/dist/components/places.js +6 -6
  27. package/dist/components/places.source.json +1 -1
  28. package/dist/components/routine-log.js +1 -1
  29. package/dist/components/routine-log.source.json +1 -1
  30. package/dist/components/scene-portraits.js +5 -5
  31. package/dist/components/scene-portraits.source.json +1 -1
  32. package/dist/components/shared-4ME6NFDK.js +277 -0
  33. package/dist/components/{shared-E2Y4ILGR.js → shared-7VDIXYAL.js} +1 -1
  34. package/dist/components/{shared-4RLNEXUH.js → shared-BBF64YGL.js} +9 -6
  35. package/dist/components/{shared-KYLSTWAJ.js → shared-BIWKZFUU.js} +3 -3
  36. package/dist/components/{shared-53LSB5XW.js → shared-JPG5DQO7.js} +598 -6
  37. package/dist/components/{shared-5YNCLFKM.js → shared-QXF5CJVN.js} +4 -2
  38. package/dist/components/{shared-WWDBUSJ5.js → shared-WV3QTKZT.js} +2 -2
  39. package/dist/components/{shared-3QXBXWVS.js → shared-XBDUENRA.js} +1 -1
  40. package/dist/components/{shared-YMBM3PBR.js → shared-YDS7HYL6.js} +30 -3
  41. package/dist/components/stats.js +6 -6
  42. package/dist/components/stats.source.json +1 -1
  43. package/dist/components/turn-order.js +5 -6
  44. package/dist/components/turn-order.source.json +1 -1
  45. package/dist/functions/time.d.ts +9 -3
  46. package/dist/functions/time.js +33 -10
  47. package/dist/genres/defaults.d.ts +24 -0
  48. package/dist/genres/defaults.js +17 -0
  49. package/dist/genres/guide/respond.js +18 -2
  50. package/dist/index.d.ts +8 -2
  51. package/dist/index.js +16 -2
  52. package/dist/primers/ninth-mile.d.ts +16 -0
  53. package/dist/primers/ninth-mile.js +68 -0
  54. package/dist/registry/genres.d.ts +3 -1
  55. package/dist/registry/genres.js +12 -4
  56. package/dist/registry/primers.d.ts +3 -1
  57. package/dist/registry/primers.js +7 -2
  58. package/dist/registry/rulesets.d.ts +94 -0
  59. package/dist/registry/slots.d.ts +86 -0
  60. package/dist/registry/slots.js +70 -1
  61. package/dist/rulesets/archetypes/cardGame.js +1 -1
  62. package/dist/rulesets/archetypes/romance.js +2 -2
  63. package/dist/rulesets/archetypes/sliceOfLife.js +5 -4
  64. package/dist/rulesets/archetypes/workplace.js +4 -4
  65. package/dist/rulesets/templates/d20Style.js +1 -1
  66. package/dist/rulesets/templates/dicePool.js +1 -1
  67. package/dist/rulesets/templates/dicelessPools.js +1 -1
  68. package/dist/rulesets/templates/slots.d.ts +8 -0
  69. package/dist/rulesets/templates/slots.js +1 -0
  70. package/dist/rulesets/vis-itineris/slots.d.ts +37 -0
  71. package/dist/rulesets/vis-itineris/slots.js +16 -0
  72. package/dist/rulesets/wherewithal/slots.d.ts +4 -0
  73. package/dist/rulesets/wherewithal/slots.js +1 -0
  74. package/dist/seed/prompts.js +20 -0
  75. package/dist/seed/scripts.js +3 -0
  76. package/dist/seed/speechTemplates.d.ts +106 -0
  77. package/dist/seed/speechTemplates.js +201 -0
  78. package/dist/shared/characterReachesOut.d.ts +14 -0
  79. package/dist/shared/characterReachesOut.js +66 -0
  80. package/dist/shared/speakMessage.d.ts +12 -0
  81. package/dist/shared/speakMessage.js +157 -0
  82. package/dist/shared/speechFields.d.ts +37 -0
  83. package/dist/shared/speechFields.js +83 -0
  84. package/dist/shared/ui/conversation/messageVerbState.d.ts +11 -1
  85. package/dist/shared/ui/conversation/messageVerbState.js +9 -3
  86. package/dist/shared/ui/widgetContext.d.ts +2 -2
  87. package/dist/shared/weather.d.ts +16 -0
  88. package/dist/shared/weather.js +86 -0
  89. package/package.json +8 -8
  90. package/dist/components/shared-QCE7JYD3.js +0 -101
  91. package/dist/components/shared-XKA5BV4M.js +0 -51
@@ -8,6 +8,7 @@
8
8
  import { actionIdentity } from "@serene-pub/sdk/component"
9
9
  import { useConversation } from "./conversation.svelte"
10
10
  import type { MessageV1, WidgetAction } from "@serene-pub/sdk/component"
11
+ import { playbackOf } from "./spokenLine"
11
12
 
12
13
  /**
13
14
  * A message's ⋮ menu: every verb the session offers on it, named in words.
@@ -18,9 +19,25 @@
18
19
  interface Props {
19
20
  msg: MessageV1
20
21
  isLastMessage?: boolean
22
+ /**
23
+ * 🚧 What ⋮ › Speech needs about this line's audio, worked out once by
24
+ * the message (heading audio control, 2026-10-29): the file's address,
25
+ * whether it can play, a live speak run, and the viewer's playback.
26
+ */
27
+ speech?: {
28
+ src: string | null
29
+ hasAudio: boolean
30
+ /** A take is on file (even under playback `never`): Read aloud reads Say it again. */
31
+ sayItAgain?: boolean
32
+ speaking: boolean
33
+ runId: string | null
34
+ playback: "auto" | "click" | "never"
35
+ onStop?: (runId: string) => void
36
+ onGone?: (partId: number) => void
37
+ }
21
38
  }
22
39
 
23
- let { msg, isLastMessage = false }: Props = $props()
40
+ let { msg, isLastMessage = false, speech }: Props = $props()
24
41
 
25
42
  const conv = useConversation()
26
43
  const open = $derived(conv.menu.open === msg.id)
@@ -41,9 +58,27 @@
41
58
  )
42
59
  const isAdmin = $derived(conv.ctx.viewer.v1.isAdmin)
43
60
 
61
+ /**
62
+ * ⋮ › Speech is a nested popover: it closes with the menu (a row pressed,
63
+ * the menu dismissed) rather than floating on beside a closed menu.
64
+ */
65
+ let speechOpen = $state(false)
66
+ /** Close the menu; with ⋮ › Speech open, in order (`closeFromSpeech`). */
44
67
  function closeMenu() {
68
+ if (speechOpen) return closeFromSpeech()
45
69
  onOpenChange(false)
46
70
  }
71
+ /**
72
+ * A row pressed inside ⋮ › Speech: the popout closes first and the menu a
73
+ * turn later. Closing both nested popovers in one pass trips the page's
74
+ * popover (a Svelte effect self-invalidating with no batch: "reading
75
+ * 'schedule'"), seen in the heading-audio walk 2026-10-29; Escape, which
76
+ * closes them one after the other, never did.
77
+ */
78
+ function closeFromSpeech() {
79
+ speechOpen = false
80
+ setTimeout(() => onOpenChange(false), 0)
81
+ }
47
82
 
48
83
  /**
49
84
  * **Change sprite** (DESIGN-sprites §6): a character's settled line, and a
@@ -97,7 +132,8 @@
97
132
  canControl,
98
133
  canRerun,
99
134
  canDelete,
100
- extendRefusal
135
+ extendRefusal,
136
+ speechReason: conv.dossier?.speech?.canSpeak === false ? conv.dossier.speech.reason : undefined
101
137
  })
102
138
  // `itemGated` rides with `canAct` (W6): a contributed action whose
103
139
  // audience is `item` was answered `true` ahead of any message, and this
@@ -114,9 +150,24 @@
114
150
  .filter((r) => r.state.shown)
115
151
  )
116
152
  const coreRows = $derived(rows.filter((r) => r.action.specSlug === "core"))
153
+ // The speak rows (*Read aloud* / *Say it again*, *Say it as…*) leave the
154
+ // contributed list for the menu's own speech group, same handlers and
155
+ // reasons (owner 2026-10-29: generate and regenerate at the top level).
156
+ const isSpeakRow = (a: WidgetAction) =>
157
+ a.specSlug !== "core" &&
158
+ a.specSlug.includes("speak-message") &&
159
+ (a.key === "read-aloud" || a.key === "say-it-as")
160
+ const speakRows = $derived(rows.filter((r) => isSpeakRow(r.action)))
117
161
  const contributedRows = $derived(
118
- rows.filter((r) => r.action.specSlug !== "core")
162
+ rows.filter((r) => r.action.specSlug !== "core" && !isSpeakRow(r.action))
119
163
  )
164
+ /** ⋮ › Speech holds the full player alone: drawn only where there is one. */
165
+ const speechPlayer = $derived(!!speech?.hasAudio && !!speech.src && speech.playback !== "never")
166
+ const reportAt = (e: Event) => conv.speech.reportMenuAt(msg.id, playbackOf((e as CustomEvent).detail))
167
+ const speechTake = $derived(conv.speech.take(msg.id, "menu"))
168
+ const menuPlayAttr = $derived(conv.speech.isPlaying(msg.id, "menu") ? { playing: "" } : {})
169
+ const speakName = (a: WidgetAction) =>
170
+ a.key === "read-aloud" && (speech?.sayItAgain ?? speech?.hasAudio) ? conv.t("Say it again") : a.name
120
171
  const hasNew = $derived(contributedRows.some((r) => r.action.isNew))
121
172
 
122
173
  /** Fire a core verb by its key: the conversation's verb, or its own edit. */
@@ -204,7 +255,10 @@
204
255
  placement="bottom-end"
205
256
  label="Message options"
206
257
  {open}
207
- onopen-change={(e: CustomEvent<{ open: boolean }>) => onOpenChange(e.detail.open)}
258
+ onopen-change={(e: CustomEvent<{ open: boolean }>) => {
259
+ if (!e.detail.open) speechOpen = false
260
+ onOpenChange(e.detail.open)
261
+ }}
208
262
  >
209
263
  <button slot="trigger" type="button" data-widget-part="messages.message-options-button messages.message-icon-button" aria-label="Message options">
210
264
  <sp-icon name="ellipsis-vertical" size="16"></sp-icon>
@@ -343,6 +397,99 @@
343
397
  <span>Prompt details</span>
344
398
  </button>
345
399
  {/if}
400
+ <!-- The speech group: the speak verbs at the menu's top level
401
+ (*Read aloud*, *Say it again* once the line has audio,
402
+ *Say it as…*), Stop while the line is spoken, then
403
+ ⋮ › Speech for the full player. -->
404
+ {#each speakRows as { action, state } (actionIdentity(action))}
405
+ <button
406
+ data-widget-part="messages.message-option"
407
+ title={titleOf(action, state.reason)}
408
+ aria-disabled={state.disabled}
409
+ aria-describedby={state.reason ? noteIdOf(action) : undefined}
410
+ onclick={(e) => {
411
+ if (state.disabled) {
412
+ e.preventDefault()
413
+ return
414
+ }
415
+ closeMenu()
416
+ conv.invoke(actionIdentity(action), msg)
417
+ }}
418
+ >
419
+ <sp-icon
420
+ name={action.key === "read-aloud" && (speech?.sayItAgain ?? speech?.hasAudio) ? "rotate-ccw" : action.icon || "play"}
421
+ size="16"
422
+ ></sp-icon>
423
+ <span>{speakName(action)}</span>
424
+ </button>
425
+ {#if state.reason}
426
+ <span id={noteIdOf(action)} data-widget-part="messages.message-option-note">
427
+ {state.reason}
428
+ </span>
429
+ {/if}
430
+ {/each}
431
+ {#if speech?.speaking && speech.runId}
432
+ <button
433
+ data-widget-part="messages.message-option"
434
+ data-verb="stop"
435
+ title="Stop speaking this line"
436
+ onclick={() => {
437
+ closeMenu()
438
+ speech.onStop?.(speech.runId!)
439
+ }}
440
+ >
441
+ <sp-icon name="square" size="16"></sp-icon>
442
+ <span>Stop speaking this line</span>
443
+ </button>
444
+ {/if}
445
+ {#if speechPlayer && speech}
446
+ <!-- ⋮ › Speech: a sub-popout holding the full player. The
447
+ player stays in the markup (not only while open), so
448
+ closing the menu never stops it. -->
449
+ <sp-popover
450
+ placement="right-start"
451
+ label="Speech"
452
+ open={speechOpen}
453
+ onopen-change={(e: CustomEvent<{ open: boolean }>) => (speechOpen = e.detail.open)}
454
+ >
455
+ <button
456
+ slot="trigger"
457
+ type="button"
458
+ data-widget-part="messages.message-option messages.message-speech-open"
459
+ title="Speech"
460
+ >
461
+ <sp-icon name="volume-2" size="16"></sp-icon>
462
+ <span>Speech</span>
463
+ <sp-icon name="chevron-right" size="14"></sp-icon>
464
+ </button>
465
+ <div data-widget-part="messages.message-speech-panel">
466
+ {#key speechTake}
467
+ <audio
468
+ data-widget-part="messages.message-speech-player"
469
+ aria-label="Spoken line player"
470
+ controls
471
+ preload="none"
472
+ src={speech.src}
473
+ {...menuPlayAttr}
474
+ onplay={(e) => {
475
+ reportAt(e)
476
+ conv.speech.heard(msg.id, "menu", false)
477
+ }}
478
+ onpause={(e) => {
479
+ reportAt(e)
480
+ conv.speech.heard(msg.id, "menu", true)
481
+ }}
482
+ onended={(e) => {
483
+ reportAt(e)
484
+ conv.speech.heard(msg.id, "menu", true)
485
+ }}
486
+ ontimeupdate={reportAt}
487
+ onloadedmetadata={reportAt}
488
+ ></audio>
489
+ {/key}
490
+ </div>
491
+ </sp-popover>
492
+ {/if}
346
493
  {#if contributedRows.length}
347
494
  <!-- The contributed entries (19 §4): after core's
348
495
  verbs, separated so a plugin's never reads as
@@ -158,8 +158,11 @@
158
158
  {#each players as item (item.partId)}
159
159
  <li data-widget-part="messages.media-item">
160
160
  <figure data-widget-part="messages.media-player">
161
- {#if item.kind === 'audio'}
161
+ {#if missing.has(item.partId)}
162
+ <p data-widget-part="messages.media-missing-text">File no longer available</p>
163
+ {:else if item.kind === 'audio'}
162
164
  <audio
165
+ onerror={() => missing.add(item.partId)}
163
166
  data-widget-part="messages.media-audio"
164
167
  controls
165
168
  preload="metadata"
@@ -5,13 +5,17 @@
5
5
  import {
6
6
  enabledWhenState,
7
7
  quickRowActions,
8
+ SPEAK_VERB_KEYS,
9
+ verbKeyOf,
8
10
  verdictOf
9
11
  } from "@serene-pub/core-catalog/conversation"
10
12
  import { actionIdentity, foldedSectionsOf } from "@serene-pub/sdk/component"
11
13
  import MessagePartsView from "./MessagePartsView.svelte"
12
14
  import MessageMediaStrip from "./MessageMediaStrip.svelte"
13
- import { mediaStripItems, viewImageParams } from "./mediaStrip"
15
+ import { mediaSrc, mediaStripItems, viewImageParams } from "./mediaStrip"
14
16
  import MessageStateLedger from "./MessageStateLedger.svelte"
17
+ import SpokenLine from "./SpokenLine.svelte"
18
+ import { isSpeaking, readAloudOf, spokenAudioItem, spokenOf, spokenPendingOf, spokenPlaybackOf } from "./spokenLine"
15
19
  import { useWidgetContext } from "../context"
16
20
  import { isDiceLine, staleOf } from "@serene-pub/core-catalog/conversation"
17
21
  import { untrack } from "svelte"
@@ -351,6 +355,10 @@
351
355
  | { primary: WidgetAction[]; overflow: WidgetAction[] }
352
356
  | undefined
353
357
  )
358
+ // Why this pub cannot speak (dossier `speech`), shared by the quick row and the ⋮ menu.
359
+ const speechReason = $derived(
360
+ conv.dossier?.speech?.canSpeak === false ? conv.dossier.speech.reason : undefined
361
+ )
354
362
  const quickActions = $derived(
355
363
  quickRowActions(venueActions?.primary ?? [], {
356
364
  msg,
@@ -361,12 +369,15 @@
361
369
  canRerun,
362
370
  // 🚧 A kept turn's row the host would refuse to delete (★9).
363
371
  canDelete: line.deletable ?? true,
364
- extendRefusal
365
- })
366
- )
367
- const showQuickActions = $derived(
368
- !isSummarizationMode && !isEditing && quickActions.length > 0
372
+ extendRefusal,
373
+ speechReason: speechReason
374
+ }, (a) => SPEAK_VERB_KEYS.includes(verbKeyOf(a)))
369
375
  )
376
+ // The speak verbs are not icons of their own: the heading's ONE speech
377
+ // icon is the line's audio (heading audio control, 2026-10-29) or, with
378
+ // none, the contributed *Read aloud*. *Say it as…* lives in the ⋮ menu.
379
+ const readAloudQuick = $derived(quickActions.find((q) => q.action.key === "read-aloud") ?? null)
380
+ const otherQuickActions = $derived(quickActions.filter((q) => !isSpeakVerb(q.action)))
370
381
 
371
382
  /**
372
383
  * A quick icon fires the same handler the menu's row does: core's verbs
@@ -408,10 +419,105 @@
408
419
  * so an attachment never disappears while its line is edited or a reply
409
420
  * streams beside it. The parts view no longer draws them inline.
410
421
  */
411
- const mediaItems = $derived(
422
+ const allMediaItems = $derived(
412
423
  mediaStripItems(msg.parts, msg.activeRevisions ?? { "0": 0 })
413
424
  )
414
425
 
426
+ // 🚧 The spoken line (speech build, E3): a line with `metadata.spoken`
427
+ // plays its audio in the spoken line under the strip, so the strip
428
+ // leaves that one file out (a gone file reads "Not spoken yet" there,
429
+ // never a broken player).
430
+ const spoken = $derived(spokenOf(msg.metadata))
431
+ const spokenAudio = $derived(spoken ? spokenAudioItem(allMediaItems) : null)
432
+ // A speak run in flight (`metadata.spoken.pending`) mounts the spoken line
433
+ // even before the line has audio: it reads *Speaking…* with a Stop.
434
+ const spokenPending = $derived(spokenPendingOf(msg.metadata))
435
+ const mediaItems = $derived(
436
+ spokenAudio ? allMediaItems.filter((i) => i.partId !== spokenAudio.partId) : allMediaItems
437
+ )
438
+ /**
439
+ * The speak verbs the message venue lists — `core:spec/speak-message`'s
440
+ * *Read aloud* and *Say it as…* (contributed actions, not core verbs) —
441
+ * by key; none listed, none drawn. Fired through `fireOfferedAction`
442
+ * like the menu's own rows, so the server checks that declaration.
443
+ */
444
+ const SPOKEN_VERB_KEYS = ["read-aloud", "say-it-as"]
445
+ const spokenVerbActions = $derived(
446
+ SPOKEN_VERB_KEYS.flatMap((key) => {
447
+ const a = [...(venueActions?.primary ?? []), ...(venueActions?.overflow ?? [])].find(
448
+ (x) => x.specSlug !== "core" && x.key === key && x.specSlug.includes("speak-message")
449
+ )
450
+ return a ? [a] : []
451
+ })
452
+ )
453
+ // Under a line that has audio, *Read aloud* reads as what it does there:
454
+ // **Say it again** (design §6.4); once its file is gone it is *Read
455
+ // aloud* again. The ⋮ menu keeps the declared name.
456
+ const spokenVerbs = $derived(
457
+ spokenVerbActions.map((a) => ({
458
+ key: a.key,
459
+ name: a.name,
460
+ ...(a.key === "read-aloud" ? { againName: conv.t("Say it again") } : {}),
461
+ description: a.description,
462
+ disabled: !a.canAct
463
+ }))
464
+ )
465
+ // Stop is the line's own `stop` verb carrying the run to cancel; the host
466
+ // cancels that run through its run-cancel path.
467
+ const stopSpoken = (runId: string) => void conv.invoke("stop", msg, { runId })
468
+ function fireSpokenVerb(key: string) {
469
+ const a = spokenVerbActions.find((x) => x.key === key)
470
+ if (a) fireOfferedAction(a, msg)
471
+ }
472
+
473
+ // ── the speak verbs in the quick row ─────────────────────────────────
474
+ // Read aloud and Say it as… sit in the message venue's primary set like
475
+ // every quick icon; this only decides how each READS on this line. A line
476
+ // with audio says *Say it again*; a live speak run gives both way to one
477
+ // Stop. A run seen live and gone since is over (see `isSpeaking`).
478
+ let seenLiveRun = $state<string | null>(null)
479
+ $effect(() => {
480
+ const p = spokenPending
481
+ if (p && conv.dossier?.liveRunIds?.includes(p.runId)) seenLiveRun = p.runId
482
+ })
483
+ const speaking = $derived(isSpeaking(spokenPending, conv.dossier?.liveRunIds, seenLiveRun))
484
+ /** The audio part the strip found gone (404): the heading reads Read aloud again, not Say it again. */
485
+ let goneSpokenPart = $state<number | null>(null)
486
+ /** The line's audio is there to play: present, not found gone, and the viewer's playback is not `never`. */
487
+ const hasAudio = $derived(
488
+ !!spokenAudio && spokenAudio.partId !== goneSpokenPart && spokenPlaybackOf(conv.dossier) !== "never"
489
+ )
490
+ const linePlaying = $derived(
491
+ conv.speech.isPlaying(msg.id, "line") || conv.speech.isPlaying(msg.id, "menu")
492
+ )
493
+ const speechSlot = $derived(speaking || hasAudio || !!readAloudQuick)
494
+ const showQuickActions = $derived(
495
+ !isSummarizationMode && !isEditing && (otherQuickActions.length > 0 || speechSlot)
496
+ )
497
+ /** What the ⋮ menu's speech group and ⋮ › Speech need, passed as one object rather than recomputed there. */
498
+ const speechForMenu = $derived({
499
+ src: hasAudio && spokenAudio ? mediaSrc(spokenAudio.assetId) : null,
500
+ hasAudio,
501
+ // The line has a take on file (whatever the viewer's playback): Read aloud reads Say it again.
502
+ sayItAgain: !!spokenAudio && spokenAudio.partId !== goneSpokenPart,
503
+ speaking,
504
+ runId: speaking && spokenPending ? spokenPending.runId : null,
505
+ playback: spokenPlaybackOf(conv.dossier),
506
+ onStop: stopSpoken,
507
+ onGone: (partId: number) => (goneSpokenPart = partId)
508
+ })
509
+ const isSpeakVerb = (a: WidgetAction) => SPEAK_VERB_KEYS.includes(verbKeyOf(a))
510
+ /** One speak icon's presentation on this line. */
511
+ function speakLook(action: WidgetAction): { icon: string; name: string } {
512
+ if (action.key === "read-aloud" && spokenAudio && spokenAudio.partId !== goneSpokenPart)
513
+ return { icon: "rotate-ccw", name: conv.t("Say it again") }
514
+ return { icon: action.icon || "volume-2", name: action.iconAlt || action.name }
515
+ }
516
+ /** The speak icons give way to ONE Stop while the line's run is live. */
517
+ const stopSpeakingFirst = $derived(
518
+ speaking && !!spokenPending ? spokenPending.runId : null
519
+ )
520
+
415
521
  // An image inside the rendered text is the host's markup; `sp-message-body`
416
522
  // raises `open-image` with its address.
417
523
  const openImage = (e: CustomEvent<{ src: string }>) =>
@@ -664,12 +770,56 @@
664
770
  data-widget-part="messages.message-actions"
665
771
  role="group"
666
772
  aria-label="Message actions"
773
+ data-speaking={stopSpeakingFirst ? "" : undefined}
774
+ data-playing={linePlaying ? "" : undefined}
667
775
  >
668
- {#each quickActions as { action } (actionIdentity(action))}
776
+ <!-- ONE speech icon, first: Stop while the run is live, the
777
+ line's audio (play / stop) when it has one, the
778
+ contributed Read aloud otherwise. -->
779
+ {#if stopSpeakingFirst}
780
+ <button
781
+ data-widget-part="messages.message-action messages.message-icon-button messages.message-speech messages.message-speak-stop"
782
+ data-state="speaking"
783
+ aria-label="Stop speaking this line"
784
+ title="Speaking… — press to stop"
785
+ onclick={() => stopSpoken(stopSpeakingFirst)}
786
+ >
787
+ <sp-icon name="volume-2" size="14"></sp-icon>
788
+ </button>
789
+ {:else if hasAudio}
790
+ {@const nm = linePlaying ? conv.t("Stop") : conv.t("Play the spoken line")}
791
+ <button
792
+ data-widget-part="messages.message-action messages.message-icon-button messages.message-speech"
793
+ data-state={linePlaying ? "playing" : "ready"}
794
+ aria-label={nm}
795
+ title={nm}
796
+ onclick={() =>
797
+ linePlaying ? conv.speech.stop(msg.id) : void conv.speech.play(msg.id, "line")}
798
+ >
799
+ <sp-icon name="volume-2" size="14"></sp-icon>
800
+ </button>
801
+ {:else if readAloudQuick}
802
+ {@const action = readAloudQuick.action}
803
+ {@const state = readAloudQuick.state}
804
+ {@const look = speakLook(action)}
805
+ <button
806
+ data-widget-part="messages.message-action messages.message-icon-button messages.message-speak"
807
+ aria-label={look.name}
808
+ aria-disabled={state.disabled ? "true" : undefined}
809
+ title={state.disabled && state.reason
810
+ ? `${look.name} — ${state.reason}`
811
+ : action.description
812
+ ? `${look.name} — ${action.description}`
813
+ : look.name}
814
+ onclick={(e) => {
815
+ if (!state.disabled) fireQuick(e, action)
816
+ }}
817
+ >
818
+ <sp-icon name={look.icon} size="14"></sp-icon>
819
+ </button>
820
+ {/if}
821
+ {#each otherQuickActions as { action } (actionIdentity(action))}
669
822
  {@const iconName = action.icon || "play"}
670
- <!-- Icon-only: the accessible name is the declaration's
671
- `iconAlt`, else its name; the tooltip adds what it
672
- does (the legend, 2026-09-28). -->
673
823
  <button
674
824
  data-widget-part="messages.message-action messages.message-icon-button"
675
825
  aria-label={action.iconAlt || action.name}
@@ -733,7 +883,7 @@
733
883
  {/if}
734
884
  </div>
735
885
  {:else}
736
- <MessageControls {msg} {isLastMessage} />
886
+ <MessageControls {msg} {isLastMessage} speech={speechForMenu} />
737
887
  {/if}
738
888
  </div>
739
889
  {/snippet}
@@ -1037,4 +1187,27 @@
1037
1187
  void conv.request("remove-attachment", { messageId: msg.id, partId: item.partId })
1038
1188
  : undefined}
1039
1189
  />
1190
+ <!-- 🚧 The spoken line (speech build, E3): its own cell after the strip,
1191
+ in content's columns (messageLayouts.css), under the card. -->
1192
+ {#if (spoken || spokenPending) && !isEditing && !msg.isGenerating && spokenPlaybackOf(conv.dossier) !== 'never'}
1193
+ <SpokenLine
1194
+ {spoken}
1195
+ pending={spokenPending}
1196
+ liveRunIds={conv.dossier?.liveRunIds}
1197
+ onStop={stopSpoken}
1198
+ item={spokenAudio}
1199
+ onGone={(partId) => (goneSpokenPart = partId)}
1200
+ playing={conv.speech.isPlaying(msg.id, "line")}
1201
+ take={conv.speech.take(msg.id, "line")}
1202
+ menuAt={conv.speech.menuAt(msg.id)}
1203
+ onPlayback={(paused) => conv.speech.heard(msg.id, "line", paused)}
1204
+ {isLastMessage}
1205
+ readAloud={readAloudOf(conv.dossier)}
1206
+ spokenPlayback={spokenPlaybackOf(conv.dossier)}
1207
+ speakerFace={line.speaker.face}
1208
+ onSayItAs={canControl && spokenVerbActions.some((x) => x.key === "say-it-as")
1209
+ ? () => fireSpokenVerb("say-it-as")
1210
+ : undefined}
1211
+ />
1212
+ {/if}
1040
1213
  </div>