Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(editor): a way back to the question you scrolled past

esengine1b3b3cbdb057
diff --git a/desktop/src/components/AgentDrawer.tsx b/desktop/src/components/AgentDrawer.tsx
index dbc68b584..b02f2d667 100644
--- a/desktop/src/components/AgentDrawer.tsx
+++ b/desktop/src/components/AgentDrawer.tsx
@@ -473,6 +473,20 @@ export function AgentPanel({ docked }: { docked?: boolean }) {
const status = useAgent((s) => s.status);
const logRef = useRef<HTMLDivElement>(null);
const stuck = useRef(true);
+ // A question that has scrolled away is a turn that looks hung. Watched per
+ // instance rather than through shared state: the dock tab and the drawer can
+ // both be mounted, and each has its own scroller.
+ const awaiting = status.phase === 'awaiting_confirm';
+ const [askOffscreen, setAskOffscreen] = useState(false);
+ useEffect(() => {
+ if (!awaiting) { setAskOffscreen(false); return; }
+ const log = logRef.current;
+ const ask = log?.querySelector('.ag-ask--confirm');
+ if (!log || !ask) return;
+ const io = new IntersectionObserver(([e]) => setAskOffscreen(!e.isIntersecting), { root: log, threshold: 0.5 });
+ io.observe(ask);
+ return () => io.disconnect();
+ }, [awaiting, turns]);
// Follow the tail only while the reader is already at it — yanking someone
// back down while they read an earlier tool result is the classic log-view bug.
@@ -526,6 +540,16 @@ export function AgentPanel({ docked }: { docked?: boolean }) {
))}
</div>
+ {askOffscreen && (
+ <button
+ type="button"
+ className="ag-jump"
+ onClick={() => logRef.current?.querySelector('.ag-ask--confirm')
+ ?.scrollIntoView({ block: 'center', behavior: 'smooth' })}
+ >
+ <ChevronDown size={12} strokeWidth={2.2} />{t('agent.jump')}
+ </button>
+ )}
{status.error && <div className="ag-banner">{status.error}</div>}
<Compose />
</div>
diff --git a/desktop/src/theme/agent.css b/desktop/src/theme/agent.css
index b5a6ca6a5..ce327b6b3 100644
--- a/desktop/src/theme/agent.css
+++ b/desktop/src/theme/agent.css
@@ -575,3 +575,18 @@
background: var(--text-dim);
animation: ag-blink 1s steps(2) infinite;
}
+
+/* A question that scrolled away. Amber, because it is the same "needs you" the
+ passage itself carries — and it sits above the composer, where the eye
+ already goes to reply. */
+.ag-jump {
+ flex: none;
+ display: flex; align-items: center; justify-content: center; gap: 6px;
+ margin: 0 13px 8px;
+ padding: 6px 12px;
+ border-radius: var(--r-sm);
+ background: var(--warn);
+ color: var(--srf-0);
+ font-size: var(--fs-sm);
+ font-weight: 500;
+}