dsh-laivox-tts 0.7.6 → 0.7.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.
package/README.md CHANGED
@@ -39,7 +39,7 @@ Replace `desktop` with your own profile name wherever needed.
39
39
  dsh plugin --profile desktop add "https://github.com/xiaolai181/dsh_laivox_tts/releases/latest/download/dsh-laivox-tts.tgz"
40
40
  ```
41
41
 
42
- This is a prebuilt package. Nothing is compiled on your machine and no build permission is asked for. To pin a version, replace `latest/download` with `download/v0.7.6`. Other versions are listed on the [Releases](https://github.com/xiaolai181/dsh_laivox_tts/releases) page.
42
+ This is a prebuilt package. Nothing is compiled on your machine and no build permission is asked for. To pin a version, replace `latest/download` with `download/v0.7.7`. Other versions are listed on the [Releases](https://github.com/xiaolai181/dsh_laivox_tts/releases) page.
43
43
 
44
44
  ### Local: install a downloaded package
45
45
 
package/README.zh-CN.md CHANGED
@@ -37,7 +37,7 @@
37
37
  dsh plugin --profile desktop add "https://github.com/xiaolai181/dsh_laivox_tts/releases/latest/download/dsh-laivox-tts.tgz"
38
38
  ```
39
39
 
40
- 这是预构建的插件包,不在你的电脑上编译,也不需要授权构建。想固定版本时,把 `latest/download` 换成 `download/v0.7.6`。所有版本见 [Releases](https://github.com/xiaolai181/dsh_laivox_tts/releases) 页面。
40
+ 这是预构建的插件包,不在你的电脑上编译,也不需要授权构建。想固定版本时,把 `latest/download` 换成 `download/v0.7.7`。所有版本见 [Releases](https://github.com/xiaolai181/dsh_laivox_tts/releases) 页面。
41
41
 
42
42
  ### 本地安装:用下载好的插件包
43
43
 
@@ -84,7 +84,7 @@ Profile 链接的是这个目录本身,安装后不要移动或删除它。`gi
84
84
 
85
85
  不想导入文件、只想粘贴正文时,用 **书架 →「新建书籍」**。
86
86
 
87
- 全新空白 Profile 首次打开插件时,书架会预置两本试听示例:《社戏 · 月夜行船 · Edge》(由微软 Edge 在线语音单人朗读生成)与《绿野仙踪 · 营救铁皮人 · LaiVox》(由 LaiVox 预置音色多角色演绎生成)。无需配置 API Key,可直接点「试听示例」或在书架打开收听。
87
+ 全新空白 Profile 首次打开插件时,书架会预置两本试听示例:《社戏 · 月夜行船 · Edge》(由微软 Edge 在线语音单人朗读生成)与《绿野仙踪 · 营救铁皮人 · LaiVox》(由 LaiVox 预置音色多角色演绎生成)。无需配置 API Key,首次打开会直接进入书架,点示例书目录里的「收听」即可试听。
88
88
 
89
89
  ## 隐私与费用
90
90
 
package/docs/GUIDE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  LaiVox 是 DeepSeek Harness(DSH)里的有声书插件:把 TXT / EPUB 小说做成单人朗读或多角色配音的音频,也能把 AI 的回答直接读给你听。默认使用 Edge 在线语音,不需要注册账号。
4
4
 
5
- 从侧栏的「小说配音(LaiVox)」进入工作台。顶部三个页签:**收听**、**制作**、**书架**;右上角是任务和设置。
5
+ 从侧栏的「小说配音(LaiVox)」进入工作台。顶部三个页签:**收听**、**制作**、**书架**;右上角是任务和设置。首次打开(或上次收听的章节已被删除)会进入书架;之后再打开会回到上次收听的章节。
6
6
 
7
7
  > 从旧版升级:第一次打开新版前,先完全退出 DSH,备份 Profile 下的 `dsh-laivox-tts` 目录。新版会升级书架数据库,旧版之后打不开它。
8
8
 
package/lib/client.js CHANGED
@@ -9279,7 +9279,6 @@ function clearLastChapter() {
9279
9279
  }
9280
9280
  function createWorkbenchMemory() {
9281
9281
  return {
9282
- scene: "listen",
9283
9282
  immersive: true,
9284
9283
  skin: "paper",
9285
9284
  activeId: lastChapter(),
@@ -9530,6 +9529,10 @@ var signatureOf = (view) => [
9530
9529
  view?.playbackStale ? 1 : 0,
9531
9530
  view?.previousComplete?.id
9532
9531
  ].join("|");
9532
+ var livePlayback = (player) => {
9533
+ const live = player.getSnapshot();
9534
+ return live.chapter && live.job && ["playing", "buffering", "paused", "blocked"].includes(live.phase) ? live : null;
9535
+ };
9533
9536
  function useWorkbench(player, navigation, memory) {
9534
9537
  const pending = (0, import_react26.useSyncExternalStore)(navigation.subscribe, navigation.getSnapshot);
9535
9538
  const active = (0, import_react26.useRef)(null);
@@ -9553,7 +9556,7 @@ function useWorkbench(player, navigation, memory) {
9553
9556
  const [jobCounts, setJobCounts] = (0, import_react26.useState)({});
9554
9557
  const countsRef = (0, import_react26.useRef)(null);
9555
9558
  const [actions, setActions] = (0, import_react26.useState)(/* @__PURE__ */ new Map());
9556
- const [booting, setBooting] = (0, import_react26.useState)(Boolean(memory.activeId || pending?.chapter));
9559
+ const [booting, setBooting] = (0, import_react26.useState)(() => Boolean(memory.activeId || pending?.chapter || pending?.book || livePlayback(player)));
9557
9560
  const [exportState, setExportState] = (0, import_react26.useState)(null);
9558
9561
  const [exportFormat, setExportFormat] = (0, import_react26.useState)("mp3");
9559
9562
  const life = (0, import_react26.useRef)(false);
@@ -10217,8 +10220,8 @@ function useWorkbench(player, navigation, memory) {
10217
10220
  if (!abort.signal.aborted) errors(error2);
10218
10221
  });
10219
10222
  if (!pending?.chapter) {
10220
- const live = player.getSnapshot();
10221
- if (live.chapter && live.job && ["playing", "buffering", "paused", "blocked"].includes(live.phase)) {
10223
+ const live = livePlayback(player);
10224
+ if (live) {
10222
10225
  void navigate({ chapter: live.chapter, job: live.job, restore: true });
10223
10226
  } else if (memory.activeId) void navigate({ chapter: memory.activeId, restore: true });
10224
10227
  }
@@ -10852,8 +10855,14 @@ function sceneFromWorkbench({ page, panel, reason }) {
10852
10855
  if (panel === "script") return { scene: "studio", studioTab: "script" };
10853
10856
  return {};
10854
10857
  }
10858
+ function initialScene(remembered, booting) {
10859
+ return remembered ?? (booting ? "listen" : "library");
10860
+ }
10861
+ function restoreFallback({ wasBooting, booting, hasChapter, chosen, creating }) {
10862
+ return wasBooting && !booting && !hasChapter && !chosen && !creating ? "library" : null;
10863
+ }
10855
10864
  function useScene(w, memory) {
10856
- const [scene, updateScene] = (0, import_react27.useState)(memory.scene ?? "listen");
10865
+ const [scene, updateScene] = (0, import_react27.useState)(() => initialScene(memory.scene, w.booting));
10857
10866
  const [studioTab, setStudioTab] = (0, import_react27.useState)("text");
10858
10867
  const [sheet, setSheet] = (0, import_react27.useState)(null);
10859
10868
  const [focus, setFocus] = (0, import_react27.useState)(null);
@@ -10891,6 +10900,18 @@ function useScene(w, memory) {
10891
10900
  previousChapter.current = w.chapter.id;
10892
10901
  }
10893
10902
  }, [w.chapter?.id]);
10903
+ const wasBooting = (0, import_react27.useRef)(w.booting);
10904
+ (0, import_react27.useEffect)(() => {
10905
+ const next = restoreFallback({
10906
+ wasBooting: wasBooting.current,
10907
+ booting: w.booting,
10908
+ hasChapter: Boolean(w.chapter),
10909
+ chosen: memory.scene != null,
10910
+ creating: Boolean(memory.creation)
10911
+ });
10912
+ wasBooting.current = w.booting;
10913
+ if (next) setScene(next);
10914
+ }, [w.booting]);
10894
10915
  (0, import_react27.useEffect)(() => {
10895
10916
  const next = sceneFromWorkbench({ page: w.page, panel: w.panel, reason: w.errorCode });
10896
10917
  if (next.scene) setScene(next.scene);
@@ -11333,7 +11354,7 @@ var SAMPLE_BOOK_IDS = SAMPLE_BOOKS.map((item) => item.bookId);
11333
11354
 
11334
11355
  // src/client/stage/EmptyStage.jsx
11335
11356
  var import_jsx_runtime27 = require("react/jsx-runtime");
11336
- function EmptyStage({ w, create, openImport, books, openBook }) {
11357
+ function EmptyStage({ w, create, openImport, books, openBook, openLibrary }) {
11337
11358
  const [plan, setPlan] = (0, import_react34.useState)(null);
11338
11359
  const chapter = w.chapter;
11339
11360
  const signature = JSON.stringify(w.options);
@@ -11356,7 +11377,8 @@ function EmptyStage({ w, create, openImport, books, openBook }) {
11356
11377
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lv-inline", children: [
11357
11378
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { className: "lv-primary", onClick: openImport, children: translate("\u5BFC\u5165 TXT / EPUB / PDF") }),
11358
11379
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { onClick: create, children: translate("\u7C98\u8D34\u4E00\u7AE0\u6B63\u6587") }),
11359
- sampleBook && openBook && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { onClick: () => openBook(sampleBook.id), children: translate("\u8BD5\u542C\u793A\u4F8B") })
11380
+ sampleBook && openBook && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { onClick: () => openBook(sampleBook.id), children: translate("\u8BD5\u542C\u793A\u4F8B") }),
11381
+ Array.isArray(books) && books.length > 0 && openLibrary && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { onClick: openLibrary, children: translate("\u6253\u5F00\u4E66\u67B6") })
11360
11382
  ] })
11361
11383
  ] });
11362
11384
  }
@@ -11699,7 +11721,7 @@ function ProseChrome({ enabled, children }) {
11699
11721
 
11700
11722
  // src/client/stage/StageScene.jsx
11701
11723
  var import_jsx_runtime30 = require("react/jsx-runtime");
11702
- function StageScene({ w, player, immersive, setImmersive, navigate, listenFrom, create, openImport, books, openBook }) {
11724
+ function StageScene({ w, player, immersive, setImmersive, navigate, listenFrom, create, openImport, books, openBook, openLibrary }) {
11703
11725
  const chapter = w.chapter;
11704
11726
  const s = (0, import_react37.useSyncExternalStore)(player.subscribe, player.getSnapshot);
11705
11727
  if (w.booting && !chapter) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("section", { role: "status", children: translate("\u6B63\u5728\u6253\u5F00\u7AE0\u8282\u2026") });
@@ -11740,7 +11762,7 @@ function StageScene({ w, player, immersive, setImmersive, navigate, listenFrom,
11740
11762
  },
11741
11763
  chapter.operation.id
11742
11764
  ),
11743
- !chapter ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EmptyStage, { w, create, openImport, books, openBook }) : !chapter.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
11765
+ !chapter ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EmptyStage, { w, create, openImport, books, openBook, openLibrary }) : !chapter.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
11744
11766
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(EmptyStage, { w, create, openImport }),
11745
11767
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ProseView, { chapter, player, draft: w.draft, busy: w.busy, notify: w.flashNotice, navigate, onSeek: listenFrom })
11746
11768
  ] }) : immersive ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImmersiveLines, { chapter, player, listenFrom }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ProseView, { chapter, player, draft: w.draft, busy: w.busy, notify: w.flashNotice, navigate, onSeek: listenFrom })
@@ -12801,6 +12823,17 @@ function Shell({ player, navigation, memory, isPanelActive, useSessions }) {
12801
12823
  if (!chapter || chapter.isSnippet) return;
12802
12824
  setShelfPick((current) => current?.id === chapter.book ? current : { id: chapter.book, title: chapter.bookTitle });
12803
12825
  }, [chapter?.book, chapter?.isSnippet]);
12826
+ const autoPick = (0, import_react46.useRef)(true);
12827
+ (0, import_react46.useEffect)(() => {
12828
+ if (chapter) {
12829
+ autoPick.current = false;
12830
+ return;
12831
+ }
12832
+ const first = books.value?.books?.[0];
12833
+ if (!autoPick.current || !onShelf || shelfPick || booksQuery || !first) return;
12834
+ autoPick.current = false;
12835
+ setShelfPick(first);
12836
+ }, [chapter, onShelf, books.value, shelfPick, booksQuery]);
12804
12837
  (0, import_react46.useLayoutEffect)(() => {
12805
12838
  setShelfQuery("");
12806
12839
  setBatch(false);
@@ -13090,14 +13123,14 @@ function Shell({ player, navigation, memory, isPanelActive, useSessions }) {
13090
13123
  } }),
13091
13124
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TopBar, { chapter, draftBookTitle: w.appendBook?.title, books: books.value?.books, openBook: (id) => nav({ book: id }), scene: scene.scene, setScene: scene.setScene, tasks: inProgress, openQueue: () => openQueue(), openSettings: () => scene.openSheet("settings"), openRail: () => setShelfOpen(true) }),
13092
13125
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "lv-shell-body", children: [
13093
- width >= 1024 && scene.scene !== "library" && rail,
13126
+ width >= 1024 && scene.scene !== "library" && (chapter || w.booting) && rail,
13094
13127
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "lv-scene-room", children: [
13095
13128
  w.error && !scene.sheet && scene.sheet !== "settings" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "lv-inline lv-error", role: "alert", children: [
13096
13129
  w.error,
13097
13130
  w.memory.activeId && !w.creationSaved && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { onClick: () => w.reloadChapter().then(w.clearError).catch(w.errors), children: translate("\u91CD\u65B0\u52A0\u8F7D") })
13098
13131
  ] }),
13099
13132
  blockedActions(),
13100
- scene.scene === "listen" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StageScene, { w, player, immersive: scene.immersive, setImmersive: scene.setImmersive, navigate: (id) => nav({ chapter: id }), listenFrom: w.listenFrom, create: () => nav({ new: true }), openImport: () => fileInput.current.click(), books: books.value?.books, openBook: (id) => nav({ book: id }) }),
13133
+ scene.scene === "listen" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StageScene, { w, player, immersive: scene.immersive, setImmersive: scene.setImmersive, navigate: (id) => nav({ chapter: id }), listenFrom: w.listenFrom, create: () => nav({ new: true }), openImport: () => fileInput.current.click(), books: books.value?.books, openBook: (id) => nav({ book: id }), openLibrary: () => scene.setScene("library") }),
13101
13134
  scene.scene === "studio" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StudioScene, { w, player, tab: scene.studioTab, change: scene.setStudioTab, roleData, staleScript, saveCreation, cancelCreation, openQueue: () => openQueue({ chapter: chapter?.id }) }),
13102
13135
  scene.scene === "library" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
13103
13136
  LibraryScene,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-laivox-tts",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "private": false,
5
5
  "description": "在 DSH 里把 TXT / EPUB / PDF 小说做成多角色音频:书架、逐章合成、播放与 MP3/WAV 导出。",
6
6
  "license": "MIT",