desky-agent 0.3.6 → 0.3.7
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/firmware/firmware.bin +0 -0
- package/firmware/manifest.json +2 -2
- package/package.json +1 -1
- package/ui/app.html +88 -23
package/firmware/firmware.bin
CHANGED
|
Binary file
|
package/firmware/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawd-desk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"chip": "esp32s3",
|
|
5
5
|
"board": "waveshare-esp32-s3-zero",
|
|
6
6
|
"flash_size": "4MB",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"file": "firmware.bin",
|
|
28
28
|
"address": "0x10000",
|
|
29
29
|
"size": 339200,
|
|
30
|
-
"sha256": "
|
|
30
|
+
"sha256": "9710e6392f4dc88ea5863ff5b5df0974f7da1503769455a43c898ca6a421dcce"
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
}
|
package/package.json
CHANGED
package/ui/app.html
CHANGED
|
@@ -307,6 +307,25 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
307
307
|
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.1); } }
|
|
308
308
|
@media (prefers-reduced-motion: reduce) { svg.alive .eye { animation: none; } .page, .wiz .step { animation: none !important; } }
|
|
309
309
|
|
|
310
|
+
/* ---------------------------------------------------------------- a new version: dialog over the window */
|
|
311
|
+
.upd { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px;
|
|
312
|
+
background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(3px); }
|
|
313
|
+
.upd .card { width: min(440px, 100%); padding: 28px 28px 22px; border-radius: 22px; box-shadow: var(--shadow-lg);
|
|
314
|
+
display: grid; gap: 14px; justify-items: center; text-align: center; animation: stepin .3s cubic-bezier(.2, .8, .2, 1); }
|
|
315
|
+
.upd svg.big { width: 112px; height: 84px; }
|
|
316
|
+
.upd h2 { font-size: 21px; margin: 0; }
|
|
317
|
+
.upd p { margin: 0; color: var(--muted); line-height: 1.5; }
|
|
318
|
+
.upd .ver { font-family: var(--f-mono, ui-monospace, monospace); font-size: 13px; padding: 4px 10px; border-radius: 99px;
|
|
319
|
+
background: var(--clawd-soft); color: var(--clawd-hi); }
|
|
320
|
+
.upd .cmd { display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 8px 8px 12px; border-radius: 10px;
|
|
321
|
+
background: var(--sunk); font-family: var(--f-mono, ui-monospace, monospace); font-size: 13px; text-align: left; }
|
|
322
|
+
.upd .cmd span { flex: 1; }
|
|
323
|
+
.upd .acts { display: flex; gap: 10px; justify-content: center; width: 100%; margin-top: 4px; }
|
|
324
|
+
.upd .acts .pri { flex: 1; }
|
|
325
|
+
.lk.btn.new { background: var(--clawd); color: var(--clawd-ink); font-weight: 600; }
|
|
326
|
+
.lk.btn.new span:last-child { color: inherit; }
|
|
327
|
+
.lk.btn.new .dot { background: var(--clawd-ink); }
|
|
328
|
+
|
|
310
329
|
/* ---------------------------------------------------------------- setup wizard */
|
|
311
330
|
.wiz { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
|
|
312
331
|
background: color-mix(in srgb, var(--bg) 88%, transparent); }
|
|
@@ -594,6 +613,17 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
594
613
|
</div>
|
|
595
614
|
|
|
596
615
|
<!-- ============================================================ setup wizard -->
|
|
616
|
+
<div class="upd" id="updModal" hidden role="dialog" aria-modal="true" aria-labelledby="updTitle">
|
|
617
|
+
<div class="card">
|
|
618
|
+
<svg class="big alive" id="updFace" viewBox="0 0 64 48" aria-hidden="true"></svg>
|
|
619
|
+
<span class="ver" id="updVer"></span>
|
|
620
|
+
<h2 id="updTitle">Вийшла нова версія Desky</h2>
|
|
621
|
+
<p id="updLead"></p>
|
|
622
|
+
<div class="cmd" id="updCmd" hidden><span>npx desky-agent@latest</span><button type="button" class="sm" id="updCopy">Копіювати</button></div>
|
|
623
|
+
<div class="acts"><button type="button" class="ghost" id="updSkip">Пізніше</button><button type="button" class="pri lg" id="updNow">Оновити зараз</button></div>
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
|
|
597
627
|
<div class="wiz" id="wiz" hidden role="dialog" aria-modal="true" aria-labelledby="wizTitle">
|
|
598
628
|
<div class="panel">
|
|
599
629
|
<div class="top">
|
|
@@ -678,6 +708,11 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
678
708
|
send(cmd);
|
|
679
709
|
});
|
|
680
710
|
}
|
|
711
|
+
// a test move, twice there and back: one small twitch is easy to miss, on a video too
|
|
712
|
+
async function demoMove(line) {
|
|
713
|
+
await move('home');
|
|
714
|
+
for (let i = 0; i < 2; i++) { await move(line); await wait(700); await move('home'); await wait(300); }
|
|
715
|
+
}
|
|
681
716
|
let onUntil = 0; // until then the board is still busy with the last "on" (any page sends it)
|
|
682
717
|
async function servosOn() {
|
|
683
718
|
if (!beat || /отпущены/.test(beat)) await send('on');
|
|
@@ -808,8 +843,8 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
808
843
|
}
|
|
809
844
|
}
|
|
810
845
|
// ---------------------------------------------------------------- new versions of the app
|
|
811
|
-
|
|
812
|
-
|
|
846
|
+
// the dialog comes back every time the window opens until the update is in; "Пізніше" closes it for this window only
|
|
847
|
+
let modalSkipped = '';
|
|
813
848
|
let updSeen = ''; // a done or failed text closed with "Сховати"
|
|
814
849
|
let au = {}, updErr = ''; // updErr: the button's own failure, kept until the next try
|
|
815
850
|
function showUpdate(a) {
|
|
@@ -819,7 +854,10 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
819
854
|
$('sVer').textContent = au.version ? (au.available ? au.version + ' → ' + au.latest : au.version) : '—';
|
|
820
855
|
$('dVer').className = 'dot ' + (au.state === 'failed' ? 'bad' : au.available ? 'warn' : 'on');
|
|
821
856
|
$('verRow').disabled = !au.available;
|
|
822
|
-
$('verRow').
|
|
857
|
+
$('verRow').classList.toggle('new', Boolean(au.available && au.state !== 'updating'));
|
|
858
|
+
if (au.available && au.state !== 'updating') $('sVer').textContent = 'оновити до ' + au.latest;
|
|
859
|
+
$('verRow').title = au.available ? 'стоїть ' + au.version + ', вийшла ' + au.latest + ': оновити' : 'версія програми Desky Agent';
|
|
860
|
+
showModal();
|
|
823
861
|
let show = false;
|
|
824
862
|
box.classList.remove('bad', 'ok');
|
|
825
863
|
p.textContent = '';
|
|
@@ -834,13 +872,13 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
834
872
|
p.append(b(au.state === 'failed' ? 'Оновлення не вдалося. ' : 'Готово. '), au.text);
|
|
835
873
|
go.hidden = !(au.state === 'failed' && au.available && au.can); go.disabled = false; go.textContent = 'Ще раз';
|
|
836
874
|
later.hidden = false; later.textContent = 'Сховати';
|
|
837
|
-
} else if (au.available
|
|
875
|
+
} else if (au.available) {
|
|
838
876
|
show = true;
|
|
839
877
|
p.append(b('Вийшла версія ' + au.latest + '.'), ' Зараз стоїть ' + au.version + '. ');
|
|
840
|
-
if (au.can) p.append('Оновлення займе
|
|
841
|
-
else { p.append('Онови з термінала: '); const c = document.createElement('span'); c.className = 'mono'; c.textContent = 'npx
|
|
878
|
+
if (au.can) p.append('Оновлення займе хвилину, налаштування й калібрування залишаться.');
|
|
879
|
+
else { p.append('Онови з термінала: '); const c = document.createElement('span'); c.className = 'mono'; c.textContent = 'npx desky-agent@latest'; p.append(c); }
|
|
842
880
|
go.hidden = !au.can; go.disabled = false; go.textContent = 'Оновити';
|
|
843
|
-
later.hidden =
|
|
881
|
+
later.hidden = true;
|
|
844
882
|
}
|
|
845
883
|
box.hidden = !show;
|
|
846
884
|
}
|
|
@@ -851,14 +889,36 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
851
889
|
};
|
|
852
890
|
$('updLater').onclick = () => {
|
|
853
891
|
if (au.state === 'failed' || au.state === 'done') { updSeen = au.text; updErr = ''; }
|
|
854
|
-
else { updLater = au.latest; try { localStorage.setItem('clawd.updLater', updLater); } catch (e) {} }
|
|
855
892
|
showUpdate(au);
|
|
856
893
|
};
|
|
857
|
-
$('verRow').onclick = () => {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
894
|
+
$('verRow').onclick = () => { modalSkipped = ''; updSeen = ''; showUpdate(au); };
|
|
895
|
+
|
|
896
|
+
// the dialog: not over the wizard (he is mid-calibration), back after it closes
|
|
897
|
+
function showModal() {
|
|
898
|
+
const m = $('updModal');
|
|
899
|
+
const want = Boolean(au.available && au.state !== 'updating' && modalSkipped !== au.latest && $('wiz').hidden);
|
|
900
|
+
if (want && m.hidden) {
|
|
901
|
+
drawFace($('updFace'), 'happy');
|
|
902
|
+
$('updVer').textContent = au.version + ' → ' + au.latest;
|
|
903
|
+
$('updLead').textContent = au.can
|
|
904
|
+
? 'Оновлення займе хвилину: вікно закриється й відкриється знову. Налаштування й калібрування залишаться, плату не від\'єднуй.'
|
|
905
|
+
: 'Онови з термінала або попроси свого агента виконати цю команду. Налаштування й калібрування залишаться.';
|
|
906
|
+
$('updCmd').hidden = Boolean(au.can);
|
|
907
|
+
$('updNow').textContent = au.can ? 'Оновити зараз' : 'Зрозуміло';
|
|
908
|
+
setTimeout(() => $('updNow').focus(), 50);
|
|
909
|
+
}
|
|
910
|
+
m.hidden = !want;
|
|
911
|
+
}
|
|
912
|
+
$('updSkip').onclick = () => { modalSkipped = au.latest; showModal(); };
|
|
913
|
+
$('updNow').onclick = () => {
|
|
914
|
+
modalSkipped = au.latest;
|
|
915
|
+
showModal();
|
|
916
|
+
if (au.can) $('updGo').click();
|
|
917
|
+
};
|
|
918
|
+
$('updCopy').onclick = async () => {
|
|
919
|
+
try { await navigator.clipboard.writeText('npx desky-agent@latest'); $('updCopy').textContent = 'Скопійовано'; } catch (e) {}
|
|
861
920
|
};
|
|
921
|
+
document.addEventListener('keydown', e => { if (e.key === 'Escape' && !$('updModal').hidden) $('updSkip').click(); });
|
|
862
922
|
|
|
863
923
|
function enable() {
|
|
864
924
|
document.querySelectorAll('[data-cmd], #send, #home, #stop, #swapYP, #flipScr, #faceTest, #calSave, #rawf button, #joints button, #joints input, #statesRow button, #soundsRow button')
|
|
@@ -944,17 +1004,21 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
944
1004
|
}
|
|
945
1005
|
const colorLine = n => 'color ' + PALETTE[n].body.slice(1).toLowerCase() + ' ' + PALETTE[n].eye.slice(1).toLowerCase();
|
|
946
1006
|
// chosen here: the app takes it at once, the config keeps it, the board repaints his face and keeps it too
|
|
947
|
-
|
|
1007
|
+
// fromBoard: the board already shows that colour, it only goes into the config (sending it back made the board
|
|
1008
|
+
// answer again, and every answer that came before the config was saved sent it once more)
|
|
1009
|
+
async function pickColor(name, fromBoard) {
|
|
948
1010
|
applyColor(name);
|
|
1011
|
+
if (CFG) CFG.color = COLOR;
|
|
1012
|
+
if (fromBoard) boardColor = COLOR;
|
|
1013
|
+
else if (connected && canColor()) { boardColor = COLOR; send(colorLine(COLOR), true); }
|
|
949
1014
|
try { CFG = (await api('/config', { color: COLOR })).config; } catch (e) {}
|
|
950
|
-
if (connected && canColor()) { boardColor = COLOR; send(colorLine(COLOR), true); }
|
|
951
1015
|
}
|
|
952
1016
|
// the board and the config disagree: a board left at the factory orange takes the chosen colour, any other colour on
|
|
953
1017
|
// the board is the robot's own (printed and set at the factory) and wins
|
|
954
1018
|
function reconcileColor() {
|
|
955
1019
|
if (!CFG || !boardColor || boardColor === 'other' || boardColor === CFG.color) return;
|
|
956
1020
|
if (boardColor === 'orange') { if (connected && canColor()) send(colorLine(CFG.color), true); boardColor = CFG.color; }
|
|
957
|
-
else pickColor(boardColor);
|
|
1021
|
+
else pickColor(boardColor, true);
|
|
958
1022
|
}
|
|
959
1023
|
function swatches(host) {
|
|
960
1024
|
host.innerHTML = '';
|
|
@@ -993,7 +1057,8 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
993
1057
|
}
|
|
994
1058
|
if (/^сохранено/.test(line)) { calDirty(false); }
|
|
995
1059
|
m = line.match(/^цвет ([0-9a-f]{6}) ([0-9a-f]{6})/i);
|
|
996
|
-
|
|
1060
|
+
// only fresh answers: the first poll replays the monitor's history, old colours included (each one sent ours back)
|
|
1061
|
+
if (m && primed) { boardColor = Object.keys(PALETTE).find(k => PALETTE[k].body.slice(1).toLowerCase() === m[1].toLowerCase()) || 'other'; reconcileColor(); }
|
|
997
1062
|
if (/^err (trim|inv|here|save|swap|flip|face)/.test(line)) toast('Плата не прийняла команду: ' + line.slice(4), true);
|
|
998
1063
|
wizLine(line);
|
|
999
1064
|
}
|
|
@@ -1046,16 +1111,16 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
1046
1111
|
// as factory/clawd_factory/calibrate.py: direction first, then the centre (an arm's trim counts along its direction)
|
|
1047
1112
|
const US_PER_DEG = 1000 / 90; // MG90S, as the firmware: about 1000 us per 90 deg
|
|
1048
1113
|
const J = [
|
|
1049
|
-
{ n: 1, name: 'Поворот голови', short: 'Поворот', base: 0, plus:
|
|
1114
|
+
{ n: 1, name: 'Поворот голови', short: 'Поворот', base: 0, plus: 25, ref: 0,
|
|
1050
1115
|
plusText: 'Голова повернулася <b>праворуч</b>, якщо дивитися Desky в обличчя.',
|
|
1051
1116
|
refText: 'голова дивиться <b>прямо вперед</b>, рівно на ноутбук', lo: 'ліворуч', hi: 'праворуч' },
|
|
1052
|
-
{ n: 2, name: 'Нахил голови', short: 'Нахил', base: 0, plus:
|
|
1117
|
+
{ n: 2, name: 'Нахил голови', short: 'Нахил', base: 0, plus: 15, ref: 0,
|
|
1053
1118
|
plusText: 'Голова нахилилася <b>вперед</b>, до ноутбука.',
|
|
1054
1119
|
refText: 'голова стоїть <b>рівно</b>: не нахилена ні вперед, ні назад', lo: 'назад', hi: 'вперед' },
|
|
1055
|
-
{ n: 3, name: 'Права рука', short: 'Права рука', base: 65, plus:
|
|
1120
|
+
{ n: 3, name: 'Права рука', short: 'Права рука', base: 65, plus: 40, ref: 65, pic: 0,
|
|
1056
1121
|
plusText: 'Права рука Desky <b>піднялася вперед</b>. Це та, що в тебе <b>зліва</b>, коли дивишся йому в обличчя.',
|
|
1057
1122
|
refText: 'права рука <b>висить рівно вниз</b>', lo: 'назад', hi: 'вперед' },
|
|
1058
|
-
{ n: 4, name: 'Ліва рука', short: 'Ліва рука', base: 65, plus:
|
|
1123
|
+
{ n: 4, name: 'Ліва рука', short: 'Ліва рука', base: 65, plus: 40, ref: 65, pic: 0,
|
|
1059
1124
|
plusText: 'Ліва рука Desky <b>піднялася вперед</b>. Це та, що в тебе <b>справа</b>, коли дивишся йому в обличчя.',
|
|
1060
1125
|
refText: 'ліва рука <b>висить рівно вниз</b>', lo: 'назад', hi: 'вперед' },
|
|
1061
1126
|
];
|
|
@@ -1148,7 +1213,7 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
1148
1213
|
};
|
|
1149
1214
|
c.querySelector('[data-goref]').onclick = () => { atRef = null; toRef(j); };
|
|
1150
1215
|
dir.querySelector('[data-test]').onclick = async () => {
|
|
1151
|
-
await
|
|
1216
|
+
await servosOn(); await demoMove('j' + jj.n + ' ' + (jj.base + jj.plus));
|
|
1152
1217
|
toast(jj.plusText.replace(/<[^>]+>/g, '') + ' Якщо ні — «Розвернути».');
|
|
1153
1218
|
};
|
|
1154
1219
|
dir.querySelector('[data-inv]').onclick = async () => { await send('inv j' + jj.n); calDirty(true); await send('cal', true); };
|
|
@@ -1441,7 +1506,7 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
1441
1506
|
foot: [back('check'), spacer(), btn('Пропустити крок', 'ghost', () => go('screen'))],
|
|
1442
1507
|
});
|
|
1443
1508
|
const ch = $('wizBody').querySelector('.choices'); ch.append(ca, cb);
|
|
1444
|
-
async function show() { await servosOn(); await
|
|
1509
|
+
async function show() { await servosOn(); await demoMove('j1 25'); }
|
|
1445
1510
|
async function answer(ok) {
|
|
1446
1511
|
if (ok) { go('screen'); return; }
|
|
1447
1512
|
if (W.retried) { note.hidden = false; note.className = 'note bad';
|
|
@@ -1494,7 +1559,7 @@ svg.alive .eye { transform-box: fill-box; transform-origin: center; animation: b
|
|
|
1494
1559
|
foot: [back(j === 0 ? 'screen' : 'j' + (j - 1)), spacer(), btn('Пропустити суглоб', 'ghost', () => go(j < 3 ? 'j' + (j + 1) : 'done'))],
|
|
1495
1560
|
});
|
|
1496
1561
|
$('wizBody').querySelector('.choices').append(yes, no);
|
|
1497
|
-
async function show() { await servosOn(); await
|
|
1562
|
+
async function show() { await servosOn(); await demoMove('j' + jj.n + ' ' + (jj.base + jj.plus)); }
|
|
1498
1563
|
async function answer(ok) {
|
|
1499
1564
|
if (ok) { await send('home'); go('j' + j, 'centre'); return; }
|
|
1500
1565
|
if (W.retried) { note.hidden = false; note.className = 'note bad';
|