clavarium 0.2.262-next.1 → 0.2.263-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/guide.mjs +2 -0
- package/server/main.mjs +15 -1
- package/server/talk.mjs +10 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.263-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.263-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/guide.mjs
CHANGED
|
@@ -121,6 +121,8 @@ export function ownText({ name, tool, workKept, resources = [], chat, online, se
|
|
|
121
121
|
if (chat) out.push('- The chat shows Markdown (lists, tables, "> [!IMPORTANT]") and pictures of /work: .');
|
|
122
122
|
/* The thread is kept whole: after a restart, its end is read, and further back on demand. */
|
|
123
123
|
if (chat && reread) out.push(`- After a restart: ${plain(reread, 60)}, the end of the chat; it says how to read further back.`);
|
|
124
|
+
/* 02-11: the one command a tool may ask of the server. */
|
|
125
|
+
if (chat) out.push('- To be restarted (new tools to take up, or anything stuck): finish what runs, then `touch /work/.parley/restart-asked`; the server restarts you once your turn ends, and your work picks up where it was.');
|
|
124
126
|
/* Its docket (dockets.mjs): what wakes it waits there until it says done or failed. */
|
|
125
127
|
if (chat) out.push('- What wakes you (a file arrived, the clock, a call) waits in your docket: when told "run docket", run it, do each, then docket done ID or docket failed ID "why". To be reminded later: docket remind --at "2026-10-23 09:00" (or --in 2h, --cron "0 9 * * 1") "what for". docket --help says all.');
|
|
126
128
|
/* Its lists (binders.mjs): kept on the server, asked for through .binder; a person approves. */
|
package/server/main.mjs
CHANGED
|
@@ -524,6 +524,20 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
524
524
|
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 */ }
|
|
525
525
|
}
|
|
526
526
|
});
|
|
527
|
+
/* A TOOL THAT ASKS TO BE RESTARTED (02-11: to take up its tools, after an update): restarted by this server
|
|
528
|
+
once its turn has ended (its pulse no longer busy), said in its chat; once per ten minutes at most. */
|
|
529
|
+
const restartedAt = new Map();
|
|
530
|
+
const restartTimer = setInterval(() => {
|
|
531
|
+
for (const name of all.awake()) {
|
|
532
|
+
if (!talk.restartAsked(name)) continue;
|
|
533
|
+
if (talk.pulse(name)?.busy) continue;
|
|
534
|
+
talk.restartTaken(name);
|
|
535
|
+
if (Date.now() - (restartedAt.get(name) ?? 0) < 10 * 60_000) continue;
|
|
536
|
+
restartedAt.set(name, Date.now());
|
|
537
|
+
try { talk.event(name, { kind: 'restarted', text: 'Restarted as it asked: its work picks up where it was.', topic: 'Restarted' }); } catch { /* its chat is off */ }
|
|
538
|
+
void all.restart(name).catch(() => {});
|
|
539
|
+
}
|
|
540
|
+
}, 15_000); restartTimer.unref?.();
|
|
527
541
|
/* The health of each machine, and folders that came loose put back: see health.mjs. */
|
|
528
542
|
const health = new Health({ vms, conversations: all, resources: folders, seen: new Store(`${dataDir}/health-seen.json`), ...(healthSettleMs === undefined ? {} : { settleMs: healthSettleMs }) });
|
|
529
543
|
const stopHealth = health.start(healthEveryMs);
|
|
@@ -625,7 +639,7 @@ export async function startHome({ port, host, dataDir, mntDir = dataDir, gitRese
|
|
|
625
639
|
speak: (text) => speech.speak(text),
|
|
626
640
|
log: (line) => events.add({ kind: 'server', text: line }) });
|
|
627
641
|
const { server, listening } = serve(port, all, folders, { gate, originOk, shortcuts, voice, sharing, door, secrets, network, signin, mailboxes, gitReview, platform, answerer, wakeups, alerts, talk, gitAccess, gitKeeper, shelf, health, setup, guide, capacity, updates, instance, certificate, team, reacting, machinesMove, serverLogs, history, events, wifi, binders, meshcentral, tethers, accounts, groups, boxes, bundles: new Bundles({ dir: `${dataDir}/imports`, folder: (name) => folders.folder(name) }), repair: (name) => repairTerminal(name) });
|
|
628
|
-
server.on('close', () => { closing = true; stopBinders(); stopTethers(); clearInterval(historyTimer); clearInterval(secretsTimer); history.save(); stopVmWatch(); stopShelf(); stopHealth(); stopUpdates(); stopWatch(); clearInterval(mailTimer); clearInterval(expiryTimer); clearInterval(answerTimer); clearInterval(wakeTimer); clearInterval(docketTimer); dockets.stop(); clearInterval(gitTimer); talk.stop(); });
|
|
642
|
+
server.on('close', () => { closing = true; stopBinders(); stopTethers(); clearInterval(historyTimer); clearInterval(secretsTimer); history.save(); stopVmWatch(); stopShelf(); stopHealth(); stopUpdates(); stopWatch(); clearInterval(mailTimer); clearInterval(restartTimer); clearInterval(expiryTimer); clearInterval(answerTimer); clearInterval(wakeTimer); clearInterval(docketTimer); dockets.stop(); clearInterval(gitTimer); talk.stop(); });
|
|
629
643
|
let closing = false;
|
|
630
644
|
boxes.attach(server, WebSocketServer);
|
|
631
645
|
for (const c of all.list()) talk.speakers(c.name, boxes.speakersOf(c.name));
|
package/server/talk.mjs
CHANGED
|
@@ -140,6 +140,8 @@ export const SYSTEM_MAX = 50;
|
|
|
140
140
|
branch: the owner allowed each one. The owner may move a kind to another
|
|
141
141
|
level (Settings); nothing else of a line changes with it. */
|
|
142
142
|
export const LEVELS = Object.freeze(['needs-you', 'news', 'trace']);
|
|
143
|
+
/* The file a tool puts beside its chat to be restarted (see restartAsked). */
|
|
144
|
+
export const RESTART_ASKED = 'restart-asked';
|
|
143
145
|
export const EVENT_LEVELS = Object.freeze({
|
|
144
146
|
sent: 'news',
|
|
145
147
|
refused: 'needs-you',
|
|
@@ -384,6 +386,14 @@ export class Talk {
|
|
|
384
386
|
/* Is its chat on? (cheap: the record alone) */
|
|
385
387
|
isOn(name) { return this.#store.get(name)?.on === true; }
|
|
386
388
|
|
|
389
|
+
/* ITS TOOL ASKS TO BE RESTARTED (02-11): a file it puts in its chat's folder (RESTART_ASKED); the server
|
|
390
|
+
restarts it once its turn has ended -- the one command a tool may ask of the server, nothing typed. */
|
|
391
|
+
restartAsked(name) {
|
|
392
|
+
if (this.#store.get(name)?.on !== true) return false;
|
|
393
|
+
try { return lstatSync(join(this.#dir(name), RESTART_ASKED), { throwIfNoEntry: false })?.isFile() === true; } catch { return false; }
|
|
394
|
+
}
|
|
395
|
+
restartTaken(name) { try { rmSync(join(this.#dir(name), RESTART_ASKED), { force: true }); } catch { /* gone already */ } }
|
|
396
|
+
|
|
387
397
|
/* Its tool's pulse (Parley): { busy, at }, or null. Where the chat is off: null. */
|
|
388
398
|
pulse(name) {
|
|
389
399
|
if (this.#store.get(name)?.on !== true) return null;
|