clavarium 0.2.453-next.1 → 0.2.454-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/main.mjs +5 -0
- package/server/talk.mjs +13 -2
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.454-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.454-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/main.mjs
CHANGED
|
@@ -566,6 +566,11 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
566
566
|
alert: (payload) => { void alerts.tell(payload); } });
|
|
567
567
|
/* Its machine restarted or built again: said in its chat, and the tool told to read it again. */
|
|
568
568
|
all.renewed = (name, text, running) => talk.renewed(name, text, running);
|
|
569
|
+
/* Restarted with nothing written since (15-11): its docket tells it, once its tool is ready and free. */
|
|
570
|
+
talk.restarted = (name, why) => {
|
|
571
|
+
if (!dockets.on(name)) return false;
|
|
572
|
+
try { dockets.post(name, { kind: 'restarted', text: `Your machine was restarted${why ? ` (${String(why).replace(/\.$/, '')})` : ''}. What ran in the background stopped with it: pick up where you were.` }); return true; } catch { return false; }
|
|
573
|
+
};
|
|
569
574
|
/* What an owner did to a machine (start, stop, sleep, force, restart): in the journal, and a line in its chat. */
|
|
570
575
|
all.machineSaid = (name, text, ok, chat) => {
|
|
571
576
|
events.add({ kind: 'machine', text: `Machine of ${name}: ${text}`, conversation: name });
|
package/server/talk.mjs
CHANGED
|
@@ -705,12 +705,15 @@ export class Talk {
|
|
|
705
705
|
/* Its machine was restarted, or built again (conversations.mjs): said in
|
|
706
706
|
the thread, and, the tool having started again with nothing of the
|
|
707
707
|
chat in mind, REREAD is typed with the person's next message (never alone). */
|
|
708
|
+
/* Set by the server (15-11): its machine restarted and nothing written since -- posted to its docket, which
|
|
709
|
+
tells it once it is free. (name, why) -> whether it was posted. */
|
|
710
|
+
restarted = null;
|
|
708
711
|
renewed(name, text, started = true) {
|
|
709
712
|
const r = this.#store.get(name);
|
|
710
713
|
if (r?.on !== true) return;
|
|
711
714
|
if (text) this.event(name, started ? { kind: 'restarted', text, topic: 'Restarted' } : { kind: 'machine-problem', text, tone: 'bad', topic: 'Machine', actions: ['restart', 'terminal'] });
|
|
712
715
|
if (started) {
|
|
713
|
-
this.#store.put({ ...this.#store.get(name), reread: true });
|
|
716
|
+
this.#store.put({ ...this.#store.get(name), reread: true, renewedText: text || undefined });
|
|
714
717
|
this.#nextTry.set(`reread:${name}`, this.#now() + this.#rereadAfter);
|
|
715
718
|
}
|
|
716
719
|
}
|
|
@@ -723,7 +726,10 @@ export class Talk {
|
|
|
723
726
|
/* Typed only when the person has written since: a line typed while the tool
|
|
724
727
|
reloads a long session after a restart sat in its input box, never sent
|
|
725
728
|
(seen on a real deployment). By then the tool has long been ready. */
|
|
726
|
-
|
|
729
|
+
/* Nothing written since (15-11, its owner's ask): its docket says it was restarted instead -- once its
|
|
730
|
+
tool is ready, as below -- and the docket tells it when it is free; never a line typed into a reload. */
|
|
731
|
+
const told = this.#parley(name).unread() === 0;
|
|
732
|
+
if (told && typeof this.restarted !== 'function') return later(RETRY_MS);
|
|
727
733
|
if (!this.#conversations.awake().includes(name)) return later(RETRY_MS);
|
|
728
734
|
const quiet = this.#now() - (this.#typedAt.get(name) ?? 0);
|
|
729
735
|
if (quiet < TYPING_QUIET_MS) return later(TYPING_QUIET_MS - quiet + 100);
|
|
@@ -736,6 +742,11 @@ export class Talk {
|
|
|
736
742
|
if (wait > 0) return later(wait + 100);
|
|
737
743
|
}
|
|
738
744
|
}
|
|
745
|
+
if (told) {
|
|
746
|
+
if (!this.restarted(name, r.renewedText ?? '')) return later(RETRY_MS);
|
|
747
|
+
this.#store.put({ ...this.#store.get(name), reread: false, renewedText: undefined });
|
|
748
|
+
return 'told';
|
|
749
|
+
}
|
|
739
750
|
if (!(await this.#type(name, this.rereadLine()).catch(() => false))) return later(RETRY_MS);
|
|
740
751
|
/* Reading the whole thread, it reads what waits too: that line is not typed after it. */
|
|
741
752
|
const waits = this.#parley(name).unread() > 0;
|