Commit ·
18d2106
1
Parent(s): 9893b8a
walkthrough: scroll-driven replay (sticky state bar + active-step highlight)
Browse filesThe walkthrough now simulates a playback as you scroll: a sticky bar at
the top of the Accordion shows the live phase, round counter X/87, an
animated token-usage bar, and trusted-fact count. Each of the 5 step
cards carries data-wt-* attributes; a small IntersectionObserver / scroll
handler picks whichever block is closest to viewport center, highlights
it, dims the past/future, and pushes its numbers into the sticky bar.
When the Context-Management step becomes active the token bar drops
dramatically (80,824 -> 2,400) with a green flash, visualising the
condenser compression.
Pure HTML/CSS/JS, no libraries; respects prefers-reduced-motion.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -1128,8 +1128,99 @@ gradio-app > div {
|
|
| 1128 |
unchanged; expanded view illustrates the 5 stages of a research run:
|
| 1129 |
Question → think+tool×N → context-management → think+tool×N → answer.
|
| 1130 |
──────────────────────────────────────────────────────────────────────── */
|
| 1131 |
-
.walkthrough { font-size: 0.9rem; color: var(--q-text); }
|
| 1132 |
.walkthrough .wt-intro { color: var(--q-muted); margin: 0 0 14px; line-height: 1.55; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
.walkthrough .wt-block {
|
| 1134 |
background: var(--q-paper);
|
| 1135 |
border: 1px solid var(--q-line);
|
|
@@ -2601,13 +2692,27 @@ WALKTHROUGH_HTML = """
|
|
| 2601 |
<div class="walkthrough">
|
| 2602 |
<p class="wt-intro">
|
| 2603 |
The trace below is from a single Mind2Web 2 task that QUEST-35B solved end-to-end.
|
| 2604 |
-
|
| 2605 |
-
|
| 2606 |
-
|
| 2607 |
</p>
|
| 2608 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2609 |
<!-- Question -->
|
| 2610 |
-
<div class="wt-block wt-question"
|
|
|
|
| 2611 |
<div class="wt-phase-tag">Question</div>
|
| 2612 |
<blockquote>
|
| 2613 |
I am interested in Retrieval-Augmented Generation (RAG) and would like to explore
|
|
@@ -2622,7 +2727,8 @@ WALKTHROUGH_HTML = """
|
|
| 2622 |
</div>
|
| 2623 |
|
| 2624 |
<!-- Phase 1 -->
|
| 2625 |
-
<div class="wt-block"
|
|
|
|
| 2626 |
<div class="wt-phase-tag">Phase 1 · Exploration <span class="wt-rounds">rounds 1 → 62</span></div>
|
| 2627 |
<div class="wt-stats">
|
| 2628 |
🧠 think + 🔧 tool × <strong>62 turns</strong> ·
|
|
@@ -2663,7 +2769,8 @@ WALKTHROUGH_HTML = """
|
|
| 2663 |
</div>
|
| 2664 |
|
| 2665 |
<!-- Context Management -->
|
| 2666 |
-
<div class="wt-block wt-condenser"
|
|
|
|
| 2667 |
<div class="wt-phase-tag">🗜️ Context Management <span class="wt-rounds">round 62</span></div>
|
| 2668 |
<div class="wt-stats">trigger: <code>CONTEXT_THRESHOLD</code> (80,000-token budget hit) · condenser LLM fires</div>
|
| 2669 |
<div class="wt-stats">output state: <strong>11 trusted</strong> facts · 1 uncertain · 0 untrusted · 21 visited sources · 8 search queries (deduplicated)</div>
|
|
@@ -2689,7 +2796,8 @@ WALKTHROUGH_HTML = """
|
|
| 2689 |
</div>
|
| 2690 |
|
| 2691 |
<!-- Phase 2 -->
|
| 2692 |
-
<div class="wt-block"
|
|
|
|
| 2693 |
<div class="wt-phase-tag">Phase 2 · Resolve & Synthesize <span class="wt-rounds">rounds 63 → 87</span></div>
|
| 2694 |
<div class="wt-stats">
|
| 2695 |
model reads <code>prev_state</code>, sees the one <em>uncertain</em> claim
|
|
@@ -2699,7 +2807,8 @@ WALKTHROUGH_HTML = """
|
|
| 2699 |
</div>
|
| 2700 |
|
| 2701 |
<!-- Answer -->
|
| 2702 |
-
<div class="wt-block"
|
|
|
|
| 2703 |
<div class="wt-phase-tag">✍️ Answer <span class="wt-rounds">round 87</span></div>
|
| 2704 |
<div class="wt-stats">final structured markdown built directly from the consolidated trusted state</div>
|
| 2705 |
<div class="wt-table-wrap">
|
|
@@ -2723,6 +2832,77 @@ WALKTHROUGH_HTML = """
|
|
| 2723 |
</div>
|
| 2724 |
</div>
|
| 2725 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2726 |
"""
|
| 2727 |
|
| 2728 |
|
|
|
|
| 1128 |
unchanged; expanded view illustrates the 5 stages of a research run:
|
| 1129 |
Question → think+tool×N → context-management → think+tool×N → answer.
|
| 1130 |
──────────────────────────────────────────────────────────────────────── */
|
| 1131 |
+
.walkthrough { font-size: 0.9rem; color: var(--q-text); position: relative; }
|
| 1132 |
.walkthrough .wt-intro { color: var(--q-muted); margin: 0 0 14px; line-height: 1.55; }
|
| 1133 |
+
|
| 1134 |
+
/* Sticky "live state" bar at top of the walkthrough — updates as the user
|
| 1135 |
+
scrolls past each step, simulating the agent's progress like a replay. */
|
| 1136 |
+
.walkthrough .wt-progress {
|
| 1137 |
+
position: sticky;
|
| 1138 |
+
top: 0;
|
| 1139 |
+
z-index: 5;
|
| 1140 |
+
display: flex;
|
| 1141 |
+
flex-wrap: wrap;
|
| 1142 |
+
align-items: center;
|
| 1143 |
+
gap: 14px;
|
| 1144 |
+
padding: 10px 14px;
|
| 1145 |
+
margin: 0 0 12px;
|
| 1146 |
+
background: var(--q-paper);
|
| 1147 |
+
border: 1px solid var(--q-line-strong);
|
| 1148 |
+
border-radius: 12px;
|
| 1149 |
+
box-shadow: 0 2px 10px rgba(15,23,42,0.05);
|
| 1150 |
+
backdrop-filter: saturate(180%) blur(6px);
|
| 1151 |
+
-webkit-backdrop-filter: saturate(180%) blur(6px);
|
| 1152 |
+
}
|
| 1153 |
+
.walkthrough .wt-progress-phase {
|
| 1154 |
+
font-size: 0.74rem;
|
| 1155 |
+
font-weight: 800;
|
| 1156 |
+
letter-spacing: 0.1em;
|
| 1157 |
+
text-transform: uppercase;
|
| 1158 |
+
color: var(--q-accent);
|
| 1159 |
+
padding: 3px 10px;
|
| 1160 |
+
background: var(--q-accent-soft);
|
| 1161 |
+
border-radius: 999px;
|
| 1162 |
+
transition: background 300ms ease, color 300ms ease;
|
| 1163 |
+
}
|
| 1164 |
+
.walkthrough .wt-progress-meters {
|
| 1165 |
+
display: flex;
|
| 1166 |
+
align-items: center;
|
| 1167 |
+
gap: 14px;
|
| 1168 |
+
font-size: 0.76rem;
|
| 1169 |
+
color: var(--q-muted);
|
| 1170 |
+
flex: 1 1 auto;
|
| 1171 |
+
flex-wrap: wrap;
|
| 1172 |
+
}
|
| 1173 |
+
.walkthrough .wt-progress-meters strong {
|
| 1174 |
+
color: var(--q-text);
|
| 1175 |
+
font-weight: 700;
|
| 1176 |
+
font-variant-numeric: tabular-nums;
|
| 1177 |
+
transition: color 200ms ease;
|
| 1178 |
+
}
|
| 1179 |
+
.walkthrough .wt-tokens-bar {
|
| 1180 |
+
position: relative;
|
| 1181 |
+
display: inline-block;
|
| 1182 |
+
vertical-align: middle;
|
| 1183 |
+
width: 90px;
|
| 1184 |
+
height: 6px;
|
| 1185 |
+
background: var(--q-surface-alt);
|
| 1186 |
+
border-radius: 999px;
|
| 1187 |
+
overflow: hidden;
|
| 1188 |
+
margin-left: 6px;
|
| 1189 |
+
}
|
| 1190 |
+
.walkthrough .wt-tokens-fill {
|
| 1191 |
+
position: absolute;
|
| 1192 |
+
inset: 0 auto 0 0;
|
| 1193 |
+
width: 0%;
|
| 1194 |
+
background: linear-gradient(90deg, #3B82F6 0%, var(--q-accent) 70%, #DC2626 100%);
|
| 1195 |
+
transition: width 700ms cubic-bezier(.4,0,.2,1);
|
| 1196 |
+
}
|
| 1197 |
+
.walkthrough .wt-tokens-fill.dropped {
|
| 1198 |
+
/* Visual flash when the condenser drops the token count */
|
| 1199 |
+
background: linear-gradient(90deg, #0B9E8A 0%, #0B9E8A 100%);
|
| 1200 |
+
}
|
| 1201 |
+
|
| 1202 |
+
/* Each step card transitions opacity / lift as it becomes active. */
|
| 1203 |
+
.walkthrough .wt-block {
|
| 1204 |
+
opacity: 0.45;
|
| 1205 |
+
transform: translateY(4px);
|
| 1206 |
+
transition: opacity 400ms ease, transform 400ms ease, box-shadow 400ms ease, border-color 300ms ease;
|
| 1207 |
+
}
|
| 1208 |
+
.walkthrough .wt-block.wt-active {
|
| 1209 |
+
opacity: 1;
|
| 1210 |
+
transform: translateY(0);
|
| 1211 |
+
box-shadow: 0 4px 18px rgba(190,91,43,0.10);
|
| 1212 |
+
border-color: var(--q-accent-line, var(--q-accent));
|
| 1213 |
+
}
|
| 1214 |
+
.walkthrough .wt-block.wt-past { opacity: 0.55; }
|
| 1215 |
+
.walkthrough .wt-block.wt-condenser.wt-active {
|
| 1216 |
+
/* extra emphasis when condenser step is the active one */
|
| 1217 |
+
box-shadow: 0 6px 22px rgba(190,91,43,0.18);
|
| 1218 |
+
}
|
| 1219 |
+
@media (prefers-reduced-motion: reduce) {
|
| 1220 |
+
.walkthrough .wt-block, .walkthrough .wt-tokens-fill, .walkthrough .wt-progress-phase, .walkthrough .wt-progress-meters strong {
|
| 1221 |
+
transition: none !important;
|
| 1222 |
+
}
|
| 1223 |
+
}
|
| 1224 |
.walkthrough .wt-block {
|
| 1225 |
background: var(--q-paper);
|
| 1226 |
border: 1px solid var(--q-line);
|
|
|
|
| 2692 |
<div class="walkthrough">
|
| 2693 |
<p class="wt-intro">
|
| 2694 |
The trace below is from a single Mind2Web 2 task that QUEST-35B solved end-to-end.
|
| 2695 |
+
Scroll through to <strong>watch the agent replay itself</strong> — the sticky bar
|
| 2696 |
+
above tracks the live round count, context token usage, and trusted-fact tally
|
| 2697 |
+
as each step enters view.
|
| 2698 |
</p>
|
| 2699 |
|
| 2700 |
+
<!-- Sticky "live state" replay bar — JS below updates it as each .wt-block scrolls into view. -->
|
| 2701 |
+
<div class="wt-progress" aria-live="polite">
|
| 2702 |
+
<span class="wt-progress-phase" data-wt-phase>Question</span>
|
| 2703 |
+
<span class="wt-progress-meters">
|
| 2704 |
+
<span>round <strong data-wt-round>0</strong>/87</span>
|
| 2705 |
+
<span>
|
| 2706 |
+
<strong data-wt-tokens>0</strong> tokens
|
| 2707 |
+
<span class="wt-tokens-bar"><span class="wt-tokens-fill" data-wt-tokens-fill></span></span>
|
| 2708 |
+
</span>
|
| 2709 |
+
<span><strong data-wt-trusted>0</strong> trusted facts</span>
|
| 2710 |
+
</span>
|
| 2711 |
+
</div>
|
| 2712 |
+
|
| 2713 |
<!-- Question -->
|
| 2714 |
+
<div class="wt-block wt-question"
|
| 2715 |
+
data-wt-phase="Question" data-wt-round="0" data-wt-tokens="0" data-wt-trusted="0">
|
| 2716 |
<div class="wt-phase-tag">Question</div>
|
| 2717 |
<blockquote>
|
| 2718 |
I am interested in Retrieval-Augmented Generation (RAG) and would like to explore
|
|
|
|
| 2727 |
</div>
|
| 2728 |
|
| 2729 |
<!-- Phase 1 -->
|
| 2730 |
+
<div class="wt-block"
|
| 2731 |
+
data-wt-phase="Phase 1 · Exploration" data-wt-round="62" data-wt-tokens="80824" data-wt-trusted="0">
|
| 2732 |
<div class="wt-phase-tag">Phase 1 · Exploration <span class="wt-rounds">rounds 1 → 62</span></div>
|
| 2733 |
<div class="wt-stats">
|
| 2734 |
🧠 think + 🔧 tool × <strong>62 turns</strong> ·
|
|
|
|
| 2769 |
</div>
|
| 2770 |
|
| 2771 |
<!-- Context Management -->
|
| 2772 |
+
<div class="wt-block wt-condenser"
|
| 2773 |
+
data-wt-phase="🗜️ Context Mgmt" data-wt-round="62" data-wt-tokens="2400" data-wt-trusted="11" data-wt-tokens-drop="1">
|
| 2774 |
<div class="wt-phase-tag">🗜️ Context Management <span class="wt-rounds">round 62</span></div>
|
| 2775 |
<div class="wt-stats">trigger: <code>CONTEXT_THRESHOLD</code> (80,000-token budget hit) · condenser LLM fires</div>
|
| 2776 |
<div class="wt-stats">output state: <strong>11 trusted</strong> facts · 1 uncertain · 0 untrusted · 21 visited sources · 8 search queries (deduplicated)</div>
|
|
|
|
| 2796 |
</div>
|
| 2797 |
|
| 2798 |
<!-- Phase 2 -->
|
| 2799 |
+
<div class="wt-block"
|
| 2800 |
+
data-wt-phase="Phase 2 · Synthesize" data-wt-round="87" data-wt-tokens="41721" data-wt-trusted="11">
|
| 2801 |
<div class="wt-phase-tag">Phase 2 · Resolve & Synthesize <span class="wt-rounds">rounds 63 → 87</span></div>
|
| 2802 |
<div class="wt-stats">
|
| 2803 |
model reads <code>prev_state</code>, sees the one <em>uncertain</em> claim
|
|
|
|
| 2807 |
</div>
|
| 2808 |
|
| 2809 |
<!-- Answer -->
|
| 2810 |
+
<div class="wt-block"
|
| 2811 |
+
data-wt-phase="✍️ Answer" data-wt-round="87" data-wt-tokens="41721" data-wt-trusted="11">
|
| 2812 |
<div class="wt-phase-tag">✍️ Answer <span class="wt-rounds">round 87</span></div>
|
| 2813 |
<div class="wt-stats">final structured markdown built directly from the consolidated trusted state</div>
|
| 2814 |
<div class="wt-table-wrap">
|
|
|
|
| 2832 |
</div>
|
| 2833 |
</div>
|
| 2834 |
</div>
|
| 2835 |
+
|
| 2836 |
+
<script>
|
| 2837 |
+
(function () {
|
| 2838 |
+
// Wait for the walkthrough markup to actually be in the DOM (it lives inside
|
| 2839 |
+
// an Accordion that may render later) and initialise once.
|
| 2840 |
+
function init() {
|
| 2841 |
+
var roots = document.querySelectorAll('.walkthrough');
|
| 2842 |
+
roots.forEach(function (root) {
|
| 2843 |
+
if (root.dataset.wtInit) return;
|
| 2844 |
+
root.dataset.wtInit = '1';
|
| 2845 |
+
|
| 2846 |
+
var blocks = root.querySelectorAll('.wt-block');
|
| 2847 |
+
if (!blocks.length) return;
|
| 2848 |
+
var TOTAL_BUDGET = 80824; // peak token count, used to scale the bar
|
| 2849 |
+
var phaseEl = root.querySelector('[data-wt-phase]');
|
| 2850 |
+
var roundEl = root.querySelector('[data-wt-round]');
|
| 2851 |
+
var tokensEl = root.querySelector('[data-wt-tokens]');
|
| 2852 |
+
var fillEl = root.querySelector('[data-wt-tokens-fill]');
|
| 2853 |
+
var trustedEl = root.querySelector('[data-wt-trusted]');
|
| 2854 |
+
|
| 2855 |
+
function setActive(idx) {
|
| 2856 |
+
blocks.forEach(function (b, i) {
|
| 2857 |
+
b.classList.toggle('wt-active', i === idx);
|
| 2858 |
+
b.classList.toggle('wt-past', i < idx);
|
| 2859 |
+
});
|
| 2860 |
+
var b = blocks[idx];
|
| 2861 |
+
if (!b) return;
|
| 2862 |
+
phaseEl.textContent = b.dataset.wtPhase || '';
|
| 2863 |
+
roundEl.textContent = b.dataset.wtRound || '0';
|
| 2864 |
+
var t = parseInt(b.dataset.wtTokens || '0', 10);
|
| 2865 |
+
tokensEl.textContent = t.toLocaleString();
|
| 2866 |
+
fillEl.style.width = Math.min(100, (t / TOTAL_BUDGET) * 100) + '%';
|
| 2867 |
+
fillEl.classList.toggle('dropped', b.dataset.wtTokensDrop === '1');
|
| 2868 |
+
trustedEl.textContent = b.dataset.wtTrusted || '0';
|
| 2869 |
+
}
|
| 2870 |
+
setActive(0);
|
| 2871 |
+
|
| 2872 |
+
// Determine active block by which one is closest to viewport center.
|
| 2873 |
+
function recompute() {
|
| 2874 |
+
var bestIdx = 0;
|
| 2875 |
+
var bestDist = Infinity;
|
| 2876 |
+
var vc = window.innerHeight / 2;
|
| 2877 |
+
blocks.forEach(function (b, i) {
|
| 2878 |
+
var r = b.getBoundingClientRect();
|
| 2879 |
+
if (r.bottom < 0 || r.top > window.innerHeight) return;
|
| 2880 |
+
var c = (r.top + r.bottom) / 2;
|
| 2881 |
+
var d = Math.abs(c - vc);
|
| 2882 |
+
if (d < bestDist) { bestDist = d; bestIdx = i; }
|
| 2883 |
+
});
|
| 2884 |
+
setActive(bestIdx);
|
| 2885 |
+
}
|
| 2886 |
+
window.addEventListener('scroll', recompute, { passive: true });
|
| 2887 |
+
window.addEventListener('resize', recompute);
|
| 2888 |
+
// Recompute when the accordion opens (its children become visible).
|
| 2889 |
+
var io = new IntersectionObserver(function (entries) {
|
| 2890 |
+
entries.forEach(function (e) { if (e.isIntersecting) recompute(); });
|
| 2891 |
+
}, { threshold: 0.05 });
|
| 2892 |
+
blocks.forEach(function (b) { io.observe(b); });
|
| 2893 |
+
// First paint after Accordion expand
|
| 2894 |
+
setTimeout(recompute, 80);
|
| 2895 |
+
});
|
| 2896 |
+
}
|
| 2897 |
+
// Gradio mounts asynchronously — observe the DOM and (re)init when nodes appear.
|
| 2898 |
+
if (document.readyState === 'loading') {
|
| 2899 |
+
document.addEventListener('DOMContentLoaded', init);
|
| 2900 |
+
} else {
|
| 2901 |
+
init();
|
| 2902 |
+
}
|
| 2903 |
+
new MutationObserver(init).observe(document.body, { childList: true, subtree: true });
|
| 2904 |
+
})();
|
| 2905 |
+
</script>
|
| 2906 |
"""
|
| 2907 |
|
| 2908 |
|