clavarium 0.2.298-next.1 → 0.2.299-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 +14 -0
- package/server/main.mjs +5 -3
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.299-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.299-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
|
@@ -778,6 +778,20 @@ export class Conversations {
|
|
|
778
778
|
return { session: 'renewed' };
|
|
779
779
|
}
|
|
780
780
|
|
|
781
|
+
/* RESTARTS ONLY ITS TOOL (04-11), for a tool that asks to be restarted (to take up new tools): its
|
|
782
|
+
machine is not touched -- a whole-machine restart may not start again, and a tool has no need of
|
|
783
|
+
it. Its tmux is ended and the tool started again in its terminal (`ready`), taking up its last
|
|
784
|
+
session, as after any start. A machine that does not run is left as it is: its next opening starts
|
|
785
|
+
the tool anyway. Resolves with whether the tool was restarted. */
|
|
786
|
+
async restartTool(name) {
|
|
787
|
+
this.#busyCheck(name);
|
|
788
|
+
if ((await this.#vms.state(name).catch(() => undefined)) !== 'Running') return false;
|
|
789
|
+
this.drop(name);
|
|
790
|
+
await this.#vms.exec(name, ['tmux', '-L', SOCKET, 'kill-server'], { timeoutMs: 10_000 }).catch(() => {});
|
|
791
|
+
this.ready(name);
|
|
792
|
+
return true;
|
|
793
|
+
}
|
|
794
|
+
|
|
781
795
|
async #fixup(name, tool) {
|
|
782
796
|
for (const step of tool.fixups) {
|
|
783
797
|
const r = await this.#vms.exec(name, step.argv, { timeoutMs: 120_000 }).catch(() => ({ code: 1 }));
|
package/server/main.mjs
CHANGED
|
@@ -528,7 +528,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
528
528
|
try { if (talk.event(name, { kind: 'tools-updated', text: 'Tools updated: restart it to use them all. Its work picks up where it was.', topic: 'Tools', actions: ['restart'] })) toolbox.told(name); } catch { /* its chat is off */ }
|
|
529
529
|
}
|
|
530
530
|
});
|
|
531
|
-
/* A TOOL THAT ASKS TO BE RESTARTED (02-11: to take up its tools, after an update): restarted by this server
|
|
531
|
+
/* A TOOL THAT ASKS TO BE RESTARTED (02-11: to take up its tools, after an update): its tool restarted by this server
|
|
532
532
|
once its turn has ended (its pulse no longer busy), said in its chat; once per ten minutes at most. */
|
|
533
533
|
const restartedAt = new Map();
|
|
534
534
|
const restartTimer = setInterval(() => {
|
|
@@ -538,8 +538,10 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
538
538
|
talk.restartTaken(name);
|
|
539
539
|
if (Date.now() - (restartedAt.get(name) ?? 0) < 10 * 60_000) continue;
|
|
540
540
|
restartedAt.set(name, Date.now());
|
|
541
|
-
|
|
542
|
-
void all.
|
|
541
|
+
/* Its tool only, never its machine (04-11: a machine restarted so did not start again). */
|
|
542
|
+
void all.restartTool(name).then((done) => {
|
|
543
|
+
if (done) try { talk.event(name, { kind: 'restarted', text: 'Its tool was restarted as it asked: its work picks up where it was.', topic: 'Restarted' }); } catch { /* its chat is off */ }
|
|
544
|
+
}).catch(() => {});
|
|
543
545
|
}
|
|
544
546
|
}, 15_000); restartTimer.unref?.();
|
|
545
547
|
/* The health of each machine, and folders that came loose put back: see health.mjs. */
|