clavarium 0.2.136-beta.1 → 0.2.137-beta.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.136-beta.1",
3
+ "version": "0.2.137-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.136-beta.1",
9
+ "version": "0.2.137-beta.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
- "clavarium-binder": "0.1.51-next.1",
14
+ "clavarium-binder": "0.1.55-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
- "clavarium-parley": "0.17.35-next.1",
16
+ "clavarium-parley": "0.17.38-next.1",
17
17
  "clavarium-tether": "0.1.0-next.46",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
@@ -761,9 +761,9 @@
761
761
  }
762
762
  },
763
763
  "node_modules/clavarium-binder": {
764
- "version": "0.1.51-next.1",
765
- "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.51-next.1.tgz",
766
- "integrity": "sha512-8gZD7UDNlZUxvwZA/Z2zo4XFYo+eWRmmu/IXP4isYeBuSZv0cCh+nQzsFP7cFJvpUKiJG0Y2kHQOeGgSy/fcxQ==",
764
+ "version": "0.1.55-next.1",
765
+ "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.55-next.1.tgz",
766
+ "integrity": "sha512-YmLM425F1WrGwIUxXeeiaL6ffkgusiPhVnMehOrJV8ZZIfxtJAhP+DbqPHQGA9vqr1bTjmHvn/5j9b6/HtkwHw==",
767
767
  "license": "MIT",
768
768
  "bin": {
769
769
  "binder": "bin/binder.mjs",
@@ -787,9 +787,9 @@
787
787
  }
788
788
  },
789
789
  "node_modules/clavarium-parley": {
790
- "version": "0.17.35-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.35-next.1.tgz",
792
- "integrity": "sha512-bUR/1I9ZqEXWJ7SoxPYdkjlOHJ8dnML5A0ZQGfuEOl4YNuB6ULT4PoWqHfj0fVhY2j6BjDLvHJKZJ8WouEGXig==",
790
+ "version": "0.17.38-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.38-next.1.tgz",
792
+ "integrity": "sha512-dDY+0cVKY5IWnuWnNalYDnwPOWEt58a/f3tzrBHtwk9nYk4dp8b8jOvqnFTld4t+os7bB3VBRZyf1q4JP0hVyQ==",
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.136-beta.1",
3
+ "version": "0.2.137-beta.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.",
@@ -44,9 +44,9 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-binder": "0.1.51-next.1",
47
+ "clavarium-binder": "0.1.55-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
- "clavarium-parley": "0.17.35-next.1",
49
+ "clavarium-parley": "0.17.38-next.1",
50
50
  "clavarium-tether": "0.1.0-next.46",
51
51
  "mammoth": "1.13.0",
52
52
  "mermaid": "11.17.2",
package/server/boxes.mjs CHANGED
@@ -150,7 +150,8 @@ export function endOf(ep, reason = '') {
150
150
  if (n(ep.mean)) parts.push(`moy ${Math.round(ep.mean)}`);
151
151
  return parts.join(' · ');
152
152
  }
153
- export const THINKING_AFTER_MS = 3_500;
153
+ /* 02-11: the light turning says it is at work; a word only when it really takes long. */
154
+ export const THINKING_AFTER_MS = 15_000;
154
155
  export const LONGER_AFTER_MS = 12_000;
155
156
  export const THINKING = ['Hmm…', 'Voyons…', 'Hmm, voyons voir…'];
156
157
  /* WHY A BOX LISTENED, in a few words beside the message (01-11): what woke it (and the wake word's score), and
@@ -524,19 +525,22 @@ export class Boxes {
524
525
  let made = null;
525
526
  this.#react(text).then((t) => { made = t; }).catch(() => {});
526
527
  link.thinkingA = setTimeout(() => { void say(made || THINKING[Math.floor(Math.random() * THINKING.length)]); }, THINKING_AFTER_MS);
527
- link.thinkingB = setTimeout(() => { void say(long ? 'Ta question est riche, je regarde, un instant.' : 'Ça me demande un peu plus de temps, je regarde.'); }, long ? LONGER_AFTER_MS * 0.6 : LONGER_AFTER_MS);
528
- link.thinkingA.unref?.(); link.thinkingB.unref?.();
528
+ /* One word of waiting, not two (02-11: « je regarde, un instant » again and again). */
529
+ link.thinkingA.unref?.();
529
530
  }
530
531
 
531
532
  async agentSaid(conversation, text, to = null, { doing = false, asked = false } = {}) {
532
533
  /* What it is doing is written for a screen ("Tâche de fond : bêta 0.2.113…"): read aloud, it was words
533
534
  from nowhere (31-10). Aloud, only a short plain one; otherwise a word that it is at work. */
534
535
  const plain = forSpeech(text);
535
- const words = doing && (plain.length > 70 || /[\d:;/()[\]→=_]/.test(plain)) ? 'Je regarde, un instant.' : plain;
536
+ /* 02-11: not even « Je regarde, un instant » in its place -- said each time the agent wrote what it does, it
537
+ came back again and again. A long or technical one is not said at all. */
538
+ const words = doing && (plain.length > 70 || /[\d:;/()[\]→=_]/.test(plain)) ? '' : plain;
536
539
  if (!words) return;
537
540
  let boxes;
538
541
  if (doing) {
539
542
  /* "I'm looking in the calendar": once per sentence heard, on the box that heard it, within two minutes. */
543
+ /* 02-11: what it really does, in its words (« je regarde dans ton agenda »); never a stock phrase. */
540
544
  boxes = [...this.#links.values()].filter((l) => l.box().conversation === conversation && l.heardAt && !l.doingSaid && this.#now() - l.heardAt < DOING_WITHIN_MS);
541
545
  for (const l of boxes) l.doingSaid = true;
542
546
  } else {
@@ -735,9 +739,13 @@ export class Boxes {
735
739
  }
736
740
  }
737
741
  };
738
- for (const piece of piecesOf(pcm)) said.push(String(await hear(wavOf(piece)) ?? '').trim());
742
+ /* A part the engine fails on is left out (02-11: « la dictée ne répond pas » said while the rest was
743
+ understood); only when every part fails is it said. */
744
+ let failed = null;
745
+ for (const piece of piecesOf(pcm)) { try { said.push(String(await hear(wavOf(piece)) ?? '').trim()); } catch (error) { failed = error; } }
746
+ if (failed && !said.some(Boolean)) throw failed;
739
747
  text = said.filter(Boolean).join(' ');
740
- } catch (error) { this.#log(`voice box ${box0.name}: ${seconds} s heard, dictation failed (${error.message})`); if (this.#tested(link, 'failed', error.message)) { link.send({ t: 'cue', name: 'error' }); return; } await lost('Pardon, la dictée ne répond pas. Tu peux répéter ?'); return; }
748
+ } catch (error) { this.#log(`voice box ${box0.name}: ${seconds} s heard, dictation failed (${error.message})`); try { this.#keep?.(box0.conversation, 'dictee-echec.txt', `${new Date(this.#now()).toISOString()} ${seconds} s: ${error.message}\n`); } catch { /* its chat may be off */ } if (this.#tested(link, 'failed', error.message)) { link.send({ t: 'cue', name: 'error' }); return; } await lost('Pardon, la dictée ne répond pas. Tu peux répéter ?'); return; }
741
749
  if (link.testing?.state === 'listening' && this.#now() <= link.testing.until) {
742
750
  this.#tested(link, text ? 'heard' : 'nothing', text);
743
751
  this.#log(`voice box ${box0.name}: microphone test, ${seconds} s heard`);
package/server/main.mjs CHANGED
@@ -149,7 +149,7 @@ DEVICE_FILES['/c/device.js'] = ['web/device.js', 'text/javascript; charset=utf-8
149
149
 
150
150
  /* Nothing loads from anywhere else, and nothing may frame the page. */
151
151
  const HEADERS = {
152
- 'content-security-policy': "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'",
152
+ 'content-security-policy': "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; media-src 'self' blob:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'",
153
153
  'x-content-type-options': 'nosniff',
154
154
  'referrer-policy': 'no-referrer',
155
155
  'cache-control': 'no-store',
package/web/app.js CHANGED
@@ -8073,6 +8073,12 @@
8073
8073
  is offered for download, and nothing is ever run. */
8074
8074
  const PREVIEW_MAX = 25 * 1024 * 1024;
8075
8075
  const TEXT_MAX = 1024 * 1024;
8076
+ /* SOUNDS AND VIDEOS (02-11): played here, by the browser's own player. What it cannot read (an .avi, an
8077
+ .mkv of another codec) says so, with Download. Up to MEDIA_MAX read whole (so it can be moved through),
8078
+ beyond, played as it comes. */
8079
+ const MEDIA = { mp3: 'audio/mpeg', wav: 'audio/wav', ogg: 'audio/ogg', oga: 'audio/ogg', opus: 'audio/ogg', m4a: 'audio/mp4', aac: 'audio/aac', flac: 'audio/flac',
8080
+ mp4: 'video/mp4', m4v: 'video/mp4', mov: 'video/mp4', webm: 'video/webm', mkv: 'video/webm', ogv: 'video/ogg' };
8081
+ const MEDIA_MAX = 200 * 1024 * 1024;
8076
8082
  const PICTURES = { png: 'image/png', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif', webp: 'image/webp' };
8077
8083
  /* Office files (02-11), read in the page: spreadsheets by SheetJS, Word by mammoth (loaded on first use). */
8078
8084
  const SHEETS = ['xlsx', 'xlsm', 'xls', 'ods'];
@@ -8345,6 +8351,25 @@
8345
8351
  $('preview-body').replaceChildren(box); note('');
8346
8352
  };
8347
8353
  const kind = name.includes('.') ? name.split('.').pop().toLowerCase() : '';
8354
+ if (MEDIA[kind]) {
8355
+ const video = MEDIA[kind].startsWith('video/');
8356
+ const player = document.createElement(video ? 'video' : 'audio');
8357
+ player.controls = true; player.preload = 'metadata'; player.className = `preview-media${video ? ' preview-video' : ''}`;
8358
+ player.setAttribute('playsinline', '');
8359
+ player.addEventListener('error', () => { if (!$('viewer').hidden && $('preview-name').textContent === name) cannot(`${size ? `${sizeOf(size)} · ` : ''}This browser cannot play this file.`); }, { once: true });
8360
+ if (size && size > MEDIA_MAX) { player.src = address; $('preview-body').replaceChildren(player); note(''); return; }
8361
+ note('Loading...');
8362
+ let got;
8363
+ try {
8364
+ const r = await fetch(address);
8365
+ if (!r.ok) throw new Error((await r.json().catch(() => ({}))).error || 'The file could not be read.');
8366
+ got = await r.arrayBuffer();
8367
+ } catch (error) { cannot(error.message); return; }
8368
+ if ($('viewer').hidden || $('preview-name').textContent !== name) return;
8369
+ shownUrl = URL.createObjectURL(new Blob([got], { type: MEDIA[kind] }));
8370
+ player.src = shownUrl; $('preview-body').replaceChildren(player); note('');
8371
+ return;
8372
+ }
8348
8373
  const known = PICTURES[kind] || kind === 'pdf' || TEXTS.includes(kind) || SHEETS.includes(kind) || kind === 'docx';
8349
8374
  if (!known) { cannot(`${size ? `${sizeOf(size)} · ` : ''}This kind of file cannot be shown here.`); return; }
8350
8375
  if (size > (TEXTS.includes(kind) ? TEXT_MAX : PREVIEW_MAX)) { cannot(`${sizeOf(size)} · Too large to be shown here.`); return; }
package/web/style.css CHANGED
@@ -22,7 +22,9 @@ body { font: .875rem var(--sans); }
22
22
  body { height: 100dvh; padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0); }
23
23
  [hidden] { display: none !important; }
24
24
  button { font: 600 .8125rem var(--sans); color: var(--ink); background: var(--button, #222c38); border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px; cursor: pointer; }
25
- button.primary { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
25
+ /* The main button (02-11): its words and outline in brass, no fill -- quieter, like a suggestion. */
26
+ button.primary { background: transparent; border-color: var(--brass); color: var(--brass); }
27
+ button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brass) 12%, transparent); }
26
28
  button:focus-visible, input:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
27
29
  /* The list on the left, the three places under it, the conversation beside them. */
28
30
  #app { display: grid; grid-template-columns: var(--list-width, 260px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
@@ -109,7 +111,7 @@ main { position: relative; flex: 1; min-height: 0; }
109
111
  #notice button { padding: 10px 18px; font-size: .9375rem; }
110
112
  footer { display: flex; gap: 6px; padding: 6px 8px; background: var(--bar); border-top: 1px solid var(--line); overflow-x: auto; }
111
113
  footer button { flex: 0 0 auto; min-width: 44px; padding: 9px 12px; }
112
- footer button.wide { flex: 1 0 auto; background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
114
+ footer button.wide { flex: 1 0 auto; background: transparent; border-color: var(--brass); color: var(--brass); }
113
115
  @media (max-width: 700px) {
114
116
  #app { grid-template-columns: minmax(0, 1fr); }
115
117
  #list, #room { grid-column: 1; grid-row: 1; border-right: 0; }
@@ -192,7 +194,7 @@ html[data-door="device"] #room { height: 100%; }
192
194
  .chip[data-access="offline"] { color: var(--warn); border-color: var(--warn); }
193
195
  #signin-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: rgba(210, 169, 78, .14); border-bottom: 1px solid var(--brass); font-size: .8125rem; }
194
196
  #signin-text { flex: 1; min-width: 160px; }
195
- a.button { font: 600 .8125rem var(--sans); text-decoration: none; border-radius: 7px; padding: 7px 11px; background: var(--brass); color: var(--on-brass); }
197
+ a.button { font: 600 .8125rem var(--sans); text-decoration: none; border-radius: 7px; padding: 7px 11px; background: transparent; border: 1px solid var(--brass); color: var(--brass); }
196
198
  #signin-form input { flex: 1; min-width: 130px; font: .875rem var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; }
197
199
  /* On a narrow screen the key row wraps instead of hiding its end, and
198
200
  dictation comes first: by voice is how a phone is used. */
@@ -243,10 +245,12 @@ footer button.careful { border-style: dashed; color: var(--ink2); }
243
245
  #viewer .row { align-items: center; gap: 8px; flex-wrap: wrap; }
244
246
  #viewer .sp { flex: 1; }
245
247
  #viewer #preview-name { overflow-wrap: anywhere; }
246
- #viewer a.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; background: var(--brass); color: var(--on-brass); font-weight: 600; text-decoration: none; }
248
+ #viewer a.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 8px; background: transparent; border: 1px solid var(--brass); color: var(--brass); font-weight: 600; text-decoration: none; }
247
249
  #viewer button { min-height: 40px; }
248
250
  #viewer p { margin: 0; }
249
251
  #preview-body { overflow: auto; flex: 1; min-height: 0; }
252
+ #preview-body .preview-media { display: block; width: 100%; max-width: 720px; margin: 16px auto; }
253
+ #preview-body .preview-video { max-height: 100%; background: #000; border-radius: 6px; }
250
254
  #preview-body img, #preview-body canvas { display: block; max-width: 100%; height: auto; margin: 0 auto 10px; background: #fff; border-radius: 4px; }
251
255
  #preview-body pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .8125rem/1.45 ui-monospace, Menlo, Consolas, monospace; color: var(--ink); margin: 0; }
252
256
 
@@ -2017,7 +2021,7 @@ details.commit > pre { margin: 6px 0 0 1.6em; white-space: pre-wrap; overflow-wr
2017
2021
  Download stands out. Full screen: the file takes the whole screen. */
2018
2022
  #viewer .ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; min-width: 38px; height: 34px; padding: 0; }
2019
2023
  #viewer .ico svg { width: 18px; height: 18px; }
2020
- #viewer .ico.primary { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
2024
+ #viewer .ico.primary { background: transparent; border-color: var(--brass); color: var(--brass); }
2021
2025
  #viewer #preview-copy[data-done="true"] { color: var(--ok); border-color: currentColor; }
2022
2026
  #viewer #preview-full[aria-pressed="true"] { border-color: var(--brass); }
2023
2027
  #viewer.viewer-full { padding: 0; }