Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

758 B
Raw Blame
// Pure toast-coalescing predicate + action type, kept out of ToastContext.tsx so
// that provider file only exports its component + hook (react-refresh HMR rule).

// Optional one-tap action (e.g. an Undo) rendered inside a toast.
export type ToastAction = { label: string; onClick: () => void };

// A toast carrying an action targets ONE specific item (e.g. undo THIS hide), so
// it must never fold into an earlier toast's repeat counter — that would strand
// the action on the wrong item. Only plain duplicates within the window coalesce.
export function shouldCoalesceToast(
  hasAction: boolean,
  existing: { expiresAt: number } | undefined,
  now: number,
): boolean {
  return !hasAction && existing !== undefined && existing.expiresAt > now;
}