@william_jin/autobrowse 0.8.17 → 0.8.19
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/assets/live-view/hub.html +88 -51
- package/assets/live-view/viewer.html +9 -3
- package/assets/overlay/bin/darwin-arm64/overlay-host +0 -0
- package/assets/overlay/bin/darwin-x64/overlay-host +0 -0
- package/assets/overlay/bin/win32-arm64/overlay-host.exe +0 -0
- package/assets/overlay/bin/win32-x64/overlay-host.exe +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<!-- The live hub's page (designs/2026-11-25-live-view.md §Hub), served by `overlay-host hub` at abhub://localhost/.
|
|
7
7
|
A sidebar of sessions and panes; each pane is an iframe of its session's viewer. Talks only to the app (ipc). -->
|
|
8
8
|
<style>
|
|
9
|
-
:root{color-scheme:light;--accent:#6a5a93;--hair:color-mix(in srgb,var(--fg) 11%,transparent);--fill:color-mix(in srgb,var(--fg) 5%,transparent);--raise:0 0 0 1px var(--hair),0 1px 2px rgb(14 14 14/.04),0 4px 14px -6px rgb(40 30 70/.10);--bg:#ecebe8;--bar:#e3e2de;--side:#e7e6e2;--fg:#1d1d1b;--mut:#65635e;--rowh:color-mix(in srgb,var(--side),#000 5%);--rowon:color-mix(in srgb,var(--side),#000 8%);--line:rgba(0,0,0,.09);--needs:#fbefd2;--needsfg:#5c4307;--needsbtn:rgba(0,0,0,.08);--ring:var(--accent);--brand:var(--accent);--held:#8a5a00;--heldt:rgba(214,150,20,.17);--btn:rgba(0,0,0,.06);--btnh:rgba(0,0,0,.1);--seg:rgba(0,0,0,.06);--segon:#fbfbfa;--pane:#dcdbd7;--mkf:#fff;--mkt:#6b4ee6;--drop:color-mix(in srgb,var(--accent) 14%,transparent);--scrim:rgba(0,0,0,.3);--lift:0 12px 40px rgba(0,0,0,.25)}
|
|
10
|
-
:root[data-theme=dark],:root[data-look=dark]{color-scheme:dark;--accent:#a596d6;--raise:0 0 0 1px var(--hair),0 6px 18px -8px rgb(0 0 0/.6);--bg:#1c1c1b;--bar:#1f1f1e;--side:#212120;--fg:#ecebe6;--mut:#9b998f;--rowh:color-mix(in srgb,var(--side),#fff 5%);--rowon:color-mix(in srgb,var(--side),#fff 8%);--line:rgba(255,255,255,.08);--needs:#3e3216;--needsfg:#f3dfa8;--needsbtn:rgba(0,0,0,.08);--ring:var(--accent);--brand:var(--accent);--held:#f0c060;--heldt:rgba(240,192,96,.15);--btn:rgba(255,255,255,.07);--btnh:rgba(255,255,255,.12);--seg:rgba(255,255,255,.06);--segon:#3a3a38;--pane:#161615;--mkf:#16161a;--mkt:#a996ff;--drop:color-mix(in srgb,var(--accent) 16%,transparent);--scrim:rgba(0,0,0,.55)}
|
|
9
|
+
:root{color-scheme:light;--accent:#6a5a93;--hair:color-mix(in srgb,var(--fg) 11%,transparent);--fill:color-mix(in srgb,var(--fg) 5%,transparent);--raise:0 0 0 1px var(--hair),0 1px 2px rgb(14 14 14/.04),0 4px 14px -6px rgb(40 30 70/.10);--bg:#ecebe8;--bar:#e3e2de;--side:#e7e6e2;--fg:#1d1d1b;--mut:#65635e;--rowh:color-mix(in srgb,var(--side),#000 5%);--rowon:color-mix(in srgb,var(--side),#000 8%);--line:rgba(0,0,0,.09);--needs:#fbefd2;--needsfg:#5c4307;--needsbtn:rgba(0,0,0,.08);--ring:var(--accent);--brand:var(--accent);--held:#8a5a00;--heldt:rgba(214,150,20,.17);--btn:rgba(0,0,0,.06);--btnh:rgba(0,0,0,.1);--seg:rgba(0,0,0,.06);--segon:#fbfbfa;--pane:#dcdbd7;--mkf:#fff;--mkt:#6b4ee6;--drop:color-mix(in srgb,var(--accent) 14%,transparent);--scrim:rgba(0,0,0,.3);--lift:0 12px 40px rgba(0,0,0,.25);--tbar:#f7f6f3;--frame:0 0 0 1px rgba(0,0,0,.13),0 1px 2px rgba(0,0,0,.06),0 8px 22px -10px rgb(40 30 70/.22)}
|
|
10
|
+
:root[data-theme=dark],:root[data-look=dark]{color-scheme:dark;--accent:#a596d6;--raise:0 0 0 1px var(--hair),0 6px 18px -8px rgb(0 0 0/.6);--bg:#1c1c1b;--bar:#1f1f1e;--side:#212120;--fg:#ecebe6;--mut:#9b998f;--rowh:color-mix(in srgb,var(--side),#fff 5%);--rowon:color-mix(in srgb,var(--side),#fff 8%);--line:rgba(255,255,255,.08);--needs:#3e3216;--needsfg:#f3dfa8;--needsbtn:rgba(0,0,0,.08);--ring:var(--accent);--brand:var(--accent);--held:#f0c060;--heldt:rgba(240,192,96,.15);--btn:rgba(255,255,255,.07);--btnh:rgba(255,255,255,.12);--seg:rgba(255,255,255,.06);--segon:#3a3a38;--pane:#161615;--mkf:#16161a;--mkt:#a996ff;--drop:color-mix(in srgb,var(--accent) 16%,transparent);--scrim:rgba(0,0,0,.55);--tbar:#2a2a28;--frame:0 0 0 1px rgba(255,255,255,.10),0 10px 28px -10px rgb(0 0 0/.75)}
|
|
11
11
|
*{box-sizing:border-box}
|
|
12
12
|
html,body{margin:0;height:100%;overflow:clip;background:var(--bg);color:var(--fg);font:13px/1.3 -apple-system,system-ui,sans-serif;-webkit-user-select:none;user-select:none;cursor:default}
|
|
13
13
|
button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:default}
|
|
@@ -155,13 +155,15 @@ kbd{display:inline-flex;align-items:center;justify-content:center;min-width:18px
|
|
|
155
155
|
.pin{display:flex;flex-direction:column;width:100%;height:100%;transform-origin:0 0}
|
|
156
156
|
.pane.in{opacity:1}
|
|
157
157
|
.pane.off{visibility:hidden;pointer-events:none}
|
|
158
|
-
|
|
158
|
+
/* §Hub windows: each run in Grid or Split is a window: frame, shadow, a raised title bar over the darker desk */
|
|
159
|
+
.grid .pane{border-radius:var(--win-r);box-shadow:var(--frame)}
|
|
159
160
|
.pane::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 1.5px var(--ring);pointer-events:none;opacity:0;transition:opacity .15s}
|
|
160
161
|
.pane.cur::after{opacity:1}
|
|
161
162
|
.single .pane.cur::after{display:none}
|
|
162
163
|
.pane.drop::before{content:"";position:absolute;inset:0;background:var(--drop);z-index:2;pointer-events:none}
|
|
163
164
|
.ph{flex:none;height:28px;display:flex;align-items:center;gap:6px;padding:0 4px 0 10px;background:var(--bar);font-size:12px}
|
|
164
165
|
.single .ph{display:none}
|
|
166
|
+
.grid .ph{background:var(--tbar);box-shadow:inset 0 -1px 0 var(--line)}
|
|
165
167
|
.ph .nm{font-weight:600;white-space:nowrap;flex:0 1 auto;min-width:0;overflow:hidden}
|
|
166
168
|
.ph .sw{flex:none;color:var(--mut);white-space:nowrap}
|
|
167
169
|
.ph .nm.cut{-webkit-mask-image:linear-gradient(90deg,#000 80%,transparent)}
|
|
@@ -365,7 +367,7 @@ window.hub = {
|
|
|
365
367
|
hubOn = !!m.visible;
|
|
366
368
|
fill(); render();
|
|
367
369
|
break;
|
|
368
|
-
case 'row': put(m.row); fill();
|
|
370
|
+
case 'row': put(m.row); fill(); soon(); break;
|
|
369
371
|
case 'gone': end(m.id); break;
|
|
370
372
|
case 'show': show(m.id); break;
|
|
371
373
|
case 'visible': hubOn = !!m.on; fill(); render(); break;
|
|
@@ -380,6 +382,8 @@ window.hub = {
|
|
|
380
382
|
};
|
|
381
383
|
function put(r) {
|
|
382
384
|
const was = rows.get(r.id);
|
|
385
|
+
// icons come only when they change (WA-1494): a row without them keeps the ones it had
|
|
386
|
+
if (was && r.state && !('icons' in r.state)) r.state = { ...r.state, icon: was.state?.icon, icons: was.state?.icons };
|
|
383
387
|
if (!was) order.push(r.id);
|
|
384
388
|
rows.set(r.id, r);
|
|
385
389
|
if (r.url || r.ended) auto.delete(r.id);
|
|
@@ -503,20 +507,26 @@ function fade(p, show) {
|
|
|
503
507
|
p.fade = p.el.animate(show ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1, visibility: v }, { opacity: 0, visibility: v }], { duration: show ? 150 : 120, easing: EASE });
|
|
504
508
|
}
|
|
505
509
|
function stopSweep(p) { for (const a of p.sweep ?? []) a.cancel(); p.sweep = null; }
|
|
506
|
-
function sweep(p, o, n) {
|
|
510
|
+
function sweep(p, o, n, r) {
|
|
507
511
|
stopSweep(p);
|
|
508
512
|
const sx = o.width / n.width, sy = o.height / n.height, dx = o.left - n.left, dy = o.top - n.top;
|
|
509
513
|
if (Math.abs(dx) < .5 && Math.abs(dy) < .5 && Math.abs(sx - 1) < .002 && Math.abs(sy - 1) < .002) return;
|
|
510
514
|
const box = [], pin = [];
|
|
511
515
|
SWEEP_AT.forEach((offset, k) => {
|
|
512
516
|
const e = k / KF, x = sx + (1 - sx) * e, y = sy + (1 - sy) * e;
|
|
513
|
-
|
|
517
|
+
const f = { offset, transform: `translate(${dx * (1 - e)}px,${dy * (1 - e)}px) scale(${x},${y})` };
|
|
518
|
+
// the window's corners stay round mid-scale
|
|
519
|
+
if (r) f.borderRadius = `${r / x}px / ${r / y}px`;
|
|
520
|
+
box.push(f);
|
|
514
521
|
pin.push({ offset, transform: `scale(${1 / x},${1 / y})` });
|
|
515
522
|
});
|
|
516
523
|
const t = { duration: SWEEP_MS, easing: 'linear' };
|
|
517
524
|
p.sweep = [p.el.animate(box, t), p.el.firstChild.animate(pin, t)];
|
|
518
525
|
p.sweep[0].onfinish = () => { p.sweep = null; };
|
|
519
526
|
}
|
|
527
|
+
/** desk between windows and their corners (§Hub windows); the CSS reads `--win-r` */
|
|
528
|
+
const GAP = 10, RADIUS = 10;
|
|
529
|
+
document.documentElement.style.setProperty('--win-r', `${RADIUS}px`);
|
|
520
530
|
/** a cell in px: each edge rounds once, so neighbours share it and every gap is exactly `gap` */
|
|
521
531
|
function boxOf([x, y, w, h], W, H, gap) {
|
|
522
532
|
const l = Math.round(x * W), t = Math.round(y * H), r = Math.round((x + w) * W), b = Math.round((y + h) * H);
|
|
@@ -612,71 +622,93 @@ function target(e) {
|
|
|
612
622
|
}
|
|
613
623
|
|
|
614
624
|
// --- render --------------------------------------------------------------------------
|
|
625
|
+
// writes only on change: a same-value write still dirties layout, and the next read forces one (WA-1494)
|
|
626
|
+
function txt(el, s) { if (el.textContent !== s) el.textContent = s; }
|
|
627
|
+
function cls(el, s) { if (el.className !== s) el.className = s; }
|
|
628
|
+
function attr(el, k, v) { if (el.getAttribute(k) !== v) el.setAttribute(k, v); }
|
|
629
|
+
let renderRaf = 0;
|
|
630
|
+
/** state lines come in bursts (url, title, icon per navigation, per run): one render a frame */
|
|
631
|
+
function soon() { if (!renderRaf) renderRaf = requestAnimationFrame(() => { renderRaf = 0; render(); }); }
|
|
632
|
+
/** each list item's place now, read before any write */
|
|
633
|
+
const rowTops = () => new Map(live().map((el) => [el.dataset.k, { top: el.getBoundingClientRect().top, off: el.offsetTop }]));
|
|
615
634
|
function render() {
|
|
616
|
-
|
|
635
|
+
if (renderRaf) { cancelAnimationFrame(renderRaf); renderRaf = 0; }
|
|
636
|
+
// reads first: after a frame, layout is clean and they cost nothing
|
|
637
|
+
const was = sweepFrom(), rowsWas = rowTops();
|
|
617
638
|
applySide();
|
|
618
639
|
roomFrom = null;
|
|
619
|
-
for (const b of $('seg').children) b
|
|
640
|
+
for (const b of $('seg').children) attr(b, 'aria-pressed', String(b.dataset.l === layout));
|
|
620
641
|
const single = max || (cells.length <= 1 && layout === 'focus');
|
|
621
642
|
stage.classList.toggle('single', single);
|
|
622
643
|
document.documentElement.classList.toggle('maxed', max);
|
|
623
|
-
$('unmax').tabIndex = max ? 0 : -1;
|
|
644
|
+
if ($('unmax').tabIndex !== (max ? 0 : -1)) $('unmax').tabIndex = max ? 0 : -1;
|
|
624
645
|
stage.classList.toggle('grid', !single);
|
|
625
646
|
// the app toggles: it holds every agent unless all are held
|
|
626
647
|
const agents = [...rows.values()].filter((r) => canPause(r) && !r.ended && !r.moved);
|
|
627
648
|
const allHeld = agents.length > 0 && agents.every((r) => r.state?.held);
|
|
628
|
-
$('pauseall').disabled = !agents.length;
|
|
649
|
+
if ($('pauseall').disabled !== !agents.length) $('pauseall').disabled = !agents.length;
|
|
629
650
|
swapText($('pauseall'), allHeld ? 'Resume all' : 'Pause all');
|
|
630
|
-
$('pauseall')
|
|
631
|
-
renderRows();
|
|
651
|
+
attr($('pauseall'), 'title', `${allHeld ? 'Resume' : 'Pause'} every agent (⌘⇧P)`);
|
|
652
|
+
renderRows(rowsWas);
|
|
632
653
|
// panes
|
|
633
|
-
const W = stage.clientWidth, H = stage.clientHeight, gap = single ? 0 :
|
|
654
|
+
const W = stage.clientWidth, H = stage.clientHeight, gap = single ? 0 : GAP;
|
|
634
655
|
const R = rects(cells.length);
|
|
635
656
|
// a window resize or a grip drag tracks the hand: no sweep; a sidebar mode change sweeps
|
|
636
657
|
const resized = `${W}x${H}` !== stageWH; stageWH = `${W}x${H}`;
|
|
637
658
|
// reduced motion: no sweep; a moved pane fades in at its new box
|
|
638
659
|
const morph = (!resized || roomMoved) && !sizing && booted && motionOn(), moves = morph && !reduceQ.matches;
|
|
639
660
|
roomMoved = false;
|
|
640
|
-
const at = moves ? stage.getBoundingClientRect() : null;
|
|
661
|
+
const at = moves ? stage.getBoundingClientRect() : null, cuts = [];
|
|
641
662
|
cells.forEach((key, i) => {
|
|
642
663
|
const p = pane(key);
|
|
643
664
|
const r = rows.get(idOf(key));
|
|
644
665
|
p.at = Date.now();
|
|
645
|
-
p.el.querySelector('.nm')
|
|
666
|
+
const nm = p.el.querySelector('.nm');
|
|
667
|
+
txt(nm, r.site || 'session');
|
|
646
668
|
const [pd, pw] = stateOf(r);
|
|
647
|
-
p.el.querySelector('.ph .dot')
|
|
669
|
+
cls(p.el.querySelector('.ph .dot'), `dot ${pd}`);
|
|
648
670
|
swapText(p.el.querySelector('.sw'), pw);
|
|
649
671
|
p.w = max ? W : Math.round(R[i][2] * W);
|
|
650
|
-
p.el.querySelector('.tt')
|
|
672
|
+
txt(p.el.querySelector('.tt'), p.title || r.state?.title || '');
|
|
651
673
|
// the bar is one line: the whole name and title on hover
|
|
652
|
-
p.el.querySelector('.ph')
|
|
653
|
-
const nm = p.el.querySelector('.nm'); nm.classList.toggle('cut', nm.scrollWidth > nm.clientWidth);
|
|
674
|
+
attr(p.el.querySelector('.ph'), 'title', `${r.site || 'session'} · ${p.title || r.state?.title || ''}`);
|
|
654
675
|
p.el.classList.toggle('cur', i === cur && cells.length > 1);
|
|
655
676
|
const off = p.el.classList.contains('off'), hidden = max && i !== cur, back = off && !hidden;
|
|
656
677
|
p.el.classList.toggle('off', hidden);
|
|
657
678
|
if (morph && (back || (hidden && !off))) fade(p, back);
|
|
658
|
-
p.el.querySelector('[data-a=max]')
|
|
679
|
+
const mb = p.el.querySelector('[data-a=max]'), mi = max ? 'min' : 'max';
|
|
680
|
+
if (mb.dataset.i !== mi) { mb.dataset.i = mi; mb.innerHTML = icon(mi); }
|
|
659
681
|
const [left, top, width, height] = boxOf(max ? [0, 0, 1, 1] : R[i], W, H, gap);
|
|
660
|
-
|
|
682
|
+
const z = i === cur ? '1' : '0';
|
|
683
|
+
if (p.el.style.zIndex !== z) p.el.style.zIndex = z;
|
|
661
684
|
const box = `${left},${top},${width},${height}`;
|
|
685
|
+
// the name fades when cut: measured after every write, and only when name, word or width changed
|
|
686
|
+
const ck = `${nm.textContent}|${pw}|${width}`;
|
|
687
|
+
if (p.cutKey !== ck) cuts.push([p, nm, ck]);
|
|
662
688
|
if (p.box !== box) {
|
|
663
689
|
p.box = box;
|
|
664
690
|
Object.assign(p.el.style, { left: `${left}px`, top: `${top}px`, width: `${width}px`, height: `${height}px` });
|
|
665
691
|
const o = moves && !hidden && !back ? was.get(key) : null;
|
|
666
|
-
if (o) sweep(p, o, { left: at.left + left, top: at.top + top, width, height });
|
|
692
|
+
if (o) sweep(p, o, { left: at.left + left, top: at.top + top, width, height }, single ? 0 : RADIUS);
|
|
667
693
|
else stopSweep(p);
|
|
668
694
|
if (morph && !moves && !hidden && !back && was.has(key)) fade(p, true);
|
|
669
695
|
}
|
|
670
696
|
});
|
|
697
|
+
const cut = cuts.map(([, nm]) => nm.scrollWidth > nm.clientWidth);
|
|
698
|
+
cuts.forEach(([p, nm, ck], i) => { p.cutKey = ck; nm.classList.toggle('cut', cut[i]); });
|
|
671
699
|
// panes out of the layout: hidden and off screen, the oldest go
|
|
672
700
|
const out = [...panes.entries()].filter(([k]) => !cells.includes(k)).sort((a, b) => b[1].at - a[1].at);
|
|
673
701
|
out.forEach(([k, p], i) => {
|
|
674
702
|
if (i >= KEEP || !placeable(idOf(k))) drop(k);
|
|
675
703
|
else if (!p.el.classList.contains('off')) { p.el.classList.add('off'); if (morph) fade(p, false); }
|
|
676
704
|
});
|
|
677
|
-
|
|
705
|
+
// a viewer hears only a change (each message makes it re-send `visible` to its session)
|
|
706
|
+
for (const [k, p] of panes) {
|
|
707
|
+
const e = embedOf(k), j = JSON.stringify(e);
|
|
708
|
+
if (p.embed !== j) { p.embed = j; p.frame.contentWindow?.postMessage({ hub: e }, '*'); }
|
|
709
|
+
}
|
|
678
710
|
$('empty').classList.toggle('on', cells.length === 0);
|
|
679
|
-
$('empty').querySelector('.h')
|
|
711
|
+
txt($('empty').querySelector('.h'), rows.size ? 'Pick a session' : 'No sessions');
|
|
680
712
|
const es = $('empty').querySelector('.s'), want = rows.size ? 'pick' : 'none';
|
|
681
713
|
if (es.dataset.k !== want) {
|
|
682
714
|
es.dataset.k = want;
|
|
@@ -815,8 +847,8 @@ function fillRow(el, r, onIds) {
|
|
|
815
847
|
el.classList.toggle('needs', !!r.needs && !r.ended);
|
|
816
848
|
el.classList.toggle('ended', !!r.ended);
|
|
817
849
|
el.classList.toggle('on', onIds.has(r.id) && hubOn);
|
|
818
|
-
el.querySelector('.ico .dot')
|
|
819
|
-
el.querySelector('.lt')
|
|
850
|
+
cls(el.querySelector('.ico .dot'), `dot ${dot}`);
|
|
851
|
+
txt(el.querySelector('.lt'), letterOf(r.site));
|
|
820
852
|
const img = el.querySelector('img'), src = typeof r.state?.icon === 'string' ? r.state.icon : '';
|
|
821
853
|
if (!src) { el.querySelector('.ico').classList.remove('has'); img.removeAttribute('src'); }
|
|
822
854
|
else if (img.getAttribute('src') !== src) img.src = src;
|
|
@@ -838,7 +870,7 @@ function fillRow(el, r, onIds) {
|
|
|
838
870
|
meta.innerHTML = `${r.torn ? icon('tear') : ''}${w ? '<span class="w"></span>' : ''}${w && since ? '<span>·</span>' : ''}${since ? `<span class="t"></span>` : ''}${kw ? '<span class="k"></span>' : ''}`;
|
|
839
871
|
}
|
|
840
872
|
if (w) swapText(meta.querySelector('.w'), w);
|
|
841
|
-
if (since) { const t = meta.querySelector('.t'); t.dataset.since
|
|
873
|
+
if (since) { const t = meta.querySelector('.t'); if (t.dataset.since !== String(since)) t.dataset.since = since; txt(t, ago(since)); }
|
|
842
874
|
if (kw) swapText(meta.querySelector('.k'), kw);
|
|
843
875
|
// a scheduled job: clock, name, schedule, next tick
|
|
844
876
|
const job = r.job && typeof r.job.name === 'string' && r.job.name.trim() ? r.job : null;
|
|
@@ -851,10 +883,10 @@ function fillRow(el, r, onIds) {
|
|
|
851
883
|
const fk = f ? `${f.name}\n${label}` : '';
|
|
852
884
|
if (f && fl.dataset.k === fk) swapText(fl.querySelector('.s'), at);
|
|
853
885
|
else lineTo(fl, f ? `${icon('flow')}<span class="n">${esc(f.name)}</span>${label ? ` · <span class="l">${esc(label)}</span>` : ''} <span class="s">${esc(at)}</span>` : '');
|
|
854
|
-
fl.dataset.k = fk;
|
|
855
|
-
el.querySelector('.why')
|
|
886
|
+
if (fl.dataset.k !== fk) fl.dataset.k = fk;
|
|
887
|
+
txt(el.querySelector('.why'), r.needs && !r.ended ? r.needs : '');
|
|
856
888
|
const tl = !r.ended && !r.moved && Array.isArray(r.state?.tabs) && r.state.tabs.length > 1 ? r.state.tabs : [];
|
|
857
|
-
el.querySelector('.title')
|
|
889
|
+
txt(el.querySelector('.title'), tl.length ? '' : r.state?.title || '');
|
|
858
890
|
fillTabs(el.querySelector('.tabs'), tl, Array.isArray(r.state?.icons) ? r.state.icons : [], r.site, r.id);
|
|
859
891
|
const acts = el.querySelector('.acts');
|
|
860
892
|
let html = '';
|
|
@@ -906,15 +938,15 @@ function fillTabs(box, tabs, icons, site, rid) {
|
|
|
906
938
|
if (live[i] !== b) box.insertBefore(b, live[i] ?? null);
|
|
907
939
|
const on = !!t.on, title = (typeof t.title === 'string' && t.title.trim()) || hostOf(t.url) || 'New tab';
|
|
908
940
|
b.classList.toggle('on', on);
|
|
909
|
-
if (on) b
|
|
941
|
+
if (on) attr(b, 'aria-current', 'true'); else b.removeAttribute('aria-current');
|
|
910
942
|
const pop = t.opener != null, k = `${pop ? 1 : 0}\n${title}`;
|
|
911
943
|
if (b.dataset.k !== k) {
|
|
912
944
|
b.dataset.k = k; b.querySelector('.tl').textContent = title;
|
|
913
945
|
const ti = b.querySelector('.ti'), g = ti.querySelector('.ic');
|
|
914
946
|
if (pop && !g) ti.insertAdjacentHTML('beforeend', icon('pop')); else if (!pop) g?.remove();
|
|
915
947
|
}
|
|
916
|
-
b
|
|
917
|
-
b.querySelector('.lt')
|
|
948
|
+
attr(b, 'title', pop ? `Popup: ${t.url || title}` : t.url || title);
|
|
949
|
+
txt(b.querySelector('.lt'), letterOf(hostOf(t.url) || site));
|
|
918
950
|
const img = b.querySelector('img'), src = Number.isInteger(t.ic) && typeof icons[t.ic] === 'string' ? icons[t.ic] : '';
|
|
919
951
|
if (!src) { b.querySelector('.ti').classList.remove('has'); img.removeAttribute('src'); }
|
|
920
952
|
else if (img.getAttribute('src') !== src) img.src = src;
|
|
@@ -926,13 +958,13 @@ function fillTabs(box, tabs, icons, site, rid) {
|
|
|
926
958
|
mb.type = 'button'; mb.className = 'tab more'; mb.dataset.more = '1';
|
|
927
959
|
mb.innerHTML = `<span class="ti">${icon('caret')}</span><span class="tl"></span>`;
|
|
928
960
|
}
|
|
929
|
-
box.append(mb);
|
|
930
|
-
mb.querySelector('.tl')
|
|
931
|
-
mb
|
|
961
|
+
if (box.lastElementChild !== mb) box.append(mb);
|
|
962
|
+
txt(mb.querySelector('.tl'), more);
|
|
963
|
+
attr(mb, 'aria-expanded', String(!cut));
|
|
932
964
|
}
|
|
933
965
|
/** the list's live items: rows and labels not on their way out */
|
|
934
966
|
const live = () => [...list.children].filter((el) => !el.classList.contains('gone'));
|
|
935
|
-
function renderRows() {
|
|
967
|
+
function renderRows(was = rowTops()) {
|
|
936
968
|
const gl = groupList(), groups = new Map(gl.map((g) => [g.k, g.ids]));
|
|
937
969
|
// the list as it should be: a label per non-empty group, then its rows unless folded
|
|
938
970
|
const want = [];
|
|
@@ -942,14 +974,13 @@ function renderRows() {
|
|
|
942
974
|
if (!folded(sec, ids.length)) for (const id of ids) want.push({ k: id, id });
|
|
943
975
|
}
|
|
944
976
|
const keep = new Set(want.map((w) => w.k));
|
|
945
|
-
// FLIP: what stays slides from where it was
|
|
946
|
-
const before = new Map(live().map((el) => [el.dataset.k, el.getBoundingClientRect().top]));
|
|
977
|
+
// FLIP: what stays slides from where it was (`was`, read before any write)
|
|
947
978
|
for (const el of live()) {
|
|
948
979
|
if (keep.has(el.dataset.k)) continue;
|
|
949
980
|
const r = rows.get(el.dataset.k);
|
|
950
981
|
// a folded row, or one that already faded (ended): out at once; a label fades out of the flow
|
|
951
982
|
if (el.classList.contains('row') && (el.classList.contains('out') || (r && folded(secOf(r), groups.get(secOf(r))?.length ?? 0)))) { el.remove(); continue; }
|
|
952
|
-
const top = el.
|
|
983
|
+
const top = was.get(el.dataset.k)?.off ?? 0;
|
|
953
984
|
el.classList.add('gone'); el.style.top = `${top}px`;
|
|
954
985
|
list.append(el);
|
|
955
986
|
setTimeout(() => el.remove(), 150);
|
|
@@ -961,18 +992,23 @@ function renderRows() {
|
|
|
961
992
|
if (list.children[i] !== el) list.insertBefore(el, list.children[i] ?? null);
|
|
962
993
|
if (w.id) fillRow(el, rows.get(w.id), onIds);
|
|
963
994
|
else {
|
|
964
|
-
el.dataset.n = w.n;
|
|
995
|
+
if (el.dataset.n !== String(w.n)) el.dataset.n = w.n;
|
|
965
996
|
swapText(el.querySelector('.n'), String(w.n));
|
|
966
997
|
const nn = el.querySelector('.nn');
|
|
967
|
-
if (nn) nn
|
|
968
|
-
el.querySelector('button')
|
|
998
|
+
if (nn) txt(nn, w.nn ? `${w.nn} need${w.nn > 1 ? '' : 's'} you` : '');
|
|
999
|
+
const fb = el.querySelector('button');
|
|
1000
|
+
if (fb) attr(fb, 'aria-expanded', String(!folded(w.sec, w.n)));
|
|
969
1001
|
}
|
|
970
1002
|
});
|
|
1003
|
+
// all reads, then all writes: one layout, not one per moved row
|
|
1004
|
+
const moved = [];
|
|
971
1005
|
for (const el of live()) {
|
|
972
|
-
const t0 =
|
|
1006
|
+
const t0 = was.get(el.dataset.k);
|
|
973
1007
|
if (t0 === undefined) continue;
|
|
974
|
-
const d = t0 - el.getBoundingClientRect().top;
|
|
975
|
-
if (
|
|
1008
|
+
const d = t0.top - el.getBoundingClientRect().top;
|
|
1009
|
+
if (d) moved.push([el, d]);
|
|
1010
|
+
}
|
|
1011
|
+
for (const [el, d] of moved) {
|
|
976
1012
|
el.style.transition = 'none'; el.style.transform = `translateY(${d}px)`;
|
|
977
1013
|
requestAnimationFrame(() => { el.style.transition = ''; el.style.transform = ''; });
|
|
978
1014
|
}
|
|
@@ -1021,8 +1057,8 @@ function swapHtml(el, html, text = false) {
|
|
|
1021
1057
|
}
|
|
1022
1058
|
const swapText = (el, text) => swapHtml(el, text, true);
|
|
1023
1059
|
setInterval(() => {
|
|
1024
|
-
for (const t of list.querySelectorAll('.t[data-since]')) t
|
|
1025
|
-
for (const x of list.querySelectorAll('.x[data-next]')) x
|
|
1060
|
+
for (const t of list.querySelectorAll('.t[data-since]')) txt(t, ago(Number(t.dataset.since)));
|
|
1061
|
+
for (const x of list.querySelectorAll('.x[data-next]')) txt(x, `next ${until(Number(x.dataset.next))}`);
|
|
1026
1062
|
}, 1000);
|
|
1027
1063
|
|
|
1028
1064
|
// --- actions -------------------------------------------------------------------------
|
|
@@ -1155,11 +1191,12 @@ function applySide() {
|
|
|
1155
1191
|
root.classList.toggle('narrow', narrowQ.matches);
|
|
1156
1192
|
root.classList.toggle('peek', open);
|
|
1157
1193
|
root.classList.toggle('compact', compact);
|
|
1158
|
-
|
|
1194
|
+
const sw = `${sizing ? sizing.w : sidew}px`;
|
|
1195
|
+
if (root.style.getPropertyValue('--sidew') !== sw) root.style.setProperty('--sidew', sw);
|
|
1159
1196
|
railRows(m === 'rail' && !open);
|
|
1160
|
-
$('sidebtn')
|
|
1197
|
+
attr($('sidebtn'), 'aria-pressed', String(m === 'full' || open));
|
|
1161
1198
|
const now = m === 'full' ? Math.round(sizing ? sizing.w : sidew) : m === 'rail' ? RAIL : 0;
|
|
1162
|
-
grip
|
|
1199
|
+
attr(grip, 'aria-valuenow', String(now));
|
|
1163
1200
|
}
|
|
1164
1201
|
/** rows turn to icons once the panel has clipped to the rail; back to full rows at once, under the opening clip */
|
|
1165
1202
|
function railRows(on) {
|
|
@@ -229,7 +229,7 @@ const tx = (m) => { if (ws && ws.readyState === 1) ws.send(JSON.stringify(m)); }
|
|
|
229
229
|
function connect() {
|
|
230
230
|
ws = new WebSocket(`ws://${location.host}/?k=${encodeURIComponent(k)}`);
|
|
231
231
|
ws.binaryType = 'arraybuffer';
|
|
232
|
-
ws.onopen = () => { if (own) tx({ t: 'own' }); if (placed) { size(true); seen(); } };
|
|
232
|
+
ws.onopen = () => { if (own) tx({ t: 'own' }); if (placed) { size(true); seen(true); } };
|
|
233
233
|
ws.onmessage = (e) => (typeof e.data === 'string' ? msg(JSON.parse(e.data)) : frame(e.data));
|
|
234
234
|
ws.onclose = () => { gone = true; closeSheet(); agentState({ off: true }); $('field').classList.remove('loading'); cover('The session ended', 'ended'); ended(); };
|
|
235
235
|
}
|
|
@@ -297,8 +297,14 @@ function size(now) {
|
|
|
297
297
|
if (now) send(); else sizeT = setTimeout(send, 150);
|
|
298
298
|
}
|
|
299
299
|
new ResizeObserver(() => size(false)).observe(stage);
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
/** the last `visible` sent: each one restarts the session's stream check; a new socket sends again */
|
|
301
|
+
let seenOn = null;
|
|
302
|
+
const seen = (force = false) => {
|
|
303
|
+
const on = !document.hidden && onScreen;
|
|
304
|
+
if (!force && on === seenOn) return;
|
|
305
|
+
seenOn = on; tx({ t: 'visible', on });
|
|
306
|
+
};
|
|
307
|
+
document.addEventListener('visibilitychange', () => seen());
|
|
302
308
|
// the hub page: tile or not, on screen or not; the app's clipboard answer
|
|
303
309
|
window.addEventListener('message', (e) => {
|
|
304
310
|
if (!embed || e.source !== parent || !e.data || typeof e.data !== 'object' || !e.data.hub) return;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { eyesOf } from "./browser/captcha/llm-eyes.js";
|
|
|
19
19
|
export { type CodeCall, CodeFailed, type CodeResult, runCode } from "./browser/code.js";
|
|
20
20
|
export type { ActOptions, BrowserFlow, FlowPage, FlowRunner, Op, RunnerOptions, Site, } from "./browser/flow.js";
|
|
21
21
|
export { defineFlow, flowRunner, SITES } from "./browser/flow.js";
|
|
22
|
+
/** The runner's `pace` (RunnerOptions.pace): `brisk(HUMAN_PACE, k)` runs k times faster. */
|
|
23
|
+
export { brisk, FILM_PACE, HUMAN_PACE, type Pace } from "./browser/human/index.js";
|
|
22
24
|
export { type Hints, type LocatorPlan, locate, planLocator } from "./browser/locate.js";
|
|
23
25
|
export { PoolFull, ProfileGate, ProfilePool } from "./browser/profile-pool.js";
|
|
24
26
|
export { type RecordsOp, type Row, records } from "./browser/records.js";
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,8 @@ export { findCaptcha, solveCaptcha, } from "./browser/captcha/index.js";
|
|
|
18
18
|
export { eyesOf } from "./browser/captcha/llm-eyes.js";
|
|
19
19
|
export { CodeFailed, runCode } from "./browser/code.js";
|
|
20
20
|
export { defineFlow, flowRunner, SITES } from "./browser/flow.js";
|
|
21
|
+
/** The runner's `pace` (RunnerOptions.pace): `brisk(HUMAN_PACE, k)` runs k times faster. */
|
|
22
|
+
export { brisk, FILM_PACE, HUMAN_PACE } from "./browser/human/index.js";
|
|
21
23
|
export { locate, planLocator } from "./browser/locate.js";
|
|
22
24
|
export { PoolFull, ProfileGate, ProfilePool } from "./browser/profile-pool.js";
|
|
23
25
|
export { records } from "./browser/records.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qEAAqE;AACrE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAqB,MAAM,WAAW,CAAC;AACzE;;;GAGG;AACH,OAAO,EAEL,WAAW,EAEX,YAAY,EACZ,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,WAAW,EACX,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,wFAAwF;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAiB,UAAU,EAAmB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAUxF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAgC,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAA4B,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EACL,WAAW,EACX,UAAU,EAGV,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EACX,aAAa,GAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,UAAU,EA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KAAK,EACL,QAAQ,EACR,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAML,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/llms.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Signed-in browser and site-API automation for agents: stored logins, official APIs behind one facade, and a journaled browser whose acts compile into workflows.
|
|
4
4
|
|
|
5
|
-
Version 0.8.
|
|
5
|
+
Version 0.8.19. Every command takes `--help --json`; `autobrowse list <words> --json` finds a route, flow or workflow. Errors are one JSON shape: `{code, message, hint, retryable, outcome?, artifact?}`.
|
|
6
6
|
|
|
7
7
|
## Skill
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@william_jin/autobrowse",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"description": "Browser and account automation: recorded flows where no API exists, official API shapes where one does, a person in the loop for money, accounts and consent.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|