clavarium 0.2.201-beta.1 → 0.2.202-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,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.201-beta.1",
3
+ "version": "0.2.202-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.201-beta.1",
9
+ "version": "0.2.202-beta.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.201-beta.1",
3
+ "version": "0.2.202-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.",
package/server/api.mjs CHANGED
@@ -126,6 +126,7 @@
126
126
  * POST /api/wifi/handover: the network handed over to NetworkManager (back as it was if it does not work)
127
127
  * GET /api/meshcentral: the remote screen (MeshCentral); POST /api/meshcentral/enable (turned on, in the background) /disable
128
128
  * GET /api/events?kind=&conversation=&q=&before=&limit= what happened, newest first
129
+ * GET /api/jobs what it is doing: { running, done } (jobs.mjs), its updates of the day among the done
129
130
  * GET /api/history?of=server|<name>&span=1h|24h|7d the curves of memory, CPU and disk (and the reserve, for the server)
130
131
  * GET /api/history/all?span=1h|24h|7d Settings, Usage: the server and every machine (asleep too) on one time axis,
131
132
  * in GB and cores: {t, capacity, server, itself, machines: [{name, alloc, asleep, ...}]}
@@ -406,6 +407,14 @@ export async function handleApi(request, response, conversations, headers, resou
406
407
  /* Who may sign in (operators.mjs): none in local mode. */
407
408
  const reactOf = /^\/api\/conversations\/([^/]+)\/health-react$/.exec(pathname);
408
409
  if (reactOf && reacting) return send(200, reacting.settings(decodeURIComponent(reactOf[1]))), true;
410
+ if (pathname === '/api/jobs' && conversations.jobs) {
411
+ const said = conversations.jobs.list(conversations.list?.() ?? []);
412
+ const day = Date.now() - 24 * 3600_000;
413
+ const updated = (updates?.about().history ?? []).filter((h) => h.at && Date.parse(h.at) >= day)
414
+ .map((h) => ({ what: `Clavarium ${h.action === 'rollback' ? 'back to' : 'updated to'} ${h.to ?? '?'}`, endedAt: h.at, result: h.result === 'done' ? 'done' : 'failed', ...(h.result === 'done' ? {} : { why: h.why ?? h.result ?? '' }) }));
415
+ const done = [...said.done, ...updated].sort((a, b) => String(b.endedAt).localeCompare(String(a.endedAt)));
416
+ return send(200, { running: said.running, done }), true;
417
+ }
409
418
  if (pathname === '/api/events' && events) {
410
419
  const ask = { kind: query.get('kind') ?? '', conversation: query.get('conversation') ?? '', q: query.get('q') ?? '', before: query.get('before') ?? '', limit: Math.min(1000, Number(query.get('limit')) || 200) };
411
420
  const said = events.list(ask);
@@ -948,9 +948,12 @@ export class Conversations {
948
948
  /* In its machine: the manifest written aside, then one archive -- the manifest first, then what is kept
949
949
  (a path it has not made yet left out), the cache left out. */
950
950
  /* (Its paths are plain -- letters, digits, . _ / - -- checked by tools.mjs: given as words.) */
951
- const script = 'set -e; m=$(mktemp -d); printf "%s" "$1" > "$m/clavarium-conversation.json"; '
951
+ const script = 'm=$(mktemp -d) || exit 2; printf "%s" "$1" > "$m/clavarium-conversation.json"; '
952
952
  + 'ex=""; for a in $2; do ex="$ex --exclude=./$a"; done; ks=""; for a in $3; do if [ -e "$HOME/$a" ]; then ks="$ks ./$a"; fi; done; '
953
- + 'tar -czf - -C "$m" clavarium-conversation.json -C "$HOME" $ex $ks; rm -rf "$m"';
953
+ + 'rc=0; tar -czf - --warning=no-file-changed -C "$m" clavarium-conversation.json -C "$HOME" $ex $ks || rc=$?; rm -rf "$m"; '
954
+ /* 1: a file changed while read (its tool writing its log as it is read, 14-11: a live Claude Code): the
955
+ archive is whole all the same -- what was there, read; only a real error (2) fails. */
956
+ + '[ "$rc" -le 1 ]';
954
957
  const argv = this.#vms.execArgv(name, ['sh', '-c', script, 'export', manifest, tool.state.skip.join(' '), tool.state.keep.join(' ')]);
955
958
  const child = spawn(argv[0], argv.slice(1), { stdio: ['ignore', 'pipe', 'pipe'] });
956
959
  /* What it said when it failed: kept short, for the message that says why (a copy, a move). */
@@ -1028,7 +1031,8 @@ export class Conversations {
1028
1031
  async #copying(from, to, c, tool, building, open = () => {}) {
1029
1032
  const dir = mkdtempSync(join(tmpdir(), 'clv-copy-'));
1030
1033
  const carried = join(dir, 'state.tar.gz');
1031
- let woke = false;
1034
+ let woke = false; let putBack = 'sleep';
1035
+ const back = () => (putBack === 'stop' ? this.machineAction(from, 'stop', { wait: true }) : this.sleep(from));
1032
1036
  try {
1033
1037
  /* Said as it goes, once a second at most: a long copy is seen moving (13-11, "on ne sait pas si ça marche"). */
1034
1038
  let said = 0;
@@ -1037,7 +1041,9 @@ export class Conversations {
1037
1041
  this.#store.patch(to, { step: `Copying ${tool.label}'s memory` });
1038
1042
  const state = await this.#vms.state(from, { fresh: true }).catch(() => undefined);
1039
1043
  if (state !== 'Running') {
1040
- this.#store.patch(to, { step: `Copying ${tool.label}'s memory: waking its original` });
1044
+ /* Put back as it was found (14-11: one stopped was left asleep, its memory held). */
1045
+ putBack = state === 'Stopped' ? 'stop' : 'sleep';
1046
+ this.#store.patch(to, { step: `Copying ${tool.label}'s memory: ${putBack === 'stop' ? 'starting its original (it was stopped)' : 'waking its original'}` });
1041
1047
  await this.room({ kind: 'start', name: from, memoryMb: Number(c.memoryMb) || tool.memoryMb });
1042
1048
  /* Woken outside a wake, it is still marked asleep: borrowed, so that the server's sweep of sleepers
1043
1049
  holding memory (capacity.mjs, reclaimSleepers) does not put it back to sleep while it is read --
@@ -1078,7 +1084,7 @@ export class Conversations {
1078
1084
  }
1079
1085
  if (code !== 0) throw new Error(`its tool's memory could not be read (exit ${code}${firstLine(child.said) ? `: ${firstLine(child.said)}` : ''}).`);
1080
1086
  /* Read: its original back to sleep at once, before the copy's machine is made. */
1081
- if (woke) { await this.sleep(from).catch(() => {}); woke = false; }
1087
+ if (woke) { await back().catch(() => {}); woke = false; }
1082
1088
  this.#borrowed.delete(from);
1083
1089
  }
1084
1090
  open(true);
@@ -1111,7 +1117,7 @@ export class Conversations {
1111
1117
  return undefined;
1112
1118
  } finally {
1113
1119
  rmSync(dir, { recursive: true, force: true });
1114
- if (woke) await this.sleep(from).catch(() => {});
1120
+ if (woke) await back().catch(() => {});
1115
1121
  this.#borrowed.delete(from);
1116
1122
  }
1117
1123
  }
@@ -0,0 +1,69 @@
1
+ /* WHAT CLAVARIUM IS DOING (the « under way » badge, 14-11): every conversation in a busy phase -- built, copied,
2
+ * moved, restarted -- is a job under way, its step said as it goes; when it leaves that phase the job ends, done
3
+ * or failed with why, and is kept a day. Nothing is asked of the machines: it is read off the conversations' own
4
+ * record as it changes (Store's onChange), so it adds no wait.
5
+ *
6
+ * seen(before, after) a conversation's record changed (before or after undefined: made or removed)
7
+ * list(now?) { running: [...], done: [...] } newest first, done within KEEP_MS
8
+ */
9
+ import { JsonFile } from './store.mjs';
10
+
11
+ export const BUSY = ['building', 'moving', 'restarting'];
12
+ const KEEP_MS = 24 * 3600_000;
13
+ const DONE_MAX = 50;
14
+
15
+ const titleOf = (c) => c?.title ?? c?.name ?? '?';
16
+
17
+ /* Its words: what it is, from the phase and the record (a copy names its original, a move its machine). */
18
+ export function jobWords(c) {
19
+ if (c.phase === 'moving') return `Moving ${titleOf(c)}${c.sharedMachine ? ` into « ${c.sharedMachine} »` : ''}`;
20
+ if (c.phase === 'restarting') return `Restarting ${titleOf(c)}`;
21
+ if (c.copyOf) return `Copy ${titleOf(c)}${c.sharedMachine ? ` in « ${c.sharedMachine} »` : ''}`;
22
+ return `Building ${titleOf(c)}${c.sharedMachine ? ` in « ${c.sharedMachine} »` : ''}`;
23
+ }
24
+
25
+ export class Jobs {
26
+ #open = new Map();
27
+ #file;
28
+ #done;
29
+ #now;
30
+
31
+ constructor({ path, now = () => Date.now() } = {}) {
32
+ this.#now = now;
33
+ this.#file = path ? new JsonFile(path, []) : undefined;
34
+ const kept = this.#file?.get();
35
+ this.#done = Array.isArray(kept) ? kept : [];
36
+ }
37
+
38
+ seen(before, after) {
39
+ const name = after?.name ?? before?.name;
40
+ if (!name) return;
41
+ const busy = after && BUSY.includes(after.phase);
42
+ if (busy && !this.#open.has(name)) this.#open.set(name, { conversation: name, what: jobWords(after), startedAt: new Date(this.#now()).toISOString() });
43
+ else if (busy) this.#open.get(name).what = jobWords(after);
44
+ if (busy || !this.#open.has(name)) return;
45
+ const job = this.#open.get(name);
46
+ this.#open.delete(name);
47
+ const ok = after?.phase === 'ready';
48
+ this.#end({ ...job, endedAt: new Date(this.#now()).toISOString(), result: after ? (ok ? 'done' : 'failed') : 'removed', ...(after && !ok && after.error ? { why: String(after.error).slice(0, 300) } : {}) });
49
+ }
50
+
51
+ #end(job) {
52
+ const since = this.#now() - KEEP_MS;
53
+ this.#done = [job, ...this.#done.filter((j) => Date.parse(j.endedAt) >= since)].slice(0, DONE_MAX);
54
+ this.#file?.set(this.#done);
55
+ }
56
+
57
+ /* `records`: the conversations as they are now, for their live step. */
58
+ list(records = []) {
59
+ const since = this.#now() - KEEP_MS;
60
+ /* Read off the records: one busy since before a restart of the server is under way too, and ends here. */
61
+ for (const c of records) if (BUSY.includes(c.phase) && !this.#open.has(c.name)) this.seen(undefined, c);
62
+ const byName = new Map(records.map((c) => [c.name, c]));
63
+ const running = [...this.#open.values()].map((j) => {
64
+ const c = byName.get(j.conversation);
65
+ return { ...j, ...(c ? { what: jobWords(c), step: c.step ?? '', progress: c.progress } : {}) };
66
+ });
67
+ return { running, done: this.#done.filter((j) => Date.parse(j.endedAt) >= since) };
68
+ }
69
+ }
package/server/main.mjs CHANGED
@@ -93,6 +93,7 @@ import { ApiKeys, handleExternal, handleApiKeys, statusOf } from './apikeys.mjs'
93
93
  import { RelayJoin, handleRelayJoin, RELAY_JOIN_PATH } from './relayjoin.mjs';
94
94
  import { WebSocketServer } from 'ws';
95
95
  import { copyWorkFolder } from './copywork.mjs';
96
+ import { Jobs } from './jobs.mjs';
96
97
 
97
98
  const ROOT = fileURLToPath(new URL('..', import.meta.url));
98
99
  const MAINTENANCE = 'deploy/maintenance.html';
@@ -312,12 +313,15 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
312
313
  let repairTerminal = async () => { throw new Error('not ready'); };
313
314
  const asHost = runner(host);
314
315
  /* A conversation in a shared machine (#221) says which: the machine its VM operations reach. */
315
- const conversationStore = new Store(`${dataDir}/conversations.json`);
316
+ const jobs = new Jobs({ path: `${dataDir}/jobs.json` });
317
+ const conversationStore = new Store(`${dataDir}/conversations.json`, { onChange: (before, after) => jobs.seen(before, after) });
316
318
  const vms = new Vms(asHost, host, {
317
319
  machineOf: (name) => { const m = conversationStore.get(name)?.sharedMachine; return typeof m === 'string' && m ? m : undefined; },
318
320
  userOf: (name) => { const u = conversationStore.get(name)?.machineUser; return u && Number.isInteger(u.uid) && Number.isInteger(u.gid) ? u : undefined; },
319
321
  });
320
322
  const all = conversations ?? new Conversations({ store: conversationStore, layout: new JsonFile(`${dataDir}/layout.json`, {}), vms, tools, ...(stopDelayMs === undefined ? {} : { stopDelayMs }) });
323
+ /* What it is doing (jobs.mjs): read by GET /api/jobs. */
324
+ if (!all.jobs) all.jobs = jobs;
321
325
  /* Who may do what with what: ONE table, shared by everything below. */
322
326
  const grants = new Grants(new Store(`${dataDir}/grants.json`));
323
327
  /* Folder-style boxes the owner drops assets into, to tidy the views and hand a whole box at once (groups.mjs). */
package/server/store.mjs CHANGED
@@ -10,9 +10,12 @@ import { dirname } from 'node:path';
10
10
  export class Store {
11
11
  #path;
12
12
  #items;
13
+ /* Told of each change, its record before and after (undefined: made or removed): jobs.mjs reads it. */
14
+ onChange;
13
15
 
14
- constructor(path) {
16
+ constructor(path, { onChange } = {}) {
15
17
  this.#path = path;
18
+ this.onChange = onChange;
16
19
  mkdirSync(dirname(path), { recursive: true });
17
20
  try { this.#items = JSON.parse(readFileSync(path, 'utf8')); } catch { this.#items = []; }
18
21
  if (!Array.isArray(this.#items)) this.#items = [];
@@ -23,21 +26,32 @@ export class Store {
23
26
 
24
27
  put(conversation) {
25
28
  const i = this.#items.findIndex((x) => x.name === conversation.name);
29
+ const before = i >= 0 ? { ...this.#items[i] } : undefined;
26
30
  if (i >= 0) this.#items[i] = { ...conversation }; else this.#items.push({ ...conversation });
27
31
  this.#save();
32
+ this.#told(before, conversation);
28
33
  }
29
34
 
30
35
  patch(name, changes) {
31
36
  const c = this.#items.find((x) => x.name === name);
32
37
  if (!c) return undefined;
38
+ const before = { ...c };
33
39
  Object.assign(c, changes);
34
40
  this.#save();
41
+ this.#told(before, c);
35
42
  return { ...c };
36
43
  }
37
44
 
38
45
  remove(name) {
46
+ const before = this.get(name);
39
47
  this.#items = this.#items.filter((x) => x.name !== name);
40
48
  this.#save();
49
+ if (before) this.#told(before, undefined);
50
+ }
51
+
52
+ #told(before, after) {
53
+ if (!this.onChange) return;
54
+ try { this.onChange(before, after ? { ...after } : undefined); } catch { /* a listener never breaks a write */ }
41
55
  }
42
56
 
43
57
  #save() {
package/web/app.js CHANGED
@@ -522,7 +522,7 @@
522
522
  const old = document.getElementById('room')?.querySelector(':scope > header');
523
523
  if (old) old.replaceWith(DEVICE
524
524
  ? KIT.TopBar({ variant: 'main', title: $('name'), actions: [...old.children].filter((n) => n.id !== 'name') })
525
- : KIT.TopBar({ variant: 'main', fold: $('fold'), back: { element: $('back'), label: 'Conversations' }, state: $('state'), title: $('name'), actions: [$('views')] }));
525
+ : KIT.TopBar({ variant: 'main', fold: $('fold'), back: { element: $('back'), label: 'Conversations' }, state: $('state'), title: $('name'), actions: [$('jobs-room'), $('views')] }));
526
526
  }
527
527
  /* A room (the device page has none): its dot, its name, under it who speaks now (only then); on its right who is
528
528
  in it (07-11: small stacked avatars, a click opens the list) then its settings, in the same group of views a
@@ -1978,10 +1978,69 @@
1978
1978
  } catch { /* a server without VMs has no list: the page is one terminal */ }
1979
1979
  /* The panel is open: what the answerer did meanwhile is said there. */
1980
1980
  if (!DEVICE && panelShown) { void paintAnswerer(); paintWakeups(); paintMachine(conversations.find((x) => x.name === current)); }
1981
+ if (!DEVICE && home) void paintJobs();
1981
1982
  /* A start told step by step is asked about more often: its tool appears soon after its last step. */
1982
1983
  if (home) pollTimer = setTimeout(refresh, conversations.some(holds) || conversations.some((c) => c.machine) ? 1500 : conversations.some((c) => c.phase === 'building' || c.phase === 'moving' || c.phase === 'restarting') ? 2500 : 10000);
1983
1984
  }
1984
1985
 
1986
+ /* ---------- WHAT IT IS DOING (jobs.mjs, 14-11) ----------
1987
+ A badge by the list's title while something runs (« ● 2 under way »), or when one failed since the list
1988
+ was last opened (« ● 1 failed », red); nothing otherwise. Tapped: what runs, its step; then the day's ends,
1989
+ done or failed with why. A line opens its conversation. Read with the list, nothing asked of the machines. */
1990
+ let jobsNow = { running: [], done: [] };
1991
+ const JOBS_SEEN = 'clavarium.jobsSeen';
1992
+ const jobsSeen = () => { try { return localStorage.getItem(JOBS_SEEN) ?? ''; } catch { return ''; } };
1993
+ async function paintJobs() {
1994
+ try { const r = await fetch(`${API}/jobs`); if (!r.ok) return; jobsNow = await r.json(); } catch { return; }
1995
+ const failed = jobsNow.done.filter((j) => j.result === 'failed' && String(j.endedAt) > jobsSeen()).length;
1996
+ const n = jobsNow.running.length;
1997
+ /* Two places, one state: by the list's title, and in the bar of the conversation open (its list folded
1998
+ away, or a phone's, a screen of its own) -- shorter there, the bar is narrow. */
1999
+ for (const [id, words] of [['jobs-open', n ? `${n} under way` : `${failed} failed`], ['jobs-room', n ? String(n) : '!']]) {
2000
+ const badge = $(id);
2001
+ badge.hidden = !n && !failed;
2002
+ badge.dataset.tone = !n && failed ? 'bad' : '';
2003
+ badge.textContent = words;
2004
+ badge.title = n ? `Under way: ${jobsNow.running.map((j) => j.what).join(' · ')}` : 'Failed: tap to see what';
2005
+ badge.setAttribute('aria-label', n ? `${n} under way` : `${failed} failed`);
2006
+ }
2007
+ if (n || failed) $('back').dataset.jobs = n ? 'on' : 'bad'; else delete $('back').dataset.jobs;
2008
+ if (!$('jobs').hidden) paintJobsList();
2009
+ }
2010
+ function paintJobsList() {
2011
+ const line = (j, mark, result) => {
2012
+ const b = document.createElement('button'); b.type = 'button'; b.className = 'job'; b.dataset.result = result;
2013
+ const when = j.endedAt ? new Date(j.endedAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) : '';
2014
+ b.append(Object.assign(document.createElement('span'), { textContent: mark }), Object.assign(document.createElement('span'), { textContent: j.what }),
2015
+ Object.assign(document.createElement('small'), { textContent: result === 'running' ? (j.step || 'Starting') : [j.why, when].filter(Boolean).join(' · ') }));
2016
+ if (j.conversation && conversations.some((c) => c.name === j.conversation)) b.addEventListener('click', () => { closeJobs(); select(j.conversation, { step: true }); });
2017
+ else b.disabled = true;
2018
+ return b;
2019
+ };
2020
+ const head = (text) => Object.assign(document.createElement('h3'), { textContent: text });
2021
+ const parts = [];
2022
+ if (jobsNow.running.length) parts.push(head('Under way'), ...jobsNow.running.map((j) => line(j, '⟳', 'running')));
2023
+ if (jobsNow.done.length) parts.push(head('Today'), ...jobsNow.done.map((j) => line(j, j.result === 'done' ? '✓' : '✗', j.result === 'done' ? 'done' : 'failed')));
2024
+ if (!parts.length) parts.push(Object.assign(document.createElement('p'), { className: 'hint', textContent: 'Nothing under way.' }));
2025
+ $('jobs').replaceChildren(...parts);
2026
+ }
2027
+ function closeJobs() { $('jobs').hidden = true; for (const id of ['jobs-open', 'jobs-room']) $(id).setAttribute('aria-expanded', 'false'); }
2028
+ for (const id of ['jobs-open', 'jobs-room']) $(id).addEventListener('click', () => {
2029
+ if (!$('jobs').hidden) { closeJobs(); return; }
2030
+ paintJobsList();
2031
+ /* Under the badge tapped, kept within the screen. */
2032
+ const at = $(id).getBoundingClientRect(); const pop = $('jobs');
2033
+ pop.hidden = false;
2034
+ pop.style.top = `${Math.round(at.bottom + 6)}px`;
2035
+ pop.style.left = `${Math.round(Math.max(8, Math.min(at.left, window.innerWidth - pop.offsetWidth - 8)))}px`;
2036
+ $(id).setAttribute('aria-expanded', 'true');
2037
+ try { localStorage.setItem(JOBS_SEEN, new Date().toISOString()); } catch { /* kept for this visit only */ }
2038
+ if (!jobsNow.running.length) { $('jobs-open').hidden = true; $('jobs-room').hidden = true; delete $('back').dataset.jobs; }
2039
+ });
2040
+ document.addEventListener('click', (event) => { if (!$('jobs').hidden && !event.target.closest('#jobs, #jobs-open, #jobs-room')) closeJobs(); });
2041
+ /* Escape closes the list, and only it: never the conversation under it too (14-11: the page went to « No conversation »). */
2042
+ document.addEventListener('keydown', (event) => { if (event.key === 'Escape' && !$('jobs').hidden) { event.stopImmediatePropagation(); event.preventDefault(); closeJobs(); } }, true);
2043
+
1985
2044
  /* ---------- A NEW CONVERSATION: a page of its own, as Settings ----------
1986
2045
  "+ New" opens it beside the list (the whole screen on a phone), with an
1987
2046
  address of its own (?open=new); Back, Escape, Cancel and its "<" link
@@ -3387,8 +3446,12 @@
3387
3446
  box.hidden = !wanted;
3388
3447
  /* Where the tool talks through the app, the chat is the whole screen: one box to write in. */
3389
3448
  /* Its chat off, on this server's own page: said, with the button that turns it on (a device's page keeps the plain screen). */
3390
- const offer = !DEVICE && !wanted && !noTerminal();
3391
- $('simple-plain').hidden = wanted || offer;
3449
+ /* Not known yet -- the list not read, its chat not asked, or it is being built or moved: nothing said
3450
+ rather than a wrong screen (14-11: « chat is off », then « Its screen: connecting », then the chat). */
3451
+ const here = conversations.find((x) => x.name === current);
3452
+ const unknown = !DEVICE && (!here || here.phase !== 'ready' || talkOf !== current);
3453
+ const offer = !unknown && !DEVICE && !wanted && !noTerminal();
3454
+ $('simple-plain').hidden = wanted || offer || unknown;
3392
3455
  $('chat-turn').hidden = !offer;
3393
3456
  if (offer) {
3394
3457
  const possible = !(talkOf === current && talk.possible === false);
package/web/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  <link rel="stylesheet" href="/vendor/diff2html.css">
15
15
  <div id="app" data-place="conversations">
16
16
  <aside id="list" hidden>
17
- <div class="top"><b id="list-title" title="Conversations">Clavarium</b><span class="top-acts"><button type="button" id="list-pin" class="icon-btn" aria-pressed="false" aria-label="Keep the list open" title="Keep the list open: it no longer folds when a conversation is opened"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg></button><button type="button" id="install-top" class="icon-btn" hidden aria-label="Install as an app" title="Install as an app: its own icon, full screen, no browser bar"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/></svg></button><button type="button" id="search-open" class="icon-btn" aria-label="Search conversations" title="Search (/ or Ctrl+K)" aria-expanded="false" aria-controls="search"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg></button><button type="button" id="new" class="icon-btn new-btn" aria-label="New conversation" title="New conversation"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg></button></span></div>
17
+ <div class="top"><b id="list-title" title="Conversations">Clavarium</b><!-- WHAT IT IS DOING (jobs.mjs, 14-11): shown only while something runs, or failed unseen. --><button type="button" id="jobs-open" class="jobs-badge" hidden aria-expanded="false" aria-controls="jobs"></button><span class="top-acts"><button type="button" id="list-pin" class="icon-btn" aria-pressed="false" aria-label="Keep the list open" title="Keep the list open: it no longer folds when a conversation is opened"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg></button><button type="button" id="install-top" class="icon-btn" hidden aria-label="Install as an app" title="Install as an app: its own icon, full screen, no browser bar"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12"/><path d="m7 10 5 5 5-5"/><path d="M5 21h14"/></svg></button><button type="button" id="search-open" class="icon-btn" aria-label="Search conversations" title="Search (/ or Ctrl+K)" aria-expanded="false" aria-controls="search"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg></button><button type="button" id="new" class="icon-btn new-btn" aria-label="New conversation" title="New conversation"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14"/><path d="M5 12h14"/></svg></button></span></div>
18
18
  <!-- SEARCH, discreet: opened by the magnifier, "/" or Ctrl+K; filters as it is typed. -->
19
19
  <div id="search" role="search" hidden><input id="search-field" type="search" placeholder="Search" aria-label="Search conversations: name, folder, identifier, tool" autocomplete="off" spellcheck="false" maxlength="60" aria-controls="items"></div>
20
20
  <!-- Needs you and Recent: copies of rows of the list below, by when they were last used (app.js, paint). -->
@@ -46,6 +46,7 @@
46
46
  <button type="button" id="fold" aria-label="Hide the list of conversations" aria-pressed="false" title="Hide or show the list of conversations">&laquo;</button>
47
47
  <span id="state" data-state="connecting" role="status">connecting</span>
48
48
  <b id="name"></b>
49
+ <button type="button" id="jobs-room" class="jobs-badge jobs-room" hidden aria-expanded="false" aria-controls="jobs"></button>
49
50
  <!-- THE BAR: its chat, its terminal, what it was given, its binders (once it has one), its settings (G). -->
50
51
  <div id="views" class="views" role="group" aria-label="What to see">
51
52
  <button type="button" id="view-chat" aria-pressed="false" title="Its chat"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414 .586l-2.202 2.202A.71 .71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/></svg><span>Chat</span></button>
@@ -1499,6 +1500,7 @@
1499
1500
  <script src="/vendor/diff2html.js"></script>
1500
1501
  <script src="/gitgraph.js"></script>
1501
1502
  <script src="/links.js"></script>
1503
+ <div id="jobs" class="jobs-pop" role="dialog" aria-label="Under way" hidden></div>
1502
1504
  <script src="/features.js"></script>
1503
1505
  <script src="/kit.js"></script>
1504
1506
  <script src="/mail-view.js"></script>
package/web/style.css CHANGED
@@ -1425,6 +1425,23 @@ select.pill { appearance: auto; }
1425
1425
  /* ---------- the list: search, folders, moved by hand ---------- */
1426
1426
  #list .top-acts { display: flex; align-items: center; gap: 6px; }
1427
1427
  #list-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
1428
+ /* What it is doing (14-11): a small badge by the title, its list folded under it. */
1429
+ .jobs-badge { display: inline-flex; align-items: center; gap: 6px; flex: none; margin-left: 8px; margin-right: auto; padding: 2px 10px; min-height: 0; border: 1px solid var(--brass); border-radius: 999px; background: transparent; color: var(--brass-ink); font-size: .75rem; font-weight: 600; white-space: nowrap; }
1430
+ .jobs-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
1431
+ .jobs-room { margin: 0; padding: 2px 4px; gap: 4px; border-color: transparent; }
1432
+ /* A phone's bar has no room for it: a dot on its way back to the list, where the badge is. */
1433
+ @media (max-width: 480px) { .jobs-room { display: none !important; } }
1434
+ #back[data-jobs] { position: relative; }
1435
+ #back[data-jobs]::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brass); }
1436
+ #back[data-jobs="bad"]::after { background: var(--danger); }
1437
+ .jobs-badge[data-tone="bad"] { border-color: var(--danger); color: var(--danger); }
1438
+ .jobs-pop { position: fixed; z-index: 60; width: min(340px, calc(100vw - 16px)); max-height: 60vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgb(0 0 0 / .35); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
1439
+ .jobs-pop h3 { margin: 2px 0 0; font-size: .8125rem; }
1440
+ .jobs-pop .job { display: grid; grid-template-columns: 16px 1fr; gap: 2px 8px; text-align: left; background: transparent; border: 0; padding: 4px 0; color: var(--ink); font: inherit; font-size: .8125rem; cursor: pointer; }
1441
+ .jobs-pop .job small { grid-column: 2; color: var(--ink2); overflow-wrap: anywhere; }
1442
+ .jobs-pop .job[data-result="done"] > span:first-child { color: var(--ok); }
1443
+ .jobs-pop .job[data-result="failed"] { color: var(--danger); }
1444
+ .jobs-pop .hint { margin: 0; }
1428
1445
  .icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; background: transparent; border-color: transparent; color: var(--ink2); }
1429
1446
  .icon-btn:hover, .icon-btn[aria-expanded="true"] { color: inherit; border-color: var(--line); }
1430
1447
  .icon-btn .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }