@7ots/cli 0.1.12 → 0.1.14

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": "@7ots/cli",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "7ots.com — your AI companion with a face of its own: a desktop pet that watches over your coding agent (Claude Code and shell hooks), a personal assistant (reminders, alerts, notes, opens sites, sees your screen if allowed) and a reproducible identity (face, personality, voice) for any agent — in apuchat meet calls, Orquesta projects or your own server.",
5
5
  "homepage": "https://7ots.com",
6
6
  "repository": {
package/server/admin.mjs CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import { createHash, createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
13
- import { getIdentity, setIdentity, MEET_AVATARS, MEET_SCENES, OPENAI_VOICES, GROK_VOICES } from './identity.mjs';
13
+ import { getIdentity, setIdentity, MEET_AVATARS, MEET_SCENES, OPENAI_VOICES, GROK_VOICES, TTS_MODELS } from './identity.mjs';
14
14
  import { widgetConfig, saveWidget, serverView, saveServer } from './settings.mjs';
15
15
  import { reqT, requestLocale } from './i18n.mjs';
16
16
 
@@ -129,7 +129,7 @@ export function createAdmin({ llm, channels, reload, synthesize, ttsProvider, re
129
129
  widget: widgetConfig(),
130
130
  server: serverView(),
131
131
  status: status(),
132
- options: { meetAvatars: MEET_AVATARS, meetScenes: MEET_SCENES, openaiVoices: OPENAI_VOICES, grokVoices: GROK_VOICES },
132
+ options: { meetAvatars: MEET_AVATARS, meetScenes: MEET_SCENES, openaiVoices: OPENAI_VOICES, grokVoices: GROK_VOICES, ttsModels: TTS_MODELS },
133
133
  });
134
134
  return true;
135
135
  }
package/server/tts.mjs CHANGED
@@ -28,6 +28,7 @@
28
28
 
29
29
  import { OPENAI_VOICES } from './identity.mjs';
30
30
  import { i18nError } from './i18n.mjs';
31
+ import { speechTagsFor } from '../src/voice/tags.js';
31
32
 
32
33
  const PROVIDERS = ['apuchat', 'elevenlabs', 'grok', 'fish', 'openai'];
33
34
  const TIMEOUT_MS = 20_000;
@@ -57,7 +58,7 @@ export function openaiTtsKey(env = process.env) {
57
58
 
58
59
  export async function synthesize({ text, voice = {}, env = process.env }) {
59
60
  const provider = PROVIDERS.includes(voice.provider) ? voice.provider : voice.provider === 'browser' ? 'none' : ttsProvider(env);
60
- const input = String(text || '').slice(0, 1500);
61
+ const input = speechTagsFor(text, provider, voice.model || (provider === 'elevenlabs' ? env.ELEVENLABS_MODEL : '')).slice(0, 1500);
61
62
  if (!input) throw i18nError(400, 'server.tts.empty');
62
63
 
63
64
  if (provider === 'apuchat') {
@@ -31,6 +31,14 @@ export const MEET_SCENES = ['studio', 'beach', 'castle', 'space', 'sunset', 'for
31
31
  export const VOICE_PROVIDERS = ['auto', 'apuchat', 'elevenlabs', 'grok', 'fish', 'openai', 'browser'];
32
32
  /** Voces integradas de xAI (Grok) TTS; también admite ids de voces clonadas propias. */
33
33
  export const GROK_VOICES = ['eve', 'ara', 'leo', 'rex', 'sal'];
34
+ /** TTS models per provider, first = what the server uses when none is picked. xAI has a single model. */
35
+ export const TTS_MODELS = {
36
+ elevenlabs: ['eleven_multilingual_v2', 'eleven_v3', 'eleven_flash_v2_5', 'eleven_turbo_v2_5'],
37
+ openai: ['gpt-4o-mini-tts', 'tts-1', 'tts-1-hd'],
38
+ fish: ['s2.1-pro', 's1', 'speech-1.6', 'speech-1.5'],
39
+ apuchat: ['s2.1-pro-free'],
40
+ grok: [],
41
+ };
34
42
  export const OPENAI_VOICES = ['alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'nova', 'onyx', 'sage', 'shimmer', 'verse'];
35
43
  export const MOODS = ['neutral', 'happy', 'angry', 'sad', 'fear', 'disgust', 'love', 'sleep'];
36
44
 
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Speech tags: the brain marks tone ("expressions" in settings → Voice) and the voice performs it.
3
+ * xAI reads them as is; ElevenLabs v3 gets its own audio tags; every other voice (and the bubble) gets clean text.
4
+ */
5
+ const INLINE = /\s*\[(pause|long-pause|laugh|cry|mouth-click|breath|sigh)\]\s*/gi;
6
+ const WRAP = /<\/?(loud|soft|whisper|fast|slow|singing)>/gi;
7
+
8
+ export function stripSpeechTags(text) {
9
+ return String(text ?? '').replace(WRAP, '').replace(INLINE, ' ').replace(/\s{2,}/g, ' ').trim();
10
+ }
11
+
12
+ const EL_INLINE = { laugh: '[laughs]', cry: '[crying]', sigh: '[sighs]', breath: '[exhales]', pause: '…', 'long-pause': '… …', 'mouth-click': '' };
13
+ const EL_WRAP = { whisper: '[whispers]', soft: '[softly]', loud: '[shouting]', slow: '[slowly]', fast: '[quickly]', singing: '[sings]' };
14
+
15
+ /** The text a provider should get: tags kept (xAI), translated (ElevenLabs v3) or removed. */
16
+ export function speechTagsFor(text, provider, model = '') {
17
+ if (provider === 'grok') return String(text ?? '');
18
+ if (provider === 'elevenlabs' && /v3/.test(model)) {
19
+ return String(text ?? '')
20
+ .replace(/<(loud|soft|whisper|fast|slow|singing)>/gi, (_, t) => `${EL_WRAP[t.toLowerCase()]} `)
21
+ .replace(/<\/(loud|soft|whisper|fast|slow|singing)>/gi, '')
22
+ .replace(/\[(pause|long-pause|laugh|cry|mouth-click|breath|sigh)\]/gi, (_, t) => EL_INLINE[t.toLowerCase()])
23
+ .replace(/\s{2,}/g, ' ')
24
+ .trim();
25
+ }
26
+ return stripSpeechTags(text);
27
+ }
28
+
29
+ export const SPEECH_TAGS_PROMPT =
30
+ 'Your words are spoken aloud by an expressive voice, and you choose the tone. When it fits (not in every line) add: [laugh], [sigh], [cry], [breath] or [pause] where the sound goes, or wrap words in <whisper>…</whisper>, <soft>…</soft>, <loud>…</loud>, <slow>…</slow> or <fast>…</fast>. Sad news sounds soft and slow, a joke gets a laugh. No other brackets or angle brackets.';