Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

453 B
Raw Blame
import { isSameTabScope, resolveTabScope, type TabScope } from './scope';

export type TabUpdate = { type: 'rewrite' } | { scope: TabScope; type: 'scope-swap'; url: string };

export const resolveTabUpdate = (activeTabScope: TabScope, reportedUrl: string): TabUpdate => {
  const scope = resolveTabScope(reportedUrl);
  if (isSameTabScope(activeTabScope, scope)) return { type: 'rewrite' };

  return { scope, type: 'scope-swap', url: reportedUrl };
};