Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

707 B
Raw Blame
import { isLinux, isMac, isWindows } from "@/lib/platform";
import type { ProviderMeta } from "@/types";

/** 能不能切 agy 的全局登录:和后端 `agy_account::keychain::supported` 一致。 */
export function canSwitchAgyAccount(): boolean {
  return isMac() || isWindows() || isLinux();
}

export function resolveManagedAccountId(
  meta: ProviderMeta | undefined,
  authProvider: string,
): string | null {
  const binding = meta?.authBinding;

  if (
    binding?.source === "managed_account" &&
    binding.authProvider === authProvider
  ) {
    return binding.accountId ?? null;
  }

  if (authProvider === "github_copilot") {
    return meta?.githubAccountId ?? null;
  }

  return null;
}