clavarium 0.2.208-next.1 → 0.2.210-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,19 +1,19 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.208-next.1",
3
+ "version": "0.2.210-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.208-next.1",
9
+ "version": "0.2.210-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
14
  "clavarium-binder": "0.1.43-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
- "clavarium-parley": "0.17.33-next.1",
16
+ "clavarium-parley": "0.17.35-next.1",
17
17
  "clavarium-tether": "0.1.0-next.46",
18
18
  "mermaid": "11.17.2",
19
19
  "node-pty": "^1.1.0",
@@ -747,9 +747,9 @@
747
747
  }
748
748
  },
749
749
  "node_modules/clavarium-parley": {
750
- "version": "0.17.33-next.1",
751
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.33-next.1.tgz",
752
- "integrity": "sha512-pJ+YFWKZgiVvrzRHpsruciTHt5R3tOzo4XbHsEWmCqlXYEKCLWI29TnyR3nJ63X0qM1AJFACfiNl7DDOrXFK5w==",
750
+ "version": "0.17.35-next.1",
751
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.35-next.1.tgz",
752
+ "integrity": "sha512-bUR/1I9ZqEXWJ7SoxPYdkjlOHJ8dnML5A0ZQGfuEOl4YNuB6ULT4PoWqHfj0fVhY2j6BjDLvHJKZJ8WouEGXig==",
753
753
  "license": "MIT",
754
754
  "bin": {
755
755
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.208-next.1",
3
+ "version": "0.2.210-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.",
@@ -46,7 +46,7 @@
46
46
  "@xterm/xterm": "^6.0.0",
47
47
  "clavarium-binder": "0.1.43-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
- "clavarium-parley": "0.17.33-next.1",
49
+ "clavarium-parley": "0.17.35-next.1",
50
50
  "clavarium-tether": "0.1.0-next.46",
51
51
  "mermaid": "11.17.2",
52
52
  "node-pty": "^1.1.0",
package/server/boxes.mjs CHANGED
@@ -135,6 +135,15 @@ export function sentencesOf(text) {
135
135
  export const THINKING_AFTER_MS = 3_500;
136
136
  export const LONGER_AFTER_MS = 12_000;
137
137
  export const THINKING = ['Hmm…', 'Voyons…', 'Hmm, voyons voir…'];
138
+ /* WHY A BOX LISTENED, in a few words beside the message (01-11): what woke it (and the wake word's score), and
139
+ what it cut short. */
140
+ export function whyOf(m) {
141
+ const reason = { wake: 'mot d\'éveil', button: 'bouton', follow: 'suite de la conversation', knock: 'toc-toc' }[m?.reason] ?? (m?.reason ? String(m.reason).slice(0, 30) : 'inconnu');
142
+ const score = Number.isFinite(m?.score) ? ` (${Math.round(m.score * 100)} %)` : '';
143
+ const cut = m?.cut ? ` ; a interrompu ${String(m.cut) === 'its own speech' ? 'sa propre phrase' : 'un son'}` : '';
144
+ return `réveil : ${reason}${score}${cut}`;
145
+ }
146
+
138
147
  export const DOING_WITHIN_MS = 120_000;
139
148
  /* A LONG RECORDING (a meeting, a class): asked in words, stopped by the button or the wake word. */
140
149
  export const RECORD_ASKED = /\b(?:lance|d[ée]marre|commence|d[ée]bute)\w*\b.{0,25}\benregistrement\b|\benregistre\b.{0,20}\b(?:r[ée]union|conversation|cours|discussion|consultation)\b/i;
@@ -557,6 +566,9 @@ export class Boxes {
557
566
  r.out.end(() => { void this.#recorded(link, r); });
558
567
  return;
559
568
  }
569
+ if (m.t === 'event' && m.name === 'wake.own') { this.#log(`voice box ${box.name}: heard its own voice say the wake word, ignored`); return; }
570
+ if (m.t === 'event' && m.name === 'noise.dropped') { this.#log(`voice box ${box.name}: a sound near full scale was cut by its noise guard`); return; }
571
+ if (m.t === 'listen.start') link.why = whyOf(m);
560
572
  if (m.t === 'listen.start') { if (this.stop(box.id)) this.#log(`voice box ${box.name}: stopped playing, someone speaks`); sentence = []; size = 0; return; }
561
573
  if (m.t === 'listen.end' && sentence && m.reason === 'nobody') {
562
574
  /* Listened again, nobody spoke: a conversation ends there, in silence. */
@@ -652,7 +664,7 @@ export class Boxes {
652
664
  link.relay = 0;
653
665
  text = `(réponse entendue de l'appareil, pas de la personne) ${text}`;
654
666
  }
655
- try { await this.#say(box.conversation, text, { id: box.id, name: box.name, ...(box.place ? { place: box.place } : {}) }); } catch (error) { this.#log(`voice box ${box.name}: ${seconds} s heard and dictated, but not said in ${box.conversation} (${error.message})`); await lost("Pardon, je n'ai pas pu transmettre ta phrase. Tu peux répéter ?"); return; }
667
+ try { await this.#say(box.conversation, text, { id: box.id, name: box.name, ...(box.place ? { place: box.place } : {}), ...(link.why ? { why: link.why } : {}) }); } catch (error) { this.#log(`voice box ${box.name}: ${seconds} s heard and dictated, but not said in ${box.conversation} (${error.message})`); await lost("Pardon, je n'ai pas pu transmettre ta phrase. Tu peux répéter ?"); return; }
656
668
  this.#log(`voice box ${box.name}: ${seconds} s heard, said in ${box.conversation}`);
657
669
  link.heardAt = this.#now();
658
670
  this.#waitFor(link, text);