agentvibes 5.1.3 → 5.2.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 (34) hide show
  1. package/.agentvibes/config.json +23 -13
  2. package/.claude/commands/agent-vibes/verbosity.md +98 -89
  3. package/.claude/config/audio-effects.cfg +6 -1
  4. package/.claude/hooks/bmad-speak.sh +2 -2
  5. package/.claude/hooks/piper-download-voices.sh +233 -225
  6. package/.claude/hooks/piper-installer.sh +1 -1
  7. package/.claude/hooks/piper-voice-manager.sh +125 -0
  8. package/.claude/hooks/play-tts-agentvibes-receiver-for-voiceless-connections.sh +97 -90
  9. package/.claude/hooks/play-tts-enhanced.sh +1 -1
  10. package/.claude/hooks/play-tts-piper.sh +16 -5
  11. package/.claude/hooks/play-tts-ssh-remote.sh +168 -167
  12. package/.claude/hooks/play-tts.sh +31 -9
  13. package/.claude/hooks/session-start-tts.sh +4 -1
  14. package/.claude/hooks/stop-tts.sh +1 -1
  15. package/.claude/hooks/verbosity-manager.sh +185 -178
  16. package/.claude/hooks-windows/download-extra-voices.ps1 +243 -185
  17. package/.claude/hooks-windows/play-tts-piper.ps1 +7 -2
  18. package/.claude/hooks-windows/play-tts.ps1 +219 -65
  19. package/.claude/hooks-windows/session-start-tts.ps1 +2 -1
  20. package/.claude/hooks-windows/verbosity-manager.ps1 +126 -119
  21. package/README.md +24 -1
  22. package/RELEASE_NOTES.md +113 -0
  23. package/bin/agentvibes-voice-browser.js +1939 -1840
  24. package/mcp-server/server.py +75 -25
  25. package/package.json +1 -1
  26. package/src/console/tabs/receiver-tab.js +1527 -1483
  27. package/src/console/tabs/settings-tab.js +2 -2
  28. package/src/console/tabs/setup-tab.js +122 -20
  29. package/src/console/tabs/voices-tab.js +130 -13
  30. package/src/i18n/en.js +202 -202
  31. package/src/installer.js +29 -25
  32. package/src/services/llm-provider-service.js +114 -11
  33. package/src/services/verbosity-service.js +159 -157
  34. package/templates/agentvibes-receiver.sh +3 -2
@@ -51,8 +51,6 @@ from typing import Optional
51
51
  from mcp.server import Server
52
52
  from mcp.types import Tool, TextContent, ImageContent, EmbeddedResource
53
53
  import mcp.server.stdio
54
-
55
-
56
54
  class AgentVibesServer:
57
55
  """MCP Server for AgentVibes TTS functionality"""
58
56
 
@@ -196,29 +194,38 @@ class AgentVibesServer:
196
194
 
197
195
  # Call the TTS script via appropriate shell.
198
196
  #
199
- # The LLM key is read from the AGENTVIBES_LLM env var so each
200
- # caller (Claude Code, GitHub Copilot, OpenAI Codex) gets routed
201
- # to its own per-LLM voice / pretext / music / effects config.
202
- # The MCP launcher in each provider's config file should set
203
- # this env var (e.g. .codex/config.toml [mcp_servers.agentvibes]
204
- # env = { AGENTVIBES_LLM = "codex" }).
197
+ # The LLM key is determined with the following priority:
198
+ #
199
+ # 1. AGENTVIBES_LLM env var (explicit wins over everything).
200
+ # Set in each provider's MCP launcher config:
201
+ # ~/.codex/config.toml -> "codex"
202
+ # ~/.copilot/mcp-config.json -> "copilot"
205
203
  #
206
- # If unset OR invalid, no -llm flag is passed and play-tts falls
207
- # back to the project / global default config. Validation
208
- # mirrors play-tts.sh line 92 alphanumeric / hyphen /
209
- # underscore only. This prevents weird values from poisoning
210
- # the audio-effects.cfg lookup or being forwarded as ambiguous
211
- # arguments to the child shell.
204
+ # 2. Auto-detection via CLAUDECODE=1 env var (Claude Code sets
205
+ # this automatically when it spawns any subprocess). This
206
+ # lets project-level .mcp.json files omit the env block
207
+ # which is critical because GitHub Copilot CLI also reads
208
+ # .mcp.json and would otherwise pick up claude-code's env.
209
+ #
210
+ # 3. Unset — play-tts falls back to llm:default or global config.
211
+ #
212
+ # Validation mirrors play-tts.sh line 92 — alphanumeric /
213
+ # hyphen / underscore only. Prevents weird values from
214
+ # poisoning the audio-effects.cfg lookup or child-shell args.
212
215
  import re as _re
213
216
  llm_key = os.environ.get("AGENTVIBES_LLM", "").strip()
214
217
  if llm_key and not _re.match(r"^[a-zA-Z0-9_-]+$", llm_key):
215
- # Invalid value — log to stderr and treat as unset
216
218
  print(
217
219
  f"[AgentVibes] WARN: Ignoring invalid AGENTVIBES_LLM='{llm_key}' "
218
- "(must match ^[a-zA-Z0-9_-]+$); falling back to default config",
220
+ "(must match ^[a-zA-Z0-9_-]+$); falling back to auto-detect",
219
221
  file=__import__('sys').stderr,
220
222
  )
221
223
  llm_key = ""
224
+ # Claude Code sets CLAUDECODE=1 when it spawns subprocesses.
225
+ # Use that as a fallback identifier when no explicit env var
226
+ # was provided. Copilot CLI and Codex do NOT set this.
227
+ if not llm_key and os.environ.get("CLAUDECODE", "").strip() == "1":
228
+ llm_key = "claude-code"
222
229
  tts_script = "play-tts.ps1" if self.is_windows else "play-tts.sh"
223
230
  play_tts = self.hooks_dir / tts_script
224
231
  if self.is_windows:
@@ -905,17 +912,58 @@ class AgentVibesServer:
905
912
  return "✅ TTS banner: **enabled**\n\nSay: \"Turn off banner\" to disable"
906
913
 
907
914
  # Helper methods
915
+ def _resolve_project_dir(self) -> Optional[Path]:
916
+ # Returns the nearest directory containing .claude/, or None.
917
+ # Checked in order: explicit CLAUDE_PROJECT_DIR, npm's INIT_CWD,
918
+ # shell PWD, os.getcwd() and its parents. Required because MCP
919
+ # clients (VS Code Copilot, Codex, Warp, etc.) don't agree on
920
+ # what cwd to spawn the server from, so relying on os.getcwd()
921
+ # alone silently falls back to package config — which breaks
922
+ # project-local per-LLM routing in audio-effects.cfg.
923
+ candidates: list[Path] = []
924
+ for var in ("CLAUDE_PROJECT_DIR", "INIT_CWD", "PWD"):
925
+ val = os.environ.get(var, "").strip()
926
+ if val:
927
+ try:
928
+ candidates.append(Path(val).resolve())
929
+ except (OSError, ValueError):
930
+ pass
931
+ try:
932
+ cwd = Path.cwd().resolve()
933
+ candidates.append(cwd)
934
+ candidates.extend(cwd.parents)
935
+ except (OSError, ValueError):
936
+ pass
937
+
938
+ try:
939
+ agentvibes_root = self.agentvibes_root.resolve()
940
+ except (OSError, ValueError):
941
+ agentvibes_root = self.agentvibes_root
942
+
943
+ seen: set[Path] = set()
944
+ for candidate in candidates:
945
+ if candidate in seen:
946
+ continue
947
+ seen.add(candidate)
948
+ if candidate == agentvibes_root:
949
+ continue
950
+ try:
951
+ if (candidate / ".claude").is_dir():
952
+ return candidate
953
+ except OSError:
954
+ continue
955
+ return None
956
+
908
957
  def _build_script_env(self) -> dict:
909
958
  """Build environment dict for script execution (shared by all script runners)"""
910
959
  env = os.environ.copy()
911
960
 
912
- # Determine where to save settings based on context:
913
- # 1. If cwd has .claude/ → Use cwd (real Claude Code project)
914
- # 2. Otherwise Use global ~/.claude/ (Claude Desktop, Warp, etc.)
915
- # Note: Hooks are ALWAYS from package .claude/ (self.claude_dir)
916
- cwd = Path.cwd()
917
- if (cwd / ".claude").is_dir() and cwd != self.agentvibes_root:
918
- env["CLAUDE_PROJECT_DIR"] = str(cwd)
961
+ # Export CLAUDE_PROJECT_DIR so play-tts.{ps1,sh} reads the
962
+ # project's .claude/config/audio-effects.cfg (per-LLM routing,
963
+ # pretext, effects) instead of the package's bundled copy.
964
+ project_dir = self._resolve_project_dir()
965
+ if project_dir is not None:
966
+ env["CLAUDE_PROJECT_DIR"] = str(project_dir)
919
967
 
920
968
  # Add common locations for piper to PATH (Unix only)
921
969
  if not self.is_windows:
@@ -1230,7 +1278,7 @@ Examples:
1230
1278
  ),
1231
1279
  Tool(
1232
1280
  name="get_verbosity",
1233
- description="Get current AgentVibes verbosity level (low/medium/high). Verbosity controls how much Claude speaks while working - from minimal (acknowledgments only) to maximum transparency (all reasoning spoken).",
1281
+ description="Get current AgentVibes verbosity level (low/medium/high/caveman). Verbosity controls how much Claude speaks while working - from minimal (acknowledgments only) to maximum transparency (all reasoning spoken) to caveman (ultra-terse fragments, max token savings).",
1234
1282
  inputSchema={"type": "object", "properties": {}},
1235
1283
  ),
1236
1284
  Tool(
@@ -1241,11 +1289,13 @@ Verbosity Levels:
1241
1289
  - LOW: Only acknowledgments (start) and completions (end). Minimal interruption.
1242
1290
  - MEDIUM: + Major decisions and key findings. Balanced transparency.
1243
1291
  - HIGH: All reasoning, decisions, and findings. Maximum transparency.
1292
+ - CAVEMAN: Ultra-terse fragments. Drops articles, filler, hedging. Abbreviates heavily. 65-75% fewer output tokens.
1244
1293
 
1245
1294
  Perfect for:
1246
1295
  - LOW: Quiet work sessions, minimal distraction
1247
1296
  - MEDIUM: Understanding major decisions without full narration
1248
1297
  - HIGH: Full transparency, learning mode, debugging complex tasks
1298
+ - CAVEMAN: Maximum token savings, minimal prose
1249
1299
 
1250
1300
  Note: Changes take effect on next Claude Code session restart.""",
1251
1301
  inputSchema={
@@ -1254,7 +1304,7 @@ Note: Changes take effect on next Claude Code session restart.""",
1254
1304
  "level": {
1255
1305
  "type": "string",
1256
1306
  "description": "Verbosity level to set",
1257
- "enum": ["low", "medium", "high"]
1307
+ "enum": ["low", "medium", "high", "caveman"]
1258
1308
  }
1259
1309
  },
1260
1310
  "required": ["level"],
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": "5.1.3",
4
+ "version": "5.2.0",
5
5
  "description": "Now your AI Agents can finally talk back! Professional TTS voice for Claude Code, Claude Desktop (via MCP), and Clawdbot with multi-provider support.",
6
6
  "homepage": "https://agentvibes.org",
7
7
  "keywords": [