Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

513 B
Raw Blame
import { isSecondaryWindow } from './secondaryWindow';

/** Drain retained invitations before the existing last ordinary navigation intent. */
export async function drainPendingDeepLinks<T extends { type: string }>(
  take: () => Promise<T | null>,
  receive: (payload: T) => void,
): Promise<void> {
  if (isSecondaryWindow()) return;
  let payload;
  do {
    payload = await take();
    if (payload) receive(payload);
  } while (payload?.type === 'chat-invite' || payload?.type === 'chat-invite-malformed');
}