clavarium 0.2.518-next.1 → 0.2.520-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 +3 -1
- package/server/revive.mjs +6 -3
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.520-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.520-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
|
@@ -303,7 +303,7 @@ export class Conversations {
|
|
|
303
303
|
return this.#store.all().sort((a, b) => order.indexOf(a.name) - order.indexOf(b.name)).map((c) => {
|
|
304
304
|
const tool = this.#tools.find((t) => t.id === c.tool);
|
|
305
305
|
/* An AI tool has an instruction file; a shell has none: what is dictated there is never marked. */
|
|
306
|
-
return { ...c, ...(c.lentTo && !this.#borrowed.has(c.name) ? { lentTo: undefined } : {}), rank: order.indexOf(c.name), ...(c.group ? { groupRank: groups.indexOf(c.group) } : {}), toolLabel: tool?.label ?? c.tool, memoryMinMb: tool?.memoryMb, resumes: Boolean(tool?.resume), switches: canSwitch(tool), rights: Boolean(tool?.rights), ai: Boolean(tool?.instructions), voiceMark: Boolean(tool?.instructions) && c.voiceMark !== false, cpus: c.cpus ?? 1, hostCpus: availableParallelism() };
|
|
306
|
+
return { ...c, ...(c.lentTo && !this.#borrowed.has(c.name) ? { lentTo: undefined } : {}), rank: order.indexOf(c.name), ...(c.group ? { groupRank: groups.indexOf(c.group) } : {}), toolLabel: tool?.label ?? c.tool, memoryMinMb: tool?.memoryMb, resumes: Boolean(tool?.resume), switches: canSwitch(tool) && !c.sharedMachine, rights: Boolean(tool?.rights), ai: Boolean(tool?.instructions), voiceMark: Boolean(tool?.instructions) && c.voiceMark !== false, cpus: c.cpus ?? 1, hostCpus: availableParallelism() };
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
309
|
|
|
@@ -979,6 +979,8 @@ export class Conversations {
|
|
|
979
979
|
const target = this.#tools.find((t) => t.id === to);
|
|
980
980
|
if (typeof to !== 'string' || !target) throw new Refusal(400, 'This AI is not offered here.');
|
|
981
981
|
if (to === c.tool) throw new Refusal(409, `It already runs ${target.label}.`);
|
|
982
|
+
/* Not tried on a real shared machine yet (22-11): refused rather than promised. */
|
|
983
|
+
if (c.sharedMachine) throw new Refusal(409, 'Changing its AI needs its own machine.');
|
|
982
984
|
if (!canSwitch(from)) throw new Refusal(409, `${from?.label ?? c.tool} cannot be changed for another AI.`);
|
|
983
985
|
if (!canSwitch(target)) throw new Refusal(400, `A conversation cannot change to ${target.label}.`);
|
|
984
986
|
if (c.lentTo || this.#store.all().some((x) => x.copyOf === name && x.phase === 'building')) throw new Refusal(409, 'It is being copied: change its AI after.', { retry: true });
|
package/server/revive.mjs
CHANGED
|
@@ -45,7 +45,7 @@ export class Revive {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
wanted(name) { return this.#wanted.get(name)?.why ?? null; }
|
|
48
|
-
forget(name) { this.#wanted.delete(name); this.#lastAt.delete(name); }
|
|
48
|
+
forget(name) { this.#wanted.delete(name); this.#lastAt.delete(name); this.#lastAt.delete(`${name}\0machine`); }
|
|
49
49
|
|
|
50
50
|
/* One pass: each one wanted, restarted when it may be. Resolves with the names restarted. */
|
|
51
51
|
async tick() {
|
|
@@ -55,8 +55,11 @@ export class Revive {
|
|
|
55
55
|
const busy = (() => { try { return this.#busy(name); } catch { return false; } })();
|
|
56
56
|
if (busy && !(why !== 'asked' && this.#now() - since >= WAIT_MS)) continue;
|
|
57
57
|
this.#wanted.delete(name);
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
/* Its tool and its machine each have their own « not again » (23-11, on a real machine: a restart of its tool
|
|
59
|
+
held back for 30 min the restart of its machine, the only thing that could bring its folders back). */
|
|
60
|
+
const key = why === 'stuck' ? `${name}\0machine` : name;
|
|
61
|
+
if (this.#now() - (this.#lastAt.get(key) ?? -Infinity) < AGAIN_MS) continue;
|
|
62
|
+
this.#lastAt.set(key, this.#now());
|
|
60
63
|
this.#going.add(name);
|
|
61
64
|
try {
|
|
62
65
|
try { this.#tell(name, why, 'before'); } catch { /* told, nothing more */ }
|