@memef1f1y/dsh-plugin-tts 0.6.3 → 0.6.4

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 (2) hide show
  1. package/lib/client.js +11 -2
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -18,7 +18,7 @@ window.__ModuleLoader__.load({
18
18
 
19
19
  // Bundle build tag: bump on every client fix so a console line proves
20
20
  // WHICH code is actually running (rules out stale-bundle confusion).
21
- const CLIENT_BUILD = "2026-09-26.04-follow-v2";
21
+ const CLIENT_BUILD = "2026-09-26.05-follow-v2-fix";
22
22
  const apply = ctx => {
23
23
  const slots = ctx.slots ?? (typeof ctx.get === "function" ? ctx.get("slots") : undefined);
24
24
  if (!slots) throw new Error("[dsh-plugin-tts] slots service unavailable");
@@ -1490,6 +1490,13 @@ window.__ModuleLoader__.load({
1490
1490
  return shared.rvc.baseVoice || shared.voice;
1491
1491
  }
1492
1492
 
1493
+ // --- Scroll-follow v2 state: apply-scope singleton so BOTH speakText
1494
+ // (new-read re-latch) and TtsReadingOverlay (tick / takeover / resume)
1495
+ // share the SAME object. Must NOT live inside the component (each render
1496
+ // would recreate it: speakText would throw ReferenceError AND latch-off
1497
+ // would be lost on next render).
1498
+ const ttsFollow = { latched: true, touchActive: false, selfUntil: 0 };
1499
+
1493
1500
  // ---------- approval voice alerts (Agent-event broadcast) ----------
1494
1501
  // The Host ingests approval session events (approval/asked, approval/
1495
1502
  // decided) from the session/event firehose and serves them through
@@ -3546,7 +3553,8 @@ window.__ModuleLoader__.load({
3546
3553
  // with manual resume; reduced-motion respected. No polling loop:
3547
3554
  // evaluation runs per chunk-index change + on scroll/touch/viewport
3548
3555
  // events (the old 250ms full-DOM scan forced reflow at 4Hz).
3549
- const ttsFollow = { latched: true, touchActive: false, selfUntil: 0 };
3556
+ // NOTE: ttsFollow lives in apply scope (shared singleton) — do NOT
3557
+ // redeclare here, or speakText can't see it (0.6.3 ReferenceError).
3550
3558
  const ttsReducedMotion = () => {
3551
3559
  try { return !!(window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches); } catch (e) { return false; }
3552
3560
  };
@@ -3640,6 +3648,7 @@ window.__ModuleLoader__.load({
3640
3648
  // one forever (that froze follow at the initial spot).
3641
3649
  const fullNeedle = shared.currentText || "";
3642
3650
  if (!fullNeedle) { mark("no-needle"); return false; }
3651
+ const ratio = total ? (idx - 1) / total : 0;
3643
3652
  const pos = Math.floor(fullNeedle.length * Math.min(0.99, Math.max(0, ratio)));
3644
3653
  const needle = fullNeedle.slice(Math.max(0, pos - 50), pos + 50);
3645
3654
  if (!needle) { mark("no-needle"); return false; }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memef1f1y/dsh-plugin-tts",
3
3
  "description": "Edge TTS 语音大集成插件:消息朗读按钮、自动朗读开关、语音设置面板(Edge TTS / RVC / Index-TTS2 / CosyVoice / Google Cloud TTS)",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=22"