clavarium 0.2.196-next.1 → 0.2.199-next.1

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.196-next.1",
3
+ "version": "0.2.199-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.196-next.1",
9
+ "version": "0.2.199-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.196-next.1",
3
+ "version": "0.2.199-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
package/server/boxes.mjs CHANGED
@@ -97,7 +97,10 @@ export function forSpeech(text) {
97
97
  .replace(/\b([01]?\d|2[0-3])\s?[hH](?:\s?([0-5]\d))?\b/g, (_, h, m) => `${h} heure${h === '1' || h === '0' ? '' : 's'}${m ? ` ${m}` : ''}`)
98
98
  /* Never its own wake word aloud: the box heard itself and cut its own sentence (31-10). */
99
99
  .replace(/\b(?:hey|hé|eh)[\s,]+jarvis\b/giu, 'le mot d\'éveil')
100
- .replace(/(?<![\p{L}])m[ée]sange(?![\p{L}])/giu, 'le mot d\'éveil')
100
+ .replace(/(?<![\p{L}])m[ée]sanges?(?![\p{L}])/giu, 'le mot d\'éveil')
101
+ .replace(/(?<![\p{L}])m[eéè]s[\s-]+anges?(?![\p{L}])/giu, 'le mot d\'éveil') /* what sounds like it: « mes anges » woke it (31-10) */
102
+ /* Nor another assistant's call: « OK Google » said in an example woke the Google Home beside it (31-10). */
103
+ .replace(/\b(?:ok|okay|hey|dis)[\s,]+(?:google|siri|alexa)\b/giu, 'l\'appel de l\'enceinte')
101
104
  .replace(/\s+/g, ' ')
102
105
  .trim()
103
106
  .slice(0, 1500);
@@ -529,7 +532,18 @@ export class Boxes {
529
532
  };
530
533
  try {
531
534
  const said = [];
532
- for (const piece of piecesOf(pcm)) said.push(String(await this.#hear(wavOf(piece)) ?? '').trim());
535
+ /* The dictation fails now and then (the network, the engine): tried again by itself, twice, before
536
+ anything is said to the person -- who should not have to repeat (31-10). */
537
+ const hear = async (wav) => {
538
+ for (let attempt = 0; ; attempt++) {
539
+ try { return await this.#hear(wav); } catch (error) {
540
+ if (attempt >= 2 || error?.status === 413 || error?.status === 400) throw error;
541
+ this.#log(`voice box ${box0.name}: dictation failed (${error.message}), tried again`);
542
+ await new Promise((r) => setTimeout(r, 800 * (attempt + 1)));
543
+ }
544
+ }
545
+ };
546
+ for (const piece of piecesOf(pcm)) said.push(String(await hear(wavOf(piece)) ?? '').trim());
533
547
  text = said.filter(Boolean).join(' ');
534
548
  } catch (error) { this.#log(`voice box ${box0.name}: ${seconds} s heard, dictation failed (${error.message})`); await lost('Pardon, la dictée ne répond pas. Tu peux répéter ?'); return; }
535
549
  if (!text) { this.#log(`voice box ${box0.name}: ${seconds} s heard, nothing recognised (silence?)`); await lost("Pardon, je n'ai rien compris. Tu peux répéter ?"); return; }