clavarium 0.2.161-next.1 → 0.2.164-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.161-next.1",
3
+ "version": "0.2.164-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.161-next.1",
9
+ "version": "0.2.164-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -14,7 +14,7 @@
14
14
  "clavarium-binder": "0.1.43-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
16
  "clavarium-parley": "0.17.31-next.1",
17
- "clavarium-tether": "0.1.0-next.38",
17
+ "clavarium-tether": "0.1.0-next.40",
18
18
  "mermaid": "11.17.2",
19
19
  "node-pty": "^1.1.0",
20
20
  "pdfjs-dist": "6.4.299",
@@ -760,9 +760,9 @@
760
760
  }
761
761
  },
762
762
  "node_modules/clavarium-tether": {
763
- "version": "0.1.0-next.38",
764
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.38.tgz",
765
- "integrity": "sha512-hIbCNROr+CmYpYAviKffHT3L51wucGJn5tHZLZ4K7NGM1uCwS6Oaq3dauF/eFtsD0QIyaRO9+2+G0HIA1q4HjA==",
763
+ "version": "0.1.0-next.40",
764
+ "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.40.tgz",
765
+ "integrity": "sha512-9vAcoV4GlNDduX+slPUfJyMB0wTb/mUAe6VVaOlmwLlWhsM691nI2F9AUb6/QH+uPI3A2e67U6koafYn4TqntA==",
766
766
  "license": "MIT",
767
767
  "bin": {
768
768
  "tether": "bin/cli.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.161-next.1",
3
+ "version": "0.2.164-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.",
@@ -47,7 +47,7 @@
47
47
  "clavarium-binder": "0.1.43-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
49
  "clavarium-parley": "0.17.31-next.1",
50
- "clavarium-tether": "0.1.0-next.38",
50
+ "clavarium-tether": "0.1.0-next.40",
51
51
  "mermaid": "11.17.2",
52
52
  "node-pty": "^1.1.0",
53
53
  "pdfjs-dist": "6.4.299",
@@ -82,7 +82,7 @@ export class Tethers {
82
82
  if (!who.startsWith(AGENT)) continue;
83
83
  const name = who.slice(AGENT.length);
84
84
  this.#seen.set(j.id, { name, verb: j.verb });
85
- try { this.announce(name, { kind: 'tether-job', text: `To do in your browser: ${j.args?.name ? `flash ${j.args.name}` : 'flash a device'}. Open this conversation's Demandes, plug it in by USB, and start.`, topic: 'Demande', tone: 'warn' }); } catch { /* its chat is off */ }
85
+ try { this.announce(name, { kind: 'tether-job', text: `To do in your browser: ${j.args?.name ? `flash ${j.args.name}` : 'flash a device'}. Plug it in by USB here, then start.`, topic: 'Demande', tone: 'warn', actions: [`flash:${j.id}`] }); } catch { /* its chat is off */ }
86
86
  }
87
87
  for (const [id, info] of [...this.#seen]) {
88
88
  if (live.has(id)) continue;
package/web/app.js CHANGED
@@ -2617,7 +2617,7 @@
2617
2617
  /* A message attached to a card (#180), from its menu: its id, as the card opens it again. */
2618
2618
  ...(!DEVICE ? { card: (m) => attachToCard({ kind: 'message', ref: m.id, title: String(m.short || m.text || '').replace(/\s+/g, ' ').trim().slice(0, 80) }) } : {}),
2619
2619
  /* The buttons of a line of the machine: what this screen may do. */
2620
- act: (id) => { if (id === 'seen-done') return; if (id === 'seen') void markSeen(); else if (id === 'memory') void openMemory(); else if (id === 'disk') void openDisk(); else if (id === 'room') seeTerminal(); else if (id === 'restart') void restartMachine(false); else if (id === 'terminal') seeTerminal(); else if (id.startsWith('allow:')) void decideTether(id.slice('allow:'.length), 'yes'); else if (id.startsWith('deny:')) void decideTether(id.slice('deny:'.length), 'no'); else if (id.startsWith('review:')) void openGit(id.slice('review:'.length)); else openCommits(id); },
2620
+ act: (id) => { if (id === 'seen-done') return; if (id === 'seen') void markSeen(); else if (id === 'memory') void openMemory(); else if (id === 'disk') void openDisk(); else if (id === 'room') seeTerminal(); else if (id === 'restart') void restartMachine(false); else if (id === 'terminal') seeTerminal(); else if (id.startsWith('allow:')) void decideTether(id.slice('allow:'.length), 'yes'); else if (id.startsWith('deny:')) void decideTether(id.slice('deny:'.length), 'no'); else if (id.startsWith('flash:')) void flashFromThread(id.slice('flash:'.length)); else if (id.startsWith('review:')) void openGit(id.slice('review:'.length)); else openCommits(id); },
2621
2621
  /* What it opens over the thread (a picture, its media, a search...) is a step of this page's: one Back closes it. */
2622
2622
  back: { open: (name, close) => nav.over(`chat-${name}`, () => close(), { stack: true }), closed: (step) => { if (step) nav.drop(step); } },
2623
2623
  /* Files attached to a message: wherever the chat may be written in. */
@@ -2751,10 +2751,10 @@
2751
2751
  /* "commits:<repository>.<to>.<from>.<n>": those commits, in the review ("See the 3 commits"). A commit a
2752
2752
  line names (7 to 40 hexadecimal characters, a digit among them) is a link to its review, on a line about
2753
2753
  a repository; the agent's own messages are never read for this. */
2754
- const ACTIONS = { memory: 'More memory...', disk: 'Give it more disk...', room: 'See what takes room', restart: 'Restart...', terminal: 'See the terminal', review: 'Open the review', seen: '\u2713 Seen', allow: 'Accept', deny: 'Refuse' };
2754
+ const ACTIONS = { memory: 'More memory...', disk: 'Give it more disk...', room: 'See what takes room', restart: 'Restart...', terminal: 'See the terminal', review: 'Open the review', seen: '\u2713 Seen', allow: 'Accept', deny: 'Refuse', flash: 'Plug it in and start' };
2755
2755
  const COMMITS = /^commits:([a-z0-9][a-z0-9-]*)\.([0-9a-f]{7,40})\.([0-9a-f]{7,40})\.(\d{1,4})$/;
2756
2756
  /* A Tether call an agent asked the owner to allow, offered right in the thread: allow:<id> / deny:<id>. */
2757
- const DEMANDE = /^(allow|deny):[0-9a-f-]{36}$/;
2757
+ const DEMANDE = /^(allow|deny|flash):[0-9a-f-]{36}$/;
2758
2758
  const COMMIT = /^commit:([a-z0-9][a-z0-9-]*)\.([0-9a-f]{7,40})$/;
2759
2759
  function openCommits(id) {
2760
2760
  if (DEVICE) return;
@@ -4389,6 +4389,19 @@
4389
4389
  Tether's own module runs here (/vendor/tether/jobs.js) and its end is the agent's answer.
4390
4390
  Its element is kept from one paint to the next: the module draws in it while it runs. */
4391
4391
  const jobPlaces = new Map();
4392
+ /* The same, from its button in the thread: the module draws in a panel over the page, closed once done. */
4393
+ async function flashFromThread(id) {
4394
+ const tether = await getJson('/tether', {});
4395
+ const job = (Array.isArray(tether.jobs) ? tether.jobs : []).find((j) => j.id === id);
4396
+ let panel = $('job-panel');
4397
+ if (!panel) { panel = el('div', 'card job-panel'); panel.id = 'job-panel'; panel.setAttribute('role', 'dialog'); document.body.append(panel); }
4398
+ panel.hidden = false;
4399
+ if (!job) { panel.replaceChildren(el('p', '', 'This flash ended already, or was cancelled.')); setTimeout(() => { panel.hidden = true; }, 3000); return; }
4400
+ const close = el('button', '', 'Close'); close.type = 'button'; close.addEventListener('click', () => { panel.hidden = true; });
4401
+ const card = jobCard(job, () => { void paintRoomAssets(); });
4402
+ panel.replaceChildren(card, close);
4403
+ card.querySelector('.action-row button.primary')?.click();
4404
+ }
4392
4405
  function jobCard(job, after) {
4393
4406
  if (!jobPlaces.has(job.id)) {
4394
4407
  const card = el('div', 'card job-card'); card.dataset.job = job.id;
@@ -8815,10 +8828,19 @@
8815
8828
  if (accessFor && conversations.some((c) => c.name === accessFor)) pick.value = accessFor;
8816
8829
  $('box-ready').hidden = true;
8817
8830
  });
8831
+ $('box-key-copy').addEventListener('click', async () => {
8832
+ const key = $('box-key').textContent;
8833
+ try { await navigator.clipboard.writeText(key); $('box-key-copy').textContent = 'Copied'; }
8834
+ catch { const range = document.createRange(); range.selectNodeContents($('box-key')); getSelection().removeAllRanges(); getSelection().addRange(range); }
8835
+ setTimeout(() => { $('box-key-copy').textContent = 'Copy the key'; }, 2000);
8836
+ });
8818
8837
  $('box-code').addEventListener('click', async () => {
8819
8838
  try {
8820
8839
  const r = await post(`${API}/boxes/code`, { conversation: $('box-conversation').value, name: $('box-room').value.trim() });
8821
8840
  $('box-code-shown').textContent = r.code; $('box-code-minutes').textContent = `valid ${r.minutes} minutes, once`;
8841
+ /* One paste instead of three fields on the box's page: this address, the room, the code. */
8842
+ const json = JSON.stringify({ u: location.origin, r: $('box-room').value.trim(), c: r.code });
8843
+ $('box-key').textContent = `GAMBELI-${btoa(unescape(encodeURIComponent(json))).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')}`;
8822
8844
  $('box-ready').hidden = false;
8823
8845
  } catch (error) { $('box-code-minutes').textContent = error.message; $('box-ready').hidden = false; }
8824
8846
  });
package/web/index.html CHANGED
@@ -462,8 +462,10 @@
462
462
  <button type="button" id="box-code" class="primary">Get a code</button>
463
463
  </div>
464
464
  <div id="box-ready" hidden>
465
- <p>Pairing code <b id="box-code-shown"></b> <span class="hint" id="box-code-minutes"></span></p>
466
- <p class="hint">Hold the box's button 5 s, join its Wi-Fi « Gambeli-… » with a phone, and type this code. A new box: ask the assistant of its conversation to flash it; you plug it in here when it asks.</p>
465
+ <p>Setup key <span class="hint" id="box-code-minutes"></span></p>
466
+ <div class="row"><code id="box-key" class="box-key"></code><button type="button" id="box-key-copy" class="primary">Copy the key</button></div>
467
+ <p class="hint">Or the pairing code alone: <b id="box-code-shown"></b></p>
468
+ <p class="hint">Hold the box's button 5 s, join its Wi-Fi « Gambeli-… » with a phone, choose your Wi-Fi and paste this key. A new box: ask the assistant of its conversation to flash it; you plug it in here when it asks.</p>
467
469
  </div>
468
470
  </div>
469
471
  <div id="box-list"></div>
package/web/style.css CHANGED
@@ -2063,3 +2063,11 @@ details.commit > pre { margin: 6px 0 0 1.6em; white-space: pre-wrap; overflow-wr
2063
2063
  .as-group.as-drop-over { outline: 2px dashed var(--brass); outline-offset: 2px; border-radius: 10px; background: rgba(210, 169, 78, .07); }
2064
2064
  body.as-dragging { user-select: none; -webkit-user-select: none; }
2065
2065
  body.as-dragging #assets-rows .as-row { touch-action: none; }
2066
+ /* A flash started from its button in the thread: Tether's module draws its steps here, over the page. */
2067
+ .job-panel { position: fixed; z-index: 60; left: 50%; top: 18%; transform: translateX(-50%); width: min(520px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; display: grid; gap: 10px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgb(0 0 0 / .45); }
2068
+ .job-panel > button { justify-self: end; }
2069
+ .job-panel .tether-flash { display: grid; gap: 8px; }
2070
+ .job-panel .tether-flash progress { width: 100%; }
2071
+ .job-panel .tether-flash-extra { display: grid; gap: 8px; }
2072
+ .job-panel .tether-flash-bad { color: var(--bad, #ff8a80); }
2073
+ .box-key { overflow-wrap: anywhere; font-size: .8rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; user-select: all; flex: 1 1 260px; min-width: 0; }