clavarium 0.2.332-next.1 → 0.2.333-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.332-next.1",
3
+ "version": "0.2.333-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.332-next.1",
9
+ "version": "0.2.333-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.332-next.1",
3
+ "version": "0.2.333-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
@@ -46,7 +46,11 @@ export const wakeHeard = (text) => { const t = plainWords(text); return WAKE_HEA
46
46
  export const WAKE_FAINT = 600;
47
47
  /* 06-11: a radio or a TV read a whole news flash after a false wake (120 s, cut by the length limit, no voice measured):
48
48
  a sentence never ended is not someone speaking to the box -- not heard AND cut by the length limit is dropped too. */
49
- export const dropsWake = (ok, voice, reason = '') => !ok && (WAKE_DROP || reason === 'timeout' || (Number.isFinite(voice) && voice > 0 && voice < WAKE_FAINT));
49
+ /* 06-11 (again): the wake's own 1.6 s held no word at all (heard: nothing) -- the word was certainly not said: a radio's
50
+ music or jingle. A real call missed by the check always held words (its sentence begun). */
51
+ /* NOT "a second miss within 10 min": checked against the owner's calls of 05-11, it would have dropped a real one (05:18,
52
+ five minutes after a missed 05:13). A radio that says words after a false wake still comes through; nothing is answered. */
53
+ export const dropsWake = (ok, voice, reason = '', heard = 'x') => !ok && (WAKE_DROP || reason === 'timeout' || !String(heard ?? '').trim() || (Number.isFinite(voice) && voice > 0 && voice < WAKE_FAINT));
50
54
  const plainWords = (t) => String(t).toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-z\s]/g, ' ').replace(/\s+/g, ' ').trim();
51
55
  export const SENTENCE_MAX = 300 * 32_000 + 32_000; /* 5 min of 16 kHz 16-bit mono, and some slack */
52
56
  export const TRIES_PER_MINUTE = 10;
@@ -923,10 +927,10 @@ export class Boxes {
923
927
  /* First in the line: Parley keeps 120 characters of `why`, and the end stats after it can pass that. */
924
928
  link.why = `mot ${check.ok ? '\u2713' : '\u2717'} « ${check.heard.slice(0, 30)} »${link.why ? ` · ${link.why}` : ''}`;
925
929
  this.#log(`voice box ${box.name}: wake word heard again: ${check.ok ? 'yes' : 'NO'} (« ${check.heard.slice(0, 40)} »)`);
926
- if (dropsWake(check.ok, link.voice, link.endReason)) {
930
+ if (dropsWake(check.ok, link.voice, link.endReason, check.heard)) {
927
931
  link.send({ t: 'cue', name: 'done' });
928
- this.#log(`voice box ${box.name}: wake ignored (word not heard again, ${link.endReason === 'timeout' ? 'a sentence that never ended' : `faint voice ${Math.round(link.voice || 0)}`})`);
929
- try { this.#note?.(box.conversation, { kind: 'box-wake-ignored', text: `Wake ignored on ${box.name}: « ${check.heard.slice(0, 40)} », ${link.endReason === 'timeout' ? 'a sound that never stopped (radio, TV)' : 'faint voice'}`, topic: 'Voice box', tone: 'info' }); } catch { /* the log has it */ }
932
+ this.#log(`voice box ${box.name}: wake ignored (word not heard again, ${link.endReason === 'timeout' ? 'a sentence that never ended' : !check.heard.trim() ? 'no word in its clip' : `faint voice ${Math.round(link.voice || 0)}`})`);
933
+ try { this.#note?.(box.conversation, { kind: 'box-wake-ignored', text: `Wake ignored on ${box.name}: « ${check.heard.slice(0, 40)} », ${link.endReason === 'timeout' ? 'a sound that never stopped (radio, TV)' : !check.heard.trim() ? 'no word where the wake word should be' : 'faint voice'}`, topic: 'Voice box', tone: 'info' }); } catch { /* the log has it */ }
930
934
  return;
931
935
  }
932
936
  }