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。

1010 B
Raw Blame
import { requireOptionalNativeModule } from "expo-modules-core";
import { randomUUID } from "expo-crypto";
import * as WebBrowser from "expo-web-browser";
import { AppState, Platform } from "react-native";
import { receivePluginOauthLoopback, type MobileLoopbackNative, type MobileLoopbackRequest } from "./pluginOauthLoopback";
export function receiveMobilePluginOauthLoopback(
  request: MobileLoopbackRequest, expiresAt: number, assertCurrent: () => void, signal?: AbortSignal,
) {
  return receivePluginOauthLoopback({
    request, expiresAt, signal, assertCurrent, id: randomUUID(), platform: Platform.OS,
    native: requireOptionalNativeModule<MobileLoopbackNative>("CindyPluginOauth"),
    openBrowser: (url) => WebBrowser.openBrowserAsync(url, { showTitle: true }),
    dismissBrowser: async () => { await WebBrowser.dismissBrowser(); },
    onAppState: (listener) => {
      const subscription = AppState.addEventListener("change", listener);
      return () => subscription.remove();
    },
  });
}