@datalayer/agent-runtimes 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +9 -0
  2. package/lib/components/chat/components/AgentDetails.d.ts +14 -1
  3. package/lib/components/chat/components/AgentDetails.js +3 -2
  4. package/lib/components/chat/components/AgentIdentity.d.ts +92 -0
  5. package/lib/components/chat/components/AgentIdentity.js +318 -0
  6. package/lib/components/chat/components/Chat.d.ts +20 -1
  7. package/lib/components/chat/components/Chat.js +16 -3
  8. package/lib/components/chat/components/ChatFloating.d.ts +6 -1
  9. package/lib/components/chat/components/ChatFloating.js +12 -6
  10. package/lib/components/chat/components/base/ChatBase.d.ts +47 -1
  11. package/lib/components/chat/components/base/ChatBase.js +242 -63
  12. package/lib/components/chat/components/display/ToolCallDisplay.d.ts +16 -2
  13. package/lib/components/chat/components/display/ToolCallDisplay.js +148 -6
  14. package/lib/components/chat/components/display/index.d.ts +1 -1
  15. package/lib/components/chat/components/display/index.js +1 -1
  16. package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +12 -1
  17. package/lib/components/chat/components/elements/ChatInputPrompt.js +8 -3
  18. package/lib/components/chat/components/index.d.ts +1 -0
  19. package/lib/components/chat/components/index.js +1 -0
  20. package/lib/components/chat/components/parts/ToolPart.d.ts +1 -1
  21. package/lib/components/chat/components/parts/ToolPart.js +142 -6
  22. package/lib/components/chat/index.d.ts +1 -1
  23. package/lib/components/chat/index.js +1 -1
  24. package/lib/components/chat/protocols/A2AAdapter.d.ts +9 -0
  25. package/lib/components/chat/protocols/A2AAdapter.js +13 -2
  26. package/lib/components/chat/protocols/ACPAdapter.d.ts +9 -0
  27. package/lib/components/chat/protocols/ACPAdapter.js +13 -2
  28. package/lib/components/chat/protocols/AGUIAdapter.d.ts +9 -0
  29. package/lib/components/chat/protocols/AGUIAdapter.js +19 -1
  30. package/lib/components/chat/protocols/VercelAIAdapter.d.ts +7 -0
  31. package/lib/components/chat/protocols/VercelAIAdapter.js +19 -0
  32. package/lib/components/chat/types/execution.d.ts +78 -0
  33. package/lib/components/chat/types/execution.js +64 -0
  34. package/lib/components/chat/types/index.d.ts +1 -0
  35. package/lib/components/chat/types/index.js +1 -0
  36. package/lib/components/chat/types/protocol.d.ts +9 -0
  37. package/lib/components/ui/pagination.d.ts +2 -2
  38. package/lib/components/ui/pagination.js +4 -4
  39. package/lib/components/ui/resizable.d.ts +4 -4
  40. package/lib/components/ui/resizable.js +4 -4
  41. package/lib/examples/A2UiRestaurantExample.js +2 -2
  42. package/lib/examples/AgUiAgenticExample.js +2 -2
  43. package/lib/examples/AgUiBackendToolRenderingExample.js +2 -2
  44. package/lib/examples/AgUiHaikuGenUIExample.js +2 -2
  45. package/lib/examples/AgUiHumanInTheLoopExample.js +2 -2
  46. package/lib/examples/AgUiSharedStateExample.js +2 -2
  47. package/lib/examples/AgUiToolsBasedGenUIExample.js +2 -2
  48. package/lib/examples/AgentRuntimeCustomExample.js +2 -2
  49. package/lib/examples/AgentRuntimeLexical2Example.js +2 -1
  50. package/lib/examples/AgentRuntimeLexicalExample.js +5 -2
  51. package/lib/examples/AgentRuntimeLexicalSidebarExample.js +4 -2
  52. package/lib/examples/AgentRuntimeNotebookExample.js +1 -1
  53. package/lib/examples/AgentRuntimeStandaloneExample.js +2 -2
  54. package/lib/examples/AgentSpaceFormExample.d.ts +70 -2
  55. package/lib/examples/AgentSpaceFormExample.js +177 -43
  56. package/lib/examples/CopilotKitLexicalExample.js +2 -1
  57. package/lib/examples/components/AgentConfiguration.d.ts +17 -2
  58. package/lib/examples/components/AgentConfiguration.js +220 -16
  59. package/lib/examples/components/LexicalEditor.js +2 -1
  60. package/lib/examples/components/MockFileBrowser.js +6 -2
  61. package/lib/examples/components/index.d.ts +0 -1
  62. package/lib/examples/components/index.js +0 -1
  63. package/lib/examples/example-selector.js +0 -1
  64. package/lib/examples/index.d.ts +0 -1
  65. package/lib/examples/index.js +0 -1
  66. package/lib/examples/lexical/editorConfig.d.ts +3 -2
  67. package/lib/examples/lexical/editorConfig.js +7 -1
  68. package/lib/examples/lexical/initial-content.json +2210 -0
  69. package/lib/examples/main.js +15 -1
  70. package/lib/identity/IdentityConnect.d.ts +90 -0
  71. package/lib/identity/IdentityConnect.js +316 -0
  72. package/lib/identity/OAuthCallback.d.ts +58 -0
  73. package/lib/identity/OAuthCallback.js +223 -0
  74. package/lib/identity/dcr.d.ts +257 -0
  75. package/lib/identity/dcr.js +282 -0
  76. package/lib/identity/identityStore.d.ts +72 -0
  77. package/lib/identity/identityStore.js +529 -0
  78. package/lib/identity/index.d.ts +46 -0
  79. package/lib/identity/index.js +17 -0
  80. package/lib/identity/pkce.d.ts +30 -0
  81. package/lib/identity/pkce.js +65 -0
  82. package/lib/identity/types.d.ts +293 -0
  83. package/lib/identity/types.js +73 -0
  84. package/lib/identity/useIdentity.d.ts +108 -0
  85. package/lib/identity/useIdentity.js +323 -0
  86. package/lib/index.d.ts +1 -0
  87. package/lib/index.js +1 -0
  88. package/lib/lib/utils.js +1 -1
  89. package/lib/renderers/a2ui/lib/utils.js +1 -1
  90. package/lib/test-setup.d.ts +1 -1
  91. package/lib/test-setup.js +1 -0
  92. package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +32 -1
  93. package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +6 -0
  94. package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +16 -17
  95. package/package.json +20 -7
  96. package/patches/@datalayer+jupyter-lexical+1.0.8.patch +11628 -0
  97. package/patches/@datalayer+jupyter-react+2.0.2.patch +5338 -0
  98. package/scripts/apply-patches.sh +32 -0
  99. package/lib/examples/AgentSpaceHomeExample.d.ts +0 -8
  100. package/lib/examples/AgentSpaceHomeExample.js +0 -171
  101. package/lib/examples/components/AgentsDataTable.d.ts +0 -13
  102. package/lib/examples/components/AgentsDataTable.js +0 -74
  103. package/lib/examples/components/Rating.d.ts +0 -14
  104. package/lib/examples/components/Rating.js +0 -12
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Identity types for OAuth 2.1 user-delegated access and token-based authentication.
3
+ *
4
+ * @module identity/types
5
+ */
6
+ /**
7
+ * Supported OAuth providers
8
+ */
9
+ export type OAuthProvider = 'github' | 'google' | 'kaggle' | 'linkedin' | 'slack' | 'notion' | 'custom';
10
+ /**
11
+ * Authentication type for a provider
12
+ */
13
+ export type AuthType = 'oauth' | 'token';
14
+ /**
15
+ * OAuth token with metadata
16
+ */
17
+ export interface OAuthToken {
18
+ /** Access token */
19
+ accessToken: string;
20
+ /** Token type (usually 'Bearer') */
21
+ tokenType: string;
22
+ /** Expiration timestamp (ms since epoch) */
23
+ expiresAt?: number;
24
+ /** Refresh token for token renewal */
25
+ refreshToken?: string;
26
+ /** Granted scopes */
27
+ scopes: string[];
28
+ /** Token metadata */
29
+ metadata?: Record<string, unknown>;
30
+ }
31
+ /**
32
+ * Identity represents a connected OAuth or token-based provider
33
+ */
34
+ export interface Identity {
35
+ /** Provider identifier */
36
+ provider: OAuthProvider | string;
37
+ /** Authentication type */
38
+ authType?: AuthType;
39
+ /** Display name for UI */
40
+ displayName: string;
41
+ /** Icon URL for UI */
42
+ iconUrl?: string;
43
+ /** Required OAuth scopes */
44
+ scopes: string[];
45
+ /** Whether this identity is currently connected */
46
+ isConnected: boolean;
47
+ /** Connection timestamp */
48
+ connectedAt?: number;
49
+ /** User info from provider (e.g., username, email) */
50
+ userInfo?: ProviderUserInfo;
51
+ /** Token (only available when connected) */
52
+ token?: OAuthToken;
53
+ }
54
+ /**
55
+ * User info from OAuth provider
56
+ */
57
+ export interface ProviderUserInfo {
58
+ /** Provider-specific user ID */
59
+ id: string;
60
+ /** Username or handle */
61
+ username?: string;
62
+ /** Display name */
63
+ name?: string;
64
+ /** Email address */
65
+ email?: string;
66
+ /** Avatar URL */
67
+ avatarUrl?: string;
68
+ /** Profile URL */
69
+ profileUrl?: string;
70
+ /** Additional provider-specific data */
71
+ raw?: Record<string, unknown>;
72
+ }
73
+ /**
74
+ * OAuth provider configuration
75
+ */
76
+ export interface OAuthProviderConfig {
77
+ /** Provider identifier */
78
+ provider: OAuthProvider | string;
79
+ /** Display name */
80
+ displayName: string;
81
+ /** Icon URL */
82
+ iconUrl?: string;
83
+ /** OAuth client ID */
84
+ clientId: string;
85
+ /** Authorization endpoint */
86
+ authorizationUrl: string;
87
+ /** Token endpoint */
88
+ tokenUrl: string;
89
+ /** User info endpoint */
90
+ userInfoUrl?: string;
91
+ /** Revocation endpoint */
92
+ revocationUrl?: string;
93
+ /** Default scopes */
94
+ defaultScopes: string[];
95
+ /** Redirect URI */
96
+ redirectUri: string;
97
+ /** Additional OAuth parameters */
98
+ additionalParams?: Record<string, string>;
99
+ }
100
+ /**
101
+ * Pending authorization request
102
+ */
103
+ export interface AuthorizationRequest {
104
+ /** Request ID (for tracking) */
105
+ requestId: string;
106
+ /** Provider requiring authorization */
107
+ provider: OAuthProvider | string;
108
+ /** OAuth authorization URL (full URL with params) */
109
+ authUrl: string;
110
+ /** State parameter for CSRF protection */
111
+ state: string;
112
+ /** PKCE code verifier */
113
+ codeVerifier: string;
114
+ /** Requested scopes */
115
+ scopes: string[];
116
+ /** Request timestamp */
117
+ requestedAt: number;
118
+ /** Optional callback after authorization */
119
+ onComplete?: (identity: Identity) => void;
120
+ /** Optional callback on error */
121
+ onError?: (error: Error) => void;
122
+ }
123
+ /**
124
+ * Authorization callback parameters
125
+ */
126
+ export interface AuthorizationCallback {
127
+ /** Authorization code */
128
+ code: string;
129
+ /** State parameter (for CSRF verification) */
130
+ state: string;
131
+ /** Error code (if authorization failed) */
132
+ error?: string;
133
+ /** Error description */
134
+ errorDescription?: string;
135
+ }
136
+ /**
137
+ * Identity store state
138
+ */
139
+ export interface IdentityState {
140
+ /** Connected identities by provider */
141
+ identities: Map<string, Identity>;
142
+ /** Pending authorization request */
143
+ pendingAuthorization: AuthorizationRequest | null;
144
+ /** Provider configurations */
145
+ providerConfigs: Map<string, OAuthProviderConfig>;
146
+ /** Loading state */
147
+ isLoading: boolean;
148
+ /** Error state */
149
+ error: Error | null;
150
+ }
151
+ /**
152
+ * Identity store actions
153
+ */
154
+ export interface IdentityActions {
155
+ /** Configure an OAuth provider */
156
+ configureProvider: (config: OAuthProviderConfig) => void;
157
+ /** Start OAuth flow for a provider */
158
+ startAuthorization: (provider: string, scopes?: string[], options?: {
159
+ onComplete?: (identity: Identity) => void;
160
+ onError?: (error: Error) => void;
161
+ }) => Promise<string>;
162
+ /** Complete OAuth flow with callback params */
163
+ completeAuthorization: (callback: AuthorizationCallback) => Promise<Identity>;
164
+ /** Cancel pending authorization */
165
+ cancelAuthorization: () => void;
166
+ /** Connect with a token directly (for token-based providers like Kaggle) */
167
+ connectWithToken: (provider: string, token: string, options?: {
168
+ displayName?: string;
169
+ iconUrl?: string;
170
+ userInfo?: ProviderUserInfo;
171
+ }) => Promise<Identity>;
172
+ /** Disconnect a provider (revoke tokens) */
173
+ disconnect: (provider: string) => Promise<void>;
174
+ /** Refresh token for a provider */
175
+ refreshToken: (provider: string) => Promise<OAuthToken>;
176
+ /** Get identity for a provider */
177
+ getIdentity: (provider: string) => Identity | undefined;
178
+ /** Check if provider is connected */
179
+ isConnected: (provider: string) => boolean;
180
+ /** Get token for a provider (refreshes if needed) */
181
+ getToken: (provider: string) => Promise<OAuthToken | null>;
182
+ /** Clear all identities */
183
+ clearAll: () => void;
184
+ /** Set error */
185
+ setError: (error: Error | null) => void;
186
+ }
187
+ /**
188
+ * Complete identity store type
189
+ */
190
+ export type IdentityStore = IdentityState & IdentityActions;
191
+ /**
192
+ * Built-in provider configurations
193
+ *
194
+ * These constants provide OAuth endpoint URLs and default scopes for common providers.
195
+ * Each provider has specific OAuth behavior:
196
+ * - GitHub: Requires client_secret for token exchange, returns user info from /user endpoint
197
+ * - Google: Supports pure PKCE, has offline access mode
198
+ * - Kaggle: Follows standard OAuth 2.1
199
+ */
200
+ /**
201
+ * GitHub OAuth provider configuration.
202
+ * Note: GitHub requires client_secret for token exchange even with PKCE.
203
+ * User info endpoint returns login, name, email, avatar_url fields.
204
+ */
205
+ export declare const GITHUB_PROVIDER: Partial<OAuthProviderConfig>;
206
+ /**
207
+ * Google OAuth provider configuration.
208
+ * Supports offline access for refresh tokens with access_type=offline.
209
+ */
210
+ export declare const GOOGLE_PROVIDER: Partial<OAuthProviderConfig>;
211
+ /**
212
+ * Kaggle OAuth provider configuration.
213
+ * Note: Kaggle doesn't offer public OAuth app registration,
214
+ * so this is only used when Kaggle provides OAuth internally (e.g., via MCP).
215
+ * For Agent Runtimes identity, use token-based authentication instead.
216
+ */
217
+ export declare const KAGGLE_PROVIDER: Partial<OAuthProviderConfig>;
218
+ /**
219
+ * Token-based provider configuration.
220
+ * For providers that don't support public OAuth app registration (like Kaggle).
221
+ */
222
+ export interface TokenProviderConfig {
223
+ /** Provider identifier */
224
+ provider: OAuthProvider | string;
225
+ /** Display name */
226
+ displayName: string;
227
+ /** Icon URL */
228
+ iconUrl?: string;
229
+ /** Profile URL template (use {username} placeholder) */
230
+ profileUrlTemplate?: string;
231
+ /** User info endpoint (called with Bearer token) */
232
+ userInfoUrl?: string;
233
+ /** Description for UI */
234
+ description?: string;
235
+ }
236
+ /**
237
+ * Kaggle token-based provider configuration.
238
+ * Generate token at: https://www.kaggle.com/settings/account (API section)
239
+ */
240
+ export declare const KAGGLE_TOKEN_PROVIDER: TokenProviderConfig;
241
+ /**
242
+ * OAuth provider configuration for identity providers.
243
+ */
244
+ export interface OAuthIdentityProviderConfig {
245
+ /** Authentication type */
246
+ type: 'oauth';
247
+ /** OAuth client ID */
248
+ clientId: string;
249
+ /** OAuth scopes to request */
250
+ scopes?: string[];
251
+ /** Additional OAuth config */
252
+ config?: Partial<OAuthProviderConfig>;
253
+ }
254
+ /**
255
+ * Token-based provider configuration for identity providers.
256
+ */
257
+ export interface TokenIdentityProviderConfig {
258
+ /** Authentication type */
259
+ type: 'token';
260
+ /** API token or key */
261
+ token: string;
262
+ /** Display name override */
263
+ displayName?: string;
264
+ /** Icon URL override */
265
+ iconUrl?: string;
266
+ }
267
+ /**
268
+ * Unified identity provider configuration.
269
+ * Supports both OAuth and token-based authentication.
270
+ */
271
+ export type IdentityProviderConfig = OAuthIdentityProviderConfig | TokenIdentityProviderConfig;
272
+ /**
273
+ * Configuration for multiple identity providers.
274
+ * Keys are provider names (e.g., 'github', 'kaggle').
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * const providers: IdentityProvidersConfig = {
279
+ * github: {
280
+ * type: 'oauth',
281
+ * clientId: 'your-github-client-id',
282
+ * scopes: ['read:user', 'repo'],
283
+ * },
284
+ * kaggle: {
285
+ * type: 'token',
286
+ * token: 'your-kaggle-api-key',
287
+ * },
288
+ * };
289
+ * ```
290
+ */
291
+ export type IdentityProvidersConfig = {
292
+ [provider: string]: IdentityProviderConfig;
293
+ };
@@ -0,0 +1,73 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Built-in provider configurations
7
+ *
8
+ * These constants provide OAuth endpoint URLs and default scopes for common providers.
9
+ * Each provider has specific OAuth behavior:
10
+ * - GitHub: Requires client_secret for token exchange, returns user info from /user endpoint
11
+ * - Google: Supports pure PKCE, has offline access mode
12
+ * - Kaggle: Follows standard OAuth 2.1
13
+ */
14
+ /**
15
+ * GitHub OAuth provider configuration.
16
+ * Note: GitHub requires client_secret for token exchange even with PKCE.
17
+ * User info endpoint returns login, name, email, avatar_url fields.
18
+ */
19
+ export const GITHUB_PROVIDER = {
20
+ provider: 'github',
21
+ displayName: 'GitHub',
22
+ iconUrl: 'https://github.githubassets.com/favicons/favicon.svg',
23
+ authorizationUrl: 'https://github.com/login/oauth/authorize',
24
+ tokenUrl: 'https://github.com/login/oauth/access_token',
25
+ userInfoUrl: 'https://api.github.com/user',
26
+ revocationUrl: 'https://api.github.com/applications/{client_id}/token',
27
+ defaultScopes: ['read:user', 'user:email'],
28
+ };
29
+ /**
30
+ * Google OAuth provider configuration.
31
+ * Supports offline access for refresh tokens with access_type=offline.
32
+ */
33
+ export const GOOGLE_PROVIDER = {
34
+ provider: 'google',
35
+ displayName: 'Google',
36
+ iconUrl: 'https://www.google.com/favicon.ico',
37
+ authorizationUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
38
+ tokenUrl: 'https://oauth2.googleapis.com/token',
39
+ userInfoUrl: 'https://www.googleapis.com/oauth2/v2/userinfo',
40
+ revocationUrl: 'https://oauth2.googleapis.com/revoke',
41
+ defaultScopes: ['openid', 'email', 'profile'],
42
+ additionalParams: {
43
+ access_type: 'offline',
44
+ prompt: 'consent',
45
+ },
46
+ };
47
+ /**
48
+ * Kaggle OAuth provider configuration.
49
+ * Note: Kaggle doesn't offer public OAuth app registration,
50
+ * so this is only used when Kaggle provides OAuth internally (e.g., via MCP).
51
+ * For Agent Runtimes identity, use token-based authentication instead.
52
+ */
53
+ export const KAGGLE_PROVIDER = {
54
+ provider: 'kaggle',
55
+ displayName: 'Kaggle',
56
+ iconUrl: 'https://www.kaggle.com/static/images/favicon.ico',
57
+ authorizationUrl: 'https://www.kaggle.com/oauth/authorize',
58
+ tokenUrl: 'https://www.kaggle.com/oauth/token',
59
+ userInfoUrl: 'https://www.kaggle.com/api/v1/me',
60
+ defaultScopes: ['datasets:read', 'notebooks:read'],
61
+ };
62
+ /**
63
+ * Kaggle token-based provider configuration.
64
+ * Generate token at: https://www.kaggle.com/settings/account (API section)
65
+ */
66
+ export const KAGGLE_TOKEN_PROVIDER = {
67
+ provider: 'kaggle',
68
+ displayName: 'Kaggle',
69
+ iconUrl: 'https://www.kaggle.com/static/images/favicon.ico',
70
+ profileUrlTemplate: 'https://www.kaggle.com/{username}',
71
+ userInfoUrl: 'https://www.kaggle.com/api/v1/me',
72
+ description: 'Access Kaggle datasets, notebooks, and competitions',
73
+ };
@@ -0,0 +1,108 @@
1
+ import { usePendingAuthorization } from './identityStore';
2
+ import type { Identity, OAuthProviderConfig, AuthorizationCallback } from './types';
3
+ /**
4
+ * Options for useIdentity hook
5
+ */
6
+ export interface UseIdentityOptions {
7
+ /**
8
+ * Provider configurations to initialize.
9
+ * Each provider has specific requirements:
10
+ * - GitHub: clientId required, client_secret handled server-side
11
+ * - Google: clientId required, supports pure PKCE
12
+ * - Kaggle: clientId required, standard OAuth 2.1
13
+ */
14
+ providers?: {
15
+ /** GitHub OAuth configuration. Note: client_secret must be configured server-side. */
16
+ github?: {
17
+ clientId: string;
18
+ redirectUri?: string;
19
+ scopes?: string[];
20
+ };
21
+ /** Google OAuth configuration. Supports offline access mode. */
22
+ google?: {
23
+ clientId: string;
24
+ redirectUri?: string;
25
+ scopes?: string[];
26
+ };
27
+ /** Kaggle OAuth configuration. */
28
+ kaggle?: {
29
+ clientId: string;
30
+ redirectUri?: string;
31
+ scopes?: string[];
32
+ };
33
+ /** Custom provider configurations. */
34
+ custom?: OAuthProviderConfig[];
35
+ };
36
+ /** Base URL for redirect URIs (defaults to window.location.origin) */
37
+ baseUrl?: string;
38
+ /** Callback path for OAuth redirects (defaults to /oauth/callback) */
39
+ callbackPath?: string;
40
+ /** Auto-handle OAuth callback from URL params */
41
+ autoHandleCallback?: boolean;
42
+ }
43
+ /**
44
+ * Return type for useIdentity hook
45
+ */
46
+ export interface UseIdentityReturn {
47
+ /** All connected identities */
48
+ identities: Identity[];
49
+ /** Connected provider names */
50
+ connectedProviders: string[];
51
+ /** Whether authorization is in progress */
52
+ isAuthorizing: boolean;
53
+ /** Whether loading (token exchange, etc.) */
54
+ isLoading: boolean;
55
+ /** Current error */
56
+ error: Error | null;
57
+ /** Pending authorization request */
58
+ pendingAuthorization: ReturnType<typeof usePendingAuthorization>;
59
+ /** Start OAuth flow for a provider */
60
+ connect: (provider: string, scopes?: string[]) => Promise<void>;
61
+ /** Open OAuth popup for a provider */
62
+ connectWithPopup: (provider: string, scopes?: string[]) => Promise<Identity>;
63
+ /** Connect with a token directly (for token-based providers like Kaggle) */
64
+ connectWithToken: (provider: string, token: string, options?: {
65
+ displayName?: string;
66
+ iconUrl?: string;
67
+ }) => Promise<Identity>;
68
+ /** Disconnect a provider */
69
+ disconnect: (provider: string) => Promise<void>;
70
+ /** Complete authorization with callback params */
71
+ completeAuthorization: (callback: AuthorizationCallback) => Promise<Identity>;
72
+ /** Cancel pending authorization */
73
+ cancelAuthorization: () => void;
74
+ /** Check if a provider is connected */
75
+ isConnected: (provider: string) => boolean;
76
+ /** Get identity for a provider */
77
+ getIdentity: (provider: string) => Identity | undefined;
78
+ /** Get access token for a provider (refreshes if needed) */
79
+ getAccessToken: (provider: string) => Promise<string | null>;
80
+ /** Configure a custom provider */
81
+ configureProvider: (config: OAuthProviderConfig) => void;
82
+ }
83
+ /**
84
+ * Hook for managing OAuth identities
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * const {
89
+ * identities,
90
+ * connect,
91
+ * disconnect,
92
+ * isConnected,
93
+ * } = useIdentity({
94
+ * providers: {
95
+ * github: { clientId: 'your-client-id' },
96
+ * },
97
+ * });
98
+ *
99
+ * // Connect to GitHub
100
+ * await connect('github', ['repo', 'read:user']);
101
+ *
102
+ * // Check connection
103
+ * if (isConnected('github')) {
104
+ * const token = await getAccessToken('github');
105
+ * }
106
+ * ```
107
+ */
108
+ export declare function useIdentity(options?: UseIdentityOptions): UseIdentityReturn;