private static boolean hasExternalSSHAgent() {
    String ssh_auth_sock = EnvironmentUtil.getValue("SSH_AUTH_SOCK");
    if (ssh_auth_sock == null) return false;

    if (StringUtil.contains(ssh_auth_sock, MAC_DEFAULT_LAUNCH)) {
      try {
        Path agentPath = Path.of(ssh_auth_sock);
        String originPath = agentPath.toString();
        String realPath = agentPath.toRealPath().toString();
        if (!originPath.equals(realPath)) {
          return true;
        }
      }
      catch (Throwable ignored) {
      }

      return false;
    }

    return true;
  }
private static boolean hasExternalSSHAgent()