clavarium 0.2.326-next.1 → 0.2.328-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.326-next.1",
3
+ "version": "0.2.328-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.326-next.1",
9
+ "version": "0.2.328-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.326-next.1",
3
+ "version": "0.2.328-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/api.mjs CHANGED
@@ -603,7 +603,13 @@ export async function handleApi(request, response, conversations, headers, resou
603
603
  if (renaming && secrets) { const done = secrets.rename(renaming[1], String(body.name ?? '').trim()); await redeliver(String(body.name ?? '').trim()); return send(200, done), true; }
604
604
  /* A new value (never sent back) and/or a new expiry, in place. */
605
605
  const replacing = /^\/api\/secrets\/([A-Z][A-Z0-9_]{0,39})\/replace$/.exec(pathname);
606
- if (replacing && secrets) { const done = secrets.replace(replacing[1], { value: body.value, expires: body.expires }); await redeliver(replacing[1]); return send(200, done), true; }
606
+ if (replacing && secrets) {
607
+ const done = secrets.replace(replacing[1], { value: body.value, expires: body.expires });
608
+ await redeliver(replacing[1]);
609
+ /* Its new value is in each machine's /run/secrets now; their tools are told again what that means (guide.mjs). */
610
+ for (const c of conversations.list()) if (secrets.of(c.name).includes(replacing[1])) void guide?.changed(c.name).catch(() => {});
611
+ return send(200, done), true;
612
+ }
607
613
  const dropped = /^\/api\/secrets\/([A-Z][A-Z0-9_]{0,39})\/remove$/.exec(pathname);
608
614
  if (dropped && secrets) { secrets.remove(dropped[1]); return send(200, { ok: true }), true; }
609
615
  if (pathname === '/api/alerts' && alerts) return send(201, alerts.add(body.subscription, body.label)), true;
@@ -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/guide.mjs CHANGED
@@ -130,7 +130,7 @@ export function ownText({ name, tool, workKept, resources = [], chat, online, se
130
130
  /* Its binder of batches is shown beside the chat (web/app.js): the person ticks there. */
131
131
  if (chat) out.push('- When you work in batches: keep them in a binder of batches, shown beside the chat. None yet: make it once (binder new batches; MCP: new-list, template batches). Then one card each (binder add Batches "title"), kept up to date; start only those the person ticked.');
132
132
  out.push(online === false ? '- Internet: off.' : '- Internet: on.');
133
- if (secrets.length) out.push(`- Secrets given, by name only: ${list(secrets.map((s) => plain(s, 40)))}.`);
133
+ if (secrets.length) out.push(`- Secrets given, by name only: ${list(secrets.map((s) => plain(s, 40)))}. Each value is the file /run/secrets/NAME, always the current one (updated within a minute when the person changes it); the variable $NAME holds the value your tool started with -- read the file when you use a key, so a key the person replaced works at once.`);
134
134
  /* A secret pasted in the chat is lifted out (talk.mjs, secret-scan.mjs): the message shows a marker, the value waits in /run/secrets. */
135
135
  if (chat) out.push('- A secret the person pastes in the chat is kept OUT of it: the message shows ⟨secret:NAME⟩ and the value waits at /run/secrets/NAME for a few minutes. Use it only from there, inside a command (clv-run, or $(cat /run/secrets/NAME)); never write its value back into the chat. It clears itself when its time runs out, or at once with `parley forget NAME` when you are done.');
136
136
  const own = lines.map((l) => plain(l)).filter(Boolean).slice(0, LINES_MAX);
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
  });