clavarium 0.2.277-next.1 → 0.2.278-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.277-next.1",
3
+ "version": "0.2.278-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.277-next.1",
9
+ "version": "0.2.278-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.58-next.1",
15
15
  "clavarium-docket": "0.1.2-next.2",
16
- "clavarium-parley": "0.17.48-next.1",
16
+ "clavarium-parley": "0.17.50-next.1",
17
17
  "clavarium-tether": "0.1.0-next.48",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
@@ -787,9 +787,9 @@
787
787
  }
788
788
  },
789
789
  "node_modules/clavarium-parley": {
790
- "version": "0.17.48-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.48-next.1.tgz",
792
- "integrity": "sha512-uw54NOmohbR136kl6Ewdt25VHHG4/E9N1JPCli8QKVPG0SXT3/VU0URMukRjQD1s41zK4CucSqPu/Bui8/NLSw==",
790
+ "version": "0.17.50-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.50-next.1.tgz",
792
+ "integrity": "sha512-0IcZLJ4uWqY393Zi7XEkIMzDHZsyCMw3ti9voB6nIuqzDBtsUf9Dy/wMT7y5kFBnU9cRZZqNMhoZNexOVnccBQ==",
793
793
  "license": "MIT",
794
794
  "bin": {
795
795
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.277-next.1",
3
+ "version": "0.2.278-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.58-next.1",
48
48
  "clavarium-docket": "0.1.2-next.2",
49
- "clavarium-parley": "0.17.48-next.1",
49
+ "clavarium-parley": "0.17.50-next.1",
50
50
  "clavarium-tether": "0.1.0-next.48",
51
51
  "mammoth": "1.13.0",
52
52
  "mermaid": "11.17.2",
package/server/boxes.mjs CHANGED
@@ -180,6 +180,8 @@ export function soundOf(pcm) {
180
180
  }
181
181
 
182
182
  export const DOING_WITHIN_MS = 120_000;
183
+ export const CHAT_IN = /\b(?:mode conversation|on discute|discutons|let'?s (?:talk|chat))\b/i;
184
+ export const CHAT_OUT = /\b(?:merci,? c'est tout|c'est tout pour (?:moi|l'instant)|(?:fin|arr[eê]te|stop)\w*\b.{0,20}\b(?:conversation|[ée]couter)|that'?s all)\b/i;
183
185
  export const TEST_SOUND = 'Test du son. Un, deux, trois. Si tu m\'entends, le son marche.';
184
186
  export const TEST_MIC = 'Test du micro. Parle-moi, je t\'écoute.';
185
187
  export const TEST_MIC_MS = 45_000;
@@ -566,10 +568,11 @@ export class Boxes {
566
568
  const answering = l.heardAt && this.#now() - l.heardAt < ANSWER_WITHIN_MS;
567
569
  const chatting = !doing && answering && this.#chatting(l);
568
570
  const opening = chatting && !l.chat;
571
+ if (chatting && !l.chat) l.send({ t: 'chat', on: true });
569
572
  if (chatting) l.chat = true;
570
573
  /* SENTENCE BY SENTENCE: the first is said while the next ones are made -- the answer starts sooner
571
574
  (31-10: a few seconds of silence before each answer). The box queues them, one after the other. */
572
- const parts = sentencesOf(opening ? `Je passe en mode conversation : je reste à l'écoute. ${words}` : words);
575
+ const parts = sentencesOf(opening ? `On discute. ${words}` : words);
573
576
  let next = this.#speak(parts[0]);
574
577
  for (const [i, part] of parts.entries()) {
575
578
  let pcm;
@@ -662,7 +665,7 @@ export class Boxes {
662
665
  /* Listened again, nobody spoke: a conversation ends there, in silence. */
663
666
  sentence = null;
664
667
  if (this.#tested(link, 'nothing')) { link.send({ t: 'cue', name: 'done' }); return; }
665
- if (link.chat) this.#log(`voice box ${box.name}: conversation ended, nobody answered`);
668
+ if (link.chat) { this.#log(`voice box ${box.name}: conversation ended, nobody answered`); link.send({ t: 'chat', on: false }); }
666
669
  link.chat = false; link.recent = [];
667
670
  link.send({ t: 'cue', name: 'done' });
668
671
  return;
@@ -773,13 +776,15 @@ export class Boxes {
773
776
  link.relay = 0;
774
777
  text = `(réponse entendue de l'appareil, pas de la personne) ${text}`;
775
778
  }
776
- try { await this.#say(box.conversation, text, { id: box.id, name: box.name, ...(box.place ? { place: box.place } : {}), why: `${link.why ? `${link.why} · ` : ''}${soundOf(pcm)}` }); } 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; }
779
+ try { await this.#say(box.conversation, text, { id: box.id, name: box.name, ...(box.place ? { place: box.place } : {}), why: `${(link.chat || CHAT_IN.test(text)) && !CHAT_OUT.test(text) ? 'en conversation : réponse courte, parlée · ' : ''}${link.why ? `${link.why} · ` : ''}${soundOf(pcm)}` }); } 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; }
777
780
  this.#log(`voice box ${box.name}: ${seconds} s heard, said in ${box.conversation}`);
778
781
  link.heardAt = this.#now();
779
782
  if (WAITING_WORDS) this.#waitFor(link, text);
780
783
  link.recent = [...(link.recent ?? []), link.heardAt];
781
- if (/\bmode conversation\b/i.test(text)) link.chat = true;
782
- if (/\b(?:fin|arr[eê]te|stop)\w*\b.{0,20}\b(?:conversation|[ée]couter)\b/i.test(text)) { link.chat = false; link.recent = []; }
784
+ /* CONVERSATION MODE (03-11, as he set it): in by « on discute » (or « mode conversation »), out by « merci,
785
+ c'est tout » (or « fin de la conversation »), or by nobody speaking after an answer. */
786
+ if (CHAT_IN.test(text) && !link.chat) { link.chat = true; link.send({ t: 'chat', on: true }); } /* its ring, its chime (0.1.46) */
787
+ if (CHAT_OUT.test(text) && link.chat) { link.chat = false; link.recent = []; link.send({ t: 'chat', on: false }); }
783
788
  link.doingSaid = false;
784
789
  }
785
790