@mitralab.io/platform-sdk 1.0.8 → 1.1.0-beta.0
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.
- package/CHANGELOG.md +49 -0
- package/LICENSE +21 -0
- package/README.md +251 -108
- package/dist/index.cjs +1835 -0
- package/dist/index.d.cts +966 -0
- package/dist/index.d.ts +409 -102
- package/dist/index.js +1238 -160
- package/package.json +29 -11
- package/dist/index.d.mts +0 -659
- package/dist/index.mjs +0 -706
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
import { Transport, TransportRequestOptions, QueryParamValue, EntityTable, FunctionExecution, ListTemplateConfigsOptions, TemplateConfigPage, ProxyResult, ProxyInput, QueryResult, CredentialStatus, AgentModel as AgentModel$1, OAuthStartResult, OAuthExchangeInput, AuthenticationResult, DeviceAuthorization, PublicFunctionsModule, AgentTasksWithSessions } from '@mitralab.io/sdk-core';
|
|
2
|
+
export { AgentQueueItem, AgentSendAndWaitOptions, AgentSendOptions, AgentSessionTransport, AgentTask, AgentTaskCreateInput, AgentTaskInput, AgentTaskListOptions, AgentTaskSessionEventMap, AgentTaskSessionOptions, AgentTaskSessionStatus, AgentTurnResult, AuthenticationResult, CredentialStatus, DeviceAuthorization, EntityListOptions, EntityTable, ExistingAgentTaskSessionOptions, FunctionExecution, ListTemplateConfigsOptions, AgentMessage as NativeAgentMessage, AgentModel as NativeAgentModel, AgentTaskSession as NativeAgentTaskSession, AgentTimelineItem as NativeAgentTimelineItem, AgentToolEvent as NativeAgentToolEvent, NewAgentTaskSessionOptions, OAuthExchangeInput, OAuthStartResult, Page, PageOptions, ProxyInput, ProxyResult, PublicFunctionAsyncResult, PublicFunctionResult, PublicFunctionsModule, QueryResult, TemplateConfigPage } from '@mitralab.io/sdk-core';
|
|
3
|
+
import * as LegacyTypes from 'mitra-interactions-sdk';
|
|
4
|
+
import { exchangeSsoCodeMitra as exchangeSsoCodeMitra$1, loginMitra as loginMitra$1, loginWithGoogleMitra as loginWithGoogleMitra$1, loginWithMicrosoftMitra as loginWithMicrosoftMitra$1 } from 'mitra-interactions-sdk';
|
|
5
|
+
export { callIntegrationMitra, configureSdkMitra, createMitraInstance, createRecordMitra, createRecordsBatchMitra, deleteRecordMitra, executePublicServerFunctionAsyncMitra, executePublicServerFunctionMitra, executeServerFunctionAsyncMitra, executeServerFunctionMitra, getAgentTaskMitra, getConfig, getPublicServerFunctionExecutionMitra, getRecordMitra, listIntegrationsMitra, listRecordsMitra, manageAgentChatMitra, manageAgentCredentialMitra, patchRecordMitra, refreshTokenSilently, resolveProjectId, stopServerFunctionExecutionMitra, updateRecordMitra } from 'mitra-interactions-sdk';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for creating an HttpClient instance.
|
|
9
|
+
*/
|
|
10
|
+
interface HttpClientConfig {
|
|
11
|
+
/** Base URL for all HTTP requests (e.g., 'https://api.mitra.io') */
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
/** Function that returns the current authentication token, or null if not authenticated */
|
|
14
|
+
getToken?: () => string | null;
|
|
15
|
+
/** Refreshes an authenticated session before the Authorization header is constructed. */
|
|
16
|
+
beforeAuthenticatedRequest?: () => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Callback invoked on a 401 with the token used by that request. Returns
|
|
19
|
+
* true when the request should be retried once with the current credential.
|
|
20
|
+
*/
|
|
21
|
+
onUnauthorized?: (requestToken: string | null) => Promise<boolean>;
|
|
22
|
+
/** Called whenever an API request fails. Useful for global error handling (e.g., toast notifications). */
|
|
23
|
+
onError?: (error: MitraApiError) => void;
|
|
24
|
+
/** Headers included in every request (e.g., X-App-Id for tracing). */
|
|
25
|
+
defaultHeaders?: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Options for making HTTP requests.
|
|
29
|
+
*/
|
|
30
|
+
interface RequestOptions extends Omit<TransportRequestOptions, 'method'> {
|
|
31
|
+
/** HTTP method (defaults to 'GET') */
|
|
32
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
33
|
+
/** Request body (will be JSON stringified) */
|
|
34
|
+
body?: unknown;
|
|
35
|
+
/** Additional headers to include in the request */
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
/** URL query parameters */
|
|
38
|
+
params?: Record<string, QueryParamValue>;
|
|
39
|
+
/** @internal Flag to prevent infinite retry loops on 401 */
|
|
40
|
+
isRetry?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* HTTP client for making authenticated API requests.
|
|
44
|
+
*
|
|
45
|
+
* Handles JSON serialization, authentication headers, and error handling.
|
|
46
|
+
* All requests automatically include the Authorization header when a token is available.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const client = new HttpClient({
|
|
51
|
+
* baseUrl: 'https://api.mitra.io',
|
|
52
|
+
* getToken: () => localStorage.getItem('token'),
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* const users = await client.get<User[]>('/users');
|
|
56
|
+
* const user = await client.post<User>('/users', { name: 'John' });
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare class HttpClient implements Transport {
|
|
60
|
+
private readonly baseUrl;
|
|
61
|
+
private readonly tokenGetter;
|
|
62
|
+
private readonly beforeAuthenticatedRequest?;
|
|
63
|
+
private readonly onUnauthorized?;
|
|
64
|
+
private readonly onError?;
|
|
65
|
+
private readonly defaultHeaders;
|
|
66
|
+
constructor(config: HttpClientConfig);
|
|
67
|
+
/**
|
|
68
|
+
* Returns the current authentication token.
|
|
69
|
+
* @returns The JWT token if authenticated, null otherwise
|
|
70
|
+
*/
|
|
71
|
+
getToken(): string | null;
|
|
72
|
+
/**
|
|
73
|
+
* Makes an HTTP request with automatic JSON handling and authentication.
|
|
74
|
+
*
|
|
75
|
+
* @param path - API endpoint path (e.g., '/users')
|
|
76
|
+
* @param options - Request options including method, body, headers, and params
|
|
77
|
+
* @returns Promise resolving to the parsed JSON response
|
|
78
|
+
* @throws {MitraApiError} When the API returns an error response
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const result = await client.request<User>('/users/123', {
|
|
83
|
+
* method: 'PUT',
|
|
84
|
+
* body: { name: 'Updated Name' },
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
89
|
+
private errorFromResponse;
|
|
90
|
+
private parseResponseBody;
|
|
91
|
+
/**
|
|
92
|
+
* Makes a GET request.
|
|
93
|
+
*
|
|
94
|
+
* @param path - API endpoint path
|
|
95
|
+
* @param params - Optional query parameters
|
|
96
|
+
* @returns Promise resolving to the parsed JSON response
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const users = await client.get<User[]>('/users', { limit: 10 });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
get<T>(path: string, params?: Record<string, QueryParamValue>): Promise<T>;
|
|
104
|
+
/**
|
|
105
|
+
* Makes a POST request.
|
|
106
|
+
*
|
|
107
|
+
* @param path - API endpoint path
|
|
108
|
+
* @param body - Request body (will be JSON stringified)
|
|
109
|
+
* @returns Promise resolving to the parsed JSON response
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const user = await client.post<User>('/users', { name: 'John', email: 'john@example.com' });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
post<T>(path: string, body?: unknown): Promise<T>;
|
|
117
|
+
/**
|
|
118
|
+
* Makes a PUT request.
|
|
119
|
+
*
|
|
120
|
+
* @param path - API endpoint path
|
|
121
|
+
* @param body - Request body (will be JSON stringified)
|
|
122
|
+
* @returns Promise resolving to the parsed JSON response
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const user = await client.put<User>('/users/123', { name: 'Updated Name' });
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
130
|
+
/**
|
|
131
|
+
* Makes a DELETE request.
|
|
132
|
+
*
|
|
133
|
+
* @param path - API endpoint path
|
|
134
|
+
* @param params - Optional query parameters
|
|
135
|
+
* @returns Promise resolving to the parsed JSON response (or undefined for 204 responses)
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* await client.delete('/users/123');
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
delete<T>(path: string, params?: Record<string, QueryParamValue>): Promise<T>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Error thrown when a Mitra API request fails.
|
|
146
|
+
*
|
|
147
|
+
* Contains detailed information about the error including HTTP status,
|
|
148
|
+
* error code, and additional details from the server response.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* try {
|
|
153
|
+
* await mitra.entities.Task.get('invalid-id');
|
|
154
|
+
* } catch (error) {
|
|
155
|
+
* if (error instanceof MitraApiError) {
|
|
156
|
+
* console.log(error.status); // 404
|
|
157
|
+
* console.log(error.message); // "Task not found"
|
|
158
|
+
* console.log(error.code); // "ENTITY_NOT_FOUND"
|
|
159
|
+
* }
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
declare class MitraApiError extends Error {
|
|
164
|
+
/** HTTP status code (e.g., 400, 401, 404, 500) */
|
|
165
|
+
readonly status: number;
|
|
166
|
+
/** Application-specific error code (e.g., 'ENTITY_NOT_FOUND', 'VALIDATION_ERROR') */
|
|
167
|
+
readonly code?: string | undefined;
|
|
168
|
+
/** Additional error details from the server response */
|
|
169
|
+
readonly details?: unknown | undefined;
|
|
170
|
+
constructor(message: string,
|
|
171
|
+
/** HTTP status code (e.g., 400, 401, 404, 500) */
|
|
172
|
+
status: number,
|
|
173
|
+
/** Application-specific error code (e.g., 'ENTITY_NOT_FOUND', 'VALIDATION_ERROR') */
|
|
174
|
+
code?: string | undefined,
|
|
175
|
+
/** Additional error details from the server response */
|
|
176
|
+
details?: unknown | undefined);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Authenticated user in the Mitra Platform. */
|
|
180
|
+
interface User {
|
|
181
|
+
/** Unique identifier. */
|
|
182
|
+
id: string;
|
|
183
|
+
/** Tenant the user belongs to. */
|
|
184
|
+
tenantId: string;
|
|
185
|
+
/** Email address. */
|
|
186
|
+
email: string;
|
|
187
|
+
/** Display name (optional). */
|
|
188
|
+
name: string | null;
|
|
189
|
+
}
|
|
190
|
+
/** Credentials for sign-in. */
|
|
191
|
+
interface SignInCredentials {
|
|
192
|
+
email: string;
|
|
193
|
+
password: string;
|
|
194
|
+
}
|
|
195
|
+
/** Data for user registration. */
|
|
196
|
+
interface SignUpData {
|
|
197
|
+
email: string;
|
|
198
|
+
password: string;
|
|
199
|
+
name?: string;
|
|
200
|
+
}
|
|
201
|
+
/** App-scoped session received from a trusted platform boundary. */
|
|
202
|
+
interface AuthSession {
|
|
203
|
+
accessToken: string;
|
|
204
|
+
refreshToken?: string | null;
|
|
205
|
+
}
|
|
206
|
+
/** Options for Google SSO. */
|
|
207
|
+
interface GoogleSignInOptions {
|
|
208
|
+
/** Opens a popup by default. Redirect mode navigates the current page. */
|
|
209
|
+
mode?: 'popup' | 'redirect';
|
|
210
|
+
}
|
|
211
|
+
/** Options for Microsoft SSO. Same handshake as Google, through the brand auth page. */
|
|
212
|
+
type MicrosoftSignInOptions = GoogleSignInOptions;
|
|
213
|
+
/** Callback for auth state changes. Receives the user on login, null on logout. */
|
|
214
|
+
type AuthStateChangeCallback = (user: User | null) => void;
|
|
215
|
+
|
|
216
|
+
interface AuthModuleOptions {
|
|
217
|
+
apiUrl?: string;
|
|
218
|
+
authPageUrl?: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Authentication module for managing user sessions.
|
|
222
|
+
*
|
|
223
|
+
* Handles Google SSO, trusted session adoption, sign-out, and automatic token refresh.
|
|
224
|
+
* Auth state is persisted to localStorage with key `mitra_auth_{appId}`
|
|
225
|
+
* and restored on page reload.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```typescript
|
|
229
|
+
* await mitra.auth.signInWithGoogle({ mode: 'popup' });
|
|
230
|
+
* console.log(mitra.auth.currentUser);
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
declare class AuthModule {
|
|
234
|
+
#private;
|
|
235
|
+
private readonly appId;
|
|
236
|
+
private _currentUser;
|
|
237
|
+
private sessionGeneration;
|
|
238
|
+
private refreshFlight;
|
|
239
|
+
private transientRefreshFailureGeneration;
|
|
240
|
+
private readonly listeners;
|
|
241
|
+
private readonly sessionListeners;
|
|
242
|
+
private readonly storageKey;
|
|
243
|
+
private readonly publicClient;
|
|
244
|
+
private readonly authedClient;
|
|
245
|
+
private readonly currentUserApi;
|
|
246
|
+
private readonly googleAuth;
|
|
247
|
+
private readonly microsoftAuth;
|
|
248
|
+
constructor(appId: string, iamBaseUrl: string, options?: AuthModuleOptions);
|
|
249
|
+
/** The currently authenticated user, or null. */
|
|
250
|
+
get currentUser(): User | null;
|
|
251
|
+
/** The current JWT access token, or null. */
|
|
252
|
+
get accessToken(): string | null;
|
|
253
|
+
/** Whether a user is currently authenticated (local check, not server-validated). */
|
|
254
|
+
get isAuthenticated(): boolean;
|
|
255
|
+
/** @deprecated Email/password authentication is not implemented by IAM. Use Google or Microsoft SSO. */
|
|
256
|
+
signIn(_credentials: SignInCredentials): Promise<User>;
|
|
257
|
+
/**
|
|
258
|
+
* Signs in with Google SSO.
|
|
259
|
+
*
|
|
260
|
+
* Popup mode is used by default. Redirect mode stores a one-time CSRF context
|
|
261
|
+
* in `sessionStorage` and navigates to the configured `sdk-auth.html` page.
|
|
262
|
+
* Call {@link completeGoogleSignInRedirect} during application startup to
|
|
263
|
+
* finish a redirect response.
|
|
264
|
+
*
|
|
265
|
+
* The auth page is resolved from `createClient({ authPageUrl })`, then
|
|
266
|
+
* `window.__mitraEnv.authPageUrl`, and finally `/sdk-auth.html` on the API
|
|
267
|
+
* gateway origin.
|
|
268
|
+
*
|
|
269
|
+
* @param options - Popup or redirect mode.
|
|
270
|
+
* @returns The authenticated and hydrated user in popup mode.
|
|
271
|
+
* @throws {MitraApiError} When IAM rejects the authorization code.
|
|
272
|
+
* @throws {Error} When the browser blocks or cancels the popup, the flow times
|
|
273
|
+
* out, or the OAuth response fails origin, source, state, or shape validation.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* const user = await mitra.auth.signInWithGoogle();
|
|
278
|
+
* ```
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```typescript
|
|
282
|
+
* await mitra.auth.signInWithGoogle({ mode: 'redirect' });
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
signInWithGoogle(options?: GoogleSignInOptions): Promise<User>;
|
|
286
|
+
/**
|
|
287
|
+
* Completes a Google redirect response from `#codeMitra` and `#stateMitra`.
|
|
288
|
+
*
|
|
289
|
+
* The method consumes and clears the fragment and stored CSRF context, sends
|
|
290
|
+
* the single-use code directly to IAM, persists both tokens, calls `auth.me()`,
|
|
291
|
+
* and notifies auth-state listeners. It returns `null` when the current URL is
|
|
292
|
+
* not a Google SSO redirect. Redirect errors must carry the same `stateMitra`
|
|
293
|
+
* stored at the start of the flow before their message is exposed or consumed.
|
|
294
|
+
*
|
|
295
|
+
* @returns The authenticated user, or `null` when no redirect result is present.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```typescript
|
|
299
|
+
* const redirectedUser = await mitra.auth.completeGoogleSignInRedirect();
|
|
300
|
+
* if (redirectedUser) console.log(redirectedUser.email);
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
completeGoogleSignInRedirect(): Promise<User | null>;
|
|
304
|
+
/**
|
|
305
|
+
* Signs in with Microsoft SSO: the same auth-page handshake as Google, exchanged
|
|
306
|
+
* at IAM's `/auth/microsoft`. Popup by default; redirect mode navigates away.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* const user = await mitra.auth.signInWithMicrosoft();
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
signInWithMicrosoft(options?: MicrosoftSignInOptions): Promise<User>;
|
|
314
|
+
/**
|
|
315
|
+
* Completes a Microsoft redirect response from `#codeMitra` and `#stateMitra`.
|
|
316
|
+
* Mirrors {@link completeGoogleSignInRedirect}; returns `null` when the current
|
|
317
|
+
* URL is not a Microsoft SSO redirect.
|
|
318
|
+
*/
|
|
319
|
+
completeMicrosoftSignInRedirect(): Promise<User | null>;
|
|
320
|
+
/** @deprecated Email/password registration is not implemented by IAM. Use Google or Microsoft SSO. */
|
|
321
|
+
signUp(_data: SignUpData): Promise<User>;
|
|
322
|
+
/**
|
|
323
|
+
* Signs out the current user, clearing all auth state and localStorage.
|
|
324
|
+
*
|
|
325
|
+
* @param redirectUrl - Optional URL to navigate to after sign-out.
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```typescript
|
|
329
|
+
* mitra.auth.signOut();
|
|
330
|
+
* mitra.auth.signOut('/login');
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
signOut(redirectUrl?: string): void;
|
|
334
|
+
/**
|
|
335
|
+
* Refreshes the session using the stored refresh token.
|
|
336
|
+
*
|
|
337
|
+
* Called automatically before requests whose JWT is close to expiry and on
|
|
338
|
+
* `401` responses. Can also be called manually. Multiple proactive, reactive,
|
|
339
|
+
* and manual calls are deduplicated into one refresh request.
|
|
340
|
+
*
|
|
341
|
+
* @returns `true` if refresh succeeded, `false` otherwise.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* const ok = await mitra.auth.refreshSession();
|
|
346
|
+
* if (!ok) mitra.auth.redirectToLogin();
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
refreshSession(): Promise<boolean>;
|
|
350
|
+
/**
|
|
351
|
+
* Resolves a 401 against the credential that actually reached the server.
|
|
352
|
+
* A newer session is retried as-is instead of being refreshed because of an
|
|
353
|
+
* older request. A signed-out session is neither refreshed nor retried.
|
|
354
|
+
*
|
|
355
|
+
* @param requestToken - Access token attached to the rejected request.
|
|
356
|
+
* @returns Whether the request should be retried once with the current token.
|
|
357
|
+
*
|
|
358
|
+
* @internal
|
|
359
|
+
*/
|
|
360
|
+
private handleUnauthorized;
|
|
361
|
+
/**
|
|
362
|
+
* Fetches the current user from the server and updates local state.
|
|
363
|
+
*
|
|
364
|
+
* Clears auth state on a definitive 401. When the request reaches 401 after
|
|
365
|
+
* IAM refresh failed due to a network error, 408, 429, or 5xx response, the
|
|
366
|
+
* retained session is preserved and this method returns null.
|
|
367
|
+
*
|
|
368
|
+
* @returns The user if authenticated, `null` otherwise.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```typescript
|
|
372
|
+
* const user = await mitra.auth.me();
|
|
373
|
+
* if (!user) console.log('Not authenticated');
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
me(): Promise<User | null>;
|
|
377
|
+
/**
|
|
378
|
+
* Validates the current session with the server.
|
|
379
|
+
*
|
|
380
|
+
* @returns `true` if the session is valid, `false` otherwise.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* const valid = await mitra.auth.checkAuth();
|
|
385
|
+
* if (!valid) mitra.auth.redirectToLogin();
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
checkAuth(): Promise<boolean>;
|
|
389
|
+
/**
|
|
390
|
+
* Sets the access token manually (e.g., from SSO/OAuth callback).
|
|
391
|
+
*
|
|
392
|
+
* Call `me()` afterwards to fetch the associated user data.
|
|
393
|
+
*
|
|
394
|
+
* @param token - JWT access token.
|
|
395
|
+
* @param saveToStorage - Whether to persist to localStorage (default: true).
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* mitra.auth.setToken(tokenFromCallback);
|
|
400
|
+
* await mitra.auth.me();
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
setToken(token: string, saveToStorage?: boolean): void;
|
|
404
|
+
/**
|
|
405
|
+
* Reads the tokens currently held by this module.
|
|
406
|
+
*
|
|
407
|
+
* Used by the legacy session bridge to hand a session persisted by this SDK
|
|
408
|
+
* over to `mitra-interactions-sdk` on startup.
|
|
409
|
+
*
|
|
410
|
+
* @returns The access and refresh tokens, each `null` when absent.
|
|
411
|
+
*
|
|
412
|
+
* @internal
|
|
413
|
+
*/
|
|
414
|
+
private readSessionTokens;
|
|
415
|
+
/**
|
|
416
|
+
* Adopts an app-scoped session received from a trusted platform boundary.
|
|
417
|
+
*
|
|
418
|
+
* This preserves the access and refresh tokens together so the normal refresh
|
|
419
|
+
* lifecycle continues after an embedded preview hands its session to the app.
|
|
420
|
+
* Call {@link checkAuth} afterward to validate the token and hydrate the user.
|
|
421
|
+
*/
|
|
422
|
+
setSession(session: AuthSession): boolean;
|
|
423
|
+
/**
|
|
424
|
+
* Ensures the current access token has enough remaining validity.
|
|
425
|
+
*
|
|
426
|
+
* JWT decoding is used only as a scheduling heuristic. Opaque tokens and JWTs
|
|
427
|
+
* without a numeric `exp` claim proceed unchanged and remain server-authoritative.
|
|
428
|
+
* Multiple proactive and reactive callers share the same refresh request.
|
|
429
|
+
* Transient refresh failures preserve the current session so the caller can
|
|
430
|
+
* continue and rely on the normal one-time `401` refresh fallback.
|
|
431
|
+
*
|
|
432
|
+
* This method is suitable for authenticated HTTP, WebSocket, and Server-Sent
|
|
433
|
+
* Events boundaries that need a fresh token before connecting.
|
|
434
|
+
*
|
|
435
|
+
* @param minValidityMs - Minimum remaining token lifetime. Defaults to 30 seconds.
|
|
436
|
+
* @returns `true` when no refresh is needed or refresh succeeds. Returns
|
|
437
|
+
* `false` when a required refresh fails, even when a transient failure keeps
|
|
438
|
+
* the current session available for a reactive server-authoritative fallback.
|
|
439
|
+
*/
|
|
440
|
+
ensureFreshSession(minValidityMs?: number): Promise<boolean>;
|
|
441
|
+
/**
|
|
442
|
+
* Subscribes an internal boundary to token changes without triggering login
|
|
443
|
+
* or refresh. Unlike auth-state listeners, this callback is not invoked
|
|
444
|
+
* immediately and does not depend on the user being hydrated.
|
|
445
|
+
*
|
|
446
|
+
* @param callback - Receives the current access and refresh tokens.
|
|
447
|
+
* @returns A function that removes the callback.
|
|
448
|
+
*
|
|
449
|
+
* @internal
|
|
450
|
+
*/
|
|
451
|
+
private onSessionChange;
|
|
452
|
+
/**
|
|
453
|
+
* Adopts a session produced outside this module, such as a legacy SSO login.
|
|
454
|
+
*
|
|
455
|
+
* Replaces the in-memory tokens and persists them under the same storage key
|
|
456
|
+
* the rest of the module uses. The current user is left untouched because the
|
|
457
|
+
* legacy SDK does not return one; call `me()` to hydrate it.
|
|
458
|
+
*
|
|
459
|
+
* @param session - Access token and, when the issuer returned one, refresh token.
|
|
460
|
+
*
|
|
461
|
+
* @internal
|
|
462
|
+
*/
|
|
463
|
+
private adoptSession;
|
|
464
|
+
/**
|
|
465
|
+
* Redirects to `/login?returnUrl=...` for unauthenticated users.
|
|
466
|
+
*
|
|
467
|
+
* @param returnUrl - URL to return to after login (default: '/').
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```typescript
|
|
471
|
+
* if (!mitra.auth.isAuthenticated) {
|
|
472
|
+
* mitra.auth.redirectToLogin(window.location.pathname);
|
|
473
|
+
* }
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
redirectToLogin(returnUrl?: string): void;
|
|
477
|
+
/**
|
|
478
|
+
* Registers a callback for auth state changes.
|
|
479
|
+
*
|
|
480
|
+
* Called immediately with the current state, then on every sign-in/sign-out.
|
|
481
|
+
*
|
|
482
|
+
* @param callback - Receives the User on login, null on logout.
|
|
483
|
+
* @returns Unsubscribe function.
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```typescript
|
|
487
|
+
* useEffect(() => {
|
|
488
|
+
* const unsub = mitra.auth.onAuthStateChange((user) => {
|
|
489
|
+
* setUser(user);
|
|
490
|
+
* setLoading(false);
|
|
491
|
+
* });
|
|
492
|
+
* return unsub;
|
|
493
|
+
* }, []);
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
onAuthStateChange(callback: AuthStateChangeCallback): () => void;
|
|
497
|
+
private doRefresh;
|
|
498
|
+
private establishSession;
|
|
499
|
+
private setAuthState;
|
|
500
|
+
private getCurrentUser;
|
|
501
|
+
private clearAuthState;
|
|
502
|
+
private invalidatePendingRefreshes;
|
|
503
|
+
private hasValidAppIdentity;
|
|
504
|
+
private belongsToConfiguredApp;
|
|
505
|
+
private notifySessionListeners;
|
|
506
|
+
private notifyListeners;
|
|
507
|
+
private saveToStorage;
|
|
508
|
+
private loadFromStorage;
|
|
509
|
+
private removeFromStorage;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Compatibility facade for the Platform SDK 1.x entity API.
|
|
514
|
+
* Shared request behavior lives in `@mitralab.io/sdk-core`.
|
|
515
|
+
*/
|
|
516
|
+
declare class EntitiesModule {
|
|
517
|
+
private readonly httpClient;
|
|
518
|
+
private core;
|
|
519
|
+
constructor(httpClient: HttpClient, _dataSourceId: string);
|
|
520
|
+
static createProxy(httpClient: HttpClient, dataSourceId: string): EntitiesModule;
|
|
521
|
+
/**
|
|
522
|
+
* Preserved for Platform SDK 1.x compatibility.
|
|
523
|
+
* Records now resolve the app from authenticated context instead of a data source path.
|
|
524
|
+
*/
|
|
525
|
+
setDataSourceId(_dataSourceId: string): void;
|
|
526
|
+
getTable<T = Record<string, unknown>>(tableName: string): EntityTable<T>;
|
|
527
|
+
}
|
|
528
|
+
type EntitiesProxy = EntitiesModule & {
|
|
529
|
+
[tableName: string]: EntityTable;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
/** Platform SDK 1.x facade over the shared Function contract. */
|
|
533
|
+
declare class FunctionsModule {
|
|
534
|
+
private readonly core;
|
|
535
|
+
constructor(httpClient: HttpClient);
|
|
536
|
+
/**
|
|
537
|
+
* Executes a Function synchronously and waits for its terminal result.
|
|
538
|
+
*/
|
|
539
|
+
execute(functionId: string, input?: Record<string, unknown>): Promise<FunctionExecution>;
|
|
540
|
+
/** Queues a Function and returns its initial execution record. */
|
|
541
|
+
executeAsync(functionId: string, input?: Record<string, unknown>): Promise<FunctionExecution>;
|
|
542
|
+
/** Reads the current state of an asynchronous Function execution. */
|
|
543
|
+
getExecution(executionId: string): Promise<FunctionExecution>;
|
|
544
|
+
/** Requests cancellation of a queued or running Function execution. */
|
|
545
|
+
cancelExecution(executionId: string): Promise<void>;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** Platform SDK 1.x facade over the shared integration contract. */
|
|
549
|
+
declare class IntegrationModule {
|
|
550
|
+
private readonly core;
|
|
551
|
+
private readonly configs;
|
|
552
|
+
constructor(httpClient: HttpClient);
|
|
553
|
+
/** Lists the current app's integration configs without exposing admin mutations. */
|
|
554
|
+
list(options?: ListTemplateConfigsOptions): Promise<TemplateConfigPage>;
|
|
555
|
+
executeResource(resourceId: string, params?: Record<string, unknown>): Promise<ProxyResult>;
|
|
556
|
+
execute(configId: string, request: ProxyInput): Promise<ProxyResult>;
|
|
557
|
+
/** Executes a saved integration config selected by its app-scoped alias. */
|
|
558
|
+
executeByAlias(alias: string, request: ProxyInput): Promise<ProxyResult>;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** Platform SDK 1.x facade over the shared custom query contract. */
|
|
562
|
+
declare class QueriesModule {
|
|
563
|
+
private readonly core;
|
|
564
|
+
constructor(httpClient: HttpClient);
|
|
565
|
+
/**
|
|
566
|
+
* @deprecated Preserved for Platform SDK 1.x source compatibility. Data Manager now resolves
|
|
567
|
+
* the Data Source from the authenticated app.
|
|
568
|
+
*/
|
|
569
|
+
setDataSourceId(_dataSourceId: string): void;
|
|
570
|
+
execute(id: string, parameters?: Record<string, unknown>): Promise<QueryResult>;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
type AgentCredentialProvider = 'ANTHROPIC' | 'OPENAI';
|
|
574
|
+
type AgentOAuthProvider = 'ANTHROPIC';
|
|
575
|
+
type AgentDeviceProvider = 'OPENAI';
|
|
576
|
+
interface AgentCredentialsModule {
|
|
577
|
+
list(): Promise<CredentialStatus[]>;
|
|
578
|
+
listModels(agentId?: string): Promise<AgentModel$1[]>;
|
|
579
|
+
saveApiKey(provider: AgentCredentialProvider, apiKey: string): Promise<void>;
|
|
580
|
+
remove(provider: AgentCredentialProvider): Promise<void>;
|
|
581
|
+
startOAuth(provider: AgentOAuthProvider): Promise<OAuthStartResult>;
|
|
582
|
+
exchangeOAuth(provider: AgentOAuthProvider, input: OAuthExchangeInput): Promise<AuthenticationResult>;
|
|
583
|
+
startDeviceAuthorization(provider: AgentDeviceProvider): Promise<DeviceAuthorization>;
|
|
584
|
+
pollDeviceAuthorization(provider: AgentDeviceProvider, deviceAuthId: string): Promise<AuthenticationResult>;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Configuration options for creating a Mitra client.
|
|
589
|
+
*/
|
|
590
|
+
interface MitraClientConfig {
|
|
591
|
+
/**
|
|
592
|
+
* Your app's unique identifier.
|
|
593
|
+
* Found in the Mitra Code Studio dashboard.
|
|
594
|
+
*/
|
|
595
|
+
appId: string;
|
|
596
|
+
/**
|
|
597
|
+
* Base URL for the Mitra API (Kong Gateway).
|
|
598
|
+
* Injected automatically via `VITE_MITRA_API_URL` environment variable
|
|
599
|
+
* during the Code Studio build process.
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```typescript
|
|
603
|
+
* apiUrl: import.meta.env.VITE_MITRA_API_URL
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
apiUrl: string;
|
|
607
|
+
/**
|
|
608
|
+
* Absolute URL of the Mitra Google SSO page.
|
|
609
|
+
*
|
|
610
|
+
* When omitted, the SDK reads `window.__mitraEnv.authPageUrl` and then falls
|
|
611
|
+
* back to `/sdk-auth.html` on the origin of `apiUrl`.
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```typescript
|
|
615
|
+
* authPageUrl: 'https://auth.example.com/sdk-auth.html'
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
authPageUrl?: string;
|
|
619
|
+
/**
|
|
620
|
+
* Global error handler called whenever an API request fails.
|
|
621
|
+
* Useful for displaying toast notifications or logging errors.
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```typescript
|
|
625
|
+
* const mitra = createClient({
|
|
626
|
+
* appId: 'your-app-id',
|
|
627
|
+
* apiUrl: 'https://api.example.com',
|
|
628
|
+
* onError: (error) => toast.error(error.message),
|
|
629
|
+
* });
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
onError?: (error: MitraApiError) => void;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* The Mitra client instance providing access to all SDK modules.
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```typescript
|
|
639
|
+
* const mitra = createClient({
|
|
640
|
+
* appId: 'your-app-id',
|
|
641
|
+
* apiUrl: 'https://api.example.com',
|
|
642
|
+
* });
|
|
643
|
+
*
|
|
644
|
+
* // Initialize (resolves app config automatically)
|
|
645
|
+
* await mitra.init();
|
|
646
|
+
*
|
|
647
|
+
* // Authentication
|
|
648
|
+
* await mitra.auth.signInWithGoogle({ mode: 'popup' });
|
|
649
|
+
*
|
|
650
|
+
* // Database operations
|
|
651
|
+
* const tasks = await mitra.entities.Task.list();
|
|
652
|
+
*
|
|
653
|
+
* // Serverless functions
|
|
654
|
+
* const execution = await mitra.functions.execute('function-id', { orderId });
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
657
|
+
interface MitraClient {
|
|
658
|
+
/**
|
|
659
|
+
* Initializes the client by resolving app config from the server.
|
|
660
|
+
*
|
|
661
|
+
* Fetches the compatibility dataSourceId and allowSignup from the public app info endpoint.
|
|
662
|
+
*
|
|
663
|
+
* Safe to call multiple times. Subsequent calls are no-ops.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```typescript
|
|
667
|
+
* const mitra = createClient({
|
|
668
|
+
* appId: 'your-app-id',
|
|
669
|
+
* apiUrl: 'https://api.example.com',
|
|
670
|
+
* });
|
|
671
|
+
* await mitra.init();
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
init(): Promise<void>;
|
|
675
|
+
/**
|
|
676
|
+
* Authentication module for managing user sessions.
|
|
677
|
+
*
|
|
678
|
+
* Handles Google SSO, trusted preview sessions, and session lifecycle.
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```typescript
|
|
682
|
+
* await mitra.auth.signInWithGoogle({ mode: 'popup' });
|
|
683
|
+
* console.log(mitra.auth.currentUser);
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
auth: AuthModule;
|
|
687
|
+
/**
|
|
688
|
+
* Entities module for database CRUD operations.
|
|
689
|
+
*
|
|
690
|
+
* Access any table dynamically using `mitra.entities.TableName`.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```typescript
|
|
694
|
+
* const tasks = await mitra.entities.Task.list('-created_at', 10);
|
|
695
|
+
* const task = await mitra.entities.Task.create({ title: 'New task' });
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
entities: EntitiesProxy;
|
|
699
|
+
/**
|
|
700
|
+
* Functions module for executing serverless functions.
|
|
701
|
+
*
|
|
702
|
+
* @example
|
|
703
|
+
* ```typescript
|
|
704
|
+
* const execution = await mitra.functions.execute('function-id', { orderId });
|
|
705
|
+
* console.log(execution.status, execution.output);
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
functions: FunctionsModule;
|
|
709
|
+
/** Anonymous execution of Functions explicitly published as public. */
|
|
710
|
+
publicFunctions: PublicFunctionsModule;
|
|
711
|
+
/** Browser-safe Agent task REST API and native live sessions. */
|
|
712
|
+
agentTasks: AgentTasksWithSessions;
|
|
713
|
+
/** Browser-safe credential status, model discovery, and provider auth flows. */
|
|
714
|
+
agentCredentials: AgentCredentialsModule;
|
|
715
|
+
/**
|
|
716
|
+
* Integration module for proxying HTTP requests to external APIs.
|
|
717
|
+
*
|
|
718
|
+
* Sends requests through the Mitra server, which handles authentication
|
|
719
|
+
* and credential injection automatically based on the template config.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```typescript
|
|
723
|
+
* const result = await mitra.integration.execute('config-id', {
|
|
724
|
+
* method: 'GET',
|
|
725
|
+
* endpoint: '/users',
|
|
726
|
+
* });
|
|
727
|
+
* console.log(result.body);
|
|
728
|
+
* ```
|
|
729
|
+
*/
|
|
730
|
+
integration: IntegrationModule;
|
|
731
|
+
/**
|
|
732
|
+
* Queries module for executing reusable named SELECT queries.
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* ```typescript
|
|
736
|
+
* const result = await mitra.queries.execute('query-id', { status: 'active' });
|
|
737
|
+
* console.log(result.rows);
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
queries: QueriesModule;
|
|
741
|
+
/**
|
|
742
|
+
* Whether this app allows public user registration.
|
|
743
|
+
* Defaults to `true` before `init()` is called.
|
|
744
|
+
*/
|
|
745
|
+
readonly allowSignup: boolean;
|
|
746
|
+
/**
|
|
747
|
+
* The configuration used to create this client.
|
|
748
|
+
*/
|
|
749
|
+
config: MitraClientConfig;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Creates a new Mitra client instance.
|
|
753
|
+
*
|
|
754
|
+
* The client provides access to all Mitra Platform features:
|
|
755
|
+
* - **auth**: User authentication and session management
|
|
756
|
+
* - **entities**: Database CRUD operations
|
|
757
|
+
* - **functions**: Serverless function invocation
|
|
758
|
+
* - **integration**: Proxy HTTP requests to external APIs
|
|
759
|
+
* - **queries**: Custom query management and execution
|
|
760
|
+
*
|
|
761
|
+
* After creating the client, call `init()` to resolve the app's compatibility config
|
|
762
|
+
* (dataSourceId, allowSignup) automatically from the server.
|
|
763
|
+
*
|
|
764
|
+
* @param config - Configuration options for the client.
|
|
765
|
+
* @returns A configured MitraClient instance.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* ```typescript
|
|
769
|
+
* import { createClient } from '@mitralab.io/platform-sdk';
|
|
770
|
+
*
|
|
771
|
+
* const mitra = createClient({
|
|
772
|
+
* appId: import.meta.env.VITE_MITRA_APP_ID,
|
|
773
|
+
* apiUrl: import.meta.env.VITE_MITRA_API_URL,
|
|
774
|
+
* });
|
|
775
|
+
*
|
|
776
|
+
* await mitra.init();
|
|
777
|
+
*
|
|
778
|
+
* // Use the client
|
|
779
|
+
* await mitra.auth.signInWithGoogle({ mode: 'popup' });
|
|
780
|
+
* const tasks = await mitra.entities.Task.list();
|
|
781
|
+
* ```
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* ```typescript
|
|
785
|
+
* // Export as singleton for use throughout your app
|
|
786
|
+
* // src/api/mitraClient.ts
|
|
787
|
+
* import { createClient } from '@mitralab.io/platform-sdk';
|
|
788
|
+
*
|
|
789
|
+
* export const mitra = createClient({
|
|
790
|
+
* appId: import.meta.env.VITE_MITRA_APP_ID,
|
|
791
|
+
* apiUrl: import.meta.env.VITE_MITRA_API_URL,
|
|
792
|
+
* });
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
declare function createClient(config: MitraClientConfig): MitraClient;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Legacy `mitra-interactions-sdk` surface, re-exported so an application can
|
|
799
|
+
* swap the legacy package for `@mitralab.io/platform-sdk` without rewriting
|
|
800
|
+
* call sites first.
|
|
801
|
+
*
|
|
802
|
+
* Everything here is deprecated. The capabilities remain available during
|
|
803
|
+
* migration even when the native API has different input or response
|
|
804
|
+
* semantics.
|
|
805
|
+
*
|
|
806
|
+
* The four legacy entry points that produce a session are wrapped so the
|
|
807
|
+
* resulting session also lands in this SDK. Every other export is the legacy
|
|
808
|
+
* implementation itself.
|
|
809
|
+
*
|
|
810
|
+
* @module
|
|
811
|
+
*/
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* @deprecated Use `mitra.auth.signInWithGoogle()` when `method` is Google.
|
|
815
|
+
* Other legacy login methods remain supported until an equivalent exists.
|
|
816
|
+
*/
|
|
817
|
+
declare const loginMitra: typeof loginMitra$1;
|
|
818
|
+
/**
|
|
819
|
+
* @deprecated Use `mitra.auth.signInWithGoogle()`.
|
|
820
|
+
*/
|
|
821
|
+
declare const loginWithGoogleMitra: typeof loginWithGoogleMitra$1;
|
|
822
|
+
/**
|
|
823
|
+
* @deprecated Use `mitra.auth.signInWithMicrosoft()`.
|
|
824
|
+
*/
|
|
825
|
+
declare const loginWithMicrosoftMitra: typeof loginWithMicrosoftMitra$1;
|
|
826
|
+
/**
|
|
827
|
+
* @deprecated For Google redirects, use
|
|
828
|
+
* `mitra.auth.completeGoogleSignInRedirect()`. Other providers remain supported
|
|
829
|
+
* through the legacy surface.
|
|
830
|
+
*/
|
|
831
|
+
declare const exchangeSsoCodeMitra: typeof exchangeSsoCodeMitra$1;
|
|
832
|
+
|
|
833
|
+
/** @deprecated Legacy compatibility type. */
|
|
834
|
+
type AgentChat = LegacyTypes.AgentChat;
|
|
835
|
+
/** @deprecated Legacy compatibility type. */
|
|
836
|
+
type AgentCredentialStatus = LegacyTypes.AgentCredentialStatus;
|
|
837
|
+
/** @deprecated Legacy compatibility type. */
|
|
838
|
+
type AgentDeltaEvent = LegacyTypes.AgentDeltaEvent;
|
|
839
|
+
/** @deprecated Legacy compatibility type. */
|
|
840
|
+
type AgentErrorEvent = LegacyTypes.AgentErrorEvent;
|
|
841
|
+
/** @deprecated Legacy compatibility type. */
|
|
842
|
+
type AgentMessage = LegacyTypes.AgentMessage;
|
|
843
|
+
/** @deprecated Legacy compatibility type. */
|
|
844
|
+
type AgentModel = LegacyTypes.AgentModel;
|
|
845
|
+
/** @deprecated Legacy compatibility type. */
|
|
846
|
+
type AgentProvider = LegacyTypes.AgentProvider;
|
|
847
|
+
/** @deprecated Legacy compatibility type. */
|
|
848
|
+
type AgentQueueChangeEvent = LegacyTypes.AgentQueueChangeEvent;
|
|
849
|
+
/** @deprecated Legacy compatibility type. */
|
|
850
|
+
type AgentRawEvent = LegacyTypes.AgentRawEvent;
|
|
851
|
+
/** @deprecated Legacy compatibility type. */
|
|
852
|
+
type AgentStatusChangeEvent = LegacyTypes.AgentStatusChangeEvent;
|
|
853
|
+
/** @deprecated Legacy compatibility type. */
|
|
854
|
+
type AgentTaskCreatedEvent = LegacyTypes.AgentTaskCreatedEvent;
|
|
855
|
+
/** @deprecated Legacy compatibility type. */
|
|
856
|
+
type AgentTaskEventMap = LegacyTypes.AgentTaskEventMap;
|
|
857
|
+
/** @deprecated Legacy compatibility type. */
|
|
858
|
+
type AgentTaskEventName = LegacyTypes.AgentTaskEventName;
|
|
859
|
+
/** @deprecated Legacy compatibility type. */
|
|
860
|
+
type AgentTaskSession = LegacyTypes.AgentTaskSession;
|
|
861
|
+
/** @deprecated Legacy compatibility type. */
|
|
862
|
+
type AgentTaskStatus = LegacyTypes.AgentTaskStatus;
|
|
863
|
+
/** @deprecated Legacy compatibility type. */
|
|
864
|
+
type AgentTaskTransport = LegacyTypes.AgentTaskTransport;
|
|
865
|
+
/** @deprecated Legacy compatibility type. */
|
|
866
|
+
type AgentTimelineItem = LegacyTypes.AgentTimelineItem;
|
|
867
|
+
/** @deprecated Legacy compatibility type. */
|
|
868
|
+
type AgentToolEvent = LegacyTypes.AgentToolEvent;
|
|
869
|
+
/** @deprecated Legacy compatibility type. */
|
|
870
|
+
type AgentTurnEndEvent = LegacyTypes.AgentTurnEndEvent;
|
|
871
|
+
/** @deprecated Legacy compatibility type. */
|
|
872
|
+
type AgentType = LegacyTypes.AgentType;
|
|
873
|
+
/** @deprecated Legacy compatibility type. */
|
|
874
|
+
type AuthAgentCredentialResult = LegacyTypes.AuthAgentCredentialResult;
|
|
875
|
+
/** @deprecated Legacy compatibility type. */
|
|
876
|
+
type CallIntegrationOptions = LegacyTypes.CallIntegrationOptions;
|
|
877
|
+
/** @deprecated Legacy compatibility type. */
|
|
878
|
+
type CallIntegrationResponse = LegacyTypes.CallIntegrationResponse;
|
|
879
|
+
/** @deprecated Legacy compatibility type. */
|
|
880
|
+
type ChatManageAction = LegacyTypes.ChatManageAction;
|
|
881
|
+
/** @deprecated Legacy compatibility type. */
|
|
882
|
+
type ConnectAgentCredentialResult = LegacyTypes.ConnectAgentCredentialResult;
|
|
883
|
+
/** @deprecated Legacy compatibility type. */
|
|
884
|
+
type CreateRecordOptions = LegacyTypes.CreateRecordOptions;
|
|
885
|
+
/** @deprecated Legacy compatibility type. */
|
|
886
|
+
type CreateRecordsBatchOptions = LegacyTypes.CreateRecordsBatchOptions;
|
|
887
|
+
/** @deprecated Legacy compatibility type. */
|
|
888
|
+
type CredentialAction = LegacyTypes.CredentialAction;
|
|
889
|
+
/** @deprecated Legacy compatibility type. */
|
|
890
|
+
type DeleteAgentChatResult = LegacyTypes.DeleteAgentChatResult;
|
|
891
|
+
/** @deprecated Legacy compatibility type. */
|
|
892
|
+
type DeleteRecordOptions = LegacyTypes.DeleteRecordOptions;
|
|
893
|
+
/** @deprecated Legacy compatibility type. */
|
|
894
|
+
type DeviceAuthAgentCredentialResult = LegacyTypes.DeviceAuthAgentCredentialResult;
|
|
895
|
+
/** @deprecated Legacy compatibility type. */
|
|
896
|
+
type ExecutePublicServerFunctionAsyncResponse = LegacyTypes.ExecutePublicServerFunctionAsyncResponse;
|
|
897
|
+
/** @deprecated Legacy compatibility type. */
|
|
898
|
+
type ExecutePublicServerFunctionOptions = LegacyTypes.ExecutePublicServerFunctionOptions;
|
|
899
|
+
/** @deprecated Legacy compatibility type. */
|
|
900
|
+
type ExecutePublicServerFunctionResponse = LegacyTypes.ExecutePublicServerFunctionResponse;
|
|
901
|
+
/** @deprecated Legacy compatibility type. */
|
|
902
|
+
type ExecuteServerFunctionAsyncOptions = LegacyTypes.ExecuteServerFunctionAsyncOptions;
|
|
903
|
+
/** @deprecated Legacy compatibility type. */
|
|
904
|
+
type ExecuteServerFunctionAsyncResponse = LegacyTypes.ExecuteServerFunctionAsyncResponse;
|
|
905
|
+
/** @deprecated Legacy compatibility type. */
|
|
906
|
+
type ExecuteServerFunctionOptions = LegacyTypes.ExecuteServerFunctionOptions;
|
|
907
|
+
/** @deprecated Legacy compatibility type. */
|
|
908
|
+
type ExecuteServerFunctionResponse = LegacyTypes.ExecuteServerFunctionResponse;
|
|
909
|
+
/** @deprecated Legacy compatibility type. */
|
|
910
|
+
type GetAgentTaskCreateOptions = LegacyTypes.GetAgentTaskCreateOptions;
|
|
911
|
+
/** @deprecated Legacy compatibility type. */
|
|
912
|
+
type GetAgentTaskOpenOptions = LegacyTypes.GetAgentTaskOpenOptions;
|
|
913
|
+
/** @deprecated Legacy compatibility type. */
|
|
914
|
+
type GetAgentTaskOptions = LegacyTypes.GetAgentTaskOptions;
|
|
915
|
+
/** @deprecated Legacy compatibility type. */
|
|
916
|
+
type GetPublicServerFunctionExecutionOptions = LegacyTypes.GetPublicServerFunctionExecutionOptions;
|
|
917
|
+
/** @deprecated Legacy compatibility type. */
|
|
918
|
+
type GetPublicServerFunctionExecutionResponse = LegacyTypes.GetPublicServerFunctionExecutionResponse;
|
|
919
|
+
/** @deprecated Legacy compatibility type. */
|
|
920
|
+
type GetRecordOptions = LegacyTypes.GetRecordOptions;
|
|
921
|
+
/** @deprecated Legacy compatibility type. */
|
|
922
|
+
type IntegrationResponse = LegacyTypes.IntegrationResponse;
|
|
923
|
+
/** @deprecated Legacy compatibility type. */
|
|
924
|
+
type ListAgentModelsResult = LegacyTypes.ListAgentModelsResult;
|
|
925
|
+
/** @deprecated Legacy compatibility type. */
|
|
926
|
+
type ListAgentProvidersResult = LegacyTypes.ListAgentProvidersResult;
|
|
927
|
+
/** @deprecated Legacy compatibility type. */
|
|
928
|
+
type ListIntegrationsOptions = LegacyTypes.ListIntegrationsOptions;
|
|
929
|
+
/** @deprecated Legacy compatibility type. */
|
|
930
|
+
type ListRecordsOptions = LegacyTypes.ListRecordsOptions;
|
|
931
|
+
/** @deprecated Legacy compatibility type. */
|
|
932
|
+
type ListRecordsResponse = LegacyTypes.ListRecordsResponse;
|
|
933
|
+
/** @deprecated Legacy compatibility type. */
|
|
934
|
+
type LoginOptions = LegacyTypes.LoginOptions;
|
|
935
|
+
/** @deprecated Legacy compatibility type. */
|
|
936
|
+
type LoginResponse = LegacyTypes.LoginResponse;
|
|
937
|
+
/** @deprecated Legacy compatibility type. */
|
|
938
|
+
type ManageAgentChatDeleteOptions = LegacyTypes.ManageAgentChatDeleteOptions;
|
|
939
|
+
/** @deprecated Legacy compatibility type. */
|
|
940
|
+
type ManageAgentChatListOptions = LegacyTypes.ManageAgentChatListOptions;
|
|
941
|
+
/** @deprecated Legacy compatibility type. */
|
|
942
|
+
type ManageAgentChatOptions = LegacyTypes.ManageAgentChatOptions;
|
|
943
|
+
/** @deprecated Legacy compatibility type. */
|
|
944
|
+
type ManageAgentChatRenameOptions = LegacyTypes.ManageAgentChatRenameOptions;
|
|
945
|
+
/** @deprecated Legacy compatibility type. */
|
|
946
|
+
type ManageAgentCredentialOptions = LegacyTypes.ManageAgentCredentialOptions;
|
|
947
|
+
/** @deprecated Legacy compatibility type. */
|
|
948
|
+
type MitraConfig = LegacyTypes.MitraConfig;
|
|
949
|
+
/** @deprecated Legacy compatibility type. */
|
|
950
|
+
type MitraInstance = LegacyTypes.MitraInstance;
|
|
951
|
+
/** @deprecated Legacy compatibility type. */
|
|
952
|
+
type PatchRecordOptions = LegacyTypes.PatchRecordOptions;
|
|
953
|
+
/** @deprecated Legacy compatibility type. */
|
|
954
|
+
type QueuedItem = LegacyTypes.QueuedItem;
|
|
955
|
+
/** @deprecated Legacy compatibility type. */
|
|
956
|
+
type RenameAgentChatResult = LegacyTypes.RenameAgentChatResult;
|
|
957
|
+
/** @deprecated Legacy compatibility type. */
|
|
958
|
+
type SendOptions = LegacyTypes.SendOptions;
|
|
959
|
+
/** @deprecated Legacy compatibility type. */
|
|
960
|
+
type StopServerFunctionExecutionOptions = LegacyTypes.StopServerFunctionExecutionOptions;
|
|
961
|
+
/** @deprecated Legacy compatibility type. */
|
|
962
|
+
type StopServerFunctionExecutionResponse = LegacyTypes.StopServerFunctionExecutionResponse;
|
|
963
|
+
/** @deprecated Legacy compatibility type. */
|
|
964
|
+
type UpdateRecordOptions = LegacyTypes.UpdateRecordOptions;
|
|
965
|
+
|
|
966
|
+
export { type AgentChat, type AgentCredentialProvider, type AgentCredentialStatus, type AgentCredentialsModule, type AgentDeltaEvent, type AgentDeviceProvider, type AgentErrorEvent, type AgentMessage, type AgentModel, type AgentOAuthProvider, type AgentProvider, type AgentQueueChangeEvent, type AgentRawEvent, type AgentStatusChangeEvent, type AgentTaskCreatedEvent, type AgentTaskEventMap, type AgentTaskEventName, type AgentTaskSession, type AgentTaskStatus, type AgentTaskTransport, type AgentTimelineItem, type AgentToolEvent, type AgentTurnEndEvent, type AgentType, type AuthAgentCredentialResult, type CallIntegrationOptions, type CallIntegrationResponse, type ChatManageAction, type ConnectAgentCredentialResult, type CreateRecordOptions, type CreateRecordsBatchOptions, type CredentialAction, type DeleteAgentChatResult, type DeleteRecordOptions, type DeviceAuthAgentCredentialResult, type ExecutePublicServerFunctionAsyncResponse, type ExecutePublicServerFunctionOptions, type ExecutePublicServerFunctionResponse, type ExecuteServerFunctionAsyncOptions, type ExecuteServerFunctionAsyncResponse, type ExecuteServerFunctionOptions, type ExecuteServerFunctionResponse, type GetAgentTaskCreateOptions, type GetAgentTaskOpenOptions, type GetAgentTaskOptions, type GetPublicServerFunctionExecutionOptions, type GetPublicServerFunctionExecutionResponse, type GetRecordOptions, type GoogleSignInOptions, type IntegrationResponse, type ListAgentModelsResult, type ListAgentProvidersResult, type ListIntegrationsOptions, type ListRecordsOptions, type ListRecordsResponse, type LoginOptions, type LoginResponse, type ManageAgentChatDeleteOptions, type ManageAgentChatListOptions, type ManageAgentChatOptions, type ManageAgentChatRenameOptions, type ManageAgentCredentialOptions, type MicrosoftSignInOptions, MitraApiError, type MitraClient, type MitraClientConfig, type MitraConfig, type MitraInstance, type PatchRecordOptions, type QueuedItem, type RenameAgentChatResult, type SendOptions, type SignInCredentials, type SignUpData, type StopServerFunctionExecutionOptions, type StopServerFunctionExecutionResponse, type UpdateRecordOptions, type User, createClient, exchangeSsoCodeMitra, loginMitra, loginWithGoogleMitra, loginWithMicrosoftMitra };
|