@openpalm/lib 0.9.7 → 0.9.9

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": "@openpalm/lib",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "license": "MPL-2.0",
5
5
  "type": "module",
6
6
  "description": "Shared control-plane library for OpenPalm — lifecycle, staging, secrets, channels, connections, scheduler",
@@ -406,6 +406,44 @@ export function buildSecretsFromSetup(input: SetupInput): Record<string, string>
406
406
  // Memory user ID
407
407
  updates.MEMORY_USER_ID = input.memoryUserId || "default_user";
408
408
 
409
+ // Voice: TTS/STT env vars based on engine choice
410
+ if (input.voice) {
411
+ // Find an OpenAI-compatible connection for cloud engines.
412
+ // Normalize base URL: strip trailing slashes and /v1 suffix since
413
+ // the voice channel providers append /v1/... themselves.
414
+ const openaiConn = effectiveConnections.find((c) => c.provider === "openai");
415
+ const openaiBaseUrl = (openaiConn?.baseUrl || "https://api.openai.com")
416
+ .replace(/\/+$/, "")
417
+ .replace(/\/v1$/, "");
418
+ const openaiKey = openaiConn?.apiKey || "";
419
+
420
+ const { tts, stt } = input.voice;
421
+
422
+ if (stt === "openai-stt") {
423
+ updates.STT_BASE_URL = openaiBaseUrl;
424
+ updates.STT_API_KEY = openaiKey;
425
+ updates.STT_MODEL = "whisper-1";
426
+ } else if (stt === "whisper-local") {
427
+ updates.STT_BASE_URL = "http://whisper:9000";
428
+ updates.STT_MODEL = "whisper-1";
429
+ }
430
+ // browser-stt / skip-stt: no env vars needed (voice channel falls back to browser)
431
+
432
+ if (tts === "openai-tts") {
433
+ updates.TTS_BASE_URL = openaiBaseUrl;
434
+ updates.TTS_API_KEY = openaiKey;
435
+ updates.TTS_MODEL = "tts-1";
436
+ updates.TTS_VOICE = "alloy";
437
+ } else if (tts === "kokoro") {
438
+ updates.TTS_BASE_URL = "http://kokoro:8880";
439
+ updates.TTS_MODEL = "kokoro";
440
+ } else if (tts === "piper") {
441
+ updates.TTS_BASE_URL = "http://piper:5000";
442
+ updates.TTS_MODEL = "piper";
443
+ }
444
+ // browser-tts / skip-tts: no env vars needed (voice channel falls back to browser)
445
+ }
446
+
409
447
  return updates;
410
448
  }
411
449