@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
33 lines • 1.53 kB
TypeScript
export interface StickToBottomOptions {
/**
* Changes whenever the rendered content grows — the signal to re-pin. A string rather than the
* message array because a streaming turn mutates in place: the array identity is stable while its
* last part's text keeps growing.
*/
contentKey: string;
/**
* How far off the bottom (px) still counts as "at the bottom". Sub-pixel layout and fractional
* device ratios leave a residue of a pixel or two after a programmatic scroll, so an exact
* comparison unpins the view on the very scroll event it just caused.
*/
threshold?: number;
}
export interface StickToBottom {
/** While true, new content scrolls into view; the user scrolling up turns it off. */
isAtBottom: boolean;
/** Whether a "jump to latest" affordance is warranted. */
showJumpToLatest: boolean;
scrollToBottom: () => void;
/** Spread onto the scrolling element. Behaviour only — no classes, no styles. */
getContainerProps: () => {
ref: (element: HTMLElement | null) => void;
onScroll: () => void;
};
}
/**
* Follow a streaming transcript only while the reader is already at the bottom. Reading back
* through history during a stream is the case this exists for: an unconditional scroll-to-bottom
* yanks the viewport away mid-sentence on every token.
*/
export declare function useStickToBottom({ contentKey, threshold, }: StickToBottomOptions): StickToBottom;
//# sourceMappingURL=use-stick-to-bottom.d.ts.map