The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import type { |
| 2 | ChatGptReconnectProfile, |
| 3 | ChatGptTransferredProfile, |
| 4 | ProviderAuthRespondInput, |
| 5 | ProviderAuthState, |
| 6 | ProviderSetupError, |
| 7 | } from "@t3tools/contracts"; |
| 8 | import type * as Effect from "effect/Effect"; |
| 9 | import type * as Scope from "effect/Scope"; |
| 10 | import type * as Stream from "effect/Stream"; |
| 11 | |
| 12 | export interface ProviderAuthController { |
| 13 | readonly credentialBinding?: { readonly owner: "provider" | "t3"; readonly key: string }; |
| 14 | readonly reconnectProfile?: ( |
| 15 | methodId: string, |
| 16 | ) => Effect.Effect<ChatGptReconnectProfile | null, ProviderSetupError>; |
| 17 | readonly importProfile?: ( |
| 18 | profile: ChatGptTransferredProfile, |
| 19 | stopSessions: Effect.Effect<void, ProviderSetupError>, |
| 20 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 21 | readonly adoptCredentials?: ( |
| 22 | update: Effect.Effect<void, ProviderSetupError>, |
| 23 | stopSessions: Effect.Effect<void, ProviderSetupError>, |
| 24 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 25 | readonly isChangingCredentials?: Effect.Effect<boolean>; |
| 26 | readonly invalidate?: Effect.Effect<void>; |
| 27 | readonly refreshMethods?: Effect.Effect<void>; |
| 28 | readonly removeMethod?: ( |
| 29 | methodId: string, |
| 30 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 31 | readonly withAccess?: <A, E, R>( |
| 32 | task: Effect.Effect<A, E, R>, |
| 33 | ) => Effect.Effect<A, E | ProviderSetupError, R | Scope.Scope>; |
| 34 | readonly start: ( |
| 35 | ownerSessionId: string, |
| 36 | stopSessions?: Effect.Effect<void, ProviderSetupError>, |
| 37 | methodId?: string, |
| 38 | returnUrl?: string, |
| 39 | callbackMode?: "server" | "client", |
| 40 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 41 | readonly complete: ( |
| 42 | ownerSessionId: string, |
| 43 | input: { readonly flowId: string; readonly callbackUrl: string }, |
| 44 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 45 | readonly cancel: ( |
| 46 | ownerSessionId: string, |
| 47 | flowId: string, |
| 48 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 49 | readonly respond?: ( |
| 50 | ownerSessionId: string, |
| 51 | input: ProviderAuthRespondInput, |
| 52 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 53 | readonly logout: ( |
| 54 | stopSessions: Effect.Effect<void, ProviderSetupError>, |
| 55 | ) => Effect.Effect<ProviderAuthState, ProviderSetupError>; |
| 56 | readonly subscribe: (ownerSessionId: string) => Stream.Stream<ProviderAuthState>; |
| 57 | readonly isLogoutPrompt?: (text: string, hasAttachments: boolean) => boolean; |
| 58 | } |