clavarium 0.2.40-next.1 → 0.2.41-beta.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/deploy/clavarium-host +10 -2
- package/deploy/updater.mjs +10 -6
- package/npm-shrinkwrap.json +10 -10
- package/package.json +3 -3
- package/server/conversations.mjs +18 -3
- package/server/vm.mjs +4 -2
- package/web/app.js +34 -7
- package/web/index.html +16 -2
- package/web/links.js +19 -5
- package/web/style.css +11 -0
package/deploy/clavarium-host
CHANGED
|
@@ -724,8 +724,16 @@ AREA="$1"; VERB="$2"; shift 2
|
|
|
724
724
|
|
|
725
725
|
case "$AREA $VERB" in
|
|
726
726
|
"vm launch")
|
|
727
|
-
|
|
728
|
-
|
|
727
|
+
# <vm> <memory> [<disk-gigabytes> <cores>]: the size chosen at creation;
|
|
728
|
+
# without the last two, the defaults (DISK, one core).
|
|
729
|
+
[ $# -eq 2 ] || [ $# -eq 4 ] || usage; vm_of "$1"; memory_ok "$2"
|
|
730
|
+
disk="$DISK"; cores=1
|
|
731
|
+
if [ $# -eq 4 ]; then
|
|
732
|
+
[[ "$3" =~ ^[0-9]{1,4}$ ]] && [ "$3" -ge 5 ] && [ "$3" -le "$DISK_MAX_GB" ] || refuse "disk out of bounds: $3"
|
|
733
|
+
[[ "$4" =~ ^[0-9]{1,3}$ ]] && [ "$4" -ge 1 ] && [ "$4" -le "$(nproc)" ] || refuse "cores out of bounds: $4 (the host has $(nproc))"
|
|
734
|
+
disk="${3}G"; cores="$4"
|
|
735
|
+
fi
|
|
736
|
+
run "$MULTIPASS" launch "$IMAGE" --name "$1" --memory "${2}M" --disk "$disk" --cpus "$cores" --timeout "$LAUNCH_SECONDS" ;;
|
|
729
737
|
"vm clone")
|
|
730
738
|
# <shelf> <vm> <memory>: a conversation's machine, copied from the
|
|
731
739
|
# ready-made one (which must be stopped: Multipass refuses otherwise).
|
package/deploy/updater.mjs
CHANGED
|
@@ -274,7 +274,7 @@ export class Updater {
|
|
|
274
274
|
this.restart = restart ?? (() => this.#restart());
|
|
275
275
|
/* What was seen when the server did not come up: its journal, its unit, who holds its port. */
|
|
276
276
|
this.diagnose = diagnose ?? (() => this.#diagnose());
|
|
277
|
-
this.health = health ?? ((release) => this.#health(release));
|
|
277
|
+
this.health = health ?? ((release, opts) => this.#health(release, opts));
|
|
278
278
|
this.backup = backup ?? ((app) => this.#backup(app));
|
|
279
279
|
this.restoreData = restoreData ?? ((app, archive) => this.#restoreData(app, archive));
|
|
280
280
|
this.installPrivileged = installPrivileged ?? ((app) => this.#installPrivileged(app));
|
|
@@ -606,13 +606,16 @@ export class Updater {
|
|
|
606
606
|
await this.installPrivileged(release.app);
|
|
607
607
|
} catch (error) { return `it could not be put in place: ${error.message}`; }
|
|
608
608
|
this.#step(action, version, 'Restarting');
|
|
609
|
-
|
|
609
|
+
/* Once the new server answers, the maintenance page is gone but a minute or two of
|
|
610
|
+
watching that it stays up is left: said as "Confirming", not "Restarting", so a page
|
|
611
|
+
back up does not look stuck restarting (deploy/updater.mjs, #health onUp). */
|
|
612
|
+
return this.#restartAndCheck(release, () => this.#step(action, version, 'Confirming'));
|
|
610
613
|
}
|
|
611
614
|
/* '' when it came up, or why not. */
|
|
612
|
-
async #restartAndCheck(release) {
|
|
615
|
+
async #restartAndCheck(release, onUp) {
|
|
613
616
|
const r = await this.restart().catch((e) => ({ code: 1, stderr: e.message }));
|
|
614
617
|
if (r?.code) return `the server did not restart: ${lastLine(r)}`;
|
|
615
|
-
const h = await this.health(release).catch((e) => e.message || 'no answer');
|
|
618
|
+
const h = await this.health(release, { onUp }).catch((e) => e.message || 'no answer');
|
|
616
619
|
return h || '';
|
|
617
620
|
}
|
|
618
621
|
|
|
@@ -802,7 +805,7 @@ export class Updater {
|
|
|
802
805
|
|
|
803
806
|
/* Comes up (answers, from this release) within healthMs, then STAYS up: watched until watchMs after
|
|
804
807
|
the restart; one restart by systemd is forgiven if it answers at the end, not two. */
|
|
805
|
-
async #health(release) {
|
|
808
|
+
async #health(release, { onUp } = {}) {
|
|
806
809
|
const { clock, sleep } = this.#o;
|
|
807
810
|
const start = clock();
|
|
808
811
|
const target = realpathSync(release.dir);
|
|
@@ -820,7 +823,8 @@ export class Updater {
|
|
|
820
823
|
if (clock() - start > this.#o.healthMs) return said;
|
|
821
824
|
await sleep(1000);
|
|
822
825
|
}
|
|
823
|
-
/*
|
|
826
|
+
/* It answers, from this release: the maintenance page gives way. Now it must stay up. */
|
|
827
|
+
onUp?.();
|
|
824
828
|
const until = Math.max(start + this.#o.watchMs, clock() + this.#o.settleMs);
|
|
825
829
|
let restarts = 0;
|
|
826
830
|
while (clock() < until) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.41-beta.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.41-beta.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
13
13
|
"@xterm/xterm": "^6.0.0",
|
|
14
|
-
"clavarium-binder": "0.1.
|
|
14
|
+
"clavarium-binder": "0.1.8-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.1",
|
|
16
|
-
"clavarium-parley": "0.17.
|
|
16
|
+
"clavarium-parley": "0.17.4-next.1",
|
|
17
17
|
"mermaid": "11.17.2",
|
|
18
18
|
"node-pty": "^1.1.0",
|
|
19
19
|
"pdfjs-dist": "6.4.299",
|
|
@@ -688,9 +688,9 @@
|
|
|
688
688
|
}
|
|
689
689
|
},
|
|
690
690
|
"node_modules/clavarium-binder": {
|
|
691
|
-
"version": "0.1.
|
|
692
|
-
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.
|
|
693
|
-
"integrity": "sha512-
|
|
691
|
+
"version": "0.1.8-next.1",
|
|
692
|
+
"resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.8-next.1.tgz",
|
|
693
|
+
"integrity": "sha512-0ZvTgn4z3IzLWjVyt5H82tnrE4g4Zdh0eb0kKrpVYjJ8vEfun6CmzHFclce9lb7vH+CC5ozKETuTAmSVYkk+lg==",
|
|
694
694
|
"license": "MIT",
|
|
695
695
|
"bin": {
|
|
696
696
|
"binder": "bin/binder.mjs",
|
|
@@ -714,9 +714,9 @@
|
|
|
714
714
|
}
|
|
715
715
|
},
|
|
716
716
|
"node_modules/clavarium-parley": {
|
|
717
|
-
"version": "0.17.
|
|
718
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.
|
|
719
|
-
"integrity": "sha512
|
|
717
|
+
"version": "0.17.4-next.1",
|
|
718
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.4-next.1.tgz",
|
|
719
|
+
"integrity": "sha512-/rQy9WLP9/XndInawH6mIhS9RivA1IQmMpB5IhYMUflnLSWBvP096Z0TF3xB3u2X1e8uni4tar5Tua5hq/wjWg==",
|
|
720
720
|
"license": "MIT",
|
|
721
721
|
"bin": {
|
|
722
722
|
"parley": "bin/parley.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.41-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@xterm/addon-fit": "^0.11.0",
|
|
46
46
|
"@xterm/xterm": "^6.0.0",
|
|
47
|
-
"clavarium-binder": "0.1.
|
|
47
|
+
"clavarium-binder": "0.1.8-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.1",
|
|
49
|
-
"clavarium-parley": "0.17.
|
|
49
|
+
"clavarium-parley": "0.17.4-next.1",
|
|
50
50
|
"mermaid": "11.17.2",
|
|
51
51
|
"node-pty": "^1.1.0",
|
|
52
52
|
"pdfjs-dist": "6.4.299",
|
package/server/conversations.mjs
CHANGED
|
@@ -260,7 +260,7 @@ export class Conversations {
|
|
|
260
260
|
return { name: id, title: title !== undefined && title !== id ? title : undefined };
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
create({ name: given, title: read, tool, memoryMb, workOnDisk, group }) {
|
|
263
|
+
create({ name: given, title: read, tool, memoryMb, cpus, diskGb, workOnDisk, group }) {
|
|
264
264
|
const { name, title } = this.#naming({ name: given, title: read });
|
|
265
265
|
if (group !== undefined) { const problem = groupProblem(group); if (problem) throw new Refusal(400, problem); }
|
|
266
266
|
if (!isConversationName(name)) throw new Refusal(400, 'A name is 1 to 32 lower-case letters, digits or hyphens; it starts with a letter and does not end with a hyphen.');
|
|
@@ -270,9 +270,14 @@ export class Conversations {
|
|
|
270
270
|
if (!Number.isInteger(memory) || memory < chosen.memoryMb || memory > 16384) {
|
|
271
271
|
throw new Refusal(400, `This tool needs at least ${chosen.memoryMb} MB of memory.`);
|
|
272
272
|
}
|
|
273
|
+
/* Cores and disk, chosen at creation like the memory; their defaults when not given. */
|
|
274
|
+
const cores = cpus ?? 1;
|
|
275
|
+
if (!Number.isInteger(cores) || cores < 1 || cores > availableParallelism()) throw new Refusal(400, `Cores are 1 to ${availableParallelism()} (what this server has).`);
|
|
276
|
+
const disk = diskGb ?? DISK_GB;
|
|
277
|
+
if (!Number.isInteger(disk) || disk < DISK_GB || disk > DISK_MAX_GB) throw new Refusal(400, `Disk is ${DISK_GB} to ${DISK_MAX_GB} GB.`);
|
|
273
278
|
if (this.#store.get(name)) throw new Refusal(409, 'A conversation already has this name.');
|
|
274
279
|
const now = new Date().toISOString();
|
|
275
|
-
const conversation = { name, ...(title ? { title } : {}), ...(group ? { group } : {}), tool, memoryMb: memory, diskGb:
|
|
280
|
+
const conversation = { name, ...(title ? { title } : {}), ...(group ? { group } : {}), tool, memoryMb: memory, cpus: cores, diskGb: disk, fixed: FIXES, work: workOnDisk === true ? 'disk' : 'kept', phase: 'building', step: 'Starting the machine', createdAt: now, buildingSince: now, progress: buildProgress(now) };
|
|
276
281
|
/* A new one comes first in its folder (or first of those in none). */
|
|
277
282
|
const { order, groups } = this.#order();
|
|
278
283
|
this.#store.put(conversation);
|
|
@@ -284,6 +289,11 @@ export class Conversations {
|
|
|
284
289
|
/* `again`: a machine built anew for a conversation that had one. */
|
|
285
290
|
async #build(name, tool, memoryMb, again = false) {
|
|
286
291
|
const fail = (what, r) => { this.#store.patch(name, { phase: 'failed', step: undefined, progress: undefined, error: `${what}: ${firstLine(r.stderr) || firstLine(r.stdout) || `exit ${r.code}`}` }); };
|
|
292
|
+
/* The size chosen at creation (stored by create, kept on a rebuild): launched with it, or, for a
|
|
293
|
+
copy of a ready-made machine, brought to it while the copy is still stopped. */
|
|
294
|
+
const made = this.#store.get(name);
|
|
295
|
+
const diskGb = made?.diskGb ?? DISK_GB; const cpus = made?.cpus ?? 1;
|
|
296
|
+
const custom = diskGb !== DISK_GB || cpus !== 1;
|
|
287
297
|
/* A COPY OF THE READY-MADE MACHINE when there is one that holds this
|
|
288
298
|
tool (see shelf.mjs): it only has to boot. Anything wrong with the
|
|
289
299
|
copy -- an older VM manager without "clone", a copy that does not
|
|
@@ -293,13 +303,18 @@ export class Conversations {
|
|
|
293
303
|
let readyMade = false;
|
|
294
304
|
if (from) {
|
|
295
305
|
const cloned = await this.#vms.clone(name, from, memoryMb);
|
|
306
|
+
if (cloned.code === 0 && custom) {
|
|
307
|
+
/* Still stopped, like the memory the clone set: its cores, and its disk grown to the chosen size. */
|
|
308
|
+
if (cpus !== 1) await this.#vms.setCpus(name, cpus).catch(() => {});
|
|
309
|
+
if (diskGb !== DISK_GB) await this.#vms.setDisk(name, diskGb).catch(() => {});
|
|
310
|
+
}
|
|
296
311
|
const started = cloned.code === 0 ? await this.#vms.start(name) : cloned;
|
|
297
312
|
readyMade = started.code === 0;
|
|
298
313
|
if (!readyMade && await this.#vms.state(name, { fresh: true }) !== undefined) await this.#vms.remove(name);
|
|
299
314
|
if (!this.#store.get(name)) return undefined; /* archived meanwhile */
|
|
300
315
|
}
|
|
301
316
|
if (!readyMade) {
|
|
302
|
-
const launched = await this.#vms.launch(name, memoryMb);
|
|
317
|
+
const launched = await this.#vms.launch(name, memoryMb, custom ? diskGb : undefined, custom ? cpus : undefined);
|
|
303
318
|
if (launched.code !== 0) return fail('The machine did not start', launched);
|
|
304
319
|
}
|
|
305
320
|
this.#store.patch(name, { step: 'Preparing the machine', readyMade: readyMade || undefined });
|
package/server/vm.mjs
CHANGED
|
@@ -93,8 +93,10 @@ export class Vms {
|
|
|
93
93
|
return this.#asking;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
launch(conversation, memoryMb) {
|
|
97
|
-
|
|
96
|
+
launch(conversation, memoryMb, diskGb, cpus) {
|
|
97
|
+
/* The disk and cores go with the memory only when they are the chosen size, not the defaults. */
|
|
98
|
+
const size = diskGb && cpus ? [String(diskGb), String(cpus)] : [];
|
|
99
|
+
return this.run(['vm', 'launch', vmName(conversation), String(memoryMb), ...size], { timeoutMs: (LAUNCH_SECONDS + 60) * 1000 });
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
/* The machine of a conversation as a COPY of the ready-made one (see
|
package/web/app.js
CHANGED
|
@@ -111,8 +111,10 @@
|
|
|
111
111
|
$('notice-spin').hidden = true; $('notice-steps').hidden = true;
|
|
112
112
|
$('notice-head').hidden = true; delete notice.dataset.progress; delete notice.dataset.loading;
|
|
113
113
|
};
|
|
114
|
-
/* A terminal on its way: a neutral word and the wheel, nothing that sounds like a fault.
|
|
115
|
-
|
|
114
|
+
/* A terminal on its way: a neutral word and the wheel, nothing that sounds like a fault. It
|
|
115
|
+
covers only when the terminal is what is on screen -- not the chat already there, which a tab
|
|
116
|
+
resume (its channel reopened) used to blank behind "Loading the terminal..." (found 26-10). */
|
|
117
|
+
const loading = () => { if (tabNow() !== 'terminal') return; show('Loading the terminal\u2026'); $('notice-spin').hidden = false; notice.dataset.loading = 'yes'; };
|
|
116
118
|
/* A restart: when the page first saw it (when the server did not say), and the clock that tells it. */
|
|
117
119
|
const restartSeen = new Map(); let restartTicking = 0;
|
|
118
120
|
/* A START TOLD STEP BY STEP (a build, a restart, a wake: `progress`, see
|
|
@@ -833,6 +835,11 @@
|
|
|
833
835
|
if (noTerminal()) $('files-open').hidden = deviceShared.length === 0;
|
|
834
836
|
$('sleep').hidden = !usable || c.asleep === true;
|
|
835
837
|
$('restart').hidden = DEVICE || !usable;
|
|
838
|
+
/* The same gestures, surfaced at the top of the panel: wake when asleep, else restart and sleep. */
|
|
839
|
+
$('quick-sleep').hidden = !usable || c.asleep === true;
|
|
840
|
+
$('quick-restart').hidden = DEVICE || !usable;
|
|
841
|
+
$('quick-wake').hidden = !c || c.asleep !== true;
|
|
842
|
+
$('panel-actions').hidden = DEVICE || !c || !(usable || c.asleep === true);
|
|
836
843
|
/* Its own sheet is there as soon as it exists: archiving one that failed is done from it. */
|
|
837
844
|
$('folders').hidden = DEVICE || !c;
|
|
838
845
|
}
|
|
@@ -1125,7 +1132,9 @@
|
|
|
1125
1132
|
/* One in Needs you just above is not said twice. */
|
|
1126
1133
|
/* The last day only: what is older is found in its group. */
|
|
1127
1134
|
const dayAgo = Date.now() - 24 * 3600_000;
|
|
1128
|
-
|
|
1135
|
+
/* Asleep ones go to the bottom of Recent: they are frozen, not what you came back to. */
|
|
1136
|
+
const recent = conversations.filter((c) => (c.hidden !== true || c.name === current) && !needsYou(c) && activityOf(c) >= dayAgo)
|
|
1137
|
+
.sort((a, b) => (Number(a.asleep === true) - Number(b.asleep === true)) || (activityOf(b) - activityOf(a)));
|
|
1129
1138
|
const few = 4;
|
|
1130
1139
|
if (recent.length && groups.length && section(RECENT, 'Recent', recent)) {
|
|
1131
1140
|
top.append(...unfolding(RECENT, recent.slice(0, showAllRecent ? recent.length : few).map((c) => itemButton(c, true))));
|
|
@@ -1420,6 +1429,15 @@
|
|
|
1420
1429
|
select.replaceChildren(...mems.map((m) => { const o = document.createElement('option'); o.value = String(m); o.textContent = sizeWords(m); return o; }));
|
|
1421
1430
|
select.value = String(mems.includes(was) ? was : least);
|
|
1422
1431
|
$('newconv-memory-least').textContent = tool ? `${tool.label} needs ${sizeWords(least)} at least` : '';
|
|
1432
|
+
/* Cores: 1 to what this server has (learnt from any machine we know), default 1. */
|
|
1433
|
+
const hostCpus = Math.max(1, ...conversations.map((c) => c.hostCpus ?? 1));
|
|
1434
|
+
const cpus = $('newconv-cpus'); const wasCpus = Number(cpus.value) || 1;
|
|
1435
|
+
cpus.replaceChildren(...Array.from({ length: hostCpus }, (_, i) => i + 1).map((n) => { const o = document.createElement('option'); o.value = String(n); o.textContent = `${n}${n === 1 ? ' (default)' : ''}${n === hostCpus && n > 1 ? ' (all of this server)' : ''}`; return o; }));
|
|
1436
|
+
cpus.value = String(wasCpus <= hostCpus ? wasCpus : 1);
|
|
1437
|
+
/* Disk: from the default up; it only grows afterwards. */
|
|
1438
|
+
const disk = $('newconv-disk'); const wasDisk = Number(disk.value) || 8;
|
|
1439
|
+
disk.replaceChildren(...DISK_CHOICES.map((d) => { const o = document.createElement('option'); o.value = String(d); o.textContent = `${d} GB${d === 8 ? ' (default)' : ''}`; return o; }));
|
|
1440
|
+
disk.value = String(DISK_CHOICES.includes(wasDisk) ? wasDisk : 8);
|
|
1423
1441
|
}
|
|
1424
1442
|
function paintNewTools() {
|
|
1425
1443
|
const box = $('newconv-tools');
|
|
@@ -1490,10 +1508,11 @@
|
|
|
1490
1508
|
if (id && !ID_SHAPE.test(id)) { newError('id', 'Lower-case letters, digits, hyphens'); return; }
|
|
1491
1509
|
const least = newTools.find((t) => t.id === chosenTool)?.memoryMb;
|
|
1492
1510
|
const memoryMb = Number($('newconv-memory').value);
|
|
1511
|
+
const cpus = Number($('newconv-cpus').value); const diskGb = Number($('newconv-disk').value);
|
|
1493
1512
|
newError('', '');
|
|
1494
1513
|
creating = true; $('newconv-create').disabled = true;
|
|
1495
1514
|
try {
|
|
1496
|
-
const made = await post(`${API}/conversations`, { title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newOnDisk(), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}) });
|
|
1515
|
+
const made = await post(`${API}/conversations`, { title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newOnDisk(), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}), ...(cpus && cpus !== 1 ? { cpus } : {}), ...(diskGb && diskGb !== 8 ? { diskGb } : {}) });
|
|
1497
1516
|
$('newconv-name').value = ''; $('newconv-id').value = ''; $('newconv-id').placeholder = 'website-redesign'; $('newconv-group').value = '';
|
|
1498
1517
|
$('newconv-work').querySelector('[data-work="kept"]').click(); $('newconv-more').open = false;
|
|
1499
1518
|
await refresh();
|
|
@@ -1672,6 +1691,9 @@
|
|
|
1672
1691
|
function paintViews() {
|
|
1673
1692
|
if (DEVICE) return;
|
|
1674
1693
|
const now = tabNow();
|
|
1694
|
+
/* The "Loading the terminal..." veil belongs to the terminal: leaving it for the chat (or
|
|
1695
|
+
any other tab) takes the veil away, so a tab already there is not covered. */
|
|
1696
|
+
if (notice.dataset.loading && now !== 'terminal') notice.hidden = true;
|
|
1675
1697
|
for (const [id, tab] of [['view-chat', 'chat'], ['view-terminal', 'terminal'], ['view-assets', 'assets'], ['view-lists', 'lists'], ['folders', 'settings']]) $(id).setAttribute('aria-pressed', String(now === tab));
|
|
1676
1698
|
}
|
|
1677
1699
|
/* THE FOUR TABS: Chat, Terminal, Assets, Settings. The one it opened on
|
|
@@ -4681,7 +4703,7 @@
|
|
|
4681
4703
|
$('updates-state').textContent = running ? `${running.action === 'back' ? 'Going back to' : 'Updating to'} ${running.version}: ${running.step.toLowerCase()}...`
|
|
4682
4704
|
: u.checkError ? 'Could not check just now.'
|
|
4683
4705
|
: u.available ? `${u.available} is out.`
|
|
4684
|
-
: u.checkedAt ? `
|
|
4706
|
+
: u.checkedAt ? `Nothing newer to install · checked ${sinceWords(u.checkedAt)}` : 'Nothing newer to install';
|
|
4685
4707
|
$('updates-check').disabled = Boolean(running);
|
|
4686
4708
|
$('updates-offer').hidden = !u.available || Boolean(running);
|
|
4687
4709
|
/* A version that already failed here is not offered as usual: tried again only on purpose, warned. */
|
|
@@ -7707,7 +7729,7 @@
|
|
|
7707
7729
|
$('share-done').addEventListener('click', leaveCompose);
|
|
7708
7730
|
|
|
7709
7731
|
/* ---------- resting and archiving ---------- */
|
|
7710
|
-
|
|
7732
|
+
async function sleepMachine() {
|
|
7711
7733
|
const name = current;
|
|
7712
7734
|
leavePanel();
|
|
7713
7735
|
disconnect();
|
|
@@ -7715,7 +7737,12 @@
|
|
|
7715
7737
|
show('Going to sleep...');
|
|
7716
7738
|
try { await post(`${API}/conversations/${encodeURIComponent(name)}/sleep`); await refresh(); enter(); }
|
|
7717
7739
|
catch (error) { say('awake', 'ended'); show(error.message, 'Back to the terminal', connect); }
|
|
7718
|
-
}
|
|
7740
|
+
}
|
|
7741
|
+
$('sleep').addEventListener('click', () => void sleepMachine());
|
|
7742
|
+
/* The quick actions at the top of the panel do the same as the Machine chapter's. */
|
|
7743
|
+
$('quick-sleep').addEventListener('click', () => void sleepMachine());
|
|
7744
|
+
$('quick-restart').addEventListener('click', () => { leavePanel(); void restartMachine(false); });
|
|
7745
|
+
$('quick-wake').addEventListener('click', () => { leavePanel(); seeTerminal(); });
|
|
7719
7746
|
async function rebuild() {
|
|
7720
7747
|
const name = current;
|
|
7721
7748
|
disconnect();
|
package/web/index.html
CHANGED
|
@@ -111,6 +111,12 @@
|
|
|
111
111
|
<div id="clists" class="sheet as-room" hidden><div id="clists-binder" class="binder-holder"></div></div>
|
|
112
112
|
<div id="panel" class="sheet" hidden>
|
|
113
113
|
<div class="panel-top"><b id="panel-title">This conversation</b></div>
|
|
114
|
+
<!-- The gestures done often on the machine, without opening the Machine chapter (app.js, paintMachine). -->
|
|
115
|
+
<div class="row panel-actions" id="panel-actions" hidden>
|
|
116
|
+
<button type="button" id="quick-wake" class="primary" hidden>Wake it</button>
|
|
117
|
+
<button type="button" id="quick-restart" hidden>Restart…</button>
|
|
118
|
+
<button type="button" id="quick-sleep" hidden title="Freezes the tool as it is; it wakes when you open the conversation">Sleep</button>
|
|
119
|
+
</div>
|
|
114
120
|
<p id="panel-error" class="error" role="alert" hidden></p>
|
|
115
121
|
<details class="chapter" id="chapter-general" data-chapter="general">
|
|
116
122
|
<summary><span class="chapter-title">General</span><span class="chapter-about">Name, group, chat.</span></summary>
|
|
@@ -372,6 +378,12 @@
|
|
|
372
378
|
<!-- THE MAP (once "Who gets what"): every device, conversation and asset, and the rights between them (links.js). -->
|
|
373
379
|
<div id="links" class="pane">
|
|
374
380
|
<div id="links-legend" class="lk-legend"></div>
|
|
381
|
+
<!-- The column filters, kept out of the board's zoom so a crowded map does not shrink them (links.js). -->
|
|
382
|
+
<div id="links-filters" class="lk-filters">
|
|
383
|
+
<label class="lk-filter"><span>Devices</span><input type="search" class="lk-find" data-k="device" placeholder="Filter…" aria-label="Filter devices"></label>
|
|
384
|
+
<label class="lk-filter"><span>Conversations</span><input type="search" class="lk-find" data-k="conversation" placeholder="Filter…" aria-label="Filter conversations"></label>
|
|
385
|
+
<label class="lk-filter"><span>Assets</span><input type="search" class="lk-find" data-k="asset" placeholder="Filter…" aria-label="Filter assets"></label>
|
|
386
|
+
</div>
|
|
375
387
|
<p id="links-hint" class="hint" aria-live="polite"></p>
|
|
376
388
|
<p id="links-error" class="error" role="alert" hidden></p>
|
|
377
389
|
<div id="links-card" class="lk-card" hidden aria-live="polite"></div>
|
|
@@ -714,7 +726,7 @@
|
|
|
714
726
|
<div id="updates-settings" class="set-rows">
|
|
715
727
|
<div class="set-row"><div class="set-what"><label for="updates-mode">Mode</label><small>When updates are installed</small></div><div class="set-control"><select id="updates-mode"><option value="auto">Automatic, in a window</option><option value="asap">As soon as out</option><option value="ask">Ask me</option><option value="off">Off</option></select></div></div>
|
|
716
728
|
<div class="set-row" id="updates-window-row"><div class="set-what"><label for="updates-from" id="updates-window-label">Window</label><small>Hours when it may restart</small></div><div class="set-control"><span id="updates-window" class="updates-window"><input type="time" id="updates-from" aria-label="From"><span aria-hidden="true">to</span><input type="time" id="updates-to" aria-label="To"></span></div></div>
|
|
717
|
-
<div class="set-row"><div class="set-what"><label for="updates-channel">Channel</label><small>
|
|
729
|
+
<div class="set-row"><div class="set-what"><label for="updates-channel">Channel</label><small>Which builds to follow; you update only to a version newer than this one</small></div><div class="set-control"><select id="updates-channel"><option value="next">Next (earliest tests)</option><option value="beta">Beta (nearly ready)</option><option value="latest">Stable</option></select></div></div>
|
|
718
730
|
<!-- What the front serves to a browser (server/certificate.mjs). -->
|
|
719
731
|
<div class="set-row" id="updates-certificate-row" hidden><div class="set-what"><span>Certificate</span><small id="updates-certificate" role="status"></small></div></div>
|
|
720
732
|
</div>
|
|
@@ -892,10 +904,12 @@
|
|
|
892
904
|
<details class="more"><summary>Which one?</summary>A code project that installs packages: its disk. Can be changed later.</details>
|
|
893
905
|
</div>
|
|
894
906
|
<details class="chapter" id="newconv-more">
|
|
895
|
-
<summary><span class="chapter-title">More</span><span class="chapter-about">Identifier, memory.</span></summary>
|
|
907
|
+
<summary><span class="chapter-title">More</span><span class="chapter-about">Identifier, memory, cores, disk.</span></summary>
|
|
896
908
|
<div class="chapter-body">
|
|
897
909
|
<div class="set-row"><div class="set-what"><label for="newconv-id">Identifier</label><small>Its machine and address. Never changes</small><span id="newconv-id-error" class="err" role="alert" hidden></span></div><div class="set-control"><input id="newconv-id" maxlength="32" pattern="[a-z]([a-z0-9\-]{0,30}[a-z0-9])?" placeholder="website-redesign" spellcheck="false" autocapitalize="none"></div></div>
|
|
898
910
|
<div class="set-row"><div class="set-what"><label for="newconv-memory">Memory</label><small id="newconv-memory-least"></small><span id="newconv-memory-error" class="err" role="alert" hidden></span></div><div class="set-control"><select id="newconv-memory"></select></div></div>
|
|
911
|
+
<div class="set-row"><div class="set-what"><label for="newconv-cpus">Cores</label><small>Shared with the server's machines</small></div><div class="set-control"><select id="newconv-cpus"></select></div></div>
|
|
912
|
+
<div class="set-row"><div class="set-what"><label for="newconv-disk">Disk</label><small>For code kept on the machine; a disk only grows</small></div><div class="set-control"><select id="newconv-disk"></select></div></div>
|
|
899
913
|
</div>
|
|
900
914
|
</details>
|
|
901
915
|
</div>
|
package/web/links.js
CHANGED
|
@@ -69,6 +69,12 @@
|
|
|
69
69
|
let allLines = true;
|
|
70
70
|
try { allLines = localStorage.getItem('clavarium-links-all') !== '0'; } catch { /* none kept */ }
|
|
71
71
|
let picked = null; let pinned = null; let focus = null; let drag = null; let pop = null; let popLink = null; let drawnMany = false;
|
|
72
|
+
/* A box is shown only if its column's filter is empty or its name holds what was typed: so a
|
|
73
|
+
crowded map (many assets) is narrowed to a few boxes, their links with them. The layout is
|
|
74
|
+
kept while typing (no reorder), and a filter cleared brings everything back. */
|
|
75
|
+
const filters = { device: '', conversation: '', asset: '' };
|
|
76
|
+
let laidOut = null;
|
|
77
|
+
const matches = (n, k) => { const f = (filters[k] || '').trim().toLowerCase(); return !f || n.name.toLowerCase().includes(f) || String(n.sub || '').toLowerCase().includes(f); };
|
|
72
78
|
const ph = { screen: 'list', kind: 'device', id: null, adding: false, sheet: null };
|
|
73
79
|
let traceOf = '*';
|
|
74
80
|
|
|
@@ -182,27 +188,35 @@
|
|
|
182
188
|
}
|
|
183
189
|
return best;
|
|
184
190
|
}
|
|
185
|
-
|
|
191
|
+
/* `relayout` false keeps the order found last: used while typing a filter, so boxes do not jump. */
|
|
192
|
+
function paint(relayout = true) {
|
|
186
193
|
for (const b of document.querySelectorAll('#links-tabs [data-view]')) b.setAttribute('aria-selected', String(b.dataset.view === view));
|
|
187
194
|
$('links-all').checked = allLines;
|
|
188
195
|
legend();
|
|
189
196
|
const bd = board();
|
|
190
197
|
bd.className = `lk-board ${VIEWS[view].cols.length === 3 ? 'three' : 'two'}`;
|
|
191
198
|
bd.querySelectorAll('.lk-col, .lk-knob').forEach((e) => e.remove()); closePop();
|
|
192
|
-
|
|
199
|
+
if (relayout || !laidOut) laidOut = layout();
|
|
200
|
+
const lists = laidOut;
|
|
193
201
|
VIEWS[view].cols.forEach((cols, ci) => {
|
|
194
202
|
const col = h('div', { class: 'lk-col' });
|
|
195
203
|
cols.forEach((k, i) => {
|
|
196
204
|
if (i) col.append(h('div', { class: 'lk-gap' }));
|
|
197
|
-
col.append(h('h3', { class: 'lk-colh' }, h('span', { text: TITLES[k] }), plus(k)));
|
|
198
|
-
const
|
|
205
|
+
col.append(h('h3', { class: 'lk-colh' }, h('span', { class: 'lk-colt', text: TITLES[k] }), plus(k)));
|
|
206
|
+
const whole = lists[ci][i];
|
|
207
|
+
const list = whole.filter((n) => matches(n, k));
|
|
199
208
|
for (const n of list) col.append(nodeEl(n));
|
|
200
|
-
if (!list.length) col.append(empty(k));
|
|
209
|
+
if (!list.length) col.append(whole.length ? h('p', { class: 'hint lk-none', text: 'Nothing matches.' }) : empty(k));
|
|
201
210
|
});
|
|
202
211
|
bd.append(col);
|
|
203
212
|
});
|
|
204
213
|
fit(); draw(); hint(); paintPhone();
|
|
205
214
|
}
|
|
215
|
+
/* The filters sit in a bar of their own, ABOVE the board and out of its zoom, so that fitting
|
|
216
|
+
a crowded map (which zooms it down) never shrinks them. Each narrows its column; the board
|
|
217
|
+
is repainted without a relayout (the inputs are not rebuilt, so the caret stays). */
|
|
218
|
+
const onFind = (e) => { filters[e.target.dataset.k] = e.target.value; paint(false); };
|
|
219
|
+
for (const inp of document.querySelectorAll('#links-filters .lk-find')) inp.addEventListener('input', onFind);
|
|
206
220
|
/* How each kind is made: a device paired, a conversation created, an asset added. The same,
|
|
207
221
|
from the small round "+" by each column's title (always there, however many it holds)
|
|
208
222
|
and from an empty column. */
|
package/web/style.css
CHANGED
|
@@ -127,6 +127,7 @@ footer button.wide { flex: 1 0 auto; background: var(--brass); border-color: var
|
|
|
127
127
|
.chip[data-access="write"] { color: var(--ok); border-color: var(--ok); }
|
|
128
128
|
.sheet { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--panel); overflow-y: auto; }
|
|
129
129
|
.panel-top { display: flex; align-items: center; justify-content: space-between; }
|
|
130
|
+
.panel-actions { margin: 2px 0 12px; }
|
|
130
131
|
#panel-rows { display: flex; flex-direction: column; }
|
|
131
132
|
.folder { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
|
|
132
133
|
.folder b { flex: 1; min-width: 100px; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -190,6 +191,8 @@ a.button { font: 600 .8125rem var(--sans); text-decoration: none; border-radius:
|
|
|
190
191
|
#mic { flex-basis: 55%; padding-block: 12px; }
|
|
191
192
|
}
|
|
192
193
|
.item[data-asleep="true"] .dot { background: var(--ink2); }
|
|
194
|
+
/* Asleep: faded in the list (and sorted to the bottom of Recent, app.js), so it is plainly not where you are. */
|
|
195
|
+
.item[data-asleep="true"]:not([aria-current="true"]) { opacity: .62; }
|
|
193
196
|
footer button.careful { border-style: dashed; color: var(--ink2); }
|
|
194
197
|
/* On a touch screen every control is at least a fingertip high. */
|
|
195
198
|
@media (max-width: 700px) {
|
|
@@ -1281,6 +1284,14 @@ select.pill { appearance: auto; }
|
|
|
1281
1284
|
/* The title of a column of the map, and its round "+" (a new device, conversation, asset): always there. */
|
|
1282
1285
|
.lk-col h3.lk-colh, .lk-phead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
1283
1286
|
.lk-col h3.lk-colh .lk-add { width: 26px; height: 26px; font-size: .95rem; letter-spacing: 0; }
|
|
1287
|
+
/* The filters: their own bar above the board, out of its zoom, so they stay a usable size. */
|
|
1288
|
+
.lk-filters { display: flex; gap: 10px 16px; flex-wrap: wrap; margin: 2px 0 10px; }
|
|
1289
|
+
.lk-filter { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 160px; }
|
|
1290
|
+
.lk-filter > span { flex: none; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
|
|
1291
|
+
.lk-filters .lk-find { flex: 1 1 auto; min-width: 0; font: inherit; font-size: .9rem; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); }
|
|
1292
|
+
.lk-filters .lk-find::placeholder { color: var(--ink2); }
|
|
1293
|
+
/* The phone shows a list of its own, not the board: the column filters do not apply there. */
|
|
1294
|
+
@media (max-width: 600px) { #links-filters { display: none; } }
|
|
1284
1295
|
.lk-phead { margin: 4px 0 6px; }
|
|
1285
1296
|
.as-kinds { display: flex; flex-wrap: wrap; gap: 8px; } .as-kinds button { display: inline-flex; align-items: center; gap: 8px; }
|
|
1286
1297
|
|