clavarium 0.2.297-next.1 → 0.2.299-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.297-next.1",
3
+ "version": "0.2.299-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.297-next.1",
9
+ "version": "0.2.299-next.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.297-next.1",
3
+ "version": "0.2.299-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.",
@@ -778,6 +778,20 @@ export class Conversations {
778
778
  return { session: 'renewed' };
779
779
  }
780
780
 
781
+ /* RESTARTS ONLY ITS TOOL (04-11), for a tool that asks to be restarted (to take up new tools): its
782
+ machine is not touched -- a whole-machine restart may not start again, and a tool has no need of
783
+ it. Its tmux is ended and the tool started again in its terminal (`ready`), taking up its last
784
+ session, as after any start. A machine that does not run is left as it is: its next opening starts
785
+ the tool anyway. Resolves with whether the tool was restarted. */
786
+ async restartTool(name) {
787
+ this.#busyCheck(name);
788
+ if ((await this.#vms.state(name).catch(() => undefined)) !== 'Running') return false;
789
+ this.drop(name);
790
+ await this.#vms.exec(name, ['tmux', '-L', SOCKET, 'kill-server'], { timeoutMs: 10_000 }).catch(() => {});
791
+ this.ready(name);
792
+ return true;
793
+ }
794
+
781
795
  async #fixup(name, tool) {
782
796
  for (const step of tool.fixups) {
783
797
  const r = await this.#vms.exec(name, step.argv, { timeoutMs: 120_000 }).catch(() => ({ code: 1 }));
package/server/main.mjs CHANGED
@@ -528,7 +528,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
528
528
  try { if (talk.event(name, { kind: 'tools-updated', text: 'Tools updated: restart it to use them all. Its work picks up where it was.', topic: 'Tools', actions: ['restart'] })) toolbox.told(name); } catch { /* its chat is off */ }
529
529
  }
530
530
  });
531
- /* A TOOL THAT ASKS TO BE RESTARTED (02-11: to take up its tools, after an update): restarted by this server
531
+ /* A TOOL THAT ASKS TO BE RESTARTED (02-11: to take up its tools, after an update): its tool restarted by this server
532
532
  once its turn has ended (its pulse no longer busy), said in its chat; once per ten minutes at most. */
533
533
  const restartedAt = new Map();
534
534
  const restartTimer = setInterval(() => {
@@ -538,8 +538,10 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
538
538
  talk.restartTaken(name);
539
539
  if (Date.now() - (restartedAt.get(name) ?? 0) < 10 * 60_000) continue;
540
540
  restartedAt.set(name, Date.now());
541
- try { talk.event(name, { kind: 'restarted', text: 'Restarted as it asked: its work picks up where it was.', topic: 'Restarted' }); } catch { /* its chat is off */ }
542
- void all.restart(name).catch(() => {});
541
+ /* Its tool only, never its machine (04-11: a machine restarted so did not start again). */
542
+ void all.restartTool(name).then((done) => {
543
+ if (done) try { talk.event(name, { kind: 'restarted', text: 'Its tool was restarted as it asked: its work picks up where it was.', topic: 'Restarted' }); } catch { /* its chat is off */ }
544
+ }).catch(() => {});
543
545
  }
544
546
  }, 15_000); restartTimer.unref?.();
545
547
  /* The health of each machine, and folders that came loose put back: see health.mjs. */
package/web/app.js CHANGED
@@ -411,7 +411,7 @@
411
411
  conversation: Chat, Terminal, Assets, Binders, its settings; a room: its settings; the others: their own
412
412
  controls). Built once here from each page's top line: the same element, the same looks, the same place. */
413
413
  function topBar(top, { state = null } = {}) {
414
- const bar = document.createElement('header'); bar.className = 'topbar';
414
+ const bar = document.createElement('header'); bar.className = ['topbar', ...[...top.classList].filter((c) => c !== 'panel-top')].join(' ');
415
415
  const fold = document.createElement('button'); fold.type = 'button'; fold.className = 'fold-here'; fold.title = 'Hide or show the list of conversations';
416
416
  fold.addEventListener('click', () => $('fold').click());
417
417
  bar.append(fold);
package/web/style.css CHANGED
@@ -1748,7 +1748,7 @@ details.more[open] > summary { margin-bottom: 4px; }
1748
1748
  #settings .chapter-group { margin: 10px 4px 0; font-size: .6875rem; letter-spacing: .06em; }
1749
1749
  @media (min-width: 1000px) {
1750
1750
  #settings { display: grid; grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; column-gap: 20px; }
1751
- #settings > .panel-top { grid-column: 1 / -1; }
1751
+ #settings > :is(.panel-top, header.topbar) { grid-column: 1 / -1; }
1752
1752
  .settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: start; }
1753
1753
  .settings-nav button { text-align: left; background: none; border: 0; color: var(--ink2); padding: 9px 10px; border-radius: 8px; font-size: .875rem; }
1754
1754
  .settings-nav button[aria-current="true"] { background: var(--button, #222c38); color: var(--ink); box-shadow: inset 3px 0 0 var(--brass); }