clavarium 0.2.228-next.1 → 0.2.229-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.228-next.1",
3
+ "version": "0.2.229-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.228-next.1",
9
+ "version": "0.2.229-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.228-next.1",
3
+ "version": "0.2.229-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.",
@@ -310,7 +310,9 @@ export class Capacity {
310
310
  const f = this.#figures(await this.room({ fresh: true }).catch(() => null));
311
311
  if (!f) return [];
312
312
  const awake = new Set(this.#conversations.awake?.() ?? []);
313
- const holding = f.machines.filter((m) => m.name && !m.shelf && !awake.has(m.name) && m.rssMb >= RECLAIM_MIN_MB);
313
+ /* Only a machine put to sleep: one being built is not awake either, yet must never be touched. */
314
+ const asleep = this.#conversations.asleep ? new Set(this.#conversations.asleep()) : null;
315
+ const holding = f.machines.filter((m) => m.name && !m.shelf && !awake.has(m.name) && (!asleep || asleep.has(m.name)) && m.rssMb >= RECLAIM_MIN_MB);
314
316
  if (!holding.length) return [];
315
317
  const now = this.#now();
316
318
  const at = this.#store.get('reclaim')?.at ?? {};
@@ -1227,6 +1227,9 @@ export class Conversations {
1227
1227
 
1228
1228
  /* The conversations whose machine should be running: built, not asleep. */
1229
1229
  awake() { return this.#store.all().filter((c) => c.phase === 'ready' && c.asleep !== true).map((c) => c.name); }
1230
+ /* Put to sleep, and nothing else: not one being built (02-11: a reset machine was taken for a sleeper and
1231
+ suspended mid-build), not a failed one. */
1232
+ asleep() { return this.#store.all().filter((c) => c.phase === 'ready' && c.asleep === true).map((c) => c.name); }
1230
1233
 
1231
1234
  /* Whether the machine of a conversation runs right now. */
1232
1235
  async running(name) { return (await this.#vms.state(name)) === 'Running'; }