clavarium 0.2.96-next.1 → 0.2.97-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.
- package/deploy/clavarium-host +4 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/capacity.mjs +6 -3
- package/server/main.mjs +1 -1
package/deploy/clavarium-host
CHANGED
|
@@ -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
|
-
|
|
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
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.97-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.97-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/capacity.mjs
CHANGED
|
@@ -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)).
|
|
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();
|