graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Clear the floating composer so the last answer can scroll up
Rach3b7d4b889f2c
diff --git a/apps/native/components/site/ChatColumn.tsx b/apps/native/components/site/ChatColumn.tsxindex c88e4017..ec5e1875 100644--- a/apps/native/components/site/ChatColumn.tsx+++ b/apps/native/components/site/ChatColumn.tsx@@ -1,5 +1,5 @@"use client";-import type { ComponentProps } from "react";+import { useLayoutEffect, useRef, type ComponentProps } from "react";import PromptBar from "@/components/primitives/PromptBar";import composer from "@/components/primitives/PromptBar.module.css";import type { Health } from "@/lib/acp-client";@@ -10,6 +10,7 @@ import PromptQueue from "./PromptQueue";import ComposerAgents from "./ComposerAgents";import SavedSnapshot from "./SavedSnapshot";import type { Chat } from "./harness-types";+import { overlayClearancePx } from "@/lib/follow-scroll";export default function ChatColumn({ thread, compact, following, register, onOpenPath, onReview, onAnswer, onEditPrompt,prompt, queue, pins, onShowPins, onClearPins, health, onOpenProject, onProjects, onConversations,@@ -26,16 +27,27 @@ export default function ChatColumn({ thread, compact, following, register, onOpe}) {const measured = thread.messages.findLast(message => message.role === "assistant" && message.turn.contextMeter);const contextMeter = measured?.role === "assistant" ? measured.turn.contextMeter : undefined;+ const hostRef = useRef<HTMLDivElement>(null);+ const composerRef = useRef<HTMLDivElement>(null);+ useLayoutEffect(() => {+ const overlay = composerRef.current, host = hostRef.current;+ if (!overlay || !host) return;+ const apply = () => host.style.setProperty("--composer-clearance", `${overlayClearancePx(overlay.offsetHeight)}px`);+ apply();+ const observer = new ResizeObserver(apply);+ observer.observe(overlay);+ return () => observer.disconnect();+ }, []);if (!thread.messages.length && !thread.snapshot) return <div className="min-h-0 flex-1 overflow-y-auto"><EmptyState compact={compact} onOpenProject={onOpenProject} onProjects={onProjects}onContinue={onConversations} onReview={onReview} onSend={prompt.onSend} onSetting={prompt.onSetting}health={health} history={prompt.history} cwd={prompt.root} models={prompt.models}modelKey={prompt.modelKey} onModelChange={prompt.onModelChange} commands={prompt.commands} /></div>;- return <div className="relative flex min-h-0 flex-1 flex-col">+ return <div ref={hostRef} className="relative flex min-h-0 flex-1 flex-col"><ChatTranscript messages={thread.messages} register={register} following={following}onOpenPath={onOpenPath} onReview={onReview} onAnswer={onAnswer} snapshot={thread.snapshot} onEditPrompt={onEditPrompt} />- <div data-chat-composer className={`pointer-events-none absolute inset-x-0 bottom-0 z-10 px-4 ${composer.dock} ${compact ? "py-2" : "pt-16 pb-6 sm:px-8"}`}>+ <div ref={composerRef} data-chat-composer className={`pointer-events-none absolute inset-x-0 bottom-0 z-10 px-4 ${composer.dock} ${compact ? "py-2" : "pt-16 pb-6 sm:px-8"}`}><div className="pointer-events-auto mx-auto max-w-[720px]">{thread.snapshot && thread.session ? <SavedSnapshot name={thread.session} cwd={thread.cwd} model={prompt.modelKey}onRefresh={onRefresh} onContinue={onContinue} /> : <>diff --git a/apps/native/components/site/ChatTranscript.tsx b/apps/native/components/site/ChatTranscript.tsxindex 25e2b71a..efbc6ec0 100644--- a/apps/native/components/site/ChatTranscript.tsx+++ b/apps/native/components/site/ChatTranscript.tsx@@ -53,7 +53,7 @@ export default memo(function ChatTranscript({ messages, register, following, onO}, []);return <div ref={registerScroller} data-chat-transcript data-following={following}className="min-h-0 min-w-0 max-w-full flex-1 overflow-x-hidden overflow-y-auto overscroll-contain" style={{ overflowAnchor: "none" }}>- <div data-transcript-content className="mx-auto flex w-full max-w-[720px] flex-col gap-8 px-4 pt-8 pb-36 sm:px-8">+ <div data-transcript-content className="mx-auto flex w-full max-w-[720px] flex-col gap-8 px-4 pt-8 sm:px-8" style={{ paddingBottom: "max(9rem, var(--composer-clearance, 9rem))" }}>{start > 0 && <button type="button" className="self-center rounded-lg bg-field px-3 py-2 text-xs text-ink-2 hover:bg-hover" onClick={() => {const el = scroller.current;if (el) anchor.current = { height: el.scrollHeight, top: el.scrollTop };diff --git a/apps/native/lib/follow-scroll.test.ts b/apps/native/lib/follow-scroll.test.tsindex 715a0028..9886fdb5 100644--- a/apps/native/lib/follow-scroll.test.ts+++ b/apps/native/lib/follow-scroll.test.ts@@ -1,6 +1,6 @@import { describe, it } from "node:test";import assert from "node:assert/strict";-import { distanceFromTail, isFollowingTail, pinScrollerTail, TAIL_SLACK_PX, followsAfterScroll } from "./follow-scroll.ts";+import { distanceFromTail, isFollowingTail, overlayClearancePx, pinScrollerTail, TAIL_SLACK_PX, followsAfterScroll } from "./follow-scroll.ts";function box(scrollTop: number, scrollHeight = 1000, clientHeight = 400) {return { scrollTop, scrollHeight, clientHeight };@@ -27,6 +27,12 @@ describe("follow-scroll", () => {});+it("clears a stacked composer instead of the old 9rem floor", () => {+ assert.equal(overlayClearancePx(80), 144);+ assert.equal(overlayClearancePx(180), 192);+ assert.equal(overlayClearancePx(Number.NaN), 144);+});+it("content growth does not impersonate a reader scrolling away", () => {assert.equal(followsAfterScroll(box(600, 2000), 600, true), true);assert.equal(followsAfterScroll(box(500, 2000), 600, true), false);diff --git a/apps/native/lib/follow-scroll.ts b/apps/native/lib/follow-scroll.tsindex 41d41170..cd7f33be 100644--- a/apps/native/lib/follow-scroll.ts+++ b/apps/native/lib/follow-scroll.ts@@ -28,3 +28,9 @@ export function pinScrollerTail(el: HTMLElement | null, following: boolean): voiif (!el || !following) return;el.scrollTop = el.scrollHeight;}++/** Bottom padding so the last transcript line sits above a floating composer. */+export function overlayClearancePx(overlayHeight: number, slack = 12, floor = 144): number {+ if (!Number.isFinite(overlayHeight) || overlayHeight < 0) return floor;+ return Math.max(floor, Math.ceil(overlayHeight + slack));+}