(null);
+ const [expanded, setExpanded] = useState(false);
+ const [truncated, setTruncated] = useState(false);
+
+ const measureRef = useCallback(
+ (body: HTMLDivElement | null) => {
+ observerRef.current?.disconnect();
+ observerRef.current = null;
+ if (!body || expanded) return;
+ const measure = () => setTruncated(body.scrollHeight > body.clientHeight);
+ measure();
+ const observer = new ResizeObserver(measure);
+ observer.observe(body);
+ observerRef.current = observer;
+ },
+ [expanded],
+ );
+
+ return (
+
+
+ {children}
+
+ {(truncated || expanded) && (
+
+ )}
+
+ );
+}
+
export function TaskFeedRow({
task,
actions,
@@ -451,10 +503,10 @@ export function TaskFeedRow({
-
+
{prompt ||
(starter ? "started a new task" : "A new task was started")}
-
+
{children}
@@ -569,9 +621,7 @@ function PendingFeedRow({
You
now
-
- {pending.prompt}
-
+ {pending.prompt}