clavarium 0.2.416-next.1 → 0.2.417-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/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/conversations.mjs +8 -3
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.417-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.417-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/conversations.mjs
CHANGED
|
@@ -993,7 +993,8 @@ export class Conversations {
|
|
|
993
993
|
if (memory > size) throw new Refusal(400, `The machine ${machine} has ${size} MB of memory: ${tool.label} needs ${tool.memoryMb} MB.`);
|
|
994
994
|
const state = await this.#vms.state(name, { fresh: true }).catch(() => undefined);
|
|
995
995
|
if (tool.state && state !== 'Running') throw new Refusal(409, 'Its machine is not running: open the conversation first, so that its tool\'s state can come along.', { retry: false });
|
|
996
|
-
|
|
996
|
+
/* A new shared machine takes its size; its own, running, is stopped before it starts: that memory is given back. */
|
|
997
|
+
if (there === undefined) await this.room({ kind: 'create', memoryMb: Math.max(0, size - (state === 'Running' ? Number(c.memoryMb) || 0 : 0)) });
|
|
997
998
|
const act = this.#take(name, 'move');
|
|
998
999
|
this.#cancelStop(name);
|
|
999
1000
|
const now = new Date().toISOString();
|
|
@@ -1040,13 +1041,16 @@ export class Conversations {
|
|
|
1040
1041
|
return back(`${why.replace(/\.?$/, '.')}`);
|
|
1041
1042
|
}
|
|
1042
1043
|
if (tool.state) {
|
|
1043
|
-
|
|
1044
|
+
/* Not opened while its state is put back: building still, to the end. */
|
|
1045
|
+
this.#store.patch(name, { phase: 'building', step: `Putting ${tool.label}'s state back` });
|
|
1044
1046
|
this.drop(name);
|
|
1045
1047
|
try { await this.#unpack(name, c.tool, createReadStream(carried)); } catch (error) {
|
|
1048
|
+
this.#store.patch(name, { phase: 'ready', step: undefined });
|
|
1046
1049
|
this.ready(name);
|
|
1047
1050
|
this.renewed(name, `Moved to the shared machine ${machine}, but ${tool.label}'s state did not come along (${error.message}): it starts afresh. Its old machine is kept, stopped.`, true);
|
|
1048
1051
|
return undefined;
|
|
1049
1052
|
}
|
|
1053
|
+
this.#store.patch(name, { phase: 'ready', step: undefined });
|
|
1050
1054
|
this.ready(name);
|
|
1051
1055
|
}
|
|
1052
1056
|
await this.#vms.removeVm(old).catch(() => {});
|
|
@@ -1213,7 +1217,8 @@ export class Conversations {
|
|
|
1213
1217
|
|
|
1214
1218
|
/* What the VM manager says the machine has, written in its record. */
|
|
1215
1219
|
async reconcile(name) {
|
|
1216
|
-
|
|
1220
|
+
/* In a shared machine (#221): what the machine has is the machine's; its memory is its own limit there. */
|
|
1221
|
+
if (!this.#store.get(name) || this.#store.get(name).sharedMachine) return;
|
|
1217
1222
|
const real = await this.#vms.size(name).catch(() => ({}));
|
|
1218
1223
|
const patch = {};
|
|
1219
1224
|
if (real.memoryMb !== undefined && real.memoryMb !== this.#store.get(name).memoryMb) patch.memoryMb = real.memoryMb;
|