agentvibes 5.2.0 → 5.3.0

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 (52) hide show
  1. package/.claude/config/audio-effects.cfg +1 -1
  2. package/.claude/hooks/audio-cache-utils.sh +246 -246
  3. package/.claude/hooks/background-music-manager.sh +404 -404
  4. package/.claude/hooks/bmad-speak-enhanced.sh +165 -165
  5. package/.claude/hooks/bmad-speak.sh +290 -290
  6. package/.claude/hooks/bmad-tts-injector.sh +568 -568
  7. package/.claude/hooks/bmad-voice-manager.sh +928 -928
  8. package/.claude/hooks/clawdbot-receiver-SECURE.sh +129 -129
  9. package/.claude/hooks/clawdbot-receiver.sh +107 -107
  10. package/.claude/hooks/clean-audio-cache.sh +22 -22
  11. package/.claude/hooks/cleanup-cache.sh +106 -106
  12. package/.claude/hooks/configure-rdp-mode.sh +137 -137
  13. package/.claude/hooks/download-extra-voices.sh +244 -244
  14. package/.claude/hooks/effects-manager.sh +268 -268
  15. package/.claude/hooks/github-star-reminder.sh +154 -154
  16. package/.claude/hooks/language-manager.sh +362 -362
  17. package/.claude/hooks/learn-manager.sh +492 -492
  18. package/.claude/hooks/macos-voice-manager.sh +205 -205
  19. package/.claude/hooks/migrate-background-music.sh +125 -125
  20. package/.claude/hooks/migrate-to-agentvibes.sh +161 -161
  21. package/.claude/hooks/optimize-background-music.sh +87 -87
  22. package/.claude/hooks/path-resolver.sh +60 -60
  23. package/.claude/hooks/personality-manager.sh +448 -448
  24. package/.claude/hooks/piper-installer.sh +292 -292
  25. package/.claude/hooks/piper-multispeaker-registry.sh +171 -171
  26. package/.claude/hooks/play-tts-enhanced.sh +105 -105
  27. package/.claude/hooks/play-tts-ssh-remote.sh +104 -10
  28. package/.claude/hooks/play-tts-termux-ssh.sh +169 -169
  29. package/.claude/hooks/play-tts.sh +31 -11
  30. package/.claude/hooks/prepare-release.sh +54 -54
  31. package/.claude/hooks/provider-commands.sh +617 -617
  32. package/.claude/hooks/provider-manager.sh +399 -399
  33. package/.claude/hooks/replay-target-audio.sh +95 -95
  34. package/.claude/hooks/sentiment-manager.sh +201 -201
  35. package/.claude/hooks/speed-manager.sh +291 -291
  36. package/.claude/hooks/stop-tts.sh +84 -84
  37. package/.claude/hooks/termux-installer.sh +261 -261
  38. package/.claude/hooks/translate-manager.sh +341 -341
  39. package/.claude/hooks/tts-queue-worker.sh +145 -145
  40. package/.claude/hooks/tts-queue.sh +165 -165
  41. package/.claude/hooks/voice-manager.sh +552 -548
  42. package/.claude/hooks-windows/bmad-party-speak.ps1 +5 -1
  43. package/.claude/hooks-windows/play-tts.ps1 +91 -59
  44. package/README.md +21 -2
  45. package/RELEASE_NOTES.md +130 -0
  46. package/bin/mcp-server.sh +206 -206
  47. package/mcp-server/server.py +35 -6
  48. package/package.json +1 -1
  49. package/src/console/tabs/setup-tab.js +68 -29
  50. package/src/console/tabs/voices-tab.js +9 -3
  51. package/src/installer.js +79 -213
  52. package/src/services/llm-provider-service.js +139 -75
@@ -1,129 +1,129 @@
1
- #!/usr/bin/env bash
2
- #
3
- # File: .claude/hooks/clawdbot-receiver.sh (SECURITY-HARDENED VERSION)
4
- #
5
- # AgentVibes Clawdbot Receiver - SSH-Remote TTS with Agent Support and Intro Messages
6
- # Receives base64-encoded text, voice, agent name, and optional intro from remote Clawdbot instances
7
- # Calls AgentVibes play-tts-enhanced.sh to apply agent-specific audio effects
8
- #
9
- # SECURITY ENHANCEMENTS:
10
- # - Voice name whitelist validation
11
- # - Agent name format validation (alphanumeric only)
12
- # - Length limits on decoded content
13
- # - Safe HOME directory handling
14
- #
15
- # Usage (called via SSH from remote):
16
- # clawdbot-receiver.sh <base64_text> <voice> <base64_agent_name> [base64_intro]
17
- #
18
- # Copyright (c) 2025 Paul Preibisch
19
- # Licensed under the Apache License, Version 2.0
20
- #
21
-
22
- set -euo pipefail
23
-
24
- ENCODED_TEXT="${1:-}"
25
- VOICE="${2:-en_US-lessac-medium}"
26
- ENCODED_AGENT="${3:-}"
27
- ENCODED_INTRO="${4:-}"
28
-
29
- # Validate inputs
30
- if [[ -z "$ENCODED_TEXT" ]]; then
31
- echo "Error: No encoded text provided" >&2
32
- echo "Usage: $0 <base64_text> <voice> <base64_agent_name> [base64_intro]" >&2
33
- exit 1
34
- fi
35
-
36
- # SECURITY: Validate base64 format (reject shell metacharacters)
37
- [[ "$ENCODED_TEXT" =~ ^[A-Za-z0-9+/=]+$ ]] || { echo "Error: invalid base64 text" >&2; exit 1; }
38
-
39
- # SECURITY: Validate VOICE parameter format (alphanumeric, hyphens, underscores only)
40
- if [[ ! "$VOICE" =~ ^[a-zA-Z0-9_-]+$ ]]; then
41
- echo "Error: Invalid voice name format: $VOICE" >&2
42
- exit 1
43
- fi
44
-
45
- # SECURITY: Decode base64 safely
46
- # This prevents command injection from malicious text
47
- DECODED_TEXT=$(echo -n "$ENCODED_TEXT" | base64 -d 2>/dev/null) || {
48
- echo "❌ Failed to decode text (invalid base64)" >&2
49
- exit 1
50
- }
51
-
52
- # SECURITY: Enforce length limit on decoded text (10KB max)
53
- if [[ ${#DECODED_TEXT} -gt 10000 ]]; then
54
- echo "❌ Decoded text too long (${#DECODED_TEXT} chars, max 10000)" >&2
55
- exit 1
56
- fi
57
-
58
- DECODED_AGENT="default"
59
- if [[ -n "$ENCODED_AGENT" ]]; then
60
- # SECURITY: Validate base64 format before decoding
61
- [[ "$ENCODED_AGENT" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_AGENT=""
62
- if [[ -n "$ENCODED_AGENT" ]]; then
63
- DECODED_AGENT=$(echo -n "$ENCODED_AGENT" | base64 -d 2>/dev/null) || DECODED_AGENT="default"
64
- fi
65
-
66
- # SECURITY: Validate agent name format (alphanumeric, dash, underscore only)
67
- [[ "$DECODED_AGENT" =~ ^[a-zA-Z0-9_-]+$ ]] || DECODED_AGENT="default"
68
-
69
- # SECURITY: Enforce length limit on agent name
70
- [[ ${#DECODED_AGENT} -le 50 ]] || DECODED_AGENT="default"
71
- fi
72
-
73
- # Decode and prepend intro if provided
74
- DECODED_INTRO=""
75
- if [[ -n "$ENCODED_INTRO" ]]; then
76
- # SECURITY: Validate base64 format before decoding
77
- [[ "$ENCODED_INTRO" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_INTRO=""
78
- if [[ -n "$ENCODED_INTRO" ]]; then
79
- DECODED_INTRO=$(echo -n "$ENCODED_INTRO" | base64 -d 2>/dev/null) || DECODED_INTRO=""
80
- fi
81
-
82
- # SECURITY: Enforce length limit on intro message
83
- [[ ${#DECODED_INTRO} -le 200 ]] || DECODED_INTRO="${DECODED_INTRO:0:200}"
84
- fi
85
-
86
- # Prepend intro to text if configured
87
- if [[ -n "$DECODED_INTRO" ]]; then
88
- DECODED_TEXT="${DECODED_INTRO} ${DECODED_TEXT}"
89
- fi
90
-
91
- # Find AgentVibes installation
92
- # SECURITY: Validate HOME is set and use absolute paths
93
- if [[ -z "${HOME:-}" ]]; then
94
- echo "❌ HOME environment variable not set" >&2
95
- exit 1
96
- fi
97
-
98
- # Priority: 1. ~/agentvibes, 2. ~/AgentVibes-dev, 3. current directory
99
- AGENTVIBES_ROOT=""
100
- if [[ -f "$HOME/agentvibes/.claude/hooks/play-tts-enhanced.sh" ]]; then
101
- AGENTVIBES_ROOT="$HOME/agentvibes"
102
- elif [[ -f "$HOME/AgentVibes-dev/.claude/hooks/play-tts-enhanced.sh" ]]; then
103
- AGENTVIBES_ROOT="$HOME/AgentVibes-dev"
104
- elif [[ -f ".claude/hooks/play-tts-enhanced.sh" ]]; then
105
- AGENTVIBES_ROOT="$(pwd)"
106
- else
107
- echo "❌ AgentVibes not found" >&2
108
- echo "💡 Install AgentVibes at ~/agentvibes/ or ~/AgentVibes-dev/" >&2
109
- exit 1
110
- fi
111
-
112
- # SECURITY: Validate AgentVibes root is a directory
113
- if [[ ! -d "$AGENTVIBES_ROOT" ]]; then
114
- echo "❌ AgentVibes root is not a directory: $AGENTVIBES_ROOT" >&2
115
- exit 1
116
- fi
117
-
118
- echo "🎤 Voice: $VOICE | Agent: $DECODED_AGENT | Vol: 30% | Effects: default" >&2
119
-
120
- # Call AgentVibes play-tts-enhanced.sh with agent name for audio-effects.cfg lookup
121
- # SECURITY: Use absolute path and proper quoting
122
- cd "$AGENTVIBES_ROOT" && \
123
- bash .claude/hooks/play-tts-enhanced.sh "$DECODED_TEXT" "$DECODED_AGENT" "$VOICE" 2>&1 || {
124
- # Fallback to standard play-tts if enhanced fails
125
- echo "⚠️ Enhanced TTS failed, using standard TTS" >&2
126
- bash .claude/hooks/play-tts.sh "$DECODED_TEXT" "$VOICE" 2>&1
127
- }
128
-
129
- exit 0
1
+ #!/usr/bin/env bash
2
+ #
3
+ # File: .claude/hooks/clawdbot-receiver.sh (SECURITY-HARDENED VERSION)
4
+ #
5
+ # AgentVibes Clawdbot Receiver - SSH-Remote TTS with Agent Support and Intro Messages
6
+ # Receives base64-encoded text, voice, agent name, and optional intro from remote Clawdbot instances
7
+ # Calls AgentVibes play-tts-enhanced.sh to apply agent-specific audio effects
8
+ #
9
+ # SECURITY ENHANCEMENTS:
10
+ # - Voice name whitelist validation
11
+ # - Agent name format validation (alphanumeric only)
12
+ # - Length limits on decoded content
13
+ # - Safe HOME directory handling
14
+ #
15
+ # Usage (called via SSH from remote):
16
+ # clawdbot-receiver.sh <base64_text> <voice> <base64_agent_name> [base64_intro]
17
+ #
18
+ # Copyright (c) 2025 Paul Preibisch
19
+ # Licensed under the Apache License, Version 2.0
20
+ #
21
+
22
+ set -euo pipefail
23
+
24
+ ENCODED_TEXT="${1:-}"
25
+ VOICE="${2:-en_US-lessac-medium}"
26
+ ENCODED_AGENT="${3:-}"
27
+ ENCODED_INTRO="${4:-}"
28
+
29
+ # Validate inputs
30
+ if [[ -z "$ENCODED_TEXT" ]]; then
31
+ echo "Error: No encoded text provided" >&2
32
+ echo "Usage: $0 <base64_text> <voice> <base64_agent_name> [base64_intro]" >&2
33
+ exit 1
34
+ fi
35
+
36
+ # SECURITY: Validate base64 format (reject shell metacharacters)
37
+ [[ "$ENCODED_TEXT" =~ ^[A-Za-z0-9+/=]+$ ]] || { echo "Error: invalid base64 text" >&2; exit 1; }
38
+
39
+ # SECURITY: Validate VOICE parameter format (alphanumeric, hyphens, underscores only)
40
+ if [[ ! "$VOICE" =~ ^[a-zA-Z0-9_-]+$ ]]; then
41
+ echo "Error: Invalid voice name format: $VOICE" >&2
42
+ exit 1
43
+ fi
44
+
45
+ # SECURITY: Decode base64 safely
46
+ # This prevents command injection from malicious text
47
+ DECODED_TEXT=$(echo -n "$ENCODED_TEXT" | base64 -d 2>/dev/null) || {
48
+ echo "❌ Failed to decode text (invalid base64)" >&2
49
+ exit 1
50
+ }
51
+
52
+ # SECURITY: Enforce length limit on decoded text (10KB max)
53
+ if [[ ${#DECODED_TEXT} -gt 10000 ]]; then
54
+ echo "❌ Decoded text too long (${#DECODED_TEXT} chars, max 10000)" >&2
55
+ exit 1
56
+ fi
57
+
58
+ DECODED_AGENT="default"
59
+ if [[ -n "$ENCODED_AGENT" ]]; then
60
+ # SECURITY: Validate base64 format before decoding
61
+ [[ "$ENCODED_AGENT" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_AGENT=""
62
+ if [[ -n "$ENCODED_AGENT" ]]; then
63
+ DECODED_AGENT=$(echo -n "$ENCODED_AGENT" | base64 -d 2>/dev/null) || DECODED_AGENT="default"
64
+ fi
65
+
66
+ # SECURITY: Validate agent name format (alphanumeric, dash, underscore only)
67
+ [[ "$DECODED_AGENT" =~ ^[a-zA-Z0-9_-]+$ ]] || DECODED_AGENT="default"
68
+
69
+ # SECURITY: Enforce length limit on agent name
70
+ [[ ${#DECODED_AGENT} -le 50 ]] || DECODED_AGENT="default"
71
+ fi
72
+
73
+ # Decode and prepend intro if provided
74
+ DECODED_INTRO=""
75
+ if [[ -n "$ENCODED_INTRO" ]]; then
76
+ # SECURITY: Validate base64 format before decoding
77
+ [[ "$ENCODED_INTRO" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_INTRO=""
78
+ if [[ -n "$ENCODED_INTRO" ]]; then
79
+ DECODED_INTRO=$(echo -n "$ENCODED_INTRO" | base64 -d 2>/dev/null) || DECODED_INTRO=""
80
+ fi
81
+
82
+ # SECURITY: Enforce length limit on intro message
83
+ [[ ${#DECODED_INTRO} -le 200 ]] || DECODED_INTRO="${DECODED_INTRO:0:200}"
84
+ fi
85
+
86
+ # Prepend intro to text if configured
87
+ if [[ -n "$DECODED_INTRO" ]]; then
88
+ DECODED_TEXT="${DECODED_INTRO} ${DECODED_TEXT}"
89
+ fi
90
+
91
+ # Find AgentVibes installation
92
+ # SECURITY: Validate HOME is set and use absolute paths
93
+ if [[ -z "${HOME:-}" ]]; then
94
+ echo "❌ HOME environment variable not set" >&2
95
+ exit 1
96
+ fi
97
+
98
+ # Priority: 1. ~/agentvibes, 2. ~/AgentVibes-dev, 3. current directory
99
+ AGENTVIBES_ROOT=""
100
+ if [[ -f "$HOME/agentvibes/.claude/hooks/play-tts-enhanced.sh" ]]; then
101
+ AGENTVIBES_ROOT="$HOME/agentvibes"
102
+ elif [[ -f "$HOME/AgentVibes-dev/.claude/hooks/play-tts-enhanced.sh" ]]; then
103
+ AGENTVIBES_ROOT="$HOME/AgentVibes-dev"
104
+ elif [[ -f ".claude/hooks/play-tts-enhanced.sh" ]]; then
105
+ AGENTVIBES_ROOT="$(pwd)"
106
+ else
107
+ echo "❌ AgentVibes not found" >&2
108
+ echo "💡 Install AgentVibes at ~/agentvibes/ or ~/AgentVibes-dev/" >&2
109
+ exit 1
110
+ fi
111
+
112
+ # SECURITY: Validate AgentVibes root is a directory
113
+ if [[ ! -d "$AGENTVIBES_ROOT" ]]; then
114
+ echo "❌ AgentVibes root is not a directory: $AGENTVIBES_ROOT" >&2
115
+ exit 1
116
+ fi
117
+
118
+ echo "🎤 Voice: $VOICE | Agent: $DECODED_AGENT | Vol: 30% | Effects: default" >&2
119
+
120
+ # Call AgentVibes play-tts-enhanced.sh with agent name for audio-effects.cfg lookup
121
+ # SECURITY: Use absolute path and proper quoting
122
+ cd "$AGENTVIBES_ROOT" && \
123
+ bash .claude/hooks/play-tts-enhanced.sh "$DECODED_TEXT" "$DECODED_AGENT" "$VOICE" 2>&1 || {
124
+ # Fallback to standard play-tts if enhanced fails
125
+ echo "⚠️ Enhanced TTS failed, using standard TTS" >&2
126
+ bash .claude/hooks/play-tts.sh "$DECODED_TEXT" "$VOICE" 2>&1
127
+ }
128
+
129
+ exit 0
@@ -1,107 +1,107 @@
1
- #!/usr/bin/env bash
2
- #
3
- # File: .claude/hooks/clawdbot-receiver.sh
4
- #
5
- # AgentVibes Clawdbot Receiver - SSH-Remote TTS with Agent Support and Intro Messages
6
- # Receives base64-encoded text, voice, agent name, and optional intro from remote Clawdbot instances
7
- #
8
- # Usage (called via SSH from remote):
9
- # clawdbot-receiver.sh <base64_text> <voice> <base64_agent_name> [base64_intro]
10
- #
11
- # Parameters:
12
- # base64_text - The main TTS text (base64 encoded)
13
- # voice - Piper voice name (e.g., en_US-amy-medium)
14
- # base64_agent_name - Agent name for audio effects lookup (base64 encoded)
15
- # base64_intro - Optional intro message to prepend (base64 encoded)
16
- # e.g., "Orion ClawdBot here." or "Samuel, your assistant."
17
- #
18
- # The intro is prepended to the text: "${INTRO} ${TEXT}"
19
- #
20
- # Copyright (c) 2025 Paul Preibisch
21
- # Licensed under the Apache License, Version 2.0
22
- #
23
-
24
- set -euo pipefail
25
-
26
- ENCODED_TEXT="${1:-}"
27
- VOICE="${2:-en_US-lessac-medium}"
28
- ENCODED_AGENT="${3:-}"
29
- ENCODED_INTRO="${4:-}"
30
-
31
- # Validate inputs
32
- if [[ -z "$ENCODED_TEXT" ]]; then
33
- echo "Error: No encoded text provided" >&2
34
- echo "Usage: $0 <base64_text> <voice> <base64_agent_name> [base64_intro]" >&2
35
- exit 1
36
- fi
37
-
38
- # SECURITY: Validate base64 format (reject shell metacharacters)
39
- [[ "$ENCODED_TEXT" =~ ^[A-Za-z0-9+/=]+$ ]] || { echo "Error: invalid base64 text" >&2; exit 1; }
40
-
41
- # SECURITY: Validate voice name format (alphanumeric, hyphens, underscores only)
42
- [[ "$VOICE" =~ ^[a-zA-Z0-9_-]+$ ]] || { echo "Error: invalid voice format" >&2; exit 1; }
43
-
44
- # SECURITY: Decode base64 safely
45
- DECODED_TEXT=$(echo -n "$ENCODED_TEXT" | base64 -d 2>/dev/null) || {
46
- echo "Error: Failed to decode text (invalid base64)" >&2
47
- exit 1
48
- }
49
-
50
- # SECURITY: Enforce length limit on decoded text (10KB max)
51
- if [[ ${#DECODED_TEXT} -gt 10000 ]]; then
52
- echo "Error: Decoded text too long (${#DECODED_TEXT} chars, max 10000)" >&2
53
- exit 1
54
- fi
55
-
56
- DECODED_AGENT="default"
57
- if [[ -n "$ENCODED_AGENT" ]]; then
58
- [[ "$ENCODED_AGENT" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_AGENT=""
59
- if [[ -n "$ENCODED_AGENT" ]]; then
60
- DECODED_AGENT=$(echo -n "$ENCODED_AGENT" | base64 -d 2>/dev/null) || DECODED_AGENT="default"
61
- fi
62
- # Validate agent name format (alphanumeric, dash, underscore only)
63
- [[ "$DECODED_AGENT" =~ ^[a-zA-Z0-9_-]+$ ]] || DECODED_AGENT="default"
64
- # Enforce length limit
65
- [[ ${#DECODED_AGENT} -le 50 ]] || DECODED_AGENT="default"
66
- fi
67
-
68
- # Decode and prepend intro if provided
69
- DECODED_INTRO=""
70
- if [[ -n "$ENCODED_INTRO" ]]; then
71
- [[ "$ENCODED_INTRO" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_INTRO=""
72
- if [[ -n "$ENCODED_INTRO" ]]; then
73
- DECODED_INTRO=$(echo -n "$ENCODED_INTRO" | base64 -d 2>/dev/null) || DECODED_INTRO=""
74
- fi
75
- # Enforce length limit on intro (200 chars max)
76
- [[ ${#DECODED_INTRO} -le 200 ]] || DECODED_INTRO="${DECODED_INTRO:0:200}"
77
- fi
78
-
79
- # Prepend intro to text if configured
80
- if [[ -n "$DECODED_INTRO" ]]; then
81
- DECODED_TEXT="${DECODED_INTRO} ${DECODED_TEXT}"
82
- fi
83
-
84
- # Find AgentVibes installation
85
- AGENTVIBES_ROOT=""
86
- if [[ -f "$HOME/agentvibes/.claude/hooks/play-tts-enhanced.sh" ]]; then
87
- AGENTVIBES_ROOT="$HOME/agentvibes"
88
- elif [[ -f "$HOME/AgentVibes-dev/.claude/hooks/play-tts-enhanced.sh" ]]; then
89
- AGENTVIBES_ROOT="$HOME/AgentVibes-dev"
90
- elif [[ -f ".claude/hooks/play-tts-enhanced.sh" ]]; then
91
- AGENTVIBES_ROOT="$(pwd)"
92
- else
93
- echo "❌ AgentVibes not found" >&2
94
- echo "💡 Install AgentVibes at ~/agentvibes/ or ~/AgentVibes-dev/" >&2
95
- exit 1
96
- fi
97
-
98
- echo "🎤 Voice: $VOICE | Agent: $DECODED_AGENT" >&2
99
-
100
- # Play TTS directly (lock removed temporarily for testing)
101
- cd "$AGENTVIBES_ROOT"
102
- bash .claude/hooks/play-tts-enhanced.sh "$DECODED_TEXT" "$DECODED_AGENT" "$VOICE" 2>&1 || {
103
- echo "⚠️ Enhanced TTS failed, using standard TTS" >&2
104
- bash .claude/hooks/play-tts.sh "$DECODED_TEXT" "$VOICE" 2>&1
105
- }
106
-
107
- exit 0
1
+ #!/usr/bin/env bash
2
+ #
3
+ # File: .claude/hooks/clawdbot-receiver.sh
4
+ #
5
+ # AgentVibes Clawdbot Receiver - SSH-Remote TTS with Agent Support and Intro Messages
6
+ # Receives base64-encoded text, voice, agent name, and optional intro from remote Clawdbot instances
7
+ #
8
+ # Usage (called via SSH from remote):
9
+ # clawdbot-receiver.sh <base64_text> <voice> <base64_agent_name> [base64_intro]
10
+ #
11
+ # Parameters:
12
+ # base64_text - The main TTS text (base64 encoded)
13
+ # voice - Piper voice name (e.g., en_US-amy-medium)
14
+ # base64_agent_name - Agent name for audio effects lookup (base64 encoded)
15
+ # base64_intro - Optional intro message to prepend (base64 encoded)
16
+ # e.g., "Orion ClawdBot here." or "Samuel, your assistant."
17
+ #
18
+ # The intro is prepended to the text: "${INTRO} ${TEXT}"
19
+ #
20
+ # Copyright (c) 2025 Paul Preibisch
21
+ # Licensed under the Apache License, Version 2.0
22
+ #
23
+
24
+ set -euo pipefail
25
+
26
+ ENCODED_TEXT="${1:-}"
27
+ VOICE="${2:-en_US-lessac-medium}"
28
+ ENCODED_AGENT="${3:-}"
29
+ ENCODED_INTRO="${4:-}"
30
+
31
+ # Validate inputs
32
+ if [[ -z "$ENCODED_TEXT" ]]; then
33
+ echo "Error: No encoded text provided" >&2
34
+ echo "Usage: $0 <base64_text> <voice> <base64_agent_name> [base64_intro]" >&2
35
+ exit 1
36
+ fi
37
+
38
+ # SECURITY: Validate base64 format (reject shell metacharacters)
39
+ [[ "$ENCODED_TEXT" =~ ^[A-Za-z0-9+/=]+$ ]] || { echo "Error: invalid base64 text" >&2; exit 1; }
40
+
41
+ # SECURITY: Validate voice name format (alphanumeric, hyphens, underscores only)
42
+ [[ "$VOICE" =~ ^[a-zA-Z0-9_-]+$ ]] || { echo "Error: invalid voice format" >&2; exit 1; }
43
+
44
+ # SECURITY: Decode base64 safely
45
+ DECODED_TEXT=$(echo -n "$ENCODED_TEXT" | base64 -d 2>/dev/null) || {
46
+ echo "Error: Failed to decode text (invalid base64)" >&2
47
+ exit 1
48
+ }
49
+
50
+ # SECURITY: Enforce length limit on decoded text (10KB max)
51
+ if [[ ${#DECODED_TEXT} -gt 10000 ]]; then
52
+ echo "Error: Decoded text too long (${#DECODED_TEXT} chars, max 10000)" >&2
53
+ exit 1
54
+ fi
55
+
56
+ DECODED_AGENT="default"
57
+ if [[ -n "$ENCODED_AGENT" ]]; then
58
+ [[ "$ENCODED_AGENT" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_AGENT=""
59
+ if [[ -n "$ENCODED_AGENT" ]]; then
60
+ DECODED_AGENT=$(echo -n "$ENCODED_AGENT" | base64 -d 2>/dev/null) || DECODED_AGENT="default"
61
+ fi
62
+ # Validate agent name format (alphanumeric, dash, underscore only)
63
+ [[ "$DECODED_AGENT" =~ ^[a-zA-Z0-9_-]+$ ]] || DECODED_AGENT="default"
64
+ # Enforce length limit
65
+ [[ ${#DECODED_AGENT} -le 50 ]] || DECODED_AGENT="default"
66
+ fi
67
+
68
+ # Decode and prepend intro if provided
69
+ DECODED_INTRO=""
70
+ if [[ -n "$ENCODED_INTRO" ]]; then
71
+ [[ "$ENCODED_INTRO" =~ ^[A-Za-z0-9+/=]+$ ]] || ENCODED_INTRO=""
72
+ if [[ -n "$ENCODED_INTRO" ]]; then
73
+ DECODED_INTRO=$(echo -n "$ENCODED_INTRO" | base64 -d 2>/dev/null) || DECODED_INTRO=""
74
+ fi
75
+ # Enforce length limit on intro (200 chars max)
76
+ [[ ${#DECODED_INTRO} -le 200 ]] || DECODED_INTRO="${DECODED_INTRO:0:200}"
77
+ fi
78
+
79
+ # Prepend intro to text if configured
80
+ if [[ -n "$DECODED_INTRO" ]]; then
81
+ DECODED_TEXT="${DECODED_INTRO} ${DECODED_TEXT}"
82
+ fi
83
+
84
+ # Find AgentVibes installation
85
+ AGENTVIBES_ROOT=""
86
+ if [[ -f "$HOME/agentvibes/.claude/hooks/play-tts-enhanced.sh" ]]; then
87
+ AGENTVIBES_ROOT="$HOME/agentvibes"
88
+ elif [[ -f "$HOME/AgentVibes-dev/.claude/hooks/play-tts-enhanced.sh" ]]; then
89
+ AGENTVIBES_ROOT="$HOME/AgentVibes-dev"
90
+ elif [[ -f ".claude/hooks/play-tts-enhanced.sh" ]]; then
91
+ AGENTVIBES_ROOT="$(pwd)"
92
+ else
93
+ echo "❌ AgentVibes not found" >&2
94
+ echo "💡 Install AgentVibes at ~/agentvibes/ or ~/AgentVibes-dev/" >&2
95
+ exit 1
96
+ fi
97
+
98
+ echo "🎤 Voice: $VOICE | Agent: $DECODED_AGENT" >&2
99
+
100
+ # Play TTS directly (lock removed temporarily for testing)
101
+ cd "$AGENTVIBES_ROOT"
102
+ bash .claude/hooks/play-tts-enhanced.sh "$DECODED_TEXT" "$DECODED_AGENT" "$VOICE" 2>&1 || {
103
+ echo "⚠️ Enhanced TTS failed, using standard TTS" >&2
104
+ bash .claude/hooks/play-tts.sh "$DECODED_TEXT" "$VOICE" 2>&1
105
+ }
106
+
107
+ exit 0
@@ -1,22 +1,22 @@
1
- #!/usr/bin/env bash
2
- # Non-Interactive TTS Audio Cache Cleanup
3
- # Used by /agent-vibes:clean skill and MCP clean_audio_cache tool
4
-
5
- set -euo pipefail
6
-
7
- # Source audio cache utilities
8
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
- source "$SCRIPT_DIR/audio-cache-utils.sh"
10
-
11
- # Colors
12
- BLUE='\033[0;34m'
13
- NC='\033[0m' # No Color
14
-
15
- echo -e "${BLUE}🧹 AgentVibes Cache Cleanup (Non-Interactive)${NC}"
16
- echo ""
17
-
18
- # Get audio directory and perform cleanup
19
- AUDIO_DIR=$(get_audio_dir)
20
- clean_all_tts_files "$AUDIO_DIR"
21
-
22
- echo ""
1
+ #!/usr/bin/env bash
2
+ # Non-Interactive TTS Audio Cache Cleanup
3
+ # Used by /agent-vibes:clean skill and MCP clean_audio_cache tool
4
+
5
+ set -euo pipefail
6
+
7
+ # Source audio cache utilities
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ source "$SCRIPT_DIR/audio-cache-utils.sh"
10
+
11
+ # Colors
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ echo -e "${BLUE}🧹 AgentVibes Cache Cleanup (Non-Interactive)${NC}"
16
+ echo ""
17
+
18
+ # Get audio directory and perform cleanup
19
+ AUDIO_DIR=$(get_audio_dir)
20
+ clean_all_tts_files "$AUDIO_DIR"
21
+
22
+ echo ""