agentvibes 2.15.0-alpha.2 → 2.15.0-alpha.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.
@@ -295,6 +295,24 @@ if command -v ffmpeg &> /dev/null; then
295
295
  fi
296
296
  fi
297
297
 
298
+ # @function apply_audio_effects
299
+ # @intent Apply sox effects and background music via audio-processor.sh
300
+ # @param Uses global: $TEMP_FILE
301
+ # @returns Updates $TEMP_FILE to processed version
302
+ # @sideeffects Applies audio effects and background music
303
+ if [[ -f "$SCRIPT_DIR/audio-processor.sh" ]]; then
304
+ PROCESSED_FILE="$AUDIO_DIR/tts-processed-$(date +%s).wav"
305
+ "$SCRIPT_DIR/audio-processor.sh" "$TEMP_FILE" "default" "$PROCESSED_FILE" 2>/dev/null || {
306
+ echo "Warning: Audio processing failed, using unprocessed audio" >&2
307
+ PROCESSED_FILE="$TEMP_FILE"
308
+ }
309
+
310
+ if [[ -f "$PROCESSED_FILE" ]] && [[ "$PROCESSED_FILE" != "$TEMP_FILE" ]]; then
311
+ rm -f "$TEMP_FILE"
312
+ TEMP_FILE="$PROCESSED_FILE"
313
+ fi
314
+ fi
315
+
298
316
  # @function play_audio
299
317
  # @intent Play generated audio using available player with sequential playback
300
318
  # @why Support multiple audio players and prevent overlapping audio in learning mode
@@ -302,14 +320,20 @@ fi
302
320
  # @sideeffects Plays audio with lock mechanism for sequential playback
303
321
  LOCK_FILE="/tmp/agentvibes-audio.lock"
304
322
 
305
- # Wait for previous audio to finish (max 30 seconds)
306
- for i in {1..60}; do
323
+ # Wait for previous audio to finish (max 2 seconds to prevent blocking)
324
+ for i in {1..4}; do
307
325
  if [ ! -f "$LOCK_FILE" ]; then
308
326
  break
309
327
  fi
310
328
  sleep 0.5
311
329
  done
312
330
 
331
+ # If still locked after 2 seconds, skip this TTS to prevent blocking Claude
332
+ if [ -f "$LOCK_FILE" ]; then
333
+ echo "⏭️ Skipping TTS (previous audio still playing)" >&2
334
+ exit 0
335
+ fi
336
+
313
337
  # Track last target language audio for replay command
314
338
  if [[ "$CURRENT_LANGUAGE" != "english" ]]; then
315
339
  TARGET_AUDIO_FILE="${CLAUDE_PROJECT_DIR:-.}/.claude/last-target-audio.txt"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "agentvibes",
4
- "version": "2.15.0-alpha.2",
4
+ "version": "2.15.0-alpha.4",
5
5
  "description": "Now your AI Agents can finally talk back! Professional TTS voice for Claude Code and Claude Desktop (via MCP) with multi-provider support.",
6
6
  "homepage": "https://agentvibes.org",
7
7
  "keywords": [
package/src/installer.js CHANGED
@@ -45,7 +45,7 @@ import { program } from 'commander';
45
45
  import path from 'node:path';
46
46
  import fs from 'node:fs/promises';
47
47
  import fsSync from 'node:fs';
48
- import { execSync, execFileSync } from 'node:child_process';
48
+ import { execSync, execFileSync, spawn } from 'node:child_process';
49
49
  import chalk from 'chalk';
50
50
  import inquirer from 'inquirer';
51
51
  import figlet from 'figlet';
@@ -162,16 +162,26 @@ function showReleaseInfo() {
162
162
  * @param {string} targetDir - Installation directory
163
163
  * @param {object} spinner - ora spinner instance
164
164
  */
165
- async function playWelcomeDemo(targetDir, spinner) {
165
+ async function playWelcomeDemo(targetDir, spinner, options = {}) {
166
+ // Skip welcome demo if --yes flag is used (non-interactive install)
167
+ if (options.yes) {
168
+ return;
169
+ }
170
+
166
171
  // Check if we have audio player
167
- let hasMpv = false;
172
+ let audioPlayer = null;
168
173
 
169
174
  try {
170
- execSync('which mpv 2>/dev/null || command -v mpv 2>/dev/null || which afplay 2>/dev/null', { stdio: 'pipe' });
171
- hasMpv = true;
172
- } catch {}
175
+ execSync('which mpv 2>/dev/null', { stdio: 'pipe' });
176
+ audioPlayer = 'mpv';
177
+ } catch {
178
+ try {
179
+ execSync('which afplay 2>/dev/null', { stdio: 'pipe' });
180
+ audioPlayer = 'afplay';
181
+ } catch {}
182
+ }
173
183
 
174
- if (!hasMpv) {
184
+ if (!audioPlayer) {
175
185
  console.log(chalk.gray('\n (Welcome demo skipped - requires mpv or afplay)'));
176
186
  return;
177
187
  }
@@ -205,6 +215,10 @@ To change my personality, just type, "change personality to sarcastic."
205
215
 
206
216
  Or to change my voice, type, "try a different voice."
207
217
 
218
+ We recently have added background music to your agents. You can turn it on or off by saying "Turn background music on" or "Turn background music off."
219
+
220
+ Lastly, Agent Vibes is updated frequently. Use npx agentvibes update to keep up to date.
221
+
208
222
  We hope you have fun with Agent Vibes! Please consider giving us a GitHub star. Thank you!"`;
209
223
 
210
224
  // Stop spinner and display the welcome script in a box
@@ -218,20 +232,25 @@ We hope you have fun with Agent Vibes! Please consider giving us a GitHub star.
218
232
  titleAlignment: 'center'
219
233
  }));
220
234
 
221
- spinner.start('🎵 Playing welcome demo...');
235
+ console.log(chalk.cyan('🎵 Playing welcome demo in background...\n'));
222
236
 
223
237
  try {
224
- // Play the pre-generated welcome demo audio
225
- execSync(`mpv --no-video --really-quiet "${welcomeDemoAudio}" 2>/dev/null || afplay "${welcomeDemoAudio}"`, {
226
- stdio: 'inherit',
227
- timeout: 120000
238
+ // Play the audio in the background (non-blocking)
239
+ const args = audioPlayer === 'mpv'
240
+ ? ['--no-video', '--really-quiet', welcomeDemoAudio]
241
+ : [welcomeDemoAudio];
242
+
243
+ const audioProcess = spawn(audioPlayer, args, {
244
+ detached: true,
245
+ stdio: 'ignore'
228
246
  });
229
247
 
230
- spinner.succeed('🎵 Welcome to AgentVibes!');
248
+ // Detach the process so it continues running after parent exits
249
+ audioProcess.unref();
231
250
 
232
251
  } catch (error) {
233
- spinner.info(chalk.gray('Welcome demo skipped'));
234
252
  // Silent fail - demo is optional
253
+ console.log(chalk.gray(' (Welcome demo skipped)'));
235
254
  }
236
255
  }
237
256
 
@@ -2006,7 +2025,7 @@ async function install(options = {}) {
2006
2025
  console.log(chalk.gray(' via SessionStart hook - no additional setup needed!\n'));
2007
2026
 
2008
2027
  // Play welcome demo with harpsichord intro and reverb voice
2009
- await playWelcomeDemo(targetDir, spinner);
2028
+ await playWelcomeDemo(targetDir, spinner, options);
2010
2029
 
2011
2030
  console.log(chalk.cyan('🎤 Try these commands:'));
2012
2031
  console.log(chalk.white(' • /agent-vibes:list') + chalk.gray(' - See all available voices'));
Binary file