clavarium 0.2.49-next.1 → 0.2.51-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/deploy/clavarium-host +10 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/conversations.mjs +18 -3
- package/server/vm.mjs +4 -2
- package/web/app.js +38 -10
- package/web/index.html +3 -1
- package/web/style.css +29 -9
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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51-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.51-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
|
@@ -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
|
@@ -966,17 +966,35 @@
|
|
|
966
966
|
full -- not marked "Seen"; a program stopped for lack of memory (its files safe) is only said. */
|
|
967
967
|
const healthNeeds = (c) => c.phase === 'ready' && !c.asleep && (c.health?.problems ?? []).some((p) => (p.level === 'bad' || (p.level === 'warn' && ['memory', 'disk'].includes(p.kind) && !String(p.key).startsWith('oom:'))) && !(c.health.seen ?? []).includes(p.key));
|
|
968
968
|
const needsYou = (c) => Boolean(talkNeeds(c) || c.answerer?.needs || c.phase === 'failed' || healthNeeds(c));
|
|
969
|
-
/*
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
const
|
|
969
|
+
/* TWO LAYERS per conversation: a point for its MACHINE (green on, amber busy, red a problem, hollow asleep)
|
|
970
|
+
and a ring around it for its AGENT (gold at work, blue waits for you, green finished). The agent asking or
|
|
971
|
+
waiting is the blue ring, not the red point -- red is kept for a machine that failed or is unwell. */
|
|
972
|
+
const machineState = (c) => (c.asleep ? 'off' : (c.phase === 'failed' || healthNeeds(c)) ? 'problem'
|
|
973
|
+
: (holds(c) || ['building', 'restarting', 'moving'].includes(c.phase)) ? 'busy' : 'online');
|
|
974
|
+
const agentState = (c) => (c.asleep ? 'sleep' : (talkNeeds(c) || c.answerer?.needs) ? 'wait'
|
|
975
|
+
: c.talk?.state === 'working' ? 'work' : c.talk?.state === 'done' ? 'done' : 'idle');
|
|
976
|
+
const MACHINE_WORDS = { online: '', busy: 'machine busy', problem: 'a problem', off: 'asleep' };
|
|
977
|
+
const AGENT_WORDS = { work: 'at work', wait: 'waits for you', done: 'finished', idle: '', sleep: '' };
|
|
978
|
+
const stateIndicator = (c) => {
|
|
979
|
+
const m = machineState(c); const a = agentState(c);
|
|
980
|
+
const ind = document.createElement('span'); ind.className = 'state-ind'; ind.dataset.machine = m; ind.dataset.agent = a;
|
|
981
|
+
const ring = document.createElement('span'); ring.className = 'state-ring';
|
|
982
|
+
const core = document.createElement('span'); core.className = 'state-core';
|
|
983
|
+
ind.append(ring, core); ind.setAttribute('role', 'img');
|
|
984
|
+
const words = [MACHINE_WORDS[m], AGENT_WORDS[a]].filter(Boolean).join(' · ') || 'idle';
|
|
985
|
+
ind.title = words; ind.setAttribute('aria-label', words);
|
|
986
|
+
return ind;
|
|
987
|
+
};
|
|
973
988
|
const statePoint = (state) => { const d = document.createElement('span'); d.className = 'state-dot'; d.dataset.state = state; return d; };
|
|
974
|
-
/* Folded, a heading
|
|
975
|
-
|
|
976
|
-
const
|
|
989
|
+
/* Folded, a heading sums its conversations: one flat point each, same colours, no ring -- the worst kept first
|
|
990
|
+
(a problem, waits for you, at work, busy, fine, asleep) -- and the same in words for a screen reader. */
|
|
991
|
+
const STATE_WORDS = { problem: 'a problem', wait: 'waits for you', work: 'at work', busy: 'busy', ok: 'fine', sleep: 'asleep' };
|
|
992
|
+
const rollup = (c) => { const m = machineState(c); const a = agentState(c);
|
|
993
|
+
return (m === 'off' ? 'sleep' : m === 'problem' ? 'problem' : a === 'wait' ? 'wait' : a === 'work' ? 'work' : m === 'busy' ? 'busy' : 'ok'); };
|
|
994
|
+
const STATE_ORDER = ['problem', 'wait', 'work', 'busy', 'ok', 'sleep'];
|
|
977
995
|
function stateSummary(list) {
|
|
978
996
|
const count = Object.fromEntries(STATE_ORDER.map((k) => [k, 0]));
|
|
979
|
-
for (const c of list) count[
|
|
997
|
+
for (const c of list) count[rollup(c)] += 1;
|
|
980
998
|
const slots = Math.min(4, list.length);
|
|
981
999
|
const present = STATE_ORDER.filter((k) => count[k] > 0);
|
|
982
1000
|
const got = Object.fromEntries(STATE_ORDER.map((k) => [k, 0]));
|
|
@@ -1055,7 +1073,7 @@
|
|
|
1055
1073
|
b.append(when); b.dataset.when = 'true';
|
|
1056
1074
|
} else b.append(title, ...(plain ? [] : [sub]));
|
|
1057
1075
|
/* Its state: one point, on the right. */
|
|
1058
|
-
|
|
1076
|
+
b.append(stateIndicator(c));
|
|
1059
1077
|
/* Found by a search while hidden: said. */
|
|
1060
1078
|
if (c.hidden === true && query) { const mark = document.createElement('small'); mark.className = 'shared-mark'; mark.textContent = 'hidden'; b.append(mark); }
|
|
1061
1079
|
/* Several models answer its simple questions; or they stopped, and it waits for its owner. */
|
|
@@ -1429,6 +1447,15 @@
|
|
|
1429
1447
|
select.replaceChildren(...mems.map((m) => { const o = document.createElement('option'); o.value = String(m); o.textContent = sizeWords(m); return o; }));
|
|
1430
1448
|
select.value = String(mems.includes(was) ? was : least);
|
|
1431
1449
|
$('newconv-memory-least').textContent = tool ? `${tool.label} needs ${sizeWords(least)} at least` : '';
|
|
1450
|
+
/* Cores: 1 to what this server has (learnt from any machine we know), default 1. */
|
|
1451
|
+
const hostCpus = Math.max(1, ...conversations.map((c) => c.hostCpus ?? 1));
|
|
1452
|
+
const cpus = $('newconv-cpus'); const wasCpus = Number(cpus.value) || 1;
|
|
1453
|
+
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; }));
|
|
1454
|
+
cpus.value = String(wasCpus <= hostCpus ? wasCpus : 1);
|
|
1455
|
+
/* Disk: from the default up; it only grows afterwards. */
|
|
1456
|
+
const disk = $('newconv-disk'); const wasDisk = Number(disk.value) || 8;
|
|
1457
|
+
disk.replaceChildren(...DISK_CHOICES.map((d) => { const o = document.createElement('option'); o.value = String(d); o.textContent = `${d} GB${d === 8 ? ' (default)' : ''}`; return o; }));
|
|
1458
|
+
disk.value = String(DISK_CHOICES.includes(wasDisk) ? wasDisk : 8);
|
|
1432
1459
|
}
|
|
1433
1460
|
function paintNewTools() {
|
|
1434
1461
|
const box = $('newconv-tools');
|
|
@@ -1499,10 +1526,11 @@
|
|
|
1499
1526
|
if (id && !ID_SHAPE.test(id)) { newError('id', 'Lower-case letters, digits, hyphens'); return; }
|
|
1500
1527
|
const least = newTools.find((t) => t.id === chosenTool)?.memoryMb;
|
|
1501
1528
|
const memoryMb = Number($('newconv-memory').value);
|
|
1529
|
+
const cpus = Number($('newconv-cpus').value); const diskGb = Number($('newconv-disk').value);
|
|
1502
1530
|
newError('', '');
|
|
1503
1531
|
creating = true; $('newconv-create').disabled = true;
|
|
1504
1532
|
try {
|
|
1505
|
-
const made = await post(`${API}/conversations`, { title, ...(id ? { name: id } : {}), ...(group ? { group } : {}), tool: chosenTool, workOnDisk: newOnDisk(), ...(memoryMb && memoryMb !== least ? { memoryMb } : {}) });
|
|
1533
|
+
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 } : {}) });
|
|
1506
1534
|
$('newconv-name').value = ''; $('newconv-id').value = ''; $('newconv-id').placeholder = 'website-redesign'; $('newconv-group').value = '';
|
|
1507
1535
|
$('newconv-work').querySelector('[data-work="kept"]').click(); $('newconv-more').open = false;
|
|
1508
1536
|
await refresh();
|
package/web/index.html
CHANGED
|
@@ -904,10 +904,12 @@
|
|
|
904
904
|
<details class="more"><summary>Which one?</summary>A code project that installs packages: its disk. Can be changed later.</details>
|
|
905
905
|
</div>
|
|
906
906
|
<details class="chapter" id="newconv-more">
|
|
907
|
-
<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>
|
|
908
908
|
<div class="chapter-body">
|
|
909
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>
|
|
910
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>
|
|
911
913
|
</div>
|
|
912
914
|
</details>
|
|
913
915
|
</div>
|
package/web/style.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
a narrow one, the list and the conversation are two screens. */
|
|
3
3
|
:root {
|
|
4
4
|
--bg: #0f141a; --bar: #161d26; --panel: #131a22; --line: #2b3745; --ink: #e7edf4; --ink2: #a3b1c2;
|
|
5
|
-
--brass: #d2a94e; --on-brass: #1b1405; --ok: #5fc39d; --warn: #e39a5c; --danger: #ee7f79;
|
|
5
|
+
--brass: #d2a94e; --on-brass: #1b1405; --ok: #5fc39d; --warn: #e39a5c; --danger: #ee7f79; --wait: #5aa9f0;
|
|
6
6
|
/* Brass as the colour of text or of a small sign: darker on a light screen, to be read. */
|
|
7
7
|
--brass-ink: #d2a94e;
|
|
8
8
|
--sans: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
colours of its own for it (app.js): a tool's "white" must stay readable. */
|
|
12
12
|
:root[data-theme="light"] {
|
|
13
13
|
--bg: #fbfbfa; --bar: #eef0f3; --panel: #ffffff; --line: #c5cdd8; --ink: #17202b; --ink2: #4f5d6d;
|
|
14
|
-
--brass: #c79a3a; --on-brass: #1b1405; --ok: #1f7a5a; --warn: #a3581a; --danger: #b3261e; --button: #e6eaef; --brass-ink: #8a5d00;
|
|
14
|
+
--brass: #c79a3a; --on-brass: #1b1405; --ok: #1f7a5a; --warn: #a3581a; --danger: #b3261e; --wait: #2f7fd6; --button: #e6eaef; --brass-ink: #8a5d00;
|
|
15
15
|
}
|
|
16
16
|
* { box-sizing: border-box; }
|
|
17
17
|
/* TEXT IS IN rem: one size at the root (set per device by app.js, as a
|
|
@@ -34,21 +34,41 @@ button:focus-visible, input:focus-visible { outline: 2px solid var(--brass); out
|
|
|
34
34
|
.item[aria-current="true"] { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass); }
|
|
35
35
|
.item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
36
36
|
.item small { color: var(--ink2); }
|
|
37
|
-
/* ITS STATE,
|
|
38
|
-
|
|
37
|
+
/* ITS STATE, on the right of its row: two layers at once -- a point for the
|
|
38
|
+
machine (green on, amber busy, red a problem, hollow asleep) and a ring
|
|
39
|
+
around it for the agent (gold at work, blue waits for you, green finished).
|
|
40
|
+
A flat point of the same colours sums a folded group, with no ring. */
|
|
41
|
+
.item { position: relative; padding-right: 28px; }
|
|
39
42
|
.state-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-sizing: border-box; background: var(--ok); }
|
|
40
|
-
.state-dot[data-state="
|
|
41
|
-
.state-dot[data-state="
|
|
43
|
+
.state-dot[data-state="problem"] { background: var(--danger); }
|
|
44
|
+
.state-dot[data-state="wait"] { background: var(--wait); }
|
|
45
|
+
.state-dot[data-state="work"] { background: var(--brass); }
|
|
46
|
+
.state-dot[data-state="busy"] { background: var(--warn); }
|
|
42
47
|
.state-dot[data-state="sleep"] { background: transparent; border: 1.5px solid var(--ink2); }
|
|
43
|
-
|
|
44
|
-
.
|
|
48
|
+
/* The row indicator: a ring (agent) around a core (machine). */
|
|
49
|
+
.state-ind { position: relative; width: 16px; height: 16px; display: inline-grid; place-items: center; flex-shrink: 0; }
|
|
50
|
+
.item > .state-ind { position: absolute; right: 9px; top: 11px; }
|
|
51
|
+
.state-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; box-sizing: border-box; }
|
|
52
|
+
.state-core { width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; background: var(--ok); }
|
|
53
|
+
.state-ind[data-machine="busy"] .state-core { background: var(--warn); animation: breathe 1.5s ease-in-out infinite; }
|
|
54
|
+
.state-ind[data-machine="problem"] .state-core { background: var(--danger); }
|
|
55
|
+
.state-ind[data-machine="off"] .state-core { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink2); }
|
|
56
|
+
.state-ind[data-agent="work"] .state-ring { border-color: var(--brass); animation: breathe 1.9s ease-in-out infinite; }
|
|
57
|
+
.state-ind[data-agent="wait"] .state-ring { border-color: var(--wait); }
|
|
58
|
+
.state-ind[data-agent="done"] .state-ring { border-color: var(--ok); }
|
|
59
|
+
.state-ind[data-agent="sleep"] .state-ring { border-color: var(--line); }
|
|
45
60
|
/* Folded: up to four points, how its conversations are. */
|
|
46
61
|
.state-sum { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
|
|
47
62
|
/* Unfolded: it comes in gently, once. */
|
|
48
63
|
.unfolding { animation: unfold .18s ease-out; }
|
|
49
64
|
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
|
|
50
65
|
@keyframes pulse { 50% { opacity: .25; } }
|
|
51
|
-
@
|
|
66
|
+
@keyframes breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.82); } }
|
|
67
|
+
/* Movement off: no pulse, and a dashed ring tells "at work" by shape instead. */
|
|
68
|
+
@media (prefers-reduced-motion: reduce) {
|
|
69
|
+
.state-core, .state-ring, .unfolding { animation: none !important; }
|
|
70
|
+
.state-ind[data-agent="work"] .state-ring { border-style: dashed; }
|
|
71
|
+
}
|
|
52
72
|
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
53
73
|
.choices button[aria-checked="true"] { border-color: var(--brass); background: rgba(210, 169, 78, .16); }
|
|
54
74
|
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|