@ducci/jarvis 1.0.88 → 1.0.90

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducci/jarvis",
3
- "version": "1.0.88",
3
+ "version": "1.0.90",
4
4
  "description": "A fully automated agent system that lives on a server.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -699,7 +699,13 @@ export async function startTelegramChannel(config) {
699
699
  // TTS: send audio summary if voice is enabled (config.voiceEnabled checked live, updated by /voice toggle)
700
700
  if (config.voiceEnabled && config.fishAudioApiKey) {
701
701
  try {
702
- const plain = toPlainText(displayText);
702
+ // If the response is a raw JSON blob (format_error recovery), extract the actual text
703
+ let ttsSource = displayText;
704
+ try {
705
+ const parsed = JSON.parse(displayText);
706
+ if (parsed?.response) ttsSource = parsed.response;
707
+ } catch { /* not JSON, use as-is */ }
708
+ const plain = toPlainText(ttsSource);
703
709
  if (plain) {
704
710
  const ttsText = await generateTtsSummary(plain, config);
705
711
  if (ttsText) {
@@ -710,6 +716,7 @@ export async function startTelegramChannel(config) {
710
716
  }
711
717
  } catch (e) {
712
718
  console.error(`[telegram] TTS error chat_id=${chatId}: ${e.message}`);
719
+ await api.sendMessage(chatId, `[TTS error: ${e.message}]`).catch(() => {});
713
720
  }
714
721
  }
715
722
  } else {
@@ -89,13 +89,7 @@ export async function textToSpeech(text, config) {
89
89
  throw new Error(`fish.audio TTS ${response.status}: ${errText.slice(0, 200)}`);
90
90
  }
91
91
 
92
- // Explicitly collect all streaming chunks — arrayBuffer() can miss trailing chunks
93
- // on chunked transfer-encoded responses from fish.audio.
94
- const chunks = [];
95
- for await (const chunk of response.body) {
96
- chunks.push(chunk);
97
- }
98
- return Buffer.concat(chunks);
92
+ return Buffer.from(await response.arrayBuffer());
99
93
  }
100
94
 
101
95
  /**