@gobing-ai/knowledge-kit 0.1.22 → 0.1.24

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 (117) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +282 -147
  3. package/package.json +5 -5
  4. package/plugins/generations/content-gen/dist/index.js +9 -9
  5. package/plugins/generations/core-facts-gen/dist/index.js +12 -12
  6. package/plugins/generations/daily-article-gen/dist/index.js +12 -12
  7. package/plugins/generations/dailynews-gen/dist/index.js +11 -11
  8. package/plugins/generations/dailynews-gen/src/script-plan.ts +2 -2
  9. package/plugins/generations/episode-plan-gen/dist/index.js +12 -12
  10. package/plugins/generations/gemini-tts/dist/index.js +56 -16
  11. package/plugins/generations/gemini-tts/src/gemini-client.ts +34 -6
  12. package/plugins/generations/image-gen/dist/index.js +9 -9
  13. package/plugins/generations/music-gen/README.md +2 -2
  14. package/plugins/generations/music-gen/dist/index.js +62 -26
  15. package/plugins/generations/music-gen/presets/formats/song.yaml +6 -1
  16. package/plugins/generations/music-gen/presets/themes/synthwave.yaml +6 -1
  17. package/plugins/generations/music-gen/src/adapter/instance.ts +34 -11
  18. package/plugins/generations/music-gen/src/presets.ts +36 -3
  19. package/plugins/generations/news-report-gen/dist/index.js +12 -12
  20. package/plugins/generations/omni-voice-gen/uv.toml +5 -0
  21. package/plugins/generations/vibe-voice-tts/README.md +64 -0
  22. package/plugins/generations/vibe-voice-tts/dist/index.js +14259 -0
  23. package/plugins/generations/vibe-voice-tts/package.json +16 -0
  24. package/plugins/generations/vibe-voice-tts/plugin.json +6 -0
  25. package/plugins/generations/vibe-voice-tts/profiles.json +10 -0
  26. package/plugins/generations/vibe-voice-tts/pyproject.toml +9 -0
  27. package/plugins/generations/vibe-voice-tts/python/worker.py +566 -0
  28. package/plugins/generations/vibe-voice-tts/src/index.ts +88 -0
  29. package/plugins/generations/vibe-voice-tts/src/vibevoice-client.ts +828 -0
  30. package/plugins/generations/vibe-voice-tts/tsconfig.json +8 -0
  31. package/plugins/generations/vibe-voice-tts/uv.lock +1767 -0
  32. package/plugins/generations/vibe-voice-tts/uv.toml +4 -0
  33. package/plugins/generations/voice-gen/dist/index.js +40 -10
  34. package/plugins/generations/voice-gen/src/voicebox-client.ts +50 -1
  35. package/plugins/generations/voxcpm-tts/dist/index.js +90 -18
  36. package/plugins/generations/voxcpm-tts/python/worker.py +9 -0
  37. package/plugins/generations/voxcpm-tts/src/index.ts +41 -0
  38. package/plugins/generations/voxcpm-tts/src/voxcpm-client.ts +32 -11
  39. package/plugins/generations/voxcpm-tts/uv.toml +5 -0
  40. package/plugins/ingestions/aihot-ingest/dist/index.js +12 -12
  41. package/plugins/ingestions/horizon-ingest/dist/index.js +12 -12
  42. package/plugins/ingestions/karakeep-local/dist/index.js +13 -13
  43. package/plugins/ingestions/last30days-ingest/dist/index.js +12 -12
  44. package/plugins/ingestions/web-search/dist/index.js +10 -10
  45. package/plugins/kk/README.md +21 -0
  46. package/plugins/kk/decisions/kk-safety.yaml +5 -2
  47. package/plugins/kk/plugin.json +1 -1
  48. package/plugins/kk/publish-presets/daily-ai-voice.json +16 -16
  49. package/plugins/kk/schedules/kk-serve.launchd.plist.tmpl +12 -1
  50. package/plugins/kk/scripts/cover-compositor.ts +104 -26
  51. package/plugins/kk/scripts/daily-stages.ts +481 -63
  52. package/plugins/kk/scripts/kk-workflow-stages.ts +218 -17
  53. package/plugins/kk/scripts/safety-artifact-check.ts +28 -5
  54. package/plugins/kk/scripts/series-names.ts +16 -3
  55. package/plugins/kk/skills/news-editorial/SKILL.md +1 -1
  56. package/plugins/kk/skills/news-editorial/references/style-contract.zh.md +3 -3
  57. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +4 -3
  58. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +6 -5
  59. package/plugins/kk/workflows/kk-daily-safety.yaml +12 -10
  60. package/plugins/kk/workflows/kk-music.yaml +20 -16
  61. package/plugins/kk/workflows/kk-news-generate.yaml +26 -3
  62. package/plugins/kk/workflows/kk-publish.yaml +4 -1
  63. package/plugins/publishings/bilibili-pub/dist/index.js +22 -22
  64. package/plugins/publishings/bilibili-pub/dist/profile-check.js +22 -22
  65. package/plugins/publishings/cnblogs-pub/dist/index.js +22 -22
  66. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +22 -22
  67. package/plugins/publishings/csdn-pub/dist/index.js +22 -22
  68. package/plugins/publishings/csdn-pub/dist/profile-check.js +22 -22
  69. package/plugins/publishings/emdash-pub/dist/index.js +9 -9
  70. package/plugins/publishings/infoq-pub/dist/index.js +22 -22
  71. package/plugins/publishings/infoq-pub/dist/profile-check.js +22 -22
  72. package/plugins/publishings/jike-pub/dist/index.js +22 -22
  73. package/plugins/publishings/jike-pub/dist/profile-check.js +22 -22
  74. package/plugins/publishings/juejin-pub/dist/index.js +22 -22
  75. package/plugins/publishings/juejin-pub/dist/profile-check.js +22 -22
  76. package/plugins/publishings/linkedin-pub/dist/index.js +133 -33
  77. package/plugins/publishings/linkedin-pub/dist/profile-check.js +27 -22
  78. package/plugins/publishings/linkedin-pub/src/index.ts +192 -18
  79. package/plugins/publishings/medium-pub/dist/index.js +9 -9
  80. package/plugins/publishings/podcast-pub/dist/index.js +240 -37
  81. package/plugins/publishings/podcast-pub/src/index.ts +154 -3
  82. package/plugins/publishings/podcast-pub/src/seo.ts +25 -8
  83. package/plugins/publishings/podcast-pub/src/show-notes-brief.ts +93 -23
  84. package/plugins/publishings/podcast-pub/src/show-notes.ts +26 -6
  85. package/plugins/publishings/qiita-pub/dist/index.js +9 -9
  86. package/plugins/publishings/shipinhao-pub/dist/index.js +23 -23
  87. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +23 -23
  88. package/plugins/publishings/shipinhao-pub/src/selectors.ts +2 -1
  89. package/plugins/publishings/sspai-pub/dist/index.js +22 -22
  90. package/plugins/publishings/sspai-pub/dist/profile-check.js +22 -22
  91. package/plugins/publishings/substack-pub/dist/index.js +22 -22
  92. package/plugins/publishings/substack-pub/dist/profile-check.js +22 -22
  93. package/plugins/publishings/surfdash-pub/dist/index.js +207 -95
  94. package/plugins/publishings/surfdash-pub/src/digest-check.ts +30 -1
  95. package/plugins/publishings/surfdash-pub/src/index.ts +101 -76
  96. package/plugins/publishings/surfdash-pub/src/media-upload.ts +83 -0
  97. package/plugins/publishings/surfdash-pub/src/patch.ts +49 -26
  98. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +12 -4
  99. package/plugins/publishings/threads-pub/dist/index.js +83 -27
  100. package/plugins/publishings/threads-pub/dist/profile-check.js +34 -23
  101. package/plugins/publishings/threads-pub/src/post-rail.ts +121 -4
  102. package/plugins/publishings/wechatmp-pub/dist/index.js +274 -98
  103. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +27 -23
  104. package/plugins/publishings/wechatmp-pub/src/cgi-draft.ts +87 -53
  105. package/plugins/publishings/wechatmp-pub/src/enrich.ts +117 -13
  106. package/plugins/publishings/wechatmp-pub/src/flow.ts +183 -43
  107. package/plugins/publishings/wechatmp-pub/src/modes.ts +30 -12
  108. package/plugins/publishings/weibo-pub/dist/index.js +22 -22
  109. package/plugins/publishings/weibo-pub/dist/profile-check.js +22 -22
  110. package/plugins/publishings/x-pub/dist/index.js +113 -32
  111. package/plugins/publishings/x-pub/dist/profile-check.js +22 -22
  112. package/plugins/publishings/x-pub/src/post-rail.ts +155 -20
  113. package/plugins/publishings/xhs-pub/dist/index.js +22 -22
  114. package/plugins/publishings/xhs-pub/dist/profile-check.js +22 -22
  115. package/plugins/publishings/xiaoyuzhou-pub/dist/index.js +22 -22
  116. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +22 -22
  117. package/plugins/publishings/zenn-pub/dist/index.js +9 -9
@@ -0,0 +1,4 @@
1
+ # Hardlink wheels from the shared uv cache instead of duplicating multi-gigabyte torch trees
2
+ # across local plugin virtualenvs. Override with UV_LINK_MODE=copy if ~/.cache/uv lives on a
3
+ # separate filesystem.
4
+ link-mode = "hardlink"
@@ -4813,7 +4813,7 @@ var init_zod = __esm(() => {
4813
4813
  init_external();
4814
4814
  });
4815
4815
 
4816
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/errors.js
4816
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/errors.js
4817
4817
  var ErrorCode;
4818
4818
  var init_errors3 = __esm(() => {
4819
4819
  ErrorCode = {
@@ -4824,7 +4824,7 @@ var init_errors3 = __esm(() => {
4824
4824
  };
4825
4825
  });
4826
4826
 
4827
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/api-response.js
4827
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/api-response.js
4828
4828
  var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
4829
4829
  var init_api_response = __esm(() => {
4830
4830
  init_errors3();
@@ -4847,13 +4847,13 @@ var init_api_response = __esm(() => {
4847
4847
  CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
4848
4848
  });
4849
4849
 
4850
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/cursor.js
4850
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/cursor.js
4851
4851
  var init_cursor = () => {};
4852
4852
 
4853
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
4853
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
4854
4854
  var init_event_severity = () => {};
4855
4855
 
4856
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/output.js
4856
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/output.js
4857
4857
  function processStream(name) {
4858
4858
  const proc = globalThis.process;
4859
4859
  const stream = proc?.[name];
@@ -4871,7 +4871,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
4871
4871
  }
4872
4872
  var defaultStderrTarget;
4873
4873
 
4874
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/index.js
4874
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/index.js
4875
4875
  var init_dist = __esm(() => {
4876
4876
  init_api_response();
4877
4877
  init_cursor();
@@ -11869,7 +11869,7 @@ var init_dist2 = __esm(() => {
11869
11869
  $visitAsync = visit.visitAsync;
11870
11870
  });
11871
11871
 
11872
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/config.js
11872
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/config.js
11873
11873
  var configSchema;
11874
11874
  var init_config = __esm(() => {
11875
11875
  init_dist2();
@@ -11893,7 +11893,7 @@ var init_config = __esm(() => {
11893
11893
  });
11894
11894
  });
11895
11895
 
11896
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
11896
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
11897
11897
  import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
11898
11898
  import { dirname, resolve as resolvePath } from "path";
11899
11899
  function createNodeFileSystem(root, paths) {
@@ -12248,7 +12248,7 @@ var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx)
12248
12248
  });
12249
12249
  }
12250
12250
  });
12251
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/index.js
12251
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
12252
12252
  init_file_system_node();
12253
12253
  init_config();
12254
12254
 
@@ -12669,6 +12669,19 @@ async function auditVoiceSegments(script, segmentWavs, segmentMetadata, client)
12669
12669
  }
12670
12670
 
12671
12671
  // ../../plugins/generations/voice-gen/src/voicebox-client.ts
12672
+ init_dist();
12673
+ var GPU_BACKENDS = new Set(["gpu", "mps", "metal", "cuda"]);
12674
+ function detectCpuFallback(payload) {
12675
+ if (payload.gpu_available !== true)
12676
+ return;
12677
+ const variant = (payload.backend_variant ?? "").toLowerCase();
12678
+ if (!variant || GPU_BACKENDS.has(variant))
12679
+ return;
12680
+ return payload;
12681
+ }
12682
+ function requireGpu(env) {
12683
+ return ["1", "true", "yes"].includes((env.VOICEBOX_REQUIRE_GPU ?? "").toLowerCase());
12684
+ }
12672
12685
  function resolveVoiceboxTimeoutMs() {
12673
12686
  const raw = process.env.VOICEBOX_TIMEOUT_MS;
12674
12687
  const parsed = raw ? Number.parseInt(raw, 10) : Number.NaN;
@@ -12683,8 +12696,9 @@ function createVoiceboxClient(options = {}) {
12683
12696
  return {
12684
12697
  url,
12685
12698
  async health() {
12699
+ let res;
12686
12700
  try {
12687
- const res = await customFetch(`${url}/health`, { signal: AbortSignal.timeout(requestTimeoutMs) });
12701
+ res = await customFetch(`${url}/health`, { signal: AbortSignal.timeout(requestTimeoutMs) });
12688
12702
  if (!res.ok) {
12689
12703
  throw new Error(`HTTP ${res.status} ${res.statusText}`);
12690
12704
  }
@@ -12692,6 +12706,21 @@ function createVoiceboxClient(options = {}) {
12692
12706
  const reason = err instanceof Error ? err.message : String(err);
12693
12707
  throw new Error(`Voicebox health check failed at ${url}: ${reason} \u2014 is Voicebox.app running with its REST server enabled? (restart the app or fix VOICEBOX_URL)`);
12694
12708
  }
12709
+ let payload;
12710
+ try {
12711
+ payload = await res.json();
12712
+ } catch {
12713
+ payload = undefined;
12714
+ }
12715
+ const fallback = payload && detectCpuFallback(payload);
12716
+ if (fallback) {
12717
+ const detail = `backend_variant: "${fallback.backend_variant}", gpu_available: true, gpu_type: "${fallback.gpu_type ?? "unknown"}"`;
12718
+ const message = `Voicebox at ${url} is rendering on CPU (${detail}) \u2014 expect ~5.6x realtime degradation. Restart Voicebox.app while Metal is free, or set VOICEBOX_REQUIRE_GPU=0 to accept it.`;
12719
+ if (requireGpu(process.env)) {
12720
+ throw new Error(`voice-gen: ${message}`);
12721
+ }
12722
+ echoError(`voice-gen: warning: ${message}`);
12723
+ }
12695
12724
  },
12696
12725
  async resolveProfile(nameOrId) {
12697
12726
  let res;
@@ -13545,6 +13574,7 @@ export {
13545
13574
  computeExpectedDurationRange,
13546
13575
  concatWavs,
13547
13576
  createVoiceboxClient,
13577
+ detectCpuFallback,
13548
13578
  detectLoudnessDip,
13549
13579
  detectRepetitions,
13550
13580
  isMp3Requested,
@@ -1,3 +1,5 @@
1
+ import { echoError } from '@gobing-ai/ts-utils';
2
+
1
3
  export interface EffectConfig {
2
4
  type: string;
3
5
  enabled?: boolean;
@@ -54,6 +56,35 @@ export interface VoiceboxClientOptions {
54
56
  sleep?: (ms: number) => Promise<void>;
55
57
  }
56
58
 
59
+ /** `/health` fields the CPU-fallback guard reads (observed live shape, 2026-11-20). */
60
+ export interface VoiceboxHealth {
61
+ status?: string;
62
+ gpu_available?: boolean;
63
+ gpu_type?: string;
64
+ backend_type?: string;
65
+ backend_variant?: string;
66
+ }
67
+
68
+ /** Backend variants that mean the GPU path is actually executing renders. */
69
+ const GPU_BACKENDS = new Set(['gpu', 'mps', 'metal', 'cuda']);
70
+
71
+ /**
72
+ * Voicebox reports `gpu_available: true` while rendering on `backend_variant: "cpu"` (~5.6x RTF).
73
+ * Returns the payload when the GPU exists but is not used, so the degradation is surfaced instead of
74
+ * silently costing an hour per episode (0417 R2).
75
+ */
76
+ export function detectCpuFallback(payload: VoiceboxHealth): VoiceboxHealth | undefined {
77
+ if (payload.gpu_available !== true) return undefined;
78
+ const variant = (payload.backend_variant ?? '').toLowerCase();
79
+ if (!variant || GPU_BACKENDS.has(variant)) return undefined;
80
+ return payload;
81
+ }
82
+
83
+ /** `VOICEBOX_REQUIRE_GPU` turns the CPU-fallback warning into a hard failure. */
84
+ function requireGpu(env: Record<string, string | undefined>): boolean {
85
+ return ['1', 'true', 'yes'].includes((env.VOICEBOX_REQUIRE_GPU ?? '').toLowerCase());
86
+ }
87
+
57
88
  /**
58
89
  * Creates a client for the Voicebox local REST API.
59
90
  */
@@ -79,8 +110,9 @@ export function createVoiceboxClient(options: VoiceboxClientOptions = {}): Voice
79
110
  url,
80
111
 
81
112
  async health(): Promise<void> {
113
+ let res: Response;
82
114
  try {
83
- const res = await customFetch(`${url}/health`, { signal: AbortSignal.timeout(requestTimeoutMs) });
115
+ res = await customFetch(`${url}/health`, { signal: AbortSignal.timeout(requestTimeoutMs) });
84
116
  if (!res.ok) {
85
117
  throw new Error(`HTTP ${res.status} ${res.statusText}`);
86
118
  }
@@ -90,6 +122,23 @@ export function createVoiceboxClient(options: VoiceboxClientOptions = {}): Voice
90
122
  `Voicebox health check failed at ${url}: ${reason} — is Voicebox.app running with its REST server enabled? (restart the app or fix VOICEBOX_URL)`,
91
123
  );
92
124
  }
125
+ // body read is best-effort: an older/partial /health must not fail the run (its JSON shape
126
+ // is not part of the client contract), only the CPU-fallback signal matters here.
127
+ let payload: VoiceboxHealth | undefined;
128
+ try {
129
+ payload = (await res.json()) as VoiceboxHealth;
130
+ } catch {
131
+ payload = undefined;
132
+ }
133
+ const fallback = payload && detectCpuFallback(payload);
134
+ if (fallback) {
135
+ const detail = `backend_variant: "${fallback.backend_variant}", gpu_available: true, gpu_type: "${fallback.gpu_type ?? 'unknown'}"`;
136
+ const message = `Voicebox at ${url} is rendering on CPU (${detail}) — expect ~5.6x realtime degradation. Restart Voicebox.app while Metal is free, or set VOICEBOX_REQUIRE_GPU=0 to accept it.`;
137
+ if (requireGpu(process.env)) {
138
+ throw new Error(`voice-gen: ${message}`);
139
+ }
140
+ echoError(`voice-gen: warning: ${message}`);
141
+ }
93
142
  },
94
143
 
95
144
  async resolveProfile(nameOrId: string): Promise<VoiceboxProfile> {
@@ -13,7 +13,7 @@ var __esm = (fn, res, err) => () => {
13
13
  };
14
14
  var __require = import.meta.require;
15
15
 
16
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/errors.js
16
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/errors.js
17
17
  var ErrorCode;
18
18
  var init_errors = __esm(() => {
19
19
  ErrorCode = {
@@ -24,7 +24,7 @@ var init_errors = __esm(() => {
24
24
  };
25
25
  });
26
26
 
27
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/api-response.js
27
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/api-response.js
28
28
  var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
29
29
  var init_api_response = __esm(() => {
30
30
  init_errors();
@@ -47,13 +47,13 @@ var init_api_response = __esm(() => {
47
47
  CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
48
48
  });
49
49
 
50
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/cursor.js
50
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/cursor.js
51
51
  var init_cursor = () => {};
52
52
 
53
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
53
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
54
54
  var init_event_severity = () => {};
55
55
 
56
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/output.js
56
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/output.js
57
57
  function processStream(name) {
58
58
  const proc = globalThis.process;
59
59
  const stream = proc?.[name];
@@ -71,7 +71,7 @@ function echoError(message, target = defaultStderrTarget ?? processStream("stder
71
71
  }
72
72
  var defaultStderrTarget;
73
73
 
74
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.32/node_modules/@gobing-ai/ts-utils/dist/index.js
74
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.8.4/node_modules/@gobing-ai/ts-utils/dist/index.js
75
75
  var init_dist = __esm(() => {
76
76
  init_api_response();
77
77
  init_cursor();
@@ -11869,7 +11869,7 @@ var init_dist2 = __esm(() => {
11869
11869
  $visitAsync = visit.visitAsync;
11870
11870
  });
11871
11871
 
11872
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/config.js
11872
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/config.js
11873
11873
  var configSchema;
11874
11874
  var init_config = __esm(() => {
11875
11875
  init_dist2();
@@ -11893,7 +11893,7 @@ var init_config = __esm(() => {
11893
11893
  });
11894
11894
  });
11895
11895
 
11896
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
11896
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
11897
11897
  import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
11898
11898
  import { dirname, resolve as resolvePath } from "path";
11899
11899
  function createNodeFileSystem(root, paths) {
@@ -12251,7 +12251,7 @@ var PluginManifestSchema = PluginManifestSchemaBase.superRefine((manifest, ctx)
12251
12251
  });
12252
12252
  }
12253
12253
  });
12254
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.32+180a6e424da77181/node_modules/@gobing-ai/ts-runtime/dist/index.js
12254
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.8.4+b85a65bb895e3074/node_modules/@gobing-ai/ts-runtime/dist/index.js
12255
12255
  init_file_system_node();
12256
12256
  init_config();
12257
12257
 
@@ -12672,6 +12672,19 @@ async function auditVoiceSegments(script, segmentWavs, segmentMetadata, client)
12672
12672
  }
12673
12673
 
12674
12674
  // ../../plugins/generations/voice-gen/src/voicebox-client.ts
12675
+ init_dist();
12676
+ var GPU_BACKENDS = new Set(["gpu", "mps", "metal", "cuda"]);
12677
+ function detectCpuFallback(payload) {
12678
+ if (payload.gpu_available !== true)
12679
+ return;
12680
+ const variant = (payload.backend_variant ?? "").toLowerCase();
12681
+ if (!variant || GPU_BACKENDS.has(variant))
12682
+ return;
12683
+ return payload;
12684
+ }
12685
+ function requireGpu(env) {
12686
+ return ["1", "true", "yes"].includes((env.VOICEBOX_REQUIRE_GPU ?? "").toLowerCase());
12687
+ }
12675
12688
  function resolveVoiceboxTimeoutMs() {
12676
12689
  const raw = process.env.VOICEBOX_TIMEOUT_MS;
12677
12690
  const parsed = raw ? Number.parseInt(raw, 10) : Number.NaN;
@@ -12686,8 +12699,9 @@ function createVoiceboxClient(options = {}) {
12686
12699
  return {
12687
12700
  url,
12688
12701
  async health() {
12702
+ let res;
12689
12703
  try {
12690
- const res = await customFetch(`${url}/health`, { signal: AbortSignal.timeout(requestTimeoutMs) });
12704
+ res = await customFetch(`${url}/health`, { signal: AbortSignal.timeout(requestTimeoutMs) });
12691
12705
  if (!res.ok) {
12692
12706
  throw new Error(`HTTP ${res.status} ${res.statusText}`);
12693
12707
  }
@@ -12695,6 +12709,21 @@ function createVoiceboxClient(options = {}) {
12695
12709
  const reason = err instanceof Error ? err.message : String(err);
12696
12710
  throw new Error(`Voicebox health check failed at ${url}: ${reason} \u2014 is Voicebox.app running with its REST server enabled? (restart the app or fix VOICEBOX_URL)`);
12697
12711
  }
12712
+ let payload;
12713
+ try {
12714
+ payload = await res.json();
12715
+ } catch {
12716
+ payload = undefined;
12717
+ }
12718
+ const fallback = payload && detectCpuFallback(payload);
12719
+ if (fallback) {
12720
+ const detail = `backend_variant: "${fallback.backend_variant}", gpu_available: true, gpu_type: "${fallback.gpu_type ?? "unknown"}"`;
12721
+ const message = `Voicebox at ${url} is rendering on CPU (${detail}) \u2014 expect ~5.6x realtime degradation. Restart Voicebox.app while Metal is free, or set VOICEBOX_REQUIRE_GPU=0 to accept it.`;
12722
+ if (requireGpu(process.env)) {
12723
+ throw new Error(`voice-gen: ${message}`);
12724
+ }
12725
+ echoError(`voice-gen: warning: ${message}`);
12726
+ }
12698
12727
  },
12699
12728
  async resolveProfile(nameOrId) {
12700
12729
  let res;
@@ -13695,6 +13724,8 @@ function createVoxCpmClient(options = {}) {
13695
13724
  let fatal;
13696
13725
  let closed = false;
13697
13726
  let stderrTail = "";
13727
+ let stderrDone = Promise.resolve();
13728
+ let exitDetails;
13698
13729
  let stdoutBuffer = "";
13699
13730
  let renderInFlight;
13700
13731
  let warnedChunk = false;
@@ -13785,22 +13816,35 @@ function createVoxCpmClient(options = {}) {
13785
13816
  child = proc;
13786
13817
  proc.on("error", (err) => fail(new Error(`voxcpm-tts: worker process error: ${err.message}`)));
13787
13818
  proc.on("exit", (code, signal) => {
13819
+ exitDetails = { code, signal };
13788
13820
  if (!closed && !fatal) {
13789
- fail(new Error(`voxcpm-tts: worker exited unexpectedly (code ${code ?? "null"}, signal ${signal ?? "none"})${stderrTail ? `: ${stderrTail.slice(-400)}` : ""}`));
13821
+ Promise.race([stderrDone, new Promise((r) => setTimeout(r, 150))]).then(() => {
13822
+ if (!closed && !fatal) {
13823
+ fail(new Error(`voxcpm-tts: worker exited unexpectedly (code ${code ?? "null"}, signal ${signal ?? "none"})${stderrTail ? `: ${stderrTail.slice(-400)}` : ""}`));
13824
+ }
13825
+ });
13790
13826
  }
13791
13827
  });
13828
+ if (proc.stderr) {
13829
+ stderrDone = pump(proc.stderr, (text) => {
13830
+ stderrTail = (stderrTail + text).slice(-STDERR_MAX_CHARS);
13831
+ });
13832
+ }
13792
13833
  if (proc.stdout) {
13793
13834
  pump(proc.stdout, consumeStdout, () => {
13794
13835
  if (!fatal && !closed) {
13795
- fail(new Error("voxcpm-tts: worker closed stdout before settling all requests"));
13836
+ Promise.race([
13837
+ Promise.all([waitForExit(proc, 250), stderrDone]),
13838
+ new Promise((r) => setTimeout(r, 250))
13839
+ ]).then(() => {
13840
+ if (!fatal && !closed) {
13841
+ const detail = exitDetails ? ` (code ${exitDetails.code ?? "null"}, signal ${exitDetails.signal ?? "none"})` : " before settling all requests";
13842
+ fail(new Error(`voxcpm-tts: worker closed stdout${detail}${stderrTail ? `: ${stderrTail.slice(-400)}` : ""}`));
13843
+ }
13844
+ });
13796
13845
  }
13797
13846
  });
13798
13847
  }
13799
- if (proc.stderr) {
13800
- pump(proc.stderr, (text) => {
13801
- stderrTail = (stderrTail + text).slice(-STDERR_MAX_CHARS);
13802
- });
13803
- }
13804
13848
  for (const signal of SIGNAL_HANDLERS) {
13805
13849
  const handler = () => {
13806
13850
  close();
@@ -14136,9 +14180,37 @@ async function main2(argv = process.argv.slice(2), options = {}) {
14136
14180
  args: argv,
14137
14181
  options: {
14138
14182
  in: { type: "string" },
14139
- out: { type: "string" }
14183
+ out: { type: "string" },
14184
+ batch: { type: "string" }
14140
14185
  }
14141
14186
  });
14187
+ const env = options.env ?? process.env;
14188
+ const batchPath = values.batch ?? env.VOXCPM_BATCH_MANIFEST;
14189
+ if (batchPath) {
14190
+ let entries;
14191
+ try {
14192
+ const parsed = JSON.parse(await Bun.file(batchPath).text());
14193
+ if (!Array.isArray(parsed) || parsed.some((e) => !e || typeof e !== "object" || typeof e.in !== "string" || typeof e.out !== "string")) {
14194
+ throw new Error("batch manifest must be an array of { in, out } string pairs");
14195
+ }
14196
+ entries = parsed;
14197
+ } catch (err) {
14198
+ echoError(`voxcpm-tts failed: invalid batch manifest: ${err instanceof Error ? err.message : String(err)}`);
14199
+ return 1;
14200
+ }
14201
+ const handle = createVoxCpmClient(options);
14202
+ try {
14203
+ for (const entry of entries) {
14204
+ await processGeneratorIO(entry.in, entry.out, handle.client, undefined, VOXCPM_TTS_GENERATOR);
14205
+ }
14206
+ return 0;
14207
+ } catch (err) {
14208
+ echoError(`voxcpm-tts failed: ${err instanceof Error ? err.message : String(err)}`);
14209
+ return 1;
14210
+ } finally {
14211
+ await handle.close();
14212
+ }
14213
+ }
14142
14214
  if (!values.in || !values.out) {
14143
14215
  echoError("voxcpm-tts failed: Missing required arguments: --in and --out");
14144
14216
  return 1;
@@ -183,6 +183,15 @@ def load_backend(environ: dict[str, str]) -> dict:
183
183
  if device not in ("auto", "cpu", "cuda", "mps"):
184
184
  raise WorkerError(f"unsupported VOXCPM_DEVICE {device!r} (allowed: auto, cpu, cuda, mps)")
185
185
 
186
+ if device == "mps":
187
+ with contextlib.redirect_stdout(sys.stderr):
188
+ import torch # type: ignore
189
+
190
+ if not torch.backends.mps.is_available():
191
+ raise WorkerError(
192
+ "VOXCPM_DEVICE='mps' requested, but PyTorch MPS backend is unavailable (refusing CPU fallback)"
193
+ )
194
+
186
195
  with contextlib.redirect_stdout(sys.stderr):
187
196
  import voxcpm # type: ignore
188
197
  from huggingface_hub import snapshot_download # type: ignore
@@ -5,11 +5,19 @@ import { createVoxCpmClient, VOXCPM_TTS_GENERATOR, type VoxCpmClientOptions } fr
5
5
 
6
6
  export * from './voxcpm-client';
7
7
 
8
+ interface BatchManifestEntry {
9
+ in: string;
10
+ out: string;
11
+ }
12
+
8
13
  /**
9
14
  * `kk` plugin entry: render Doc[] into audio Content through the shared voice-gen pipeline,
10
15
  * injecting the invocation-scoped VoxCPM adapter and closing it (worker, signals, scratch) in
11
16
  * `finally`. The worker stays lazy until `health()` runs after shared Doc validation, so empty
12
17
  * input starts nothing (AC3).
18
+ *
19
+ * When `VOXCPM_BATCH_MANIFEST` (or `--batch <path>`) is set, renders every `{ in, out }` entry
20
+ * sequentially against one shared worker handle so the model loads at most once per episode.
13
21
  */
14
22
  export async function main(argv: string[] = process.argv.slice(2), options: VoxCpmClientOptions = {}): Promise<number> {
15
23
  const { values } = parseArgs({
@@ -17,9 +25,42 @@ export async function main(argv: string[] = process.argv.slice(2), options: VoxC
17
25
  options: {
18
26
  in: { type: 'string' },
19
27
  out: { type: 'string' },
28
+ batch: { type: 'string' },
20
29
  },
21
30
  });
22
31
 
32
+ const env = options.env ?? (process.env as Record<string, string | undefined>);
33
+ const batchPath = values.batch ?? env.VOXCPM_BATCH_MANIFEST;
34
+
35
+ if (batchPath) {
36
+ let entries: BatchManifestEntry[];
37
+ try {
38
+ const parsed = JSON.parse(await Bun.file(batchPath).text()) as unknown;
39
+ if (
40
+ !Array.isArray(parsed) ||
41
+ parsed.some((e) => !e || typeof e !== 'object' || typeof e.in !== 'string' || typeof e.out !== 'string')
42
+ ) {
43
+ throw new Error('batch manifest must be an array of { in, out } string pairs');
44
+ }
45
+ entries = parsed as BatchManifestEntry[];
46
+ } catch (err: unknown) {
47
+ echoError(`voxcpm-tts failed: invalid batch manifest: ${err instanceof Error ? err.message : String(err)}`);
48
+ return 1;
49
+ }
50
+ const handle = createVoxCpmClient(options);
51
+ try {
52
+ for (const entry of entries) {
53
+ await processGeneratorIO(entry.in, entry.out, handle.client, undefined, VOXCPM_TTS_GENERATOR);
54
+ }
55
+ return 0;
56
+ } catch (err: unknown) {
57
+ echoError(`voxcpm-tts failed: ${err instanceof Error ? err.message : String(err)}`);
58
+ return 1;
59
+ } finally {
60
+ await handle.close();
61
+ }
62
+ }
63
+
23
64
  if (!values.in || !values.out) {
24
65
  echoError('voxcpm-tts failed: Missing required arguments: --in and --out');
25
66
  return 1;
@@ -269,6 +269,8 @@ export function createVoxCpmClient(options: VoxCpmClientOptions = {}): VoxCpmCli
269
269
  let fatal: Error | undefined;
270
270
  let closed = false;
271
271
  let stderrTail = '';
272
+ let stderrDone: Promise<void> = Promise.resolve();
273
+ let exitDetails: { code: number | null; signal: NodeJS.Signals | null } | undefined;
272
274
  let stdoutBuffer = '';
273
275
  let renderInFlight: { id: number; dest: string } | undefined;
274
276
  let warnedChunk = false;
@@ -363,26 +365,45 @@ export function createVoxCpmClient(options: VoxCpmClientOptions = {}): VoxCpmCli
363
365
  child = proc;
364
366
  proc.on('error', (err) => fail(new Error(`voxcpm-tts: worker process error: ${err.message}`)));
365
367
  proc.on('exit', (code, signal) => {
368
+ exitDetails = { code, signal };
366
369
  if (!closed && !fatal) {
367
- fail(
368
- new Error(
369
- `voxcpm-tts: worker exited unexpectedly (code ${code ?? 'null'}, signal ${signal ?? 'none'})${stderrTail ? `: ${stderrTail.slice(-400)}` : ''}`,
370
- ),
371
- );
370
+ void Promise.race([stderrDone, new Promise((r) => setTimeout(r, 150))]).then(() => {
371
+ if (!closed && !fatal) {
372
+ fail(
373
+ new Error(
374
+ `voxcpm-tts: worker exited unexpectedly (code ${code ?? 'null'}, signal ${signal ?? 'none'})${stderrTail ? `: ${stderrTail.slice(-400)}` : ''}`,
375
+ ),
376
+ );
377
+ }
378
+ });
372
379
  }
373
380
  });
381
+ if (proc.stderr) {
382
+ stderrDone = pump(proc.stderr, (text) => {
383
+ stderrTail = (stderrTail + text).slice(-STDERR_MAX_CHARS);
384
+ });
385
+ }
374
386
  if (proc.stdout) {
375
387
  void pump(proc.stdout, consumeStdout, () => {
376
388
  if (!fatal && !closed) {
377
- fail(new Error('voxcpm-tts: worker closed stdout before settling all requests'));
389
+ void Promise.race([
390
+ Promise.all([waitForExit(proc, 250), stderrDone]),
391
+ new Promise((r) => setTimeout(r, 250)),
392
+ ]).then(() => {
393
+ if (!fatal && !closed) {
394
+ const detail = exitDetails
395
+ ? ` (code ${exitDetails.code ?? 'null'}, signal ${exitDetails.signal ?? 'none'})`
396
+ : ' before settling all requests';
397
+ fail(
398
+ new Error(
399
+ `voxcpm-tts: worker closed stdout${detail}${stderrTail ? `: ${stderrTail.slice(-400)}` : ''}`,
400
+ ),
401
+ );
402
+ }
403
+ });
378
404
  }
379
405
  });
380
406
  }
381
- if (proc.stderr) {
382
- void pump(proc.stderr, (text) => {
383
- stderrTail = (stderrTail + text).slice(-STDERR_MAX_CHARS);
384
- });
385
- }
386
407
  // Normal-signal teardown: SIGTERM/SIGINT close, terminate and reap owned workers.
387
408
  for (const signal of SIGNAL_HANDLERS) {
388
409
  const handler = () => {
@@ -0,0 +1,5 @@
1
+ # Hardlink wheels from the shared uv cache instead of copying them. Measured 2026-11-20: this
2
+ # env and omni-voice-gen's held 2.45 GiB with zero hardlinked bytes, so torch/scipy/llvmlite
3
+ # were stored twice on top of ~/.cache/uv/archive-v0. Hardlinks need both paths on one
4
+ # filesystem; override with UV_LINK_MODE=copy if the cache ever moves to another device.
5
+ link-mode = "hardlink"