clavarium 0.2.96-next.1 → 0.2.98-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.
@@ -820,11 +820,12 @@ case "$AREA $VERB" in
820
820
  "if it still does: $MULTIPASS stop $1 (free it; it wakes by a boot)"
821
821
  exit 0
822
822
  fi
823
- vm_freed "$1" && exit 0
823
+ # Each step that frees the RAM says how, so the server can tell the owner.
824
+ vm_freed "$1" && { echo "freed-already"; exit 0; }
824
825
  "$MULTIPASS" start "$1" >/dev/null 2>&1 && "$MULTIPASS" suspend "$1" >/dev/null 2>&1
825
- vm_freed "$1" && exit 0
826
+ vm_freed "$1" && { echo "freed-resleep"; exit 0; }
826
827
  "$MULTIPASS" stop "$1" >/dev/null 2>&1 || true
827
- vm_freed "$1" && exit 0
828
+ vm_freed "$1" && { echo "freed-stop"; exit 0; }
828
829
  refuse "could not free $1's memory (its qemu stayed); the VM manager likely needs a restart" ;;
829
830
  "vm kill")
830
831
  # A stop that does not wait for the system inside: asked only after a
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.96-next.1",
3
+ "version": "0.2.98-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.96-next.1",
9
+ "version": "0.2.98-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
- "clavarium-binder": "0.1.8-next.1",
14
+ "clavarium-binder": "0.1.12-next.1",
15
15
  "clavarium-docket": "0.1.1",
16
16
  "clavarium-parley": "0.17.11-next.1",
17
- "clavarium-tether": "0.1.0-next.22",
17
+ "clavarium-tether": "0.1.0-next.23",
18
18
  "mermaid": "11.17.2",
19
19
  "node-pty": "^1.1.0",
20
20
  "pdfjs-dist": "6.4.299",
@@ -716,9 +716,9 @@
716
716
  }
717
717
  },
718
718
  "node_modules/clavarium-binder": {
719
- "version": "0.1.8-next.1",
720
- "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.8-next.1.tgz",
721
- "integrity": "sha512-0ZvTgn4z3IzLWjVyt5H82tnrE4g4Zdh0eb0kKrpVYjJ8vEfun6CmzHFclce9lb7vH+CC5ozKETuTAmSVYkk+lg==",
719
+ "version": "0.1.12-next.1",
720
+ "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.12-next.1.tgz",
721
+ "integrity": "sha512-V/+nRPEVjD9alhZqHqqFEyIVj17jhMyUtOSVD3TzwnITWg7TpvS+KCkgGoJek7XBd4ZooOlkaAFlLU8vzVMSVw==",
722
722
  "license": "MIT",
723
723
  "bin": {
724
724
  "binder": "bin/binder.mjs",
@@ -755,9 +755,9 @@
755
755
  }
756
756
  },
757
757
  "node_modules/clavarium-tether": {
758
- "version": "0.1.0-next.22",
759
- "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.22.tgz",
760
- "integrity": "sha512-s2CNPr1kPF+vYdK6+YiJ3/NyKR20k6wtOZvrNzQnjvwxI27SkRgbkyIVsEiccvEUp/5fYXXePGIDg4e36y5u0Q==",
758
+ "version": "0.1.0-next.23",
759
+ "resolved": "https://registry.npmjs.org/clavarium-tether/-/clavarium-tether-0.1.0-next.23.tgz",
760
+ "integrity": "sha512-/Ke9LtsbVElZxQ53n9bkcfwODYQeNOmG62JTyW4rLmFVWcgvVgsN41HbhF+WWBwhP3/zU+/NexXsSkefnGbR7w==",
761
761
  "license": "MIT",
762
762
  "bin": {
763
763
  "tether": "bin/cli.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.96-next.1",
3
+ "version": "0.2.98-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.",
@@ -44,10 +44,10 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-binder": "0.1.8-next.1",
47
+ "clavarium-binder": "0.1.12-next.1",
48
48
  "clavarium-docket": "0.1.1",
49
49
  "clavarium-parley": "0.17.11-next.1",
50
- "clavarium-tether": "0.1.0-next.22",
50
+ "clavarium-tether": "0.1.0-next.23",
51
51
  "mermaid": "11.17.2",
52
52
  "node-pty": "^1.1.0",
53
53
  "pdfjs-dist": "6.4.299",
@@ -320,14 +320,17 @@ export class Capacity {
320
320
  at[m.name] = now;
321
321
  this.#store.put({ name: 'reclaim', at });
322
322
  const held = m.rssMb;
323
- await Promise.resolve(this.#reclaim(m.name)).catch(() => {});
323
+ const how = await Promise.resolve(this.#reclaim(m.name)).then((x) => String(x || ''), () => '');
324
+ const by = how.includes('resleep') ? ' by waking it and putting it back to sleep'
325
+ : how.includes('stop') ? ' with a clean stop (it will boot when you open it)'
326
+ : '';
324
327
  const after = this.#figures(await this.room({ fresh: true }).catch(() => null));
325
328
  const freed = !after?.machines.some((x) => x.name === m.name && !awake.has(x.name) && x.rssMb >= RECLAIM_MIN_MB);
326
329
  this.#alert?.(freed
327
- ? { title: "Reclaimed a sleeping machine's memory", body: `${m.name} was asleep but still held ${gb(held)} (its sleep had not freed it); its memory was reclaimed.`, url: '/?open=settings&at=resources' }
330
+ ? { title: "Reclaimed a sleeping machine's memory", body: `${m.name} was asleep but still held ${gb(held)} (its sleep had not freed it); its memory was reclaimed${by}.`, url: '/?open=settings&at=resources' }
328
331
  : { title: 'A sleeping machine still holds memory', body: `${m.name} was asleep but still held ${gb(held)} and could not be freed; the VM manager may need a restart.`, url: '/?open=settings&at=resources' });
329
332
  this.#say?.(m.name, freed
330
- ? `This machine was asleep but still held ${gb(held)} of memory (its sleep had not freed it). Its memory was reclaimed; it still wakes when you open it.`
333
+ ? `This machine was asleep but still held ${gb(held)} of memory (its sleep had not freed it). Its memory was reclaimed${by}; it still wakes when you open it.`
331
334
  : `This machine was asleep but still held ${gb(held)} of memory, and it could not be freed automatically — the VM manager may need a restart.`);
332
335
  done.push({ name: m.name, heldMb: held, freed });
333
336
  }
package/server/main.mjs CHANGED
@@ -525,7 +525,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
525
525
  /* Under the reserve: the machine that takes the most put to sleep, the owner told, and its chat. */
526
526
  sleep: (name) => { events.add({ kind: 'machine', text: `Machine of ${name} put to sleep: this server was short of room`, conversation: name }); return all.sleep(name); }, alert: (payload) => { events.add({ kind: 'server', text: `${payload.title}: ${payload.body ?? ''}`.trim() }); void alerts.tell(payload); },
527
527
  /* A machine asleep but still holding its RAM (a suspend that did not free it): its memory reclaimed, only that machine touched. */
528
- reclaim: (name) => { events.add({ kind: 'machine', text: `Machine of ${name}: memory reclaimed (it was asleep but still held RAM)`, conversation: name }); return vms.reclaim(name); },
528
+ reclaim: (name) => { events.add({ kind: 'machine', text: `Machine of ${name}: memory reclaimed (it was asleep but still held RAM)`, conversation: name }); return vms.reclaim(name).then((r) => (r.stdout || '').trim()); },
529
529
  say: (name, text) => { try { talk.event(name, { kind: 'machine-problem', text, tone: 'warn', topic: 'Machine' }); } catch { /* its chat may be off */ } } });
530
530
  all.room = (ask) => capacity.check(ask);
531
531
  const stopWatch = capacity.start();