fix: patch subagent display (#512)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-10 09:59:00 -08:00
committed by GitHub
parent ff9ad0deb0
commit 3fa18f7699
5 changed files with 663 additions and 429 deletions

View File

@@ -0,0 +1,54 @@
/**
* AnimationContext - Global context for controlling animations based on overflow
*
* When the live content area exceeds the terminal viewport, Ink's clearTerminal
* behavior causes severe flickering on every re-render. This context provides
* a global `shouldAnimate` flag that components (like BlinkDot) can consume
* to disable animations when content would overflow.
*
* The parent (App.tsx) calculates total live content height and determines
* if animations should be disabled, then provides this via context.
*/
import { createContext, type ReactNode, useContext } from "react";
interface AnimationContextValue {
/**
* Whether animations should be enabled.
* False when live content would overflow the viewport.
*/
shouldAnimate: boolean;
}
const AnimationContext = createContext<AnimationContextValue>({
shouldAnimate: true,
});
/**
* Hook to access the animation context.
* Returns { shouldAnimate: true } if used outside of a provider.
*/
export function useAnimation(): AnimationContextValue {
return useContext(AnimationContext);
}
interface AnimationProviderProps {
children: ReactNode;
shouldAnimate: boolean;
}
/**
* Provider component that controls animation state for all descendants.
* Wrap the live content area with this and pass shouldAnimate based on
* overflow detection.
*/
export function AnimationProvider({
children,
shouldAnimate,
}: AnimationProviderProps) {
return (
<AnimationContext.Provider value={{ shouldAnimate }}>
{children}
</AnimationContext.Provider>
);
}