clavarium 0.2.433-next.1 → 0.2.435-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 +6 -6
- package/package.json +2 -2
- package/server/api.mjs +8 -1
- package/server/conversations.mjs +13 -7
- package/server/door.mjs +1 -1
- package/server/jobs.mjs +59 -6
- package/server/settingswords.mjs +5 -2
- package/server/talk.mjs +7 -1
- package/web/app.js +51 -5
- package/web/index.html +8 -0
- package/web/style.css +20 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.435-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.435-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
|
13
13
|
"@xterm/xterm": "^6.0.0",
|
|
14
14
|
"clavarium-binder": "0.1.62-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.2-next.2",
|
|
16
|
-
"clavarium-parley": "0.17.
|
|
16
|
+
"clavarium-parley": "0.17.92-next.1",
|
|
17
17
|
"clavarium-tether": "0.1.0-next.67",
|
|
18
18
|
"mammoth": "1.13.0",
|
|
19
19
|
"mermaid": "11.17.2",
|
|
@@ -787,9 +787,9 @@
|
|
|
787
787
|
}
|
|
788
788
|
},
|
|
789
789
|
"node_modules/clavarium-parley": {
|
|
790
|
-
"version": "0.17.
|
|
791
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.
|
|
792
|
-
"integrity": "sha512-
|
|
790
|
+
"version": "0.17.92-next.1",
|
|
791
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.92-next.1.tgz",
|
|
792
|
+
"integrity": "sha512-THH8l0YkllcG6J4H1suSthJLgRWYbGnRMj6m90OSqyui7ttVBaeCC1sREVROs+D6KnHS7yZXRdWeFwiK0gwzdQ==",
|
|
793
793
|
"license": "MIT",
|
|
794
794
|
"bin": {
|
|
795
795
|
"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.435-next.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.",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@xterm/xterm": "^6.0.0",
|
|
48
48
|
"clavarium-binder": "0.1.62-next.1",
|
|
49
49
|
"clavarium-docket": "0.1.2-next.2",
|
|
50
|
-
"clavarium-parley": "0.17.
|
|
50
|
+
"clavarium-parley": "0.17.92-next.1",
|
|
51
51
|
"clavarium-tether": "0.1.0-next.67",
|
|
52
52
|
"mammoth": "1.13.0",
|
|
53
53
|
"mermaid": "11.17.2",
|
package/server/api.mjs
CHANGED
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
* GET /api/meshcentral: the remote screen (MeshCentral); POST /api/meshcentral/enable (turned on, in the background) /disable
|
|
128
128
|
* GET /api/events?kind=&conversation=&q=&before=&limit= what happened, newest first
|
|
129
129
|
* GET /api/jobs what it is doing: { running, done } (jobs.mjs), its updates of the day among the done
|
|
130
|
+
* GET /api/jobs/log?id= that job, under way or done today, with its log [{at, text}] (404: unknown)
|
|
130
131
|
* GET /api/history?of=server|<name>&span=1h|24h|7d the curves of memory, CPU and disk (and the reserve, for the server)
|
|
131
132
|
* GET /api/history/all?span=1h|24h|7d Settings, Usage: the server and every machine (asleep too) on one time axis,
|
|
132
133
|
* in GB and cores: {t, capacity, server, itself, machines: [{name, alloc, asleep, ...}]}
|
|
@@ -415,6 +416,12 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
415
416
|
const done = [...said.done, ...updated].sort((a, b) => String(b.endedAt).localeCompare(String(a.endedAt)));
|
|
416
417
|
return send(200, { running: said.running, done }), true;
|
|
417
418
|
}
|
|
419
|
+
/* A job's log (jobs.mjs): read when its line is opened, never with the list, which stays light. */
|
|
420
|
+
if (pathname === '/api/jobs/log' && conversations.jobs) {
|
|
421
|
+
const job = conversations.jobs.log(query.get('id') ?? '');
|
|
422
|
+
if (!job) throw new Refusal(404, 'No such job.');
|
|
423
|
+
return send(200, job), true;
|
|
424
|
+
}
|
|
418
425
|
if (pathname === '/api/events' && events) {
|
|
419
426
|
const ask = { kind: query.get('kind') ?? '', conversation: query.get('conversation') ?? '', q: query.get('q') ?? '', before: query.get('before') ?? '', limit: Math.min(1000, Number(query.get('limit')) || 200) };
|
|
420
427
|
const said = events.list(ask);
|
|
@@ -829,7 +836,7 @@ export async function handleApi(request, response, conversations, headers, resou
|
|
|
829
836
|
if (talking[2] === '/pin') return send(200, await talk.pin(conversation, body.to, body.on !== false)), true;
|
|
830
837
|
if (typeof body.on === 'boolean') { const now = await talk.set(conversation, body.on); retell(conversation); return send(200, now), true; }
|
|
831
838
|
/* What the chat may add to an answer: the choices ticked, the answers of a group, the zone of a picture it is about (Parley checks each). */
|
|
832
|
-
return send(201, await talk.say(conversation, body.text, body.answers, body.files, body.via, { picked: body.picked, replies: body.replies, about: body.about })), true;
|
|
839
|
+
return send(201, await talk.say(conversation, body.text, body.answers, body.files, body.via, { picked: body.picked, replies: body.replies, about: body.about, quick: body.quick === true })), true;
|
|
833
840
|
}
|
|
834
841
|
const docketed = /^\/api\/conversations\/([^/]+)\/docket(\/cancel)?$/.exec(pathname);
|
|
835
842
|
if (docketed && wakeups) {
|
package/server/conversations.mjs
CHANGED
|
@@ -948,7 +948,8 @@ export class Conversations {
|
|
|
948
948
|
/* In its machine: the manifest written aside, then one archive -- the manifest first, then what is kept
|
|
949
949
|
(a path it has not made yet left out), the cache left out. */
|
|
950
950
|
/* (Its paths are plain -- letters, digits, . _ / - -- checked by tools.mjs: given as words.) */
|
|
951
|
-
|
|
951
|
+
/* A reading of an earlier try that never ended (14-11: three left, each holding its pipe): ended first. */
|
|
952
|
+
const script = 'for p in $(pgrep -f "^tar -czf - --warning=no-file-changed -C /tmp/"); do kill $p 2>/dev/null; done; m=$(mktemp -d) || exit 2; printf "%s" "$1" > "$m/clavarium-conversation.json"; '
|
|
952
953
|
+ 'ex=""; for a in $2; do ex="$ex --exclude=./$a"; done; ks=""; for a in $3; do if [ -e "$HOME/$a" ]; then ks="$ks ./$a"; fi; done; '
|
|
953
954
|
+ 'rc=0; tar -czf - --warning=no-file-changed -C "$m" clavarium-conversation.json -C "$HOME" $ex $ks || rc=$?; rm -rf "$m"; '
|
|
954
955
|
/* 1: a file changed while read (its tool writing its log as it is read, 14-11: a live Claude Code): the
|
|
@@ -1071,17 +1072,22 @@ export class Conversations {
|
|
|
1071
1072
|
/* Nothing comes for a while: said, with how long; for too long, the reading is ended and why said --
|
|
1072
1073
|
never an endless wait nobody can read (14-11: stuck at "36 KB read"). */
|
|
1073
1074
|
/* Quiet for 30 s: its machine asked, once, what its reading does -- the file it is on and its state
|
|
1074
|
-
(D: waiting on the disk), its load, its free memory -- or said not to answer at all.
|
|
1075
|
-
|
|
1075
|
+
(D: waiting on the disk), its load, its free memory -- or said not to answer at all. Written to the
|
|
1076
|
+
copy's job log; the screen and the end's why stay short (14-11: stuck at 36 KB on the owner's server, never here). */
|
|
1076
1077
|
let seen = '';
|
|
1077
|
-
|
|
1078
|
+
/* Each tar and gzip: its state, what the kernel has it wait on (wchan), the file it holds and that
|
|
1079
|
+
file's filesystem -- enough to tell a disk, a network mount or a pipe nobody empties. */
|
|
1080
|
+
const probe = 'for p in $(pgrep -x tar) $(pgrep -x gzip); do f=$(ls -l /proc/$p/fd 2>/dev/null | grep -o "/home/[^ ]*" | tail -1); '
|
|
1081
|
+
+ 'echo "$(cat /proc/$p/comm) $p $(cut -d" " -f3 /proc/$p/stat) $(cat /proc/$p/wchan 2>/dev/null) ${f#$HOME/}${f:+ [$(stat -f -c %T "$f" 2>/dev/null)]}"; done; '
|
|
1078
1082
|
+ 'echo "load $(cut -d" " -f1 /proc/loadavg)"; awk \'/MemAvailable/{print "free " int($2/1024) " MB"}\' /proc/meminfo';
|
|
1079
|
-
|
|
1083
|
+
/* What it said goes to the copy's job log (jobs.mjs), read in Settings and by its AI -- not on screen. */
|
|
1084
|
+
const heard = (said) => { seen = said; this.jobs?.note(to, `Its original's reading: ${said}`); };
|
|
1085
|
+
const ask = () => { seen = '…'; this.#vms.exec(from, ['sh', '-c', probe], { timeoutMs: 20_000 }).then((r) => { heard(r.code === 0 ? (r.stdout || '').trim().split('\n').join(', ').slice(0, 200) : 'its machine did not answer'); }, () => { heard('its machine did not answer'); }); };
|
|
1080
1086
|
const watch = setInterval(() => {
|
|
1081
1087
|
const quiet = Math.round((Date.now() - lastAt) / 1000);
|
|
1082
1088
|
if (quiet >= COPY_QUIET_MS / 1000) { stalled = true; child.kill('SIGKILL'); return; }
|
|
1083
1089
|
if (quiet >= 30 && !seen) ask();
|
|
1084
|
-
if (quiet >= 15) say(`Copying ${tool.label}'s memory: ${sizeWords(read)} read, nothing more for ${quiet} s
|
|
1090
|
+
if (quiet >= 15) say(`Copying ${tool.label}'s memory: ${sizeWords(read)} read, nothing more for ${quiet} s`);
|
|
1085
1091
|
}, 5000);
|
|
1086
1092
|
const failed = new Promise((ok) => child.on('error', () => ok(-1)));
|
|
1087
1093
|
const file = createWriteStream(carried, { mode: 0o600 });
|
|
@@ -1089,7 +1095,7 @@ export class Conversations {
|
|
|
1089
1095
|
code = await Promise.race([new Promise((ok) => child.on('close', ok)), failed]).finally(() => clearInterval(watch));
|
|
1090
1096
|
if (stalled) {
|
|
1091
1097
|
const now = await this.#vms.state(from, { fresh: true }).catch(() => undefined);
|
|
1092
|
-
throw new Error(`its original stopped sending its tool's memory
|
|
1098
|
+
throw new Error(`its original stopped sending its tool's memory: ${sizeWords(read)} read, then nothing for ${COPY_QUIET_MS / 60_000} min, its machine ${now ?? 'unreadable'} (see its job's log in Settings)`);
|
|
1093
1099
|
}
|
|
1094
1100
|
await new Promise((ok) => (file.writableFinished ? ok() : file.on('finish', ok)));
|
|
1095
1101
|
if (code !== 255) break;
|
package/server/door.mjs
CHANGED
|
@@ -188,7 +188,7 @@ export async function handleDoor(request, response, { devices, conversations, re
|
|
|
188
188
|
if (request.headers['content-type'] !== 'application/octet-stream') return send(400, { error: 'An attachment is a file.' });
|
|
189
189
|
return send(201, await talk.attach(name, url.searchParams.get('name') ?? '', request));
|
|
190
190
|
}
|
|
191
|
-
if (request.method === 'POST' && talking[1] === undefined) { const body = await readJson(request); return send(201, await talk.say(name, body.text, body.answers, body.files, body.via)); }
|
|
191
|
+
if (request.method === 'POST' && talking[1] === undefined) { const body = await readJson(request); return send(201, await talk.say(name, body.text, body.answers, body.files, body.via, { quick: body.quick === true })); }
|
|
192
192
|
}
|
|
193
193
|
/* Its terminal does not come: only a device given it asks for it to be repaired. */
|
|
194
194
|
if (request.method === 'POST' && route === '/terminal/repair') { need(part.terminal, 'the terminal'); return send(200, await repair(name)); }
|
package/server/jobs.mjs
CHANGED
|
@@ -4,15 +4,29 @@
|
|
|
4
4
|
* record as it changes (Store's onChange), so it adds no wait.
|
|
5
5
|
*
|
|
6
6
|
* seen(before, after) a conversation's record changed (before or after undefined: made or removed)
|
|
7
|
-
*
|
|
7
|
+
* note(name, text) a line added to the log of that conversation's job under way (none: nothing)
|
|
8
|
+
* list(now?) { running: [...], done: [...] } newest first, done within KEEP_MS; without their logs
|
|
9
|
+
* log(id) that job, under way or done, with its log; undefined if unknown
|
|
10
|
+
*
|
|
11
|
+
* Each job keeps a LOG (14-11), for the owner in Settings and for the conversation's AI, rather than diagnostics
|
|
12
|
+
* on screen: each new step, the lines noted, its end. A step that only counts on ("… 12 MB read") is kept once
|
|
13
|
+
* every PROGRESS_MS, and its last. Kept with the done jobs on disk, LOG_MAX lines of LINE_MAX characters at most.
|
|
8
14
|
*/
|
|
9
15
|
import { JsonFile } from './store.mjs';
|
|
10
16
|
|
|
11
17
|
export const BUSY = ['building', 'moving', 'restarting'];
|
|
12
18
|
const KEEP_MS = 24 * 3600_000;
|
|
13
19
|
const DONE_MAX = 50;
|
|
20
|
+
const LOG_MAX = 300;
|
|
21
|
+
const LINE_MAX = 300;
|
|
22
|
+
const PROGRESS_MS = 10_000;
|
|
14
23
|
|
|
15
24
|
const titleOf = (c) => c?.title ?? c?.name ?? '?';
|
|
25
|
+
/* Its id: its conversation and when it started, in letters an address carries as they are. */
|
|
26
|
+
const idOf = (j) => `${j.conversation}-${j.startedAt}`.replace(/[^A-Za-z0-9_-]/g, '-');
|
|
27
|
+
/* A line that says the same as another but for its numbers: a count going on. */
|
|
28
|
+
const shapeOf = (text) => text.replace(/\d+(?:[.,]\d+)?/g, '#');
|
|
29
|
+
const bare = ({ log, ...job }) => job;
|
|
16
30
|
|
|
17
31
|
/* Its words: what it is, from the phase and the record (a copy names its original, a move its machine). */
|
|
18
32
|
export function jobWords(c) {
|
|
@@ -24,6 +38,8 @@ export function jobWords(c) {
|
|
|
24
38
|
|
|
25
39
|
export class Jobs {
|
|
26
40
|
#open = new Map();
|
|
41
|
+
/* A job under way's log, and the count line held back, said only if no other comes after it. */
|
|
42
|
+
#logs = new Map();
|
|
27
43
|
#file;
|
|
28
44
|
#done;
|
|
29
45
|
#now;
|
|
@@ -32,20 +48,46 @@ export class Jobs {
|
|
|
32
48
|
this.#now = now;
|
|
33
49
|
this.#file = path ? new JsonFile(path, []) : undefined;
|
|
34
50
|
const kept = this.#file?.get();
|
|
35
|
-
this.#done = Array.isArray(kept) ? kept : [];
|
|
51
|
+
this.#done = Array.isArray(kept) ? kept.map((j) => ({ ...j, id: j.id ?? idOf(j) })) : [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* A line to a job's log: a step that only counts on is held back if the last one kept is less than
|
|
55
|
+
PROGRESS_MS old -- said when the next different line comes, or at the end, so its last is never lost. */
|
|
56
|
+
#add(name, text, { thin = false } = {}) {
|
|
57
|
+
const kept = this.#logs.get(name);
|
|
58
|
+
if (!kept) return;
|
|
59
|
+
const line = { at: new Date(this.#now()).toISOString(), text: String(text).slice(0, LINE_MAX) };
|
|
60
|
+
const last = kept.log.at(-1);
|
|
61
|
+
if (last?.text === line.text || kept.held?.text === line.text) return;
|
|
62
|
+
if (thin && last && shapeOf(last.text) === shapeOf(line.text) && Date.parse(line.at) - Date.parse(last.at) < PROGRESS_MS) { kept.held = line; return; }
|
|
63
|
+
if (kept.held && !(thin && last && shapeOf(kept.held.text) === shapeOf(line.text))) kept.log.push(kept.held);
|
|
64
|
+
kept.held = undefined;
|
|
65
|
+
kept.log.push(line);
|
|
66
|
+
/* Too long: its oldest lines go, its end is what tells what happened. */
|
|
67
|
+
if (kept.log.length > LOG_MAX) kept.log.splice(0, kept.log.length - LOG_MAX);
|
|
36
68
|
}
|
|
37
69
|
|
|
70
|
+
note(name, text) { if (this.#open.has(name)) this.#add(name, text); }
|
|
71
|
+
|
|
38
72
|
seen(before, after) {
|
|
39
73
|
const name = after?.name ?? before?.name;
|
|
40
74
|
if (!name) return;
|
|
41
75
|
const busy = after && BUSY.includes(after.phase);
|
|
42
|
-
if (busy && !this.#open.has(name))
|
|
43
|
-
|
|
76
|
+
if (busy && !this.#open.has(name)) {
|
|
77
|
+
const job = { conversation: name, what: jobWords(after), startedAt: new Date(this.#now()).toISOString() };
|
|
78
|
+
this.#open.set(name, { id: idOf(job), ...job });
|
|
79
|
+
this.#logs.set(name, { log: [] });
|
|
80
|
+
} else if (busy) this.#open.get(name).what = jobWords(after);
|
|
81
|
+
if (busy && after.step) this.#add(name, after.step, { thin: true });
|
|
44
82
|
if (busy || !this.#open.has(name)) return;
|
|
45
83
|
const job = this.#open.get(name);
|
|
46
84
|
this.#open.delete(name);
|
|
47
85
|
const ok = after?.phase === 'ready';
|
|
48
|
-
|
|
86
|
+
const why = after && !ok && after.error ? String(after.error).slice(0, 300) : '';
|
|
87
|
+
this.#add(name, after ? (ok ? 'Done' : `Failed${why ? `: ${why}` : ''}`) : 'Removed');
|
|
88
|
+
const { log } = this.#logs.get(name);
|
|
89
|
+
this.#logs.delete(name);
|
|
90
|
+
this.#end({ ...job, endedAt: new Date(this.#now()).toISOString(), result: after ? (ok ? 'done' : 'failed') : 'removed', ...(why ? { why } : {}), log });
|
|
49
91
|
}
|
|
50
92
|
|
|
51
93
|
#end(job) {
|
|
@@ -64,6 +106,17 @@ export class Jobs {
|
|
|
64
106
|
const c = byName.get(j.conversation);
|
|
65
107
|
return { ...j, ...(c ? { what: jobWords(c), step: c.step ?? '', progress: c.progress } : {}) };
|
|
66
108
|
});
|
|
67
|
-
return { running, done: this.#done.filter((j) => Date.parse(j.endedAt) >= since) };
|
|
109
|
+
return { running, done: this.#done.filter((j) => Date.parse(j.endedAt) >= since).map(bare) };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
log(id) {
|
|
113
|
+
for (const [name, job] of this.#open) {
|
|
114
|
+
if (job.id !== id) continue;
|
|
115
|
+
const { log, held } = this.#logs.get(name);
|
|
116
|
+
return { ...job, log: held ? [...log, held] : [...log] };
|
|
117
|
+
}
|
|
118
|
+
const since = this.#now() - KEEP_MS;
|
|
119
|
+
const done = this.#done.find((j) => j.id === id && Date.parse(j.endedAt) >= since);
|
|
120
|
+
return done && { ...done, log: done.log ?? [] };
|
|
68
121
|
}
|
|
69
122
|
}
|
package/server/settingswords.mjs
CHANGED
|
@@ -9,10 +9,13 @@ export const SETTINGS_WORDS_FR = {
|
|
|
9
9
|
'set-ch-s-general': 'Général', 'set-ch-s-about': 'À propos', 'set-ch-s-screen': 'Écran', 'set-ch-s-alerts': 'Alertes',
|
|
10
10
|
'set-ch-s-resources': 'Ressources', 'set-ch-s-operators': 'Administrateurs', 'set-ch-s-network': 'Réseau', 'set-ch-s-remote-screen': 'Écran à distance',
|
|
11
11
|
'set-ch-s-words': 'Écran du chat', 'set-ch-s-dictation': 'Dictée', 'set-ch-s-shortcuts': 'Raccourcis', 'set-ch-s-thread': 'Événements du chat',
|
|
12
|
-
'set-ch-s-updates': 'Mises à jour', 'set-ch-s-binders': 'Classeurs', 'set-ch-s-events': 'Activité', 'set-ch-s-logs': 'Journaux',
|
|
12
|
+
'set-ch-s-updates': 'Mises à jour', 'set-ch-s-binders': 'Classeurs', 'set-ch-s-events': 'Activité', 'set-ch-s-jobs': 'Tâches', 'set-ch-s-logs': 'Journaux',
|
|
13
13
|
'set-ch-s-usage': 'Usage', 'set-ch-s-backup': 'Sauvegarde', 'set-ch-s-advanced': 'Avancé',
|
|
14
14
|
'set-check-updates': 'Chercher une mise à jour', 'set-activity': 'Activité', 'set-restart-dots': 'Redémarrer…', 'set-terminal': 'Terminal',
|
|
15
15
|
'set-search': 'Chercher', 'set-why': 'Pourquoi',
|
|
16
|
+
/* Diagnostics › Tâches (jobs.mjs): celles du jour, chacune avec son journal. */
|
|
17
|
+
'set-jobs-running': 'En cours', 'set-jobs-today': 'Aujourd\'hui', 'set-jobs-none': 'Rien aujourd\'hui',
|
|
18
|
+
'set-jobs-starting': 'Démarrage', 'set-jobs-nolog': 'Rien de noté', 'set-jobs-unread': 'Illisible pour le moment',
|
|
16
19
|
/* Diagnostics › « Vérifier les dossiers partagés » (health.mjs, linkguard.mjs). */
|
|
17
20
|
'set-check-folders': 'Vérifier les dossiers partagés', 'set-looking': 'Vérification…',
|
|
18
21
|
'set-fold-ok': '{path} : monté, lisible', 'set-fold-remounted': '{path} : détaché, remonté', 'set-fold-missing': '{path} : inaccessible',
|
|
@@ -135,7 +138,7 @@ export const SETTINGS_WORDS_FR = {
|
|
|
135
138
|
'set-list-not-filed': 'Sans groupe', 'set-list-asks': 'vous demande', 'set-list-waits': 'vous attend',
|
|
136
139
|
'set-list-asks-for': 'le répondeur vous demande', 'set-list-answered': 'a répondu à votre place',
|
|
137
140
|
'set-list-wakeup': '1 réveil', 'set-list-wakeups': '{n} réveils', 'set-list-hidden': 'cachée',
|
|
138
|
-
'set-list-asleep': 'en veille', 'set-list-stopped': 'arrêtée',
|
|
141
|
+
'set-list-asleep': 'en veille', 'set-list-stopped': 'arrêtée', 'set-reaching': 'Je la retrouve :',
|
|
139
142
|
'set-lent-page': 'Lue pour sa copie « {t} » · rien à faire', 'set-carry-down': 'Elle doit tourner pour exporter ou importer', 'set-list-starting': 'démarre', 'set-list-restarting': 'redémarre',
|
|
140
143
|
'set-list-moving': 'déplace son travail', 'set-list-failed': 'en échec', 'set-list-you': 'Vous : {text}',
|
|
141
144
|
'set-list-fewer': 'En montrer moins', 'set-list-more': 'En montrer {n} de plus',
|
package/server/talk.mjs
CHANGED
|
@@ -497,8 +497,13 @@ export class Talk {
|
|
|
497
497
|
/* The rooms it is in, and who is there (#268): told to its agent, which answers there by their ids. */
|
|
498
498
|
rooms(name, list) { try { this.#parley(name).setRooms(list); } catch { /* its folder is not there yet */ } }
|
|
499
499
|
|
|
500
|
+
/* Whether its chat is on, without reading the thread (`of` builds it all: too dear before each message). */
|
|
501
|
+
#on(name) { return this.#known(name).work === 'kept' && this.#store.get(name)?.on === true; }
|
|
502
|
+
|
|
503
|
+
/* `extra.quick` (the page's own send, 14-11): answered as soon as the message is written -- its tool told
|
|
504
|
+
after, by itself -- so that the message shows at once; the page draws the thread again anyway. */
|
|
500
505
|
async say(name, text, answers, files, via, extra) {
|
|
501
|
-
if (!this
|
|
506
|
+
if (!this.#on(name)) throw new Refusal(409, 'Talking through the app is not turned on for this conversation.');
|
|
502
507
|
const given = files === undefined || files === null ? [] : files;
|
|
503
508
|
if (!Array.isArray(given) || given.length > FILES_MAX) throw new Refusal(400, `A message has ${FILES_MAX} files at most.`);
|
|
504
509
|
/* Only files put here by `attach`: their paths are this server's, and each is there. Each is
|
|
@@ -519,6 +524,7 @@ export class Talk {
|
|
|
519
524
|
let said = text ?? '';
|
|
520
525
|
if (this.#screen && said) { try { said = await this.#screen(name, said); } catch { said = text ?? ''; } }
|
|
521
526
|
try { this.#parley(name).say(said, answers, attached, { via: via === 'voice' ? 'voice' : undefined, ...(extra && typeof extra === 'object' ? { picked: extra.picked, replies: extra.replies, about: extra.about, by: extra.by, room: extra.room } : {}) }); } catch (error) { if (error instanceof RangeError) throw new Refusal(400, error.message); throw error; }
|
|
527
|
+
if (extra?.quick === true) { void this.#wake(name).catch(() => {}); return { ok: true, told: 'later' }; }
|
|
522
528
|
const told = await this.#wake(name);
|
|
523
529
|
return { ...this.of(name), told };
|
|
524
530
|
}
|
package/web/app.js
CHANGED
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
if (pose === null) { if (m) m.hidden = true; return; }
|
|
141
141
|
if (!m) {
|
|
142
142
|
m = document.createElement('div'); m.id = 'notice-mascot'; m.className = 'mascot';
|
|
143
|
-
m.innerHTML = `${MASCOTS[MASCOT]()}<span class="m-z">z</span><span class="m-z">z</span><span class="m-z">z</span>`;
|
|
143
|
+
m.innerHTML = `${MASCOTS[MASCOT]()}<span class="m-z">z</span><span class="m-z">z</span><span class="m-z">z</span><span class="m-q" aria-hidden="true">?</span>`;
|
|
144
144
|
$('notice-text').before(m);
|
|
145
145
|
}
|
|
146
146
|
m.hidden = false;
|
|
@@ -169,9 +169,18 @@
|
|
|
169
169
|
}
|
|
170
170
|
m.classList.remove('waking', 'stirring');
|
|
171
171
|
m.classList.toggle('asleep', pose === 'asleep');
|
|
172
|
+
/* Finding its way back (14-11): the page come back after a while, the server asked again -- a question mark over it. */
|
|
173
|
+
m.classList.toggle('wondering', pose === 'wondering');
|
|
172
174
|
m.dataset.pose = pose;
|
|
173
175
|
};
|
|
174
176
|
|
|
177
|
+
/* A wait that ends goes in a short fade (14-11: not abrupt), its place given back at once. */
|
|
178
|
+
const fadeAway = (box) => {
|
|
179
|
+
if (box.hidden) return;
|
|
180
|
+
if (matchMedia('(prefers-reduced-motion: reduce)').matches) { box.hidden = true; return; }
|
|
181
|
+
box.classList.add('fading-out');
|
|
182
|
+
setTimeout(() => { box.classList.remove('fading-out'); box.hidden = true; }, 160);
|
|
183
|
+
};
|
|
175
184
|
const show = (text, action, run, cancel) => {
|
|
176
185
|
$('notice-text').textContent = text;
|
|
177
186
|
$('notice-action').textContent = action ?? '';
|
|
@@ -869,7 +878,7 @@
|
|
|
869
878
|
it said then was lost -- nobody listened yet. The bridge listens
|
|
870
879
|
from "ready" on. Until it hears, the tool draws for the old size
|
|
871
880
|
and whatever is typed meanwhile lands in a garbled screen. */
|
|
872
|
-
if (message.type === 'ready') { say('live', 'live'); notice
|
|
881
|
+
if (message.type === 'ready') { say('live', 'live'); fadeAway(notice); fit.fit(); sendSize(); setTimeout(() => { fit.fit(); sendSize(); }, 300); }
|
|
873
882
|
/* A start told step by step: the same panel as a build or a restart. */
|
|
874
883
|
if (message.type === 'status' && message.progress) {
|
|
875
884
|
if (message.text) say(String(message.text), 'connecting');
|
|
@@ -881,13 +890,13 @@
|
|
|
881
890
|
not enough for a wait that can last minutes (a tester waited
|
|
882
891
|
three, with nothing else to read). One sentence, with the time
|
|
883
892
|
it has taken so far, said again each second. */
|
|
884
|
-
const said = String(message.text);
|
|
893
|
+
const said = message.text ? String(message.text) : uiSaid('set-reaching', 'Reaching it again:');
|
|
885
894
|
const since = waitingSince || Date.now();
|
|
886
895
|
const tell = () => {
|
|
887
896
|
const s = Math.floor((Date.now() - since) / 1000);
|
|
888
897
|
$('notice-text').textContent = `${said} ${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')} so far; a start usually takes a minute or two. Its work, its files and its chat are kept.`;
|
|
889
898
|
};
|
|
890
|
-
show(''); tell();
|
|
899
|
+
show(''); tell(); mascot('wondering');
|
|
891
900
|
const ticking = setInterval(() => { if (socket !== mine || output || notice.hidden) { clearInterval(ticking); return; } tell(); }, 1000);
|
|
892
901
|
slowTimers.push(ticking);
|
|
893
902
|
}
|
|
@@ -3515,7 +3524,7 @@
|
|
|
3515
3524
|
/* The whole thread searched, however little of it is shown. */
|
|
3516
3525
|
search: (q) => fetch(talkPath(name, '/search', { q })).then((r) => (r.ok ? r.json() : { matches: [], count: 0 })),
|
|
3517
3526
|
/* `via: 'voice'`: part of it was dictated, said to the tool. */
|
|
3518
|
-
send: (text, answers, files, extra) => post(talkPath(name), { text, answers, ...(files ? { files: files.map((f) => (f.note ? { path: f.path, note: f.note } : f.path)) } : {}), ...(extra?.via === 'voice' ? { via: 'voice' } : {}),
|
|
3527
|
+
send: (text, answers, files, extra) => post(talkPath(name), { text, answers, quick: true, ...(files ? { files: files.map((f) => (f.note ? { path: f.path, note: f.note } : f.path)) } : {}), ...(extra?.via === 'voice' ? { via: 'voice' } : {}),
|
|
3519
3528
|
/* The choices ticked, the answers of a group, the zone of a picture the answer is about. */
|
|
3520
3529
|
...(extra?.picked ? { picked: extra.picked } : {}), ...(extra?.replies ? { replies: extra.replies } : {}), ...(extra?.about ? { about: extra.about } : {}) }),
|
|
3521
3530
|
/* Formulas: Parley's own KaTeX, served here. Zones and people may point to a file of a shared folder (file:/work/...). */
|
|
@@ -8331,6 +8340,43 @@
|
|
|
8331
8340
|
$('events-more').hidden = got.length < 100;
|
|
8332
8341
|
}
|
|
8333
8342
|
$('settings-events-top').addEventListener('toggle', () => { if ($('settings-events-top').open) void paintEvents(); });
|
|
8343
|
+
/* JOBS (jobs.mjs): the day's, under way first, as in the badge's list; a line opened reads its log
|
|
8344
|
+
(GET /api/jobs/log), kept open when the list is read again -- every 5 s while one is under way. */
|
|
8345
|
+
let jobsTimer; const jobsOpen = new Set();
|
|
8346
|
+
const jobClock = (at) => new Date(at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false });
|
|
8347
|
+
async function paintJobLog(box, id) {
|
|
8348
|
+
const got = await fetch(`${API}/jobs/log?id=${encodeURIComponent(id)}`).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
8349
|
+
const list = el('ol', 'job-log');
|
|
8350
|
+
for (const line of got?.log ?? []) { const li = el('li'); const when = el('time', '', jobClock(line.at)); when.dateTime = line.at; li.append(when, el('span', '', line.text)); list.append(li); }
|
|
8351
|
+
if (!list.children.length) list.append(el('li', 'hint', got ? uiSaid('set-jobs-nolog', 'Nothing logged') : uiSaid('set-jobs-unread', 'Cannot be read just now')));
|
|
8352
|
+
box.querySelector('.job-log')?.remove(); box.append(list);
|
|
8353
|
+
}
|
|
8354
|
+
async function paintJobsChapter() {
|
|
8355
|
+
clearTimeout(jobsTimer);
|
|
8356
|
+
if (!$('settings-jobs-top').open) return;
|
|
8357
|
+
const got = await fetch(`${API}/jobs`).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
8358
|
+
if (!got) { $('jobs-said').textContent = uiSaid('set-jobs-unread', 'Cannot be read just now'); return; }
|
|
8359
|
+
const line = (j, result) => {
|
|
8360
|
+
const box = el('details', 'job-line'); box.dataset.result = result;
|
|
8361
|
+
const sum = el('summary');
|
|
8362
|
+
sum.append(el('span', '', result === 'running' ? '⟳' : result === 'done' ? '✓' : '✗'), el('span', '', j.what),
|
|
8363
|
+
el('small', '', result === 'running' ? (j.step || uiSaid('set-jobs-starting', 'Starting')) : [j.why, j.endedAt ? jobClock(j.endedAt) : ''].filter(Boolean).join(' · ')));
|
|
8364
|
+
box.append(sum);
|
|
8365
|
+
/* Clavarium's own updates have no log here: their story is in Updates. */
|
|
8366
|
+
if (!j.id) { sum.addEventListener('click', (event) => event.preventDefault()); return box; }
|
|
8367
|
+
box.dataset.job = j.id;
|
|
8368
|
+
box.addEventListener('toggle', () => { if (box.open) { jobsOpen.add(j.id); void paintJobLog(box, j.id); } else jobsOpen.delete(j.id); });
|
|
8369
|
+
if (jobsOpen.has(j.id)) box.open = true;
|
|
8370
|
+
return box;
|
|
8371
|
+
};
|
|
8372
|
+
const parts = [];
|
|
8373
|
+
if (got.running.length) parts.push(el('h3', '', uiSaid('set-jobs-running', 'Under way')), ...got.running.map((j) => line(j, 'running')));
|
|
8374
|
+
if (got.done.length) parts.push(el('h3', '', uiSaid('set-jobs-today', 'Today')), ...got.done.map((j) => line(j, j.result === 'done' ? 'done' : 'failed')));
|
|
8375
|
+
$('jobs-list').replaceChildren(...parts);
|
|
8376
|
+
$('jobs-said').textContent = parts.length ? '' : uiSaid('set-jobs-none', 'Nothing today');
|
|
8377
|
+
if (got.running.length) jobsTimer = setTimeout(() => { void paintJobsChapter(); }, 5000);
|
|
8378
|
+
}
|
|
8379
|
+
$('settings-jobs-top').addEventListener('toggle', () => { void paintJobsChapter(); });
|
|
8334
8380
|
$('events-kind').addEventListener('change', () => { void paintEvents(); });
|
|
8335
8381
|
let eventsTyping;
|
|
8336
8382
|
$('events-q').addEventListener('input', () => { clearTimeout(eventsTyping); eventsTyping = setTimeout(() => { void paintEvents(); }, 250); });
|
package/web/index.html
CHANGED
|
@@ -1345,6 +1345,14 @@
|
|
|
1345
1345
|
<button type="button" id="events-more" hidden>Show older</button>
|
|
1346
1346
|
</div>
|
|
1347
1347
|
</details>
|
|
1348
|
+
<!-- WHAT IT DID TODAY: the day's jobs (server/jobs.mjs), under way first; each opens to its log. -->
|
|
1349
|
+
<details class="chapter" id="settings-jobs-top" data-chapter="s-jobs">
|
|
1350
|
+
<summary><span class="chapter-title" data-said="set-ch-s-jobs">Jobs</span><span class="chapter-about">Builds, copies, moves, step by step.</span></summary>
|
|
1351
|
+
<div class="chapter-body">
|
|
1352
|
+
<div id="jobs-list" class="jobs-list" aria-live="polite"></div>
|
|
1353
|
+
<p class="hint" id="jobs-said" role="status"></p>
|
|
1354
|
+
</div>
|
|
1355
|
+
</details>
|
|
1348
1356
|
<!-- WHAT THE SERVER'S PROGRAMS SAID, to read, copy whole or keep (server/serverlogs.mjs);
|
|
1349
1357
|
and this server started again. -->
|
|
1350
1358
|
<details class="chapter" id="settings-logs-top" data-chapter="s-logs">
|
package/web/style.css
CHANGED
|
@@ -1673,6 +1673,19 @@ svg.u-spark .u-oom { fill: var(--danger); stroke: var(--panel); stroke-width: 1.
|
|
|
1673
1673
|
.event-conv { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
|
|
1674
1674
|
.event-conv button { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
1675
1675
|
@media (max-width: 600px) { .event { grid-template-columns: 1fr auto auto; } .event-text, .event-who { grid-column: 1 / -1; } }
|
|
1676
|
+
/* Settings, Jobs: one line each, as in the badge's list; opened, its log, one line a step. */
|
|
1677
|
+
.jobs-list { display: flex; flex-direction: column; margin: 8px 0; font-size: .875rem; }
|
|
1678
|
+
.jobs-list h3 { margin: 10px 0 2px; font-size: .8125rem; color: var(--ink2); }
|
|
1679
|
+
.job-line { border-bottom: 1px solid var(--line); }
|
|
1680
|
+
.job-line > summary { display: grid; grid-template-columns: 16px 1fr; gap: 2px 8px; padding: 4px 0; cursor: pointer; list-style: none; }
|
|
1681
|
+
.job-line > summary::-webkit-details-marker { display: none; }
|
|
1682
|
+
.job-line > summary small { grid-column: 2; color: var(--ink2); overflow-wrap: anywhere; }
|
|
1683
|
+
.job-line[data-result="done"] > summary > span:first-child { color: var(--ok); }
|
|
1684
|
+
.job-line[data-result="failed"] > summary { color: var(--danger); }
|
|
1685
|
+
.job-log { list-style: none; margin: 0 0 6px 24px; padding: 0; font-size: .8125rem; }
|
|
1686
|
+
.job-log li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 8px; padding: 1px 0; }
|
|
1687
|
+
.job-log time { color: var(--ink2); font-variant-numeric: tabular-nums; }
|
|
1688
|
+
.job-log span { min-width: 0; overflow-wrap: anywhere; }
|
|
1676
1689
|
/* The choices of Logs and What happened: as wide as their words, in the colours of the page. */
|
|
1677
1690
|
.events-pick select, .logs-pick select { width: auto; max-width: 100%; background-color: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
|
|
1678
1691
|
/* Needs you and Recent: a heading that folds its rows, with how many it holds. */
|
|
@@ -3078,3 +3091,10 @@ button.kit-switch[aria-checked="true"]::after { left: 18px; background: var(--ok
|
|
|
3078
3091
|
.hand-switches .set-row > .set-what { flex: none; }
|
|
3079
3092
|
.hand-switches .set-row > .set-control { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
|
|
3080
3093
|
a.button[aria-disabled] { opacity: .5; pointer-events: none; }
|
|
3094
|
+
|
|
3095
|
+
/* Finding its way back (14-11): a question mark that rises over the sheep, slowly. */
|
|
3096
|
+
.mascot .m-q { position: absolute; left: 80%; top: -10%; font: 700 18px var(--sans, system-ui); color: var(--brass); opacity: 0; pointer-events: none; }
|
|
3097
|
+
.mascot.wondering .m-q { animation: m-q 2.4s ease-in-out infinite; }
|
|
3098
|
+
@keyframes m-q { 0% { opacity: 0; transform: translateY(6px) rotate(-8deg); } 30%, 70% { opacity: 1; transform: translateY(0) rotate(6deg); } 100% { opacity: 0; transform: translateY(-4px) rotate(-4deg); } }
|
|
3099
|
+
.fading-out { transition: opacity .15s ease-out; opacity: 0; }
|
|
3100
|
+
@media (prefers-reduced-motion: reduce) { .mascot.wondering .m-q { animation: none; opacity: 1; } }
|