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.
- package/.claude/config/audio-effects.cfg +1 -1
- package/.claude/hooks/audio-cache-utils.sh +246 -246
- package/.claude/hooks/background-music-manager.sh +404 -404
- package/.claude/hooks/bmad-speak-enhanced.sh +165 -165
- package/.claude/hooks/bmad-speak.sh +290 -290
- package/.claude/hooks/bmad-tts-injector.sh +568 -568
- package/.claude/hooks/bmad-voice-manager.sh +928 -928
- package/.claude/hooks/clawdbot-receiver-SECURE.sh +129 -129
- package/.claude/hooks/clawdbot-receiver.sh +107 -107
- package/.claude/hooks/clean-audio-cache.sh +22 -22
- package/.claude/hooks/cleanup-cache.sh +106 -106
- package/.claude/hooks/configure-rdp-mode.sh +137 -137
- package/.claude/hooks/download-extra-voices.sh +244 -244
- package/.claude/hooks/effects-manager.sh +268 -268
- package/.claude/hooks/github-star-reminder.sh +154 -154
- package/.claude/hooks/language-manager.sh +362 -362
- package/.claude/hooks/learn-manager.sh +492 -492
- package/.claude/hooks/macos-voice-manager.sh +205 -205
- package/.claude/hooks/migrate-background-music.sh +125 -125
- package/.claude/hooks/migrate-to-agentvibes.sh +161 -161
- package/.claude/hooks/optimize-background-music.sh +87 -87
- package/.claude/hooks/path-resolver.sh +60 -60
- package/.claude/hooks/personality-manager.sh +448 -448
- package/.claude/hooks/piper-installer.sh +292 -292
- package/.claude/hooks/piper-multispeaker-registry.sh +171 -171
- package/.claude/hooks/play-tts-enhanced.sh +105 -105
- package/.claude/hooks/play-tts-ssh-remote.sh +104 -10
- package/.claude/hooks/play-tts-termux-ssh.sh +169 -169
- package/.claude/hooks/play-tts.sh +31 -11
- package/.claude/hooks/prepare-release.sh +54 -54
- package/.claude/hooks/provider-commands.sh +617 -617
- package/.claude/hooks/provider-manager.sh +399 -399
- package/.claude/hooks/replay-target-audio.sh +95 -95
- package/.claude/hooks/sentiment-manager.sh +201 -201
- package/.claude/hooks/speed-manager.sh +291 -291
- package/.claude/hooks/stop-tts.sh +84 -84
- package/.claude/hooks/termux-installer.sh +261 -261
- package/.claude/hooks/translate-manager.sh +341 -341
- package/.claude/hooks/tts-queue-worker.sh +145 -145
- package/.claude/hooks/tts-queue.sh +165 -165
- package/.claude/hooks/voice-manager.sh +552 -548
- package/.claude/hooks-windows/bmad-party-speak.ps1 +5 -1
- package/.claude/hooks-windows/play-tts.ps1 +91 -59
- package/README.md +21 -2
- package/RELEASE_NOTES.md +130 -0
- package/bin/mcp-server.sh +206 -206
- package/mcp-server/server.py +35 -6
- package/package.json +1 -1
- package/src/console/tabs/setup-tab.js +68 -29
- package/src/console/tabs/voices-tab.js +9 -3
- package/src/installer.js +79 -213
- package/src/services/llm-provider-service.js +139 -75
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# File: .claude/hooks/replay-target-audio.sh
|
|
4
|
-
#
|
|
5
|
-
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
-
# Website: https://agentvibes.org
|
|
7
|
-
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
-
#
|
|
9
|
-
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
-
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
-
#
|
|
12
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
# you may not use this file except in compliance with the License.
|
|
14
|
-
# You may obtain a copy of the License at
|
|
15
|
-
#
|
|
16
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
#
|
|
18
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
# See the License for the specific language governing permissions and
|
|
22
|
-
# limitations under the License.
|
|
23
|
-
#
|
|
24
|
-
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
-
# express or implied, including but not limited to the warranties of
|
|
26
|
-
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
-
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
-
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
-
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
-
# use or other dealings in the software.
|
|
31
|
-
#
|
|
32
|
-
# ---
|
|
33
|
-
#
|
|
34
|
-
# @fileoverview Replay Last Target Language Audio
|
|
35
|
-
# @context Replays the most recent target language TTS for language learning
|
|
36
|
-
# @architecture Simple audio replay with lock mechanism for sequential playback
|
|
37
|
-
# @dependencies ffprobe, paplay/aplay/mpg123/mpv, .claude/last-target-audio.txt
|
|
38
|
-
# @entrypoints Called by /agent-vibes:replay-target slash command
|
|
39
|
-
# @patterns Sequential audio playback with lock file, duration-based lock release
|
|
40
|
-
# @related play-tts-piper.sh, play-tts-macos.sh, learn-manager.sh
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
# Fix locale warnings
|
|
44
|
-
export LC_ALL=C
|
|
45
|
-
|
|
46
|
-
TARGET_AUDIO_FILE="${CLAUDE_PROJECT_DIR:-.}/.claude/last-target-audio.txt"
|
|
47
|
-
|
|
48
|
-
# Check if target audio tracking file exists
|
|
49
|
-
if [ ! -f "$TARGET_AUDIO_FILE" ]; then
|
|
50
|
-
echo "❌ No target language audio found."
|
|
51
|
-
echo " Language learning mode may not be active."
|
|
52
|
-
echo " Activate with: /agent-vibes:learn"
|
|
53
|
-
exit 1
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# Read last target audio file path
|
|
57
|
-
LAST_AUDIO=$(cat "$TARGET_AUDIO_FILE")
|
|
58
|
-
|
|
59
|
-
# Verify audio file exists
|
|
60
|
-
if [ ! -f "$LAST_AUDIO" ]; then
|
|
61
|
-
echo "❌ Audio file not found: $LAST_AUDIO"
|
|
62
|
-
echo " The file may have been deleted or moved."
|
|
63
|
-
exit 1
|
|
64
|
-
fi
|
|
65
|
-
|
|
66
|
-
echo "🔁 Replaying target language audio..."
|
|
67
|
-
|
|
68
|
-
# Use lock file for sequential playback
|
|
69
|
-
LOCK_FILE="/tmp/agentvibes-audio.lock"
|
|
70
|
-
|
|
71
|
-
# Wait for any current audio to finish (max 30 seconds)
|
|
72
|
-
for i in {1..60}; do
|
|
73
|
-
if [ ! -f "$LOCK_FILE" ]; then
|
|
74
|
-
break
|
|
75
|
-
fi
|
|
76
|
-
sleep 0.5
|
|
77
|
-
done
|
|
78
|
-
|
|
79
|
-
# Create lock
|
|
80
|
-
touch "$LOCK_FILE"
|
|
81
|
-
|
|
82
|
-
# Get audio duration for proper lock timing
|
|
83
|
-
DURATION=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$LAST_AUDIO" 2>/dev/null)
|
|
84
|
-
DURATION=${DURATION%.*} # Round to integer
|
|
85
|
-
DURATION=${DURATION:-1} # Default to 1 second if detection fails
|
|
86
|
-
|
|
87
|
-
# Play audio
|
|
88
|
-
(paplay "$LAST_AUDIO" || aplay "$LAST_AUDIO" || mpg123 "$LAST_AUDIO" || mpv "$LAST_AUDIO") >/dev/null 2>&1 &
|
|
89
|
-
PLAYER_PID=$!
|
|
90
|
-
|
|
91
|
-
# Wait for audio to finish, then release lock
|
|
92
|
-
(sleep $DURATION; rm -f "$LOCK_FILE") &
|
|
93
|
-
disown
|
|
94
|
-
|
|
95
|
-
echo "✅ Replay complete: $(basename "$LAST_AUDIO")"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# File: .claude/hooks/replay-target-audio.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied, including but not limited to the warranties of
|
|
26
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
+
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
+
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
+
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
+
# use or other dealings in the software.
|
|
31
|
+
#
|
|
32
|
+
# ---
|
|
33
|
+
#
|
|
34
|
+
# @fileoverview Replay Last Target Language Audio
|
|
35
|
+
# @context Replays the most recent target language TTS for language learning
|
|
36
|
+
# @architecture Simple audio replay with lock mechanism for sequential playback
|
|
37
|
+
# @dependencies ffprobe, paplay/aplay/mpg123/mpv, .claude/last-target-audio.txt
|
|
38
|
+
# @entrypoints Called by /agent-vibes:replay-target slash command
|
|
39
|
+
# @patterns Sequential audio playback with lock file, duration-based lock release
|
|
40
|
+
# @related play-tts-piper.sh, play-tts-macos.sh, learn-manager.sh
|
|
41
|
+
#
|
|
42
|
+
|
|
43
|
+
# Fix locale warnings
|
|
44
|
+
export LC_ALL=C
|
|
45
|
+
|
|
46
|
+
TARGET_AUDIO_FILE="${CLAUDE_PROJECT_DIR:-.}/.claude/last-target-audio.txt"
|
|
47
|
+
|
|
48
|
+
# Check if target audio tracking file exists
|
|
49
|
+
if [ ! -f "$TARGET_AUDIO_FILE" ]; then
|
|
50
|
+
echo "❌ No target language audio found."
|
|
51
|
+
echo " Language learning mode may not be active."
|
|
52
|
+
echo " Activate with: /agent-vibes:learn"
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# Read last target audio file path
|
|
57
|
+
LAST_AUDIO=$(cat "$TARGET_AUDIO_FILE")
|
|
58
|
+
|
|
59
|
+
# Verify audio file exists
|
|
60
|
+
if [ ! -f "$LAST_AUDIO" ]; then
|
|
61
|
+
echo "❌ Audio file not found: $LAST_AUDIO"
|
|
62
|
+
echo " The file may have been deleted or moved."
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
echo "🔁 Replaying target language audio..."
|
|
67
|
+
|
|
68
|
+
# Use lock file for sequential playback
|
|
69
|
+
LOCK_FILE="/tmp/agentvibes-audio.lock"
|
|
70
|
+
|
|
71
|
+
# Wait for any current audio to finish (max 30 seconds)
|
|
72
|
+
for i in {1..60}; do
|
|
73
|
+
if [ ! -f "$LOCK_FILE" ]; then
|
|
74
|
+
break
|
|
75
|
+
fi
|
|
76
|
+
sleep 0.5
|
|
77
|
+
done
|
|
78
|
+
|
|
79
|
+
# Create lock
|
|
80
|
+
touch "$LOCK_FILE"
|
|
81
|
+
|
|
82
|
+
# Get audio duration for proper lock timing
|
|
83
|
+
DURATION=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$LAST_AUDIO" 2>/dev/null)
|
|
84
|
+
DURATION=${DURATION%.*} # Round to integer
|
|
85
|
+
DURATION=${DURATION:-1} # Default to 1 second if detection fails
|
|
86
|
+
|
|
87
|
+
# Play audio
|
|
88
|
+
(paplay "$LAST_AUDIO" || aplay "$LAST_AUDIO" || mpg123 "$LAST_AUDIO" || mpv "$LAST_AUDIO") >/dev/null 2>&1 &
|
|
89
|
+
PLAYER_PID=$!
|
|
90
|
+
|
|
91
|
+
# Wait for audio to finish, then release lock
|
|
92
|
+
(sleep $DURATION; rm -f "$LOCK_FILE") &
|
|
93
|
+
disown
|
|
94
|
+
|
|
95
|
+
echo "✅ Replay complete: $(basename "$LAST_AUDIO")"
|
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# File: .claude/hooks/sentiment-manager.sh
|
|
4
|
-
#
|
|
5
|
-
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
-
# Website: https://agentvibes.org
|
|
7
|
-
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
-
#
|
|
9
|
-
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
-
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
-
#
|
|
12
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
# you may not use this file except in compliance with the License.
|
|
14
|
-
# You may obtain a copy of the License at
|
|
15
|
-
#
|
|
16
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
-
#
|
|
18
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
-
# See the License for the specific language governing permissions and
|
|
22
|
-
# limitations under the License.
|
|
23
|
-
#
|
|
24
|
-
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
-
# express or implied, including but not limited to the warranties of
|
|
26
|
-
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
-
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
-
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
-
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
-
# use or other dealings in the software.
|
|
31
|
-
#
|
|
32
|
-
# ---
|
|
33
|
-
#
|
|
34
|
-
# @fileoverview Sentiment Manager - Applies personality styles to current voice without changing the voice itself
|
|
35
|
-
# @context Allows adding emotional/tonal layers (flirty, sarcastic, etc.) to any voice while preserving voice identity
|
|
36
|
-
# @architecture Reuses personality markdown files, stores sentiment separately from personality
|
|
37
|
-
# @dependencies .claude/personalities/*.md files, play-tts.sh for acknowledgment
|
|
38
|
-
# @entrypoints Called by /agent-vibes:sentiment slash command
|
|
39
|
-
# @patterns Personality/sentiment separation, state file management, random example selection
|
|
40
|
-
# @related personality-manager.sh, .claude/personalities/*.md, .claude/tts-sentiment.txt
|
|
41
|
-
|
|
42
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
43
|
-
PERSONALITIES_DIR="$SCRIPT_DIR/../personalities"
|
|
44
|
-
|
|
45
|
-
# Project-local file first, global fallback
|
|
46
|
-
# Use logical path (not physical) to handle symlinked .claude directories
|
|
47
|
-
# Script is at .claude/hooks/sentiment-manager.sh, so .claude is ..
|
|
48
|
-
CLAUDE_DIR="$(cd "$SCRIPT_DIR/.." 2>/dev/null && pwd)"
|
|
49
|
-
|
|
50
|
-
# Check if we have a project-local .claude directory
|
|
51
|
-
if [[ -d "$CLAUDE_DIR" ]] && [[ "$CLAUDE_DIR" != "$HOME/.claude" ]]; then
|
|
52
|
-
SENTIMENT_FILE="$CLAUDE_DIR/tts-sentiment.txt"
|
|
53
|
-
else
|
|
54
|
-
SENTIMENT_FILE="$HOME/.claude/tts-sentiment.txt"
|
|
55
|
-
fi
|
|
56
|
-
|
|
57
|
-
# Function to get personality data from markdown file
|
|
58
|
-
get_personality_data() {
|
|
59
|
-
local personality="$1"
|
|
60
|
-
local field="$2"
|
|
61
|
-
local file="$PERSONALITIES_DIR/${personality}.md"
|
|
62
|
-
|
|
63
|
-
if [[ ! -f "$file" ]]; then
|
|
64
|
-
return 1
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
case "$field" in
|
|
68
|
-
description)
|
|
69
|
-
grep "^description:" "$file" | cut -d: -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
|
|
70
|
-
;;
|
|
71
|
-
esac
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
# Function to list all available personalities
|
|
75
|
-
list_personalities() {
|
|
76
|
-
if [[ -d "$PERSONALITIES_DIR" ]]; then
|
|
77
|
-
for file in "$PERSONALITIES_DIR"/*.md; do
|
|
78
|
-
if [[ -f "$file" ]]; then
|
|
79
|
-
basename "$file" .md
|
|
80
|
-
fi
|
|
81
|
-
done
|
|
82
|
-
fi
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
case "$1" in
|
|
86
|
-
list)
|
|
87
|
-
echo "🎭 Available Sentiments:"
|
|
88
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
89
|
-
|
|
90
|
-
# Get current sentiment
|
|
91
|
-
CURRENT="none"
|
|
92
|
-
if [ -f "$SENTIMENT_FILE" ]; then
|
|
93
|
-
CURRENT=$(cat "$SENTIMENT_FILE")
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
# List personalities from markdown files
|
|
97
|
-
echo "Available sentiment styles:"
|
|
98
|
-
for personality in $(list_personalities | sort); do
|
|
99
|
-
desc=$(get_personality_data "$personality" "description")
|
|
100
|
-
if [[ "$personality" == "$CURRENT" ]]; then
|
|
101
|
-
echo " ✓ $personality - $desc (current)"
|
|
102
|
-
else
|
|
103
|
-
echo " - $personality - $desc"
|
|
104
|
-
fi
|
|
105
|
-
done
|
|
106
|
-
|
|
107
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
108
|
-
echo ""
|
|
109
|
-
echo "Usage: /agent-vibes:sentiment <name>"
|
|
110
|
-
echo " /agent-vibes:sentiment clear"
|
|
111
|
-
;;
|
|
112
|
-
|
|
113
|
-
set)
|
|
114
|
-
SENTIMENT="$2"
|
|
115
|
-
|
|
116
|
-
if [[ -z "$SENTIMENT" ]]; then
|
|
117
|
-
echo "❌ Please specify a sentiment name"
|
|
118
|
-
echo "Usage: $0 set <sentiment>"
|
|
119
|
-
exit 1
|
|
120
|
-
fi
|
|
121
|
-
|
|
122
|
-
# Check if sentiment file exists
|
|
123
|
-
if [[ ! -f "$PERSONALITIES_DIR/${SENTIMENT}.md" ]]; then
|
|
124
|
-
echo "❌ Sentiment not found: $SENTIMENT"
|
|
125
|
-
echo ""
|
|
126
|
-
echo "Available sentiments:"
|
|
127
|
-
for p in $(list_personalities | sort); do
|
|
128
|
-
echo " • $p"
|
|
129
|
-
done
|
|
130
|
-
exit 1
|
|
131
|
-
fi
|
|
132
|
-
|
|
133
|
-
# Save the sentiment (but don't change personality or voice)
|
|
134
|
-
echo "$SENTIMENT" > "$SENTIMENT_FILE"
|
|
135
|
-
echo "🎭 Sentiment set to: $SENTIMENT"
|
|
136
|
-
echo "🎤 Voice remains unchanged"
|
|
137
|
-
echo ""
|
|
138
|
-
|
|
139
|
-
# Make a sentiment-appropriate remark with TTS
|
|
140
|
-
TTS_SCRIPT="$SCRIPT_DIR/play-tts.sh"
|
|
141
|
-
|
|
142
|
-
# Try to get acknowledgment from personality file (sentiments use same personality files)
|
|
143
|
-
PERSONALITY_FILE_PATH="$PERSONALITIES_DIR/${SENTIMENT}.md"
|
|
144
|
-
REMARK=""
|
|
145
|
-
|
|
146
|
-
if [[ -f "$PERSONALITY_FILE_PATH" ]]; then
|
|
147
|
-
# Extract example responses from personality file (lines starting with "- ")
|
|
148
|
-
mapfile -t EXAMPLES < <(grep '^- "' "$PERSONALITY_FILE_PATH" | sed 's/^- "//; s/"$//')
|
|
149
|
-
|
|
150
|
-
if [[ ${#EXAMPLES[@]} -gt 0 ]]; then
|
|
151
|
-
# Pick a random example
|
|
152
|
-
REMARK="${EXAMPLES[$RANDOM % ${#EXAMPLES[@]}]}"
|
|
153
|
-
fi
|
|
154
|
-
fi
|
|
155
|
-
|
|
156
|
-
# Fallback if no examples found
|
|
157
|
-
if [[ -z "$REMARK" ]]; then
|
|
158
|
-
REMARK="Sentiment set to ${SENTIMENT} while maintaining current voice"
|
|
159
|
-
fi
|
|
160
|
-
|
|
161
|
-
echo "💬 $REMARK"
|
|
162
|
-
"$TTS_SCRIPT" "$REMARK"
|
|
163
|
-
;;
|
|
164
|
-
|
|
165
|
-
get)
|
|
166
|
-
if [ -f "$SENTIMENT_FILE" ]; then
|
|
167
|
-
CURRENT=$(cat "$SENTIMENT_FILE")
|
|
168
|
-
echo "Current sentiment: $CURRENT"
|
|
169
|
-
|
|
170
|
-
desc=$(get_personality_data "$CURRENT" "description")
|
|
171
|
-
[[ -n "$desc" ]] && echo "Description: $desc"
|
|
172
|
-
else
|
|
173
|
-
echo "Current sentiment: none (voice personality only)"
|
|
174
|
-
fi
|
|
175
|
-
;;
|
|
176
|
-
|
|
177
|
-
clear)
|
|
178
|
-
rm -f "$SENTIMENT_FILE"
|
|
179
|
-
echo "🎭 Sentiment cleared - using voice personality only"
|
|
180
|
-
;;
|
|
181
|
-
|
|
182
|
-
*)
|
|
183
|
-
# If a single argument is provided and it's not a command, treat it as "set <sentiment>"
|
|
184
|
-
if [[ -n "$1" ]] && [[ -f "$PERSONALITIES_DIR/${1}.md" ]]; then
|
|
185
|
-
exec "$0" set "$1"
|
|
186
|
-
else
|
|
187
|
-
echo "AgentVibes Sentiment Manager"
|
|
188
|
-
echo ""
|
|
189
|
-
echo "Commands:"
|
|
190
|
-
echo " list - List all sentiments"
|
|
191
|
-
echo " set <name> - Set sentiment for current voice"
|
|
192
|
-
echo " get - Show current sentiment"
|
|
193
|
-
echo " clear - Clear sentiment"
|
|
194
|
-
echo ""
|
|
195
|
-
echo "Examples:"
|
|
196
|
-
echo " /agent-vibes:sentiment flirty # Add flirty style to current voice"
|
|
197
|
-
echo " /agent-vibes:sentiment sarcastic # Add sarcasm to current voice"
|
|
198
|
-
echo " /agent-vibes:sentiment clear # Remove sentiment"
|
|
199
|
-
fi
|
|
200
|
-
;;
|
|
201
|
-
esac
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# File: .claude/hooks/sentiment-manager.sh
|
|
4
|
+
#
|
|
5
|
+
# AgentVibes - Finally, your AI Agents can Talk Back! Text-to-Speech WITH personality for AI Assistants!
|
|
6
|
+
# Website: https://agentvibes.org
|
|
7
|
+
# Repository: https://github.com/paulpreibisch/AgentVibes
|
|
8
|
+
#
|
|
9
|
+
# Co-created by Paul Preibisch with Claude AI
|
|
10
|
+
# Copyright (c) 2025 Paul Preibisch
|
|
11
|
+
#
|
|
12
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
# you may not use this file except in compliance with the License.
|
|
14
|
+
# You may obtain a copy of the License at
|
|
15
|
+
#
|
|
16
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
#
|
|
18
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
# See the License for the specific language governing permissions and
|
|
22
|
+
# limitations under the License.
|
|
23
|
+
#
|
|
24
|
+
# DISCLAIMER: This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
25
|
+
# express or implied, including but not limited to the warranties of
|
|
26
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
27
|
+
# In no event shall the authors or copyright holders be liable for any claim,
|
|
28
|
+
# damages or other liability, whether in an action of contract, tort or
|
|
29
|
+
# otherwise, arising from, out of or in connection with the software or the
|
|
30
|
+
# use or other dealings in the software.
|
|
31
|
+
#
|
|
32
|
+
# ---
|
|
33
|
+
#
|
|
34
|
+
# @fileoverview Sentiment Manager - Applies personality styles to current voice without changing the voice itself
|
|
35
|
+
# @context Allows adding emotional/tonal layers (flirty, sarcastic, etc.) to any voice while preserving voice identity
|
|
36
|
+
# @architecture Reuses personality markdown files, stores sentiment separately from personality
|
|
37
|
+
# @dependencies .claude/personalities/*.md files, play-tts.sh for acknowledgment
|
|
38
|
+
# @entrypoints Called by /agent-vibes:sentiment slash command
|
|
39
|
+
# @patterns Personality/sentiment separation, state file management, random example selection
|
|
40
|
+
# @related personality-manager.sh, .claude/personalities/*.md, .claude/tts-sentiment.txt
|
|
41
|
+
|
|
42
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
43
|
+
PERSONALITIES_DIR="$SCRIPT_DIR/../personalities"
|
|
44
|
+
|
|
45
|
+
# Project-local file first, global fallback
|
|
46
|
+
# Use logical path (not physical) to handle symlinked .claude directories
|
|
47
|
+
# Script is at .claude/hooks/sentiment-manager.sh, so .claude is ..
|
|
48
|
+
CLAUDE_DIR="$(cd "$SCRIPT_DIR/.." 2>/dev/null && pwd)"
|
|
49
|
+
|
|
50
|
+
# Check if we have a project-local .claude directory
|
|
51
|
+
if [[ -d "$CLAUDE_DIR" ]] && [[ "$CLAUDE_DIR" != "$HOME/.claude" ]]; then
|
|
52
|
+
SENTIMENT_FILE="$CLAUDE_DIR/tts-sentiment.txt"
|
|
53
|
+
else
|
|
54
|
+
SENTIMENT_FILE="$HOME/.claude/tts-sentiment.txt"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Function to get personality data from markdown file
|
|
58
|
+
get_personality_data() {
|
|
59
|
+
local personality="$1"
|
|
60
|
+
local field="$2"
|
|
61
|
+
local file="$PERSONALITIES_DIR/${personality}.md"
|
|
62
|
+
|
|
63
|
+
if [[ ! -f "$file" ]]; then
|
|
64
|
+
return 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
case "$field" in
|
|
68
|
+
description)
|
|
69
|
+
grep "^description:" "$file" | cut -d: -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
|
|
70
|
+
;;
|
|
71
|
+
esac
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Function to list all available personalities
|
|
75
|
+
list_personalities() {
|
|
76
|
+
if [[ -d "$PERSONALITIES_DIR" ]]; then
|
|
77
|
+
for file in "$PERSONALITIES_DIR"/*.md; do
|
|
78
|
+
if [[ -f "$file" ]]; then
|
|
79
|
+
basename "$file" .md
|
|
80
|
+
fi
|
|
81
|
+
done
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case "$1" in
|
|
86
|
+
list)
|
|
87
|
+
echo "🎭 Available Sentiments:"
|
|
88
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
89
|
+
|
|
90
|
+
# Get current sentiment
|
|
91
|
+
CURRENT="none"
|
|
92
|
+
if [ -f "$SENTIMENT_FILE" ]; then
|
|
93
|
+
CURRENT=$(cat "$SENTIMENT_FILE")
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# List personalities from markdown files
|
|
97
|
+
echo "Available sentiment styles:"
|
|
98
|
+
for personality in $(list_personalities | sort); do
|
|
99
|
+
desc=$(get_personality_data "$personality" "description")
|
|
100
|
+
if [[ "$personality" == "$CURRENT" ]]; then
|
|
101
|
+
echo " ✓ $personality - $desc (current)"
|
|
102
|
+
else
|
|
103
|
+
echo " - $personality - $desc"
|
|
104
|
+
fi
|
|
105
|
+
done
|
|
106
|
+
|
|
107
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
108
|
+
echo ""
|
|
109
|
+
echo "Usage: /agent-vibes:sentiment <name>"
|
|
110
|
+
echo " /agent-vibes:sentiment clear"
|
|
111
|
+
;;
|
|
112
|
+
|
|
113
|
+
set)
|
|
114
|
+
SENTIMENT="$2"
|
|
115
|
+
|
|
116
|
+
if [[ -z "$SENTIMENT" ]]; then
|
|
117
|
+
echo "❌ Please specify a sentiment name"
|
|
118
|
+
echo "Usage: $0 set <sentiment>"
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Check if sentiment file exists
|
|
123
|
+
if [[ ! -f "$PERSONALITIES_DIR/${SENTIMENT}.md" ]]; then
|
|
124
|
+
echo "❌ Sentiment not found: $SENTIMENT"
|
|
125
|
+
echo ""
|
|
126
|
+
echo "Available sentiments:"
|
|
127
|
+
for p in $(list_personalities | sort); do
|
|
128
|
+
echo " • $p"
|
|
129
|
+
done
|
|
130
|
+
exit 1
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
# Save the sentiment (but don't change personality or voice)
|
|
134
|
+
echo "$SENTIMENT" > "$SENTIMENT_FILE"
|
|
135
|
+
echo "🎭 Sentiment set to: $SENTIMENT"
|
|
136
|
+
echo "🎤 Voice remains unchanged"
|
|
137
|
+
echo ""
|
|
138
|
+
|
|
139
|
+
# Make a sentiment-appropriate remark with TTS
|
|
140
|
+
TTS_SCRIPT="$SCRIPT_DIR/play-tts.sh"
|
|
141
|
+
|
|
142
|
+
# Try to get acknowledgment from personality file (sentiments use same personality files)
|
|
143
|
+
PERSONALITY_FILE_PATH="$PERSONALITIES_DIR/${SENTIMENT}.md"
|
|
144
|
+
REMARK=""
|
|
145
|
+
|
|
146
|
+
if [[ -f "$PERSONALITY_FILE_PATH" ]]; then
|
|
147
|
+
# Extract example responses from personality file (lines starting with "- ")
|
|
148
|
+
mapfile -t EXAMPLES < <(grep '^- "' "$PERSONALITY_FILE_PATH" | sed 's/^- "//; s/"$//')
|
|
149
|
+
|
|
150
|
+
if [[ ${#EXAMPLES[@]} -gt 0 ]]; then
|
|
151
|
+
# Pick a random example
|
|
152
|
+
REMARK="${EXAMPLES[$RANDOM % ${#EXAMPLES[@]}]}"
|
|
153
|
+
fi
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
# Fallback if no examples found
|
|
157
|
+
if [[ -z "$REMARK" ]]; then
|
|
158
|
+
REMARK="Sentiment set to ${SENTIMENT} while maintaining current voice"
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
echo "💬 $REMARK"
|
|
162
|
+
"$TTS_SCRIPT" "$REMARK"
|
|
163
|
+
;;
|
|
164
|
+
|
|
165
|
+
get)
|
|
166
|
+
if [ -f "$SENTIMENT_FILE" ]; then
|
|
167
|
+
CURRENT=$(cat "$SENTIMENT_FILE")
|
|
168
|
+
echo "Current sentiment: $CURRENT"
|
|
169
|
+
|
|
170
|
+
desc=$(get_personality_data "$CURRENT" "description")
|
|
171
|
+
[[ -n "$desc" ]] && echo "Description: $desc"
|
|
172
|
+
else
|
|
173
|
+
echo "Current sentiment: none (voice personality only)"
|
|
174
|
+
fi
|
|
175
|
+
;;
|
|
176
|
+
|
|
177
|
+
clear)
|
|
178
|
+
rm -f "$SENTIMENT_FILE"
|
|
179
|
+
echo "🎭 Sentiment cleared - using voice personality only"
|
|
180
|
+
;;
|
|
181
|
+
|
|
182
|
+
*)
|
|
183
|
+
# If a single argument is provided and it's not a command, treat it as "set <sentiment>"
|
|
184
|
+
if [[ -n "$1" ]] && [[ -f "$PERSONALITIES_DIR/${1}.md" ]]; then
|
|
185
|
+
exec "$0" set "$1"
|
|
186
|
+
else
|
|
187
|
+
echo "AgentVibes Sentiment Manager"
|
|
188
|
+
echo ""
|
|
189
|
+
echo "Commands:"
|
|
190
|
+
echo " list - List all sentiments"
|
|
191
|
+
echo " set <name> - Set sentiment for current voice"
|
|
192
|
+
echo " get - Show current sentiment"
|
|
193
|
+
echo " clear - Clear sentiment"
|
|
194
|
+
echo ""
|
|
195
|
+
echo "Examples:"
|
|
196
|
+
echo " /agent-vibes:sentiment flirty # Add flirty style to current voice"
|
|
197
|
+
echo " /agent-vibes:sentiment sarcastic # Add sarcasm to current voice"
|
|
198
|
+
echo " /agent-vibes:sentiment clear # Remove sentiment"
|
|
199
|
+
fi
|
|
200
|
+
;;
|
|
201
|
+
esac
|