@burdenoff/microfe-healthybowl 2026.831.3 → 2026.831.4
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.
|
@@ -22,31 +22,37 @@ var e = "chirp3-hd", t = [
|
|
|
22
22
|
"ur-IN",
|
|
23
23
|
"ar-XA",
|
|
24
24
|
"es-ES",
|
|
25
|
-
"
|
|
25
|
+
"cmn-CN",
|
|
26
26
|
"ja-JP",
|
|
27
27
|
"fr-FR",
|
|
28
28
|
"de-DE"
|
|
29
|
-
], r =
|
|
29
|
+
], r = { "cmn-CN": "zh-CN" };
|
|
30
|
+
function i(e) {
|
|
31
|
+
return r[e] ?? e;
|
|
32
|
+
}
|
|
33
|
+
var a = n.flatMap((e) => t.map((t) => ({
|
|
30
34
|
name: `${e}-Chirp3-HD-${t}`,
|
|
31
|
-
lang: e,
|
|
35
|
+
lang: i(e),
|
|
32
36
|
localService: !1
|
|
33
|
-
}))),
|
|
34
|
-
for (let e of n) {
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
+
}))), o = /* @__PURE__ */ new Map();
|
|
38
|
+
for (let e of n) for (let t of new Set([i(e), e])) {
|
|
39
|
+
let n = t.toLowerCase().split("-")[0];
|
|
40
|
+
o.has(n) || o.set(n, e);
|
|
37
41
|
}
|
|
38
|
-
|
|
42
|
+
var s = /* @__PURE__ */ new Map();
|
|
43
|
+
for (let e of n) s.set(e.toLowerCase(), e), s.set(i(e).toLowerCase(), e);
|
|
44
|
+
function c(e) {
|
|
39
45
|
let t = e.trim().replace("_", "-");
|
|
40
46
|
if (!t) return null;
|
|
41
|
-
let
|
|
42
|
-
if (
|
|
43
|
-
let
|
|
44
|
-
return
|
|
47
|
+
let n = s.get(t.toLowerCase());
|
|
48
|
+
if (n) return n;
|
|
49
|
+
let r = t.toLowerCase().split("-")[0];
|
|
50
|
+
return o.get(r) ?? null;
|
|
45
51
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
52
|
+
function l(e) {
|
|
53
|
+
return c(e) !== null;
|
|
48
54
|
}
|
|
49
55
|
//#endregion
|
|
50
|
-
export { e as HOSTED_TTS_TIER,
|
|
56
|
+
export { e as HOSTED_TTS_TIER, a as HOSTED_VOICES, c as hostedLocaleFor, l as hostedSupportsLanguage };
|
|
51
57
|
|
|
52
58
|
//# sourceMappingURL=hostedVoiceCatalogue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostedVoiceCatalogue.js","names":[],"sources":["../../../src/services/speech/hostedVoiceCatalogue.ts"],"sourcesContent":["/**\n * The voices a hosted engine can offer, per locale (BOFF-7111).\n *\n * A hosted engine has no `getVoices()` to ask — the catalogue is a property of\n * the vendor, not of the device — so it is declared here and returned from\n * `listVoices()`. That keeps the whole existing selection stack working\n * unchanged: `voicesForLocale` ranks these, `selectVoiceForLocale` honours the\n * user's saved pick, and the picker renders them exactly as it renders device\n * voices.\n *\n * Named for Google's Chirp 3: HD tier, which is the reason for doing this at\n * all — it is the only tier that covers every language the assistant speaks\n * INCLUDING Tamil. (Amazon Polly has no Tamil at all, which is why it was\n * rejected.) The names are the vendor's own voice ids so the backend can pass\n * them straight through without a mapping table that could drift.\n *\n * `localService: false` on every entry is not decoration: `voiceQualityRank`\n * scores non-local voices above local ones, so when a device voice and a hosted\n * voice are both somehow present the hosted one wins by default — which is the\n * whole point of turning the hosted engine on.\n */\n\nimport type { SpeechVoiceLike } from '../../utils/speechVoices';\n\n/** Vendor tier this catalogue describes; sent to the backend with each request. */\nexport const HOSTED_TTS_TIER = 'chirp3-hd';\n\n/**\n * Speaker names are shared across locales in this tier — the same speaker id is\n * offered in every supported locale, so the catalogue is a cross product rather\n * than a hand-written list per language.\n */\nconst SPEAKERS = ['Achernar', 'Algenib', 'Charon', 'Kore', 'Puck', 'Zephyr'] as const;\n\n/**\n * The locales the assistant can speak, as
|
|
1
|
+
{"version":3,"file":"hostedVoiceCatalogue.js","names":[],"sources":["../../../src/services/speech/hostedVoiceCatalogue.ts"],"sourcesContent":["/**\n * The voices a hosted engine can offer, per locale (BOFF-7111).\n *\n * A hosted engine has no `getVoices()` to ask — the catalogue is a property of\n * the vendor, not of the device — so it is declared here and returned from\n * `listVoices()`. That keeps the whole existing selection stack working\n * unchanged: `voicesForLocale` ranks these, `selectVoiceForLocale` honours the\n * user's saved pick, and the picker renders them exactly as it renders device\n * voices.\n *\n * Named for Google's Chirp 3: HD tier, which is the reason for doing this at\n * all — it is the only tier that covers every language the assistant speaks\n * INCLUDING Tamil. (Amazon Polly has no Tamil at all, which is why it was\n * rejected.) The names are the vendor's own voice ids so the backend can pass\n * them straight through without a mapping table that could drift.\n *\n * `localService: false` on every entry is not decoration: `voiceQualityRank`\n * scores non-local voices above local ones, so when a device voice and a hosted\n * voice are both somehow present the hosted one wins by default — which is the\n * whole point of turning the hosted engine on.\n *\n * Every entry below was verified against the vendor's live `voices.list` on\n * 2026-08-31 (BOFF-7117), once the API was actually enabled. That check is the\n * reason this file distinguishes an app tag from a vendor locale at all — see\n * `VENDOR_LOCALES`.\n */\n\nimport type { SpeechVoiceLike } from '../../utils/speechVoices';\n\n/** Vendor tier this catalogue describes; sent to the backend with each request. */\nexport const HOSTED_TTS_TIER = 'chirp3-hd';\n\n/**\n * Speaker names are shared across locales in this tier — the same speaker id is\n * offered in every supported locale, so the catalogue is a cross product rather\n * than a hand-written list per language.\n */\nconst SPEAKERS = ['Achernar', 'Algenib', 'Charon', 'Kore', 'Puck', 'Zephyr'] as const;\n\n/**\n * The locales the assistant can speak, **as the vendor spells them**.\n *\n * Deliberately NOT every locale the vendor supports: offering a language the\n * assistant cannot actually reply in would be a dead option in the picker.\n *\n * These are the vendor's tags, not the app's, and the two are not always the\n * same string. Getting that wrong is not a cosmetic bug: a voice id the vendor\n * does not publish is rejected with HTTP 400, `classifyHttpFailure` maps 400 to\n * `unknown`, and the reply then fails to play at all — strictly worse than the\n * device voice it was meant to replace, because the device path would at least\n * have spoken. `APP_TAG_BY_VENDOR_LOCALE` is what keeps the two vocabularies\n * from being confused.\n */\nconst VENDOR_LOCALES = [\n 'en-US',\n 'en-GB',\n 'en-IN',\n 'ta-IN',\n 'hi-IN',\n 'bn-IN',\n 'te-IN',\n 'mr-IN',\n 'gu-IN',\n 'kn-IN',\n 'ml-IN',\n 'pa-IN',\n 'ur-IN',\n 'ar-XA',\n 'es-ES',\n // Mandarin. The app calls this `zh-CN` (SPEECH_LANG.zh) but the vendor\n // publishes it ONLY as `cmn-CN` — `zh-CN-Chirp3-HD-Kore` does not exist and\n // returns \"Voice ... does not exist. Is it misspelled?\". Verified live.\n 'cmn-CN',\n 'ja-JP',\n 'fr-FR',\n 'de-DE',\n] as const;\n\n/**\n * Vendor locale -> the tag the APP uses for the same language, for the tags\n * where the two genuinely disagree.\n *\n * This is the `lang` each catalogue entry advertises, and it has to be the\n * app's tag rather than the vendor's, because `voicesForLocale` matches a voice\n * to a locale by PRIMARY SUBTAG. `zh` and `cmn` are different primary subtags,\n * so a catalogue entry advertising `lang: 'cmn-CN'` would be invisible to a\n * Chinese reply — the hosted Chinese voices would simply never appear in the\n * picker, which is the quiet half of the same bug.\n *\n * Arabic needs no entry here: the app says `ar-SA` and the vendor says `ar-XA`,\n * but both reduce to the primary subtag `ar`, so the existing \"same language,\n * any region\" rung of the ladder already matches them. Mandarin is the only\n * language in this catalogue where the primary subtags themselves differ.\n */\nconst APP_TAG_BY_VENDOR_LOCALE: Readonly<Record<string, string>> = {\n 'cmn-CN': 'zh-CN',\n};\n\n/** The app-facing tag to advertise for a vendor locale. */\nfunction appTagFor(vendorLocale: string): string {\n return APP_TAG_BY_VENDOR_LOCALE[vendorLocale] ?? vendorLocale;\n}\n\n/**\n * Every hosted voice, as `SpeechVoiceLike` so it is interchangeable with a\n * device voice everywhere downstream.\n *\n * The vendor id form is `<vendor-locale>-Chirp3-HD-<Speaker>`, e.g.\n * `ta-IN-Chirp3-HD-Kore`. It is used as BOTH the display name and the id the\n * backend receives, because the persisted preference is keyed by name — a\n * separate display label would break a saved pick the first time it changed.\n *\n * `name` is therefore always the VENDOR's spelling (it is sent on the wire and\n * must exist), while `lang` is always the APP's (it is matched against\n * `SPEECH_LANG`). For every locale but Mandarin these are the same string.\n */\nexport const HOSTED_VOICES: readonly SpeechVoiceLike[] = VENDOR_LOCALES.flatMap((vendorLocale) =>\n SPEAKERS.map((speaker) => ({\n name: `${vendorLocale}-Chirp3-HD-${speaker}`,\n lang: appTagFor(vendorLocale),\n // Never on-device. See the file header: this is what makes a hosted voice\n // outrank a compact device voice in `voiceQualityRank`.\n localService: false,\n }))\n);\n\n/**\n * App locale tag -> the vendor's own locale, by primary subtag.\n *\n * These are NOT always the same string, and assuming they were is a real bug:\n * the app speaks Arabic as `ar-SA` while Google's catalogue only has `ar-XA`,\n * and Mandarin as `zh-CN` while Google's catalogue only has `cmn-CN`. Sending\n * the app's tag would be an unsupported vendor locale AND would cause the\n * chosen voice to be dropped as a cross-language mismatch, so the language\n * would fail on both counts.\n *\n * Built once from the catalogue rather than hand-written, so a locale can never\n * be listed here that has no voices. Keyed on the primary subtag of the\n * APP-facing tag, because an app tag is what callers pass. First match wins,\n * which is why the regional English variants are ordered deliberately in\n * `VENDOR_LOCALES`.\n */\nconst VENDOR_LOCALE_BY_PRIMARY = new Map<string, string>();\nfor (const vendorLocale of VENDOR_LOCALES) {\n for (const tag of new Set([appTagFor(vendorLocale), vendorLocale])) {\n const primary = tag.toLowerCase().split('-')[0] as string;\n if (!VENDOR_LOCALE_BY_PRIMARY.has(primary)) VENDOR_LOCALE_BY_PRIMARY.set(primary, vendorLocale);\n }\n}\n\n/** Exact app-facing tag -> vendor locale, checked before the primary-subtag fallback. */\nconst VENDOR_LOCALE_BY_APP_TAG = new Map<string, string>();\nfor (const vendorLocale of VENDOR_LOCALES) {\n VENDOR_LOCALE_BY_APP_TAG.set(vendorLocale.toLowerCase(), vendorLocale);\n VENDOR_LOCALE_BY_APP_TAG.set(appTagFor(vendorLocale).toLowerCase(), vendorLocale);\n}\n\n/**\n * The exact vendor locale to request for an app tag, or null when the vendor\n * cannot speak the language at all.\n *\n * Prefers an exact match (`en-GB` stays `en-GB`, `zh-CN` becomes `cmn-CN`) and\n * otherwise falls back to the primary subtag's canonical vendor locale\n * (`ar-SA` -> `ar-XA`, `zh` -> `cmn-CN`).\n */\nexport function hostedLocaleFor(tag: string): string | null {\n const normalised = tag.trim().replace('_', '-');\n if (!normalised) return null;\n const exact = VENDOR_LOCALE_BY_APP_TAG.get(normalised.toLowerCase());\n if (exact) return exact;\n const primary = normalised.toLowerCase().split('-')[0] as string;\n return VENDOR_LOCALE_BY_PRIMARY.get(primary) ?? null;\n}\n\n/**\n * True when the hosted engine can actually speak this language.\n *\n * The caller needs this to decide whether to fall back to the device engine\n * for a reply in a language the vendor does not cover, rather than sending a\n * request that can only fail.\n */\nexport function hostedSupportsLanguage(tag: string): boolean {\n return hostedLocaleFor(tag) !== null;\n}\n"],"mappings":";AA8BA,IAAa,IAAkB,aAOzB,IAAW;CAAC;CAAY;CAAW;CAAU;CAAQ;CAAQ;AAAQ,GAgBrE,IAAiB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIA;CACA;CACA;CACA;AACF,GAkBM,IAA6D,EACjE,UAAU,QACZ;AAGA,SAAS,EAAU,GAA8B;CAC/C,OAAO,EAAyB,MAAiB;AACnD;AAeA,IAAa,IAA4C,EAAe,SAAS,MAC/E,EAAS,KAAK,OAAa;CACzB,MAAM,GAAG,EAAa,aAAa;CACnC,MAAM,EAAU,CAAY;CAG5B,cAAc;AAChB,EAAE,CACJ,GAkBM,oBAA2B,IAAI,IAAoB;AACzD,KAAK,IAAM,KAAgB,GACzB,KAAK,IAAM,KAAO,IAAI,IAAI,CAAC,EAAU,CAAY,GAAG,CAAY,CAAC,GAAG;CAClE,IAAM,IAAU,EAAI,YAAY,EAAE,MAAM,GAAG,EAAE;CAC7C,AAAK,EAAyB,IAAI,CAAO,KAAG,EAAyB,IAAI,GAAS,CAAY;AAChG;AAIF,IAAM,oBAA2B,IAAI,IAAoB;AACzD,KAAK,IAAM,KAAgB,GAEzB,AADA,EAAyB,IAAI,EAAa,YAAY,GAAG,CAAY,GACrE,EAAyB,IAAI,EAAU,CAAY,EAAE,YAAY,GAAG,CAAY;AAWlF,SAAgB,EAAgB,GAA4B;CAC1D,IAAM,IAAa,EAAI,KAAK,EAAE,QAAQ,KAAK,GAAG;CAC9C,IAAI,CAAC,GAAY,OAAO;CACxB,IAAM,IAAQ,EAAyB,IAAI,EAAW,YAAY,CAAC;CACnE,IAAI,GAAO,OAAO;CAClB,IAAM,IAAU,EAAW,YAAY,EAAE,MAAM,GAAG,EAAE;CACpD,OAAO,EAAyB,IAAI,CAAO,KAAK;AAClD;AASA,SAAgB,EAAuB,GAAsB;CAC3D,OAAO,EAAgB,CAAG,MAAM;AAClC"}
|
package/package.json
CHANGED