clavarium 0.2.325-next.1 → 0.2.327-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.325-next.1",
3
+ "version": "0.2.327-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.325-next.1",
9
+ "version": "0.2.327-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.60-next.1",
15
15
  "clavarium-docket": "0.1.2-next.2",
16
- "clavarium-parley": "0.17.69-next.1",
16
+ "clavarium-parley": "0.17.70-next.1",
17
17
  "clavarium-tether": "0.1.0-next.49",
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.69-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.69-next.1.tgz",
792
- "integrity": "sha512-NDT/l1J97PKnaNSu1srD+cldqMRRISfzBckwH2odMFaGLTtXnxHSVLifpZxEojwoRU2OPKXuNTQj1ZLLR3oPkg==",
790
+ "version": "0.17.70-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.70-next.1.tgz",
792
+ "integrity": "sha512-DfoNmVWNt32vIXLjtV9Mtvzj6PgIVy+Up4AtJQ5rwtW+4z3988hSYZni4PwRW+yYtZ991WPE8mGg1r6iIvr9/w==",
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.325-next.1",
3
+ "version": "0.2.327-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.60-next.1",
48
48
  "clavarium-docket": "0.1.2-next.2",
49
- "clavarium-parley": "0.17.69-next.1",
49
+ "clavarium-parley": "0.17.70-next.1",
50
50
  "clavarium-tether": "0.1.0-next.49",
51
51
  "mammoth": "1.13.0",
52
52
  "mermaid": "11.17.2",
package/server/boxes.mjs CHANGED
@@ -33,6 +33,18 @@ export const FIRMWARE_MINUTES = 10;
33
33
  export const CLIP_MAX_BYTES = 16_000 * 2 * 3;
34
34
  export const WAKE_HEARD = /\bm[ae]i?s+\s?an?ge?s?\b|\b[ml][ae]s anges?\b|\bmesange|\bmaisange|\bmessage?s?\b|\bmessenge?s?\b/; /* « Messenges »: Whisper's reading of the server's own voice saying it */
35
35
  export const WAKE_DROP = process.env.CLAVARIUM_WAKE_DROP === '1';
36
+ /* THE WORD BY ITS SOUND (05-11): on a lone word, Whisper writes « Mise en jeu », « Les ongles », « Mes doigts »
37
+ for « Mésange » -- 14 of 21 real calls of 05-11 were marked ✗ by the spelling alone. Read by its sound: a first
38
+ word in m/l ending on an s/z sound, then a word in an/en/on (« mise en… », « les ongles », « mes anges »), or
39
+ « mes doigts ». Measured on the 22 real cases of 05-11: 19 of 21 calls heard (11 before), the one talk of
40
+ the room (« Oui, à l'ombre ») not. */
41
+ const WAKE_SOUND = /^(?:\S+ )?[ml](?:a|e|i|ai|ei)(?:s|z|ss|se|ze|sse) (?:a|e|o)n|^m[ae]s doi/;
42
+ export const wakeHeard = (text) => { const t = plainWords(text); return WAKE_HEARD.test(t) || WAKE_SOUND.test(t.replace(/^l /, '')); };
43
+ /* DROPPED IN SILENCE (05-11, the owner's go): a wake whose word is not heard again AND whose voice was faint --
44
+ the room's talk from afar, not someone speaking to the box. Every real call of 05-11 that the word missed
45
+ had a firm voice or none measured; the false wake of 05-11, 429. Said by one discreet line in the thread. */
46
+ export const WAKE_FAINT = 600;
47
+ export const dropsWake = (ok, voice) => !ok && (WAKE_DROP || (Number.isFinite(voice) && voice > 0 && voice < WAKE_FAINT));
36
48
  const plainWords = (t) => String(t).toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-z\s]/g, ' ').replace(/\s+/g, ' ').trim();
37
49
  export const SENTENCE_MAX = 300 * 32_000 + 32_000; /* 5 min of 16 kHz 16-bit mono, and some slack */
38
50
  export const TRIES_PER_MINUTE = 10;
@@ -262,14 +274,14 @@ export function piecesOf(pcm, { least = 8, most = 14 } = {}) {
262
274
 
263
275
  export class Boxes {
264
276
  #file; #codes = new Map(); #links = new Map(); #tries = []; #now;
265
- #exists; #hear; #say; #speak; #log; #changed; #images = new Map(); #origin; #spawn; #fetch; #streams = new Map(); #recordDir; #parts; #keep; #react; #learn;
277
+ #exists; #hear; #say; #note; #speak; #log; #changed; #images = new Map(); #origin; #spawn; #fetch; #streams = new Map(); #recordDir; #parts; #keep; #react; #learn;
266
278
 
267
279
  /* file: a JsonFile holding [{ id, name, conversation, keyHash, firmware, createdAt, seenAt }].
268
280
  exists(conversation), hear(wav) -> text, say(conversation, text, room), speak(text) -> PCM 16 kHz. */
269
- constructor({ file, exists = () => true, hear, say, speak, changed = () => {}, origin = () => null, now = () => Date.now(), log = () => {}, spawn = spawnProcess, fetcher = fetch, recordDir = null, parts = null, keep = null, react = async () => null, learn = null }) {
281
+ constructor({ file, exists = () => true, hear, say, note = null, speak, changed = () => {}, origin = () => null, now = () => Date.now(), log = () => {}, spawn = spawnProcess, fetcher = fetch, recordDir = null, parts = null, keep = null, react = async () => null, learn = null }) {
270
282
  this.#react = react; this.#learn = learn;
271
283
  this.#spawn = spawn; this.#fetch = fetcher; this.#recordDir = recordDir; this.#parts = parts; this.#keep = keep;
272
- this.#file = file; this.#changed = changed; this.#origin = origin; this.#exists = exists; this.#hear = hear; this.#say = say; this.#speak = speak; this.#now = now; this.#log = log;
284
+ this.#file = file; this.#changed = changed; this.#origin = origin; this.#exists = exists; this.#hear = hear; this.#say = say; this.#note = note; this.#speak = speak; this.#now = now; this.#log = log;
273
285
  }
274
286
 
275
287
  #all() { const v = this.#file.get(); return Array.isArray(v) ? v : []; }
@@ -783,6 +795,7 @@ export class Boxes {
783
795
  if (m.t === 'listen.end' && m.ep) {
784
796
  const end = endOf(m.ep, m.reason ?? '');
785
797
  link.why = `${link.why ? `${link.why} · ` : ''}${end}`;
798
+ link.voice = Number(m.ep.voice);
786
799
  this.#log(`voice box ${box.name}: ${end}`);
787
800
  }
788
801
  if (m.t === 'listen.end' && sentence) {
@@ -846,7 +859,7 @@ export class Boxes {
846
859
  async #checkWake(link, pcm, { score = null, near = false } = {}) {
847
860
  if (pcm.length < 8_000) return null;
848
861
  const heard = String(await this.#hear(wavOf(pcm), link.box().lang) ?? '').trim();
849
- const ok = WAKE_HEARD.test(plainWords(heard));
862
+ const ok = wakeHeard(heard);
850
863
  /* Counted, and kept when the box learns (the clip only: never the sentence), with the box's score. */
851
864
  const box = link.box();
852
865
  try { this.#learn?.checked(box.id, pcm, ok, { keep: box.wake === 'learn', heard, score, near }); } catch (error) { this.#log(`voice box ${box.name}: wake clip not kept (${error.message})`); }
@@ -906,7 +919,12 @@ export class Boxes {
906
919
  /* First in the line: Parley keeps 120 characters of `why`, and the end stats after it can pass that. */
907
920
  link.why = `mot ${check.ok ? '\u2713' : '\u2717'} « ${check.heard.slice(0, 30)} »${link.why ? ` · ${link.why}` : ''}`;
908
921
  this.#log(`voice box ${box.name}: wake word heard again: ${check.ok ? 'yes' : 'NO'} (« ${check.heard.slice(0, 40)} »)`);
909
- if (!check.ok && WAKE_DROP) { link.send({ t: 'cue', name: 'done' }); return; }
922
+ if (dropsWake(check.ok, link.voice)) {
923
+ link.send({ t: 'cue', name: 'done' });
924
+ this.#log(`voice box ${box.name}: wake ignored (word not heard again, faint voice ${Math.round(link.voice || 0)})`);
925
+ try { this.#note?.(box.conversation, { kind: 'box-wake-ignored', text: `Wake ignored on ${box.name}: « ${check.heard.slice(0, 40)} », faint voice`, topic: 'Voice box', tone: 'info' }); } catch { /* the log has it */ }
926
+ return;
927
+ }
910
928
  }
911
929
  /* Only a short order starts a recording ("lance l'enregistrement de la réunion"): a sentence that merely
912
930
  mentions recording does not (01-11). */
@@ -15,15 +15,17 @@
15
15
  export const HOLD_S = 5;
16
16
  const KINDS = new Set(['mail', 'calendar', 'contacts', 'files', 'terminal', 'browser', 'screen', 'device']);
17
17
 
18
- const hhmm = (when) => /[T ](\d{2}:\d{2})/.exec(String(when ?? ''))?.[1] ?? '';
19
- const dayWords = (when) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(when ?? '')); return m ? new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], 12)).toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short', timeZone: 'UTC' }) : String(when ?? ''); };
20
- const span = (from, to) => [hhmm(from), hhmm(to)].filter(Boolean).join('–');
21
- const whenWords = (from, to) => [dayWords(from), span(from, to)].filter(Boolean).join(' · ');
18
+ /* EACH TEXT A WORD AND ITS VALUES ({k, v}), said by each screen in its own language (Parley's
19
+ * dictionary, the req-* words): the interface language may be each device's, so none is chosen
20
+ * here. Data stays as it is (subjects, addresses, names, paths); a day and time is {at, end} (ISO),
21
+ * written by the screen the locale's way; a count picks its word, one or several. */
22
+ const w = (k, v) => (v ? { k, v } : { k });
23
+ const count = (n, key) => w(n === 1 ? `${key}-one` : key, { count: n });
24
+ const when = (at, end) => (/^\d{4}-\d{2}-\d{2}/.test(String(at ?? '')) ? { at: String(at), ...(end ? { end: String(end) } : {}) } : String(at ?? ''));
22
25
  const nameOfAddr = (a) => { const m = /^\s*"?([^"<]*?)"?\s*<([^>]+)>/.exec(String(a ?? '')); return m && m[1] ? m[1] : String(a ?? '').split('@')[0]; };
23
- const subj = (s) => (s ? `“${s}”` : 'a message');
24
- const sizeOf = (kb) => (kb >= 1024 ? `${(kb / 1024).toFixed(1)} MB` : `${kb} KB`);
25
- const filesLine = (files) => (files?.length ? files.map((f) => `${f.name}${f.kb ? ` (${sizeOf(f.kb)})` : ''}`).join(', ') : '');
26
- const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
26
+ const quoted = (s, none) => (s ? w('req-quoted', { text: String(s) }) : w(none));
27
+ const sizeOf = (kb) => (kb >= 1024 ? w('req-size-mb', { n: Math.round((kb / 1024) * 10) / 10 }) : w('req-size-kb', { n: kb }));
28
+ const filesLine = (files) => ({ list: (files ?? []).map((f) => (f.kb ? w('req-file-size', { name: String(f.name), size: sizeOf(f.kb) }) : String(f.name))) });
27
29
  /* Whom: the first, and how many more. */
28
30
  const whom = (list) => (list.length ? `${list[0]}${list.length > 1 ? ` +${list.length - 1}` : ''}` : '');
29
31
  /* The body as it will read: the Markdown marks taken off. */
@@ -36,95 +38,100 @@ export function demandeView(q) {
36
38
  const own = String(c.self ?? '').split('@')[1] ?? '';
37
39
  const outside = (list) => (own ? (list ?? []).filter((x) => !String(x).toLowerCase().endsWith(`@${own}`)) : []);
38
40
  const chips = (list, ext = []) => (list ?? []).map((x) => ({ text: String(x), ...(ext.includes(x) ? { ext: true } : {}) }));
41
+ const fact = (key, value) => [w(`req-fact-${key}`), value];
39
42
  const where = q?.target?.title ?? '';
40
- const v = { kind, title: '', sub: '', risk: [], facts: [], irreversible: false, yes: 'Accept' };
43
+ const v = { kind, title: '', risk: [], facts: [], irreversible: false, yes: 'accept' };
41
44
  const sub = [];
45
+ const raw = (action) => `${action} ${q?.detail ?? ''}`.trim();
42
46
  if (c.kind === 'mail') {
43
47
  const recipients = [...(c.to ?? []), ...(c.cc ?? []), ...(c.bcc ?? [])];
44
48
  const ext = outside(recipients);
45
49
  const sending = ['send', 'reply', 'forward'].includes(c.action);
46
- if (sending && ext.length) v.risk.push('Goes outside your domain');
47
- const sendWord = c.draft ? 'Save draft' : c.at ? 'Schedule' : 'Send';
50
+ if (sending && ext.length) v.risk.push(w('req-risk-outside'));
51
+ const sendWord = c.draft ? 'save-draft' : c.at ? 'schedule' : 'send';
48
52
  const to = whom(c.to ?? []);
49
- if (c.action === 'send') { v.title = c.draft ? `Draft ${subj(c.subject)}${to ? ` to ${to}` : ''}` : `${sendWord} ${subj(c.subject)}${to ? ` to ${to}` : ''}`; v.yes = sendWord; }
50
- else if (c.action === 'reply') { v.title = `${c.all ? 'Reply to all on' : 'Reply to'} ${about.from ? nameOfAddr(about.from) : 'a message'}${about.subject ? ` on “${about.subject}”` : ''}`; v.yes = sendWord; }
53
+ const subject = quoted(c.subject, 'req-a-message');
54
+ const aboutSubject = quoted(about.subject, 'req-a-message');
55
+ if (c.action === 'send') { const verb = c.draft ? 'draft' : c.at ? 'schedule' : 'send'; v.title = w(`req-mail-${verb}${to ? '-to' : ''}`, { subject, ...(to ? { to } : {}) }); v.yes = sendWord; }
56
+ else if (c.action === 'reply') { v.title = w(`req-mail-reply${c.all ? '-all' : ''}${about.subject ? '-on' : ''}`, { who: about.from ? nameOfAddr(about.from) : w('req-a-message'), ...(about.subject ? { subject: quoted(about.subject) } : {}) }); v.yes = sendWord; }
51
57
  else if (c.action === 'forward') {
52
- v.title = `Forward ${subj(about.subject)}${to ? ` to ${to}` : ''}`; v.yes = c.draft ? 'Save draft' : 'Forward';
58
+ v.title = w(`req-mail-forward${to ? '-to' : ''}`, { subject: aboutSubject, ...(to ? { to } : {}) }); v.yes = c.draft ? 'save-draft' : 'forward';
53
59
  const k = String(c.keep ?? 'all').toLowerCase();
54
- v.facts.push(['Keeps', /^(none|false|no)$/.test(k) ? 'without its files' : /^(all|true|yes|)$/.test(k) ? (about.files?.length ? filesLine(about.files) : 'its files') : String(c.keep)]);
55
- } else if (c.action === 'move') { v.title = `Move ${subj(about.subject)} to ${c.mailbox ?? 'a folder'}`; v.yes = 'Move'; }
56
- else if (c.action === 'flag') { v.title = `Mark ${subj(about.subject)} ${c.flag ?? ''}`.trim(); v.yes = 'Mark'; }
57
- else if (c.action === 'delete') { v.title = `Delete ${subj(about.subject)}`; v.yes = 'Delete'; v.irreversible = true; }
58
- else v.title = `${c.action ?? 'mail'} ${q?.detail ?? ''}`.trim();
60
+ v.facts.push(fact('keeps', /^(none|false|no)$/.test(k) ? w('req-keeps-none') : /^(all|true|yes|)$/.test(k) ? (about.files?.length ? filesLine(about.files) : w('req-keeps-files')) : String(c.keep)));
61
+ } else if (c.action === 'move') { v.title = w('req-mail-move', { subject: aboutSubject, folder: c.mailbox ?? w('req-a-folder') }); v.yes = 'move'; }
62
+ else if (c.action === 'flag') { v.title = w('req-mail-flag', { subject: aboutSubject, flag: String(c.flag ?? '') }); v.yes = 'mark'; }
63
+ else if (c.action === 'delete') { v.title = w('req-mail-delete', { subject: aboutSubject }); v.yes = 'delete'; v.irreversible = true; }
64
+ else v.title = raw(c.action ?? 'mail');
59
65
  if (sending && !c.draft && ext.length) v.irreversible = true;
60
- if (about.from && c.action !== 'reply') v.facts.push(['From', String(about.from)]);
61
- if (about.date && !sending) v.facts.push(['Date', String(about.date)]);
62
- if (c.to?.length) v.facts.push(['To', chips(c.to, ext)]);
63
- if (c.cc?.length) v.facts.push(['Cc', chips(c.cc, ext)]);
64
- if (c.bcc?.length) v.facts.push(['Bcc', chips(c.bcc, ext)]);
65
- if (c.files?.length) v.facts.push(['Joined', filesLine(c.files)]);
66
- if (c.at) v.facts.push(['Leaves', `${whenWords(c.at)} (waits in Drafts)`]);
66
+ if (about.from && c.action !== 'reply') v.facts.push(fact('from', String(about.from)));
67
+ if (about.date && !sending) v.facts.push(fact('date', when(about.date)));
68
+ if (c.to?.length) v.facts.push(fact('to', chips(c.to, ext)));
69
+ if (c.cc?.length) v.facts.push(fact('cc', chips(c.cc, ext)));
70
+ if (c.bcc?.length) v.facts.push(fact('bcc', chips(c.bcc, ext)));
71
+ if (c.files?.length) v.facts.push(fact('joined', filesLine(c.files)));
72
+ if (c.at) v.facts.push(fact('leaves', w('req-leaves', { when: when(c.at) })));
67
73
  if (where) sub.push(where);
68
- if (c.body) { const lines = String(c.body).split('\n').length; sub.push(plural(lines, 'line')); v.quote = plain(c.body); }
69
- if (c.files?.length) sub.push(plural(c.files.length, 'attachment'));
74
+ if (c.body) { sub.push(count(String(c.body).split('\n').length, 'req-lines')); v.quote = plain(c.body); }
75
+ if (c.files?.length) sub.push(count(c.files.length, 'req-attachments'));
70
76
  } else if (c.kind === 'calendar') {
71
- const answer = { accept: 'Accept', yes: 'Accept', decline: 'Decline', no: 'Decline', refuse: 'Decline', tentative: 'Maybe', maybe: 'Maybe' }[String(c.answer ?? '').toLowerCase()] ?? '';
77
+ const answer = { accept: 'accept', yes: 'accept', decline: 'decline', no: 'decline', refuse: 'decline', tentative: 'maybe', maybe: 'maybe' }[String(c.answer ?? '').toLowerCase()] ?? '';
72
78
  const was = c.action === 'create' ? null : about;
73
79
  const ev = c.action === 'create' ? c : { ...about, ...Object.fromEntries(Object.entries(c).filter(([k]) => ['title', 'start', 'end', 'where'].includes(k))) };
74
- const name = was?.title || c.title || 'an event';
80
+ const name = quoted(was?.title || c.title, 'req-an-event');
75
81
  const guests = c.action === 'create' || c.action === 'update' ? (c.with?.length ? c.with : (about.attendees ?? [])) : (about.attendees ?? []);
76
82
  const ext = outside(c.with ?? []);
77
- if (c.action === 'respond') v.title = `${answer || 'Answer'} “${about.title || 'an invitation'}”${about.start ? ` (${whenWords(about.start, about.end)})` : ''}`;
78
- else if (c.action === 'create') v.title = `Create “${c.title ?? 'New event'}”${c.start ? ` ${whenWords(c.start, c.end)}` : ''}`;
79
- else if (c.action === 'delete') v.title = `Delete “${name}”${about.start ? ` (${whenWords(about.start, about.end)})` : ''}`;
80
- else if (c.action === 'update') v.title = (c.start && c.start !== about.start) ? `Move “${name}” to ${whenWords(c.start, c.end ?? about.end)}` : `Change “${name}”`;
81
- else if (c.action === 'attach') v.title = `Attach ${filesLine(c.files)} to “${name}”`;
82
- else v.title = `${c.action ?? 'calendar'} ${q?.detail ?? ''}`.trim();
83
+ if (c.action === 'respond') v.title = w(`req-cal-respond${about.start ? '-when' : ''}`, { answer: w(`req-yes-${answer || 'answer'}`), name: quoted(about.title, 'req-an-invitation'), ...(about.start ? { when: when(about.start, about.end) } : {}) });
84
+ else if (c.action === 'create') v.title = w(`req-cal-create${c.start ? '-when' : ''}`, { name: c.title ? quoted(c.title) : w('req-new-event'), ...(c.start ? { when: when(c.start, c.end) } : {}) });
85
+ else if (c.action === 'delete') v.title = w(`req-cal-delete${about.start ? '-when' : ''}`, { name, ...(about.start ? { when: when(about.start, about.end) } : {}) });
86
+ else if (c.action === 'update') v.title = (c.start && c.start !== about.start) ? w('req-cal-move', { name, when: when(c.start, c.end ?? about.end) }) : w('req-cal-change', { name });
87
+ else if (c.action === 'attach') v.title = w('req-cal-attach', { files: filesLine(c.files), name });
88
+ else v.title = raw(c.action ?? 'calendar');
83
89
  /* Before -> after: what changes of a change, and the event itself otherwise. */
84
90
  if (c.action === 'update' && was?.start) {
85
- v.before = [whenWords(was.start, was.end), was.where].filter(Boolean);
86
- v.after = [whenWords(ev.start, ev.end), ev.where].filter(Boolean);
87
- sub.push(`was ${whenWords(was.start, was.end)}`);
88
- } else if (ev.start) { if (c.action !== 'respond' && c.action !== 'delete' && c.action !== 'create') sub.push(whenWords(ev.start, ev.end)); if (ev.where) v.facts.push(['Where', String(ev.where)]); }
89
- if (guests.length && ['update', 'delete'].includes(c.action)) { sub.push(`${plural(guests.length, 'guest')} told`); v.irreversible = true; }
90
- if (about.clashes?.length) v.risk.push(`Clashes with ${about.clashes.join(', ')}`);
91
- if (ext.length) v.risk.push('Invites someone outside your domain');
92
- if (about.organizer && c.action === 'respond') v.facts.push(['From', String(about.organizer)]);
93
- if (guests.length) v.facts.push(['Guests', chips(guests, ext)]);
94
- if (c.online === 'teams' || (c.action === 'create' && (c.with ?? []).length && !c.online)) v.facts.push(['Online', 'Teams meeting']);
91
+ v.before = [when(was.start, was.end), was.where].filter(Boolean);
92
+ v.after = [when(ev.start, ev.end), ev.where].filter(Boolean);
93
+ sub.push(w('req-was', { when: when(was.start, was.end) }));
94
+ } else if (ev.start) { if (c.action !== 'respond' && c.action !== 'delete' && c.action !== 'create') sub.push(when(ev.start, ev.end)); if (ev.where) v.facts.push(fact('where', String(ev.where))); }
95
+ if (guests.length && ['update', 'delete'].includes(c.action)) { sub.push(count(guests.length, 'req-guests-told')); v.irreversible = true; }
96
+ if (about.clashes?.length) v.risk.push(w('req-risk-clash', { what: { list: about.clashes.map(String) } }));
97
+ if (ext.length) v.risk.push(w('req-risk-invites-outside'));
98
+ if (about.organizer && c.action === 'respond') v.facts.push(fact('from', String(about.organizer)));
99
+ if (guests.length) v.facts.push(fact('guests', chips(guests, ext)));
100
+ if (c.online === 'teams' || (c.action === 'create' && (c.with ?? []).length && !c.online)) v.facts.push(fact('online', w('req-teams')));
95
101
  if (where) sub.unshift(where);
96
102
  if (c.notes) v.quote = String(c.notes);
97
- v.yes = c.action === 'respond' ? (answer || 'Answer') : c.action === 'create' ? ((c.with ?? []).length ? 'Create and invite' : 'Create') : c.action === 'delete' ? 'Delete' : c.action === 'update' ? (v.before ? 'Move' : 'Change') : 'Accept';
103
+ v.yes = c.action === 'respond' ? (answer || 'answer') : c.action === 'create' ? ((c.with ?? []).length ? 'create-invite' : 'create') : c.action === 'delete' ? 'delete' : c.action === 'update' ? (v.before ? 'move' : 'change') : 'accept';
98
104
  if (c.action === 'delete') v.irreversible = true;
99
105
  } else if (c.kind === 'contacts') {
100
- v.title = c.action === 'create' ? `Add ${c.name || c.email || 'a contact'}` : c.action === 'update' ? `Update ${c.name || 'a contact'}` : c.action === 'delete' ? `Delete ${c.name || 'a contact'}` : c.action === 'attach' ? `Set ${c.name ? `${c.name}'s` : 'a contact\'s'} photo` : `${c.action ?? 'contacts'} ${q?.detail ?? ''}`.trim();
101
- if (c.name && c.action !== 'create') v.facts.push(['Name', String(c.name)]);
102
- if (c.email) v.facts.push(['Email', String(c.email)]);
103
- if (c.phone) v.facts.push(['Phone', String(c.phone)]);
106
+ const who = (x) => (x ? String(x) : w('req-a-contact'));
107
+ v.title = c.action === 'create' ? w('req-contact-add', { who: who(c.name || c.email) }) : c.action === 'update' ? w('req-contact-update', { who: who(c.name) }) : c.action === 'delete' ? w('req-contact-delete', { who: who(c.name) }) : c.action === 'attach' ? w('req-contact-photo', { who: who(c.name) }) : raw(c.action ?? 'contacts');
108
+ if (c.name && c.action !== 'create') v.facts.push(fact('name', String(c.name)));
109
+ if (c.email) v.facts.push(fact('email', String(c.email)));
110
+ if (c.phone) v.facts.push(fact('phone', String(c.phone)));
104
111
  if (where) sub.push(where);
105
112
  if (c.email && c.action === 'create') sub.push(String(c.email));
106
- v.yes = c.action === 'create' ? 'Add' : c.action === 'delete' ? 'Delete' : 'Update';
113
+ v.yes = c.action === 'create' ? 'add' : c.action === 'delete' ? 'delete' : 'update';
107
114
  if (c.action === 'delete') v.irreversible = true;
108
115
  } else if (c.kind === 'terminal') {
109
- const on = where || 'a machine';
110
- v.title = c.action === 'run' ? `Run a command on ${on}` : c.action === 'type' ? `Type into a terminal on ${on}` : `Open a terminal on ${on}`;
111
- if (/^\s*sudo\b/.test(c.command ?? '')) v.risk.push('As administrator');
116
+ const on = where || w('req-a-machine');
117
+ v.title = w(c.action === 'run' ? 'req-term-run' : c.action === 'type' ? 'req-term-type' : 'req-term-open', { on });
118
+ if (/^\s*sudo\b/.test(c.command ?? '')) v.risk.push(w('req-risk-admin'));
112
119
  if (c.command || c.text) { v.code = String(c.command ?? c.text); sub.push(v.code.split('\n')[0].slice(0, 60)); }
113
- v.yes = c.action === 'run' ? 'Run' : c.action === 'type' ? 'Type' : 'Open';
120
+ v.yes = c.action === 'run' ? 'run' : c.action === 'type' ? 'type' : 'open';
114
121
  if (c.action === 'run') v.irreversible = true;
115
122
  } else if (c.kind === 'files') {
116
- v.title = c.action === 'write' ? `Write ${c.path}` : c.action === 'delete' ? `Delete ${c.path}` : c.action === 'move' ? `Move ${c.from} → ${c.to}` : `${c.action ?? 'files'} ${c.path ?? ''}`.trim();
123
+ v.title = c.action === 'write' ? w('req-files-write', { path: String(c.path) }) : c.action === 'delete' ? w('req-files-delete', { path: String(c.path) }) : c.action === 'move' ? w('req-files-move', { from: String(c.from), to: String(c.to) }) : `${c.action ?? 'files'} ${c.path ?? ''}`.trim();
117
124
  if (where) sub.push(where);
118
- if (c.bytes !== undefined) { const size = c.bytes >= 1024 ? `${Math.round(c.bytes / 1024)} KB` : `${c.bytes} bytes`; sub.push(size); v.facts.push(['Size', size]); }
125
+ if (c.bytes !== undefined) { const size = c.bytes >= 1024 ? w('req-size-kb', { n: Math.round(c.bytes / 1024) }) : w('req-size-bytes', { n: c.bytes }); sub.push(size); v.facts.push(fact('size', size)); }
119
126
  if (c.action === 'move') { v.before = [String(c.from ?? '')]; v.after = [String(c.to ?? '')]; }
120
- else if (c.path) v.facts.push(['Path', String(c.path)]);
121
- v.yes = c.action === 'delete' ? 'Delete' : c.action === 'move' ? 'Move' : 'Write';
122
- if (c.action === 'delete') { v.irreversible = true; v.risk.push('Cannot be undone'); }
123
- } else if (c.kind === 'browser' && c.action === 'open') { v.title = `Open ${c.url}`; v.yes = 'Open'; if (where) sub.push(where); }
127
+ else if (c.path) v.facts.push(fact('path', String(c.path)));
128
+ v.yes = c.action === 'delete' ? 'delete' : c.action === 'move' ? 'move' : 'write';
129
+ if (c.action === 'delete') { v.irreversible = true; v.risk.push(w('req-risk-final')); }
130
+ } else if (c.kind === 'browser' && c.action === 'open') { v.title = w('req-browser-open', { url: String(c.url) }); v.yes = 'open'; if (where) sub.push(where); }
124
131
  else { v.title = `${q?.verb ?? 'action'}${q?.detail ? ` ${q.detail}` : ''}`; if (where) sub.push(where); }
125
132
  const id = String(q?.id ?? '');
126
133
  return {
127
- kind, title: v.title || String(q?.verb ?? 'A request'), sub: sub.filter(Boolean).slice(0, 3).join(' · '),
134
+ kind, title: v.title || (q?.verb ? String(q.verb) : w('req-a-request')), sub: sub.filter(Boolean).slice(0, 3),
128
135
  ...(v.risk.length ? { risk: v.risk } : {}), ...(v.facts.length ? { facts: v.facts } : {}),
129
136
  ...(v.before ? { before: v.before, after: v.after } : {}),
130
137
  ...(v.quote ? { quote: v.quote } : {}), ...(v.code ? { code: v.code } : {}),
@@ -132,9 +139,9 @@ export function demandeView(q) {
132
139
  /* The technical line, in "See all" only. */
133
140
  detail: [q?.verb, q?.detail].filter(Boolean).join(' — '),
134
141
  irreversible: v.irreversible,
135
- yes: { id: `allow:${id}`, label: v.yes }, no: { id: `deny:${id}`, label: 'Refuse' },
142
+ yes: { id: `allow:${id}`, label: w(`req-yes-${v.yes}`) }, no: { id: `deny:${id}`, label: w('req-no') },
136
143
  /* "Always allow ...": behind "⋯", as before. */
137
- ...(q?.rule ? { others: [{ id: `always:${id}`, label: `Always allow ${q.rule.value ?? 'this'}` }] } : {}),
144
+ ...(q?.rule ? { others: [{ id: `always:${id}`, label: q.rule.value ? w('req-always', { what: String(q.rule.value) }) : w('req-always-this') }] } : {}),
138
145
  hold: HOLD_S,
139
146
  };
140
147
  }
package/server/main.mjs CHANGED
@@ -658,6 +658,8 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
658
658
  hear: (wav, lang) => hearBox(voice, wav, lang), /* any language heard; one neither the box's (its page's) nor English heard again in the box's (voice.mjs) */
659
659
  /* Said as the person's own message, the room named (one speaker for now). */
660
660
  say: (name, text, by) => (/^room:/.test(name) ? rooms.say(name.slice(5), text, { box: by?.id }) : talk.say(name, text, undefined, undefined, 'voice', { by })),
661
+ /* A discreet line in the thread, never a message to the agent: a wake ignored (05-11). A room: the log only. */
662
+ note: (name, event) => (/^room:/.test(name) ? null : talk.event(name, event)),
661
663
  /* Each conversation's thread knows its boxes: their names, and the ids its agent answers. */
662
664
  origin: () => publicOrigin ?? null,
663
665
  changed: () => { try { rooms?.boxesBound(boxes.all()); } catch (error) { console.error(`voice boxes in rooms: ${error.message}`); } for (const c of all.list()) talk.speakers(c.name, boxes.speakersOf(c.name)); try { syncTargets(tethers.store(), boxes.all()); } catch (error) { console.error(`voice boxes in Tether: ${error.message}`); } },
package/web/app.js CHANGED
@@ -4825,7 +4825,7 @@
4825
4825
  cardSteps ??= P.stepper({ open: (name, close) => nav.over(`demande-${name}`, () => close(), { stack: true }), closed: (step) => { if (step) nav.drop(step); } });
4826
4826
  for (const q of approvals) {
4827
4827
  if (!q.view) continue;
4828
- const view = withWho && q.agent?.name ? { ...q.view, sub: [q.agent.name, q.view.sub].filter(Boolean).join(' · ') } : q.view;
4828
+ const view = withWho && q.agent?.name ? { ...q.view, sub: [q.agent.name, ...(Array.isArray(q.view.sub) ? q.view.sub : [q.view.sub])].filter(Boolean) } : q.view;
4829
4829
  box.append(P.requestCard(view, { act, words, steps: cardSteps, host: document.body }));
4830
4830
  }
4831
4831
  });