@onkernel/sdk 0.30.0 → 0.32.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/client.d.mts +8 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +12 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +12 -2
  9. package/client.mjs.map +1 -1
  10. package/package.json +3 -2
  11. package/resources/agents/auth/auth.d.mts +115 -46
  12. package/resources/agents/auth/auth.d.mts.map +1 -1
  13. package/resources/agents/auth/auth.d.ts +115 -46
  14. package/resources/agents/auth/auth.d.ts.map +1 -1
  15. package/resources/agents/auth/auth.js +15 -30
  16. package/resources/agents/auth/auth.js.map +1 -1
  17. package/resources/agents/auth/auth.mjs +15 -30
  18. package/resources/agents/auth/auth.mjs.map +1 -1
  19. package/resources/agents/auth/invocations.d.mts +18 -47
  20. package/resources/agents/auth/invocations.d.mts.map +1 -1
  21. package/resources/agents/auth/invocations.d.ts +18 -47
  22. package/resources/agents/auth/invocations.d.ts.map +1 -1
  23. package/resources/agents/auth/invocations.js +16 -45
  24. package/resources/agents/auth/invocations.js.map +1 -1
  25. package/resources/agents/auth/invocations.mjs +16 -45
  26. package/resources/agents/auth/invocations.mjs.map +1 -1
  27. package/resources/auth/auth.d.mts +10 -0
  28. package/resources/auth/auth.d.mts.map +1 -0
  29. package/resources/auth/auth.d.ts +10 -0
  30. package/resources/auth/auth.d.ts.map +1 -0
  31. package/resources/auth/auth.js +17 -0
  32. package/resources/auth/auth.js.map +1 -0
  33. package/resources/auth/auth.mjs +12 -0
  34. package/resources/auth/auth.mjs.map +1 -0
  35. package/resources/auth/connections.d.mts +688 -0
  36. package/resources/auth/connections.d.mts.map +1 -0
  37. package/resources/auth/connections.d.ts +688 -0
  38. package/resources/auth/connections.d.ts.map +1 -0
  39. package/resources/auth/connections.js +123 -0
  40. package/resources/auth/connections.js.map +1 -0
  41. package/resources/auth/connections.mjs +119 -0
  42. package/resources/auth/connections.mjs.map +1 -0
  43. package/resources/auth/index.d.mts +3 -0
  44. package/resources/auth/index.d.mts.map +1 -0
  45. package/resources/auth/index.d.ts +3 -0
  46. package/resources/auth/index.d.ts.map +1 -0
  47. package/resources/auth/index.js +9 -0
  48. package/resources/auth/index.js.map +1 -0
  49. package/resources/auth/index.mjs +4 -0
  50. package/resources/auth/index.mjs.map +1 -0
  51. package/resources/auth.d.mts +2 -0
  52. package/resources/auth.d.mts.map +1 -0
  53. package/resources/auth.d.ts +2 -0
  54. package/resources/auth.d.ts.map +1 -0
  55. package/resources/auth.js +6 -0
  56. package/resources/auth.js.map +1 -0
  57. package/resources/auth.mjs +3 -0
  58. package/resources/auth.mjs.map +1 -0
  59. package/resources/browsers/browsers.d.mts +2 -2
  60. package/resources/browsers/browsers.d.mts.map +1 -1
  61. package/resources/browsers/browsers.d.ts +2 -2
  62. package/resources/browsers/browsers.d.ts.map +1 -1
  63. package/resources/browsers/browsers.js.map +1 -1
  64. package/resources/browsers/browsers.mjs.map +1 -1
  65. package/resources/browsers/computer.d.mts +199 -1
  66. package/resources/browsers/computer.d.mts.map +1 -1
  67. package/resources/browsers/computer.d.ts +199 -1
  68. package/resources/browsers/computer.d.ts.map +1 -1
  69. package/resources/browsers/computer.js +31 -0
  70. package/resources/browsers/computer.js.map +1 -1
  71. package/resources/browsers/computer.mjs +31 -0
  72. package/resources/browsers/computer.mjs.map +1 -1
  73. package/resources/browsers/index.d.mts +1 -1
  74. package/resources/browsers/index.d.mts.map +1 -1
  75. package/resources/browsers/index.d.ts +1 -1
  76. package/resources/browsers/index.d.ts.map +1 -1
  77. package/resources/browsers/index.js.map +1 -1
  78. package/resources/browsers/index.mjs.map +1 -1
  79. package/resources/credential-providers.d.mts +66 -1
  80. package/resources/credential-providers.d.mts.map +1 -1
  81. package/resources/credential-providers.d.ts +66 -1
  82. package/resources/credential-providers.d.ts.map +1 -1
  83. package/resources/credential-providers.js +21 -6
  84. package/resources/credential-providers.js.map +1 -1
  85. package/resources/credential-providers.mjs +21 -6
  86. package/resources/credential-providers.mjs.map +1 -1
  87. package/resources/index.d.mts +2 -1
  88. package/resources/index.d.mts.map +1 -1
  89. package/resources/index.d.ts +2 -1
  90. package/resources/index.d.ts.map +1 -1
  91. package/resources/index.js +3 -1
  92. package/resources/index.js.map +1 -1
  93. package/resources/index.mjs +1 -0
  94. package/resources/index.mjs.map +1 -1
  95. package/src/client.ts +24 -4
  96. package/src/resources/agents/auth/auth.ts +121 -46
  97. package/src/resources/agents/auth/invocations.ts +18 -47
  98. package/src/resources/auth/auth.ts +43 -0
  99. package/src/resources/auth/connections.ts +848 -0
  100. package/src/resources/auth/index.ts +18 -0
  101. package/src/resources/auth.ts +3 -0
  102. package/src/resources/browsers/browsers.ts +4 -0
  103. package/src/resources/browsers/computer.ts +257 -0
  104. package/src/resources/browsers/index.ts +2 -0
  105. package/src/resources/credential-providers.ts +88 -6
  106. package/src/resources/index.ts +3 -0
  107. package/src/version.ts +1 -1
  108. package/version.d.mts +1 -1
  109. package/version.d.ts +1 -1
  110. package/version.js +1 -1
  111. package/version.mjs +1 -1
@@ -0,0 +1,848 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as Shared from '../shared';
5
+ import * as AuthAPI from '../agents/auth/auth';
6
+ import { APIPromise } from '../../core/api-promise';
7
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../core/pagination';
8
+ import { Stream } from '../../core/streaming';
9
+ import { buildHeaders } from '../../internal/headers';
10
+ import { RequestOptions } from '../../internal/request-options';
11
+ import { path } from '../../internal/utils/path';
12
+
13
+ export class Connections extends APIResource {
14
+ /**
15
+ * Creates managed authentication for a profile and domain combination. Returns 409
16
+ * Conflict if managed auth already exists for the given profile and domain.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const managedAuth = await client.auth.connections.create({
21
+ * domain: 'netflix.com',
22
+ * profile_name: 'user-123',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body: ConnectionCreateParams, options?: RequestOptions): APIPromise<ManagedAuth> {
27
+ return this._client.post('/auth/connections', { body, ...options });
28
+ }
29
+
30
+ /**
31
+ * Retrieve managed auth by its ID. Includes current flow state if a login is in
32
+ * progress.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const managedAuth = await client.auth.connections.retrieve(
37
+ * 'id',
38
+ * );
39
+ * ```
40
+ */
41
+ retrieve(id: string, options?: RequestOptions): APIPromise<ManagedAuth> {
42
+ return this._client.get(path`/auth/connections/${id}`, options);
43
+ }
44
+
45
+ /**
46
+ * List managed auths with optional filters for profile_name and domain.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * // Automatically fetches more pages as needed.
51
+ * for await (const managedAuth of client.auth.connections.list()) {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ list(
57
+ query: ConnectionListParams | null | undefined = {},
58
+ options?: RequestOptions,
59
+ ): PagePromise<ManagedAuthsOffsetPagination, ManagedAuth> {
60
+ return this._client.getAPIList('/auth/connections', OffsetPagination<ManagedAuth>, { query, ...options });
61
+ }
62
+
63
+ /**
64
+ * Deletes managed auth and terminates its workflow. This will:
65
+ *
66
+ * - Delete the managed auth record
67
+ * - Terminate the Temporal workflow
68
+ * - Cancel any in-progress login flows
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * await client.auth.connections.delete('id');
73
+ * ```
74
+ */
75
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
76
+ return this._client.delete(path`/auth/connections/${id}`, {
77
+ ...options,
78
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Establishes a Server-Sent Events (SSE) stream that delivers real-time login flow
84
+ * state updates. The stream terminates automatically once the flow reaches a
85
+ * terminal state (SUCCESS, FAILED, EXPIRED, CANCELED).
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const response = await client.auth.connections.follow('id');
90
+ * ```
91
+ */
92
+ follow(id: string, options?: RequestOptions): APIPromise<Stream<ConnectionFollowResponse>> {
93
+ return this._client.get(path`/auth/connections/${id}/events`, {
94
+ ...options,
95
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
96
+ stream: true,
97
+ }) as APIPromise<Stream<ConnectionFollowResponse>>;
98
+ }
99
+
100
+ /**
101
+ * Starts a login flow for the managed auth. Returns immediately with a hosted URL
102
+ * for the user to complete authentication, or triggers automatic re-auth if
103
+ * credentials are stored.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * const loginResponse = await client.auth.connections.login(
108
+ * 'id',
109
+ * );
110
+ * ```
111
+ */
112
+ login(
113
+ id: string,
114
+ body: ConnectionLoginParams | null | undefined = {},
115
+ options?: RequestOptions,
116
+ ): APIPromise<LoginResponse> {
117
+ return this._client.post(path`/auth/connections/${id}/login`, { body, ...options });
118
+ }
119
+
120
+ /**
121
+ * Submits field values for the login form. Poll the managed auth to track progress
122
+ * and get results.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const submitFieldsResponse =
127
+ * await client.auth.connections.submit('id', {
128
+ * fields: {
129
+ * email: 'user@example.com',
130
+ * password: 'secret',
131
+ * },
132
+ * });
133
+ * ```
134
+ */
135
+ submit(
136
+ id: string,
137
+ body: ConnectionSubmitParams,
138
+ options?: RequestOptions,
139
+ ): APIPromise<SubmitFieldsResponse> {
140
+ return this._client.post(path`/auth/connections/${id}/submit`, { body, ...options });
141
+ }
142
+ }
143
+
144
+ export type ManagedAuthsOffsetPagination = OffsetPagination<ManagedAuth>;
145
+
146
+ /**
147
+ * Request to start a login flow
148
+ */
149
+ export interface LoginRequest {
150
+ /**
151
+ * If provided, saves credentials under this name upon successful login
152
+ */
153
+ save_credential_as?: string;
154
+ }
155
+
156
+ /**
157
+ * Response from starting a login flow
158
+ */
159
+ export interface LoginResponse {
160
+ /**
161
+ * Managed auth ID
162
+ */
163
+ id: string;
164
+
165
+ /**
166
+ * When the login flow expires
167
+ */
168
+ flow_expires_at: string;
169
+
170
+ /**
171
+ * Type of login flow started
172
+ */
173
+ flow_type: 'LOGIN' | 'REAUTH';
174
+
175
+ /**
176
+ * URL to redirect user to for login
177
+ */
178
+ hosted_url: string;
179
+
180
+ /**
181
+ * One-time code for handoff (internal use)
182
+ */
183
+ handoff_code?: string;
184
+
185
+ /**
186
+ * Browser live view URL for watching the login flow
187
+ */
188
+ live_view_url?: string;
189
+ }
190
+
191
+ /**
192
+ * Managed authentication that keeps a profile logged into a specific domain. Flow
193
+ * fields (flow_status, flow_step, discovered_fields, mfa_options) reflect the most
194
+ * recent login flow and are null when no flow has been initiated.
195
+ */
196
+ export interface ManagedAuth {
197
+ /**
198
+ * Unique identifier for the managed auth
199
+ */
200
+ id: string;
201
+
202
+ /**
203
+ * Target domain for authentication
204
+ */
205
+ domain: string;
206
+
207
+ /**
208
+ * Name of the profile associated with this managed auth
209
+ */
210
+ profile_name: string;
211
+
212
+ /**
213
+ * Current authentication status of the managed profile
214
+ */
215
+ status: 'AUTHENTICATED' | 'NEEDS_AUTH';
216
+
217
+ /**
218
+ * Additional domains that are valid for this auth flow (besides the primary
219
+ * domain). Useful when login pages redirect to different domains.
220
+ *
221
+ * The following SSO/OAuth provider domains are automatically allowed by default
222
+ * and do not need to be specified:
223
+ *
224
+ * - Google: accounts.google.com
225
+ * - Microsoft/Azure AD: login.microsoftonline.com, login.live.com
226
+ * - Okta: _.okta.com, _.oktapreview.com
227
+ * - Auth0: _.auth0.com, _.us.auth0.com, _.eu.auth0.com, _.au.auth0.com
228
+ * - Apple: appleid.apple.com
229
+ * - GitHub: github.com
230
+ * - Facebook/Meta: www.facebook.com
231
+ * - LinkedIn: www.linkedin.com
232
+ * - Amazon Cognito: \*.amazoncognito.com
233
+ * - OneLogin: \*.onelogin.com
234
+ * - Ping Identity: _.pingone.com, _.pingidentity.com
235
+ */
236
+ allowed_domains?: Array<string>;
237
+
238
+ /**
239
+ * Whether automatic re-authentication is possible (has credential, selectors, and
240
+ * login_url)
241
+ */
242
+ can_reauth?: boolean;
243
+
244
+ /**
245
+ * Reason why automatic re-authentication is or is not possible
246
+ */
247
+ can_reauth_reason?: string;
248
+
249
+ /**
250
+ * Reference to credentials for managed auth. Use one of:
251
+ *
252
+ * - { name } for Kernel credentials
253
+ * - { provider, path } for external provider item
254
+ * - { provider, auto: true } for external provider domain lookup
255
+ */
256
+ credential?: ManagedAuth.Credential;
257
+
258
+ /**
259
+ * Fields awaiting input (present when flow_step=awaiting_input)
260
+ */
261
+ discovered_fields?: Array<AuthAPI.DiscoveredField> | null;
262
+
263
+ /**
264
+ * Error message (present when flow_status=failed)
265
+ */
266
+ error_message?: string | null;
267
+
268
+ /**
269
+ * Instructions for external action (present when
270
+ * flow_step=awaiting_external_action)
271
+ */
272
+ external_action_message?: string | null;
273
+
274
+ /**
275
+ * When the current flow expires (null when no flow in progress)
276
+ */
277
+ flow_expires_at?: string | null;
278
+
279
+ /**
280
+ * Current flow status (null when no flow in progress)
281
+ */
282
+ flow_status?: 'IN_PROGRESS' | 'SUCCESS' | 'FAILED' | 'EXPIRED' | 'CANCELED' | null;
283
+
284
+ /**
285
+ * Current step in the flow (null when no flow in progress)
286
+ */
287
+ flow_step?:
288
+ | 'DISCOVERING'
289
+ | 'AWAITING_INPUT'
290
+ | 'AWAITING_EXTERNAL_ACTION'
291
+ | 'SUBMITTING'
292
+ | 'COMPLETED'
293
+ | null;
294
+
295
+ /**
296
+ * Type of the current flow (null when no flow in progress)
297
+ */
298
+ flow_type?: 'LOGIN' | 'REAUTH' | null;
299
+
300
+ /**
301
+ * Interval in seconds between automatic health checks. When set, the system
302
+ * periodically verifies the authentication status and triggers re-authentication
303
+ * if needed. Must be between 300 (5 minutes) and 86400 (24 hours). Default is 3600
304
+ * (1 hour).
305
+ */
306
+ health_check_interval?: number | null;
307
+
308
+ /**
309
+ * URL to redirect user to for hosted login (present when flow in progress)
310
+ */
311
+ hosted_url?: string | null;
312
+
313
+ /**
314
+ * When the profile was last successfully authenticated
315
+ */
316
+ last_auth_at?: string;
317
+
318
+ /**
319
+ * Browser live view URL for debugging (present when flow in progress)
320
+ */
321
+ live_view_url?: string | null;
322
+
323
+ /**
324
+ * MFA method options (present when flow_step=awaiting_input and MFA selection
325
+ * required)
326
+ */
327
+ mfa_options?: Array<ManagedAuth.MfaOption> | null;
328
+
329
+ /**
330
+ * SSO buttons available (present when flow_step=awaiting_input)
331
+ */
332
+ pending_sso_buttons?: Array<ManagedAuth.PendingSSOButton> | null;
333
+
334
+ /**
335
+ * URL where the browser landed after successful login
336
+ */
337
+ post_login_url?: string;
338
+
339
+ /**
340
+ * SSO provider being used (e.g., google, github, microsoft)
341
+ */
342
+ sso_provider?: string | null;
343
+
344
+ /**
345
+ * Visible error message from the website (e.g., 'Incorrect password'). Present
346
+ * when the website displays an error during login.
347
+ */
348
+ website_error?: string | null;
349
+ }
350
+
351
+ export namespace ManagedAuth {
352
+ /**
353
+ * Reference to credentials for managed auth. Use one of:
354
+ *
355
+ * - { name } for Kernel credentials
356
+ * - { provider, path } for external provider item
357
+ * - { provider, auto: true } for external provider domain lookup
358
+ */
359
+ export interface Credential {
360
+ /**
361
+ * If true, lookup by domain from the specified provider
362
+ */
363
+ auto?: boolean;
364
+
365
+ /**
366
+ * Kernel credential name
367
+ */
368
+ name?: string;
369
+
370
+ /**
371
+ * Provider-specific path (e.g., "VaultName/ItemName" for 1Password)
372
+ */
373
+ path?: string;
374
+
375
+ /**
376
+ * External provider name (e.g., "my-1p")
377
+ */
378
+ provider?: string;
379
+ }
380
+
381
+ /**
382
+ * An MFA method option for verification
383
+ */
384
+ export interface MfaOption {
385
+ /**
386
+ * The visible option text
387
+ */
388
+ label: string;
389
+
390
+ /**
391
+ * The MFA delivery method type (includes password for auth method selection pages)
392
+ */
393
+ type: 'sms' | 'call' | 'email' | 'totp' | 'push' | 'password';
394
+
395
+ /**
396
+ * Additional instructions from the site
397
+ */
398
+ description?: string | null;
399
+
400
+ /**
401
+ * The masked destination (phone/email) if shown
402
+ */
403
+ target?: string | null;
404
+ }
405
+
406
+ /**
407
+ * An SSO button for signing in with an external identity provider
408
+ */
409
+ export interface PendingSSOButton {
410
+ /**
411
+ * Visible button text
412
+ */
413
+ label: string;
414
+
415
+ /**
416
+ * Identity provider name
417
+ */
418
+ provider: string;
419
+
420
+ /**
421
+ * XPath selector for the button
422
+ */
423
+ selector: string;
424
+ }
425
+ }
426
+
427
+ /**
428
+ * Request to create managed auth for a profile and domain
429
+ */
430
+ export interface ManagedAuthCreateRequest {
431
+ /**
432
+ * Domain for authentication
433
+ */
434
+ domain: string;
435
+
436
+ /**
437
+ * Name of the profile to manage authentication for
438
+ */
439
+ profile_name: string;
440
+
441
+ /**
442
+ * Additional domains valid for this auth flow (besides the primary domain). Useful
443
+ * when login pages redirect to different domains.
444
+ *
445
+ * The following SSO/OAuth provider domains are automatically allowed by default
446
+ * and do not need to be specified:
447
+ *
448
+ * - Google: accounts.google.com
449
+ * - Microsoft/Azure AD: login.microsoftonline.com, login.live.com
450
+ * - Okta: _.okta.com, _.oktapreview.com
451
+ * - Auth0: _.auth0.com, _.us.auth0.com, _.eu.auth0.com, _.au.auth0.com
452
+ * - Apple: appleid.apple.com
453
+ * - GitHub: github.com
454
+ * - Facebook/Meta: www.facebook.com
455
+ * - LinkedIn: www.linkedin.com
456
+ * - Amazon Cognito: \*.amazoncognito.com
457
+ * - OneLogin: \*.onelogin.com
458
+ * - Ping Identity: _.pingone.com, _.pingidentity.com
459
+ */
460
+ allowed_domains?: Array<string>;
461
+
462
+ /**
463
+ * Reference to credentials for managed auth. Use one of:
464
+ *
465
+ * - { name } for Kernel credentials
466
+ * - { provider, path } for external provider item
467
+ * - { provider, auto: true } for external provider domain lookup
468
+ */
469
+ credential?: ManagedAuthCreateRequest.Credential;
470
+
471
+ /**
472
+ * Interval in seconds between automatic health checks. When set, the system
473
+ * periodically verifies the authentication status and triggers re-authentication
474
+ * if needed. Must be between 300 (5 minutes) and 86400 (24 hours). Default is 3600
475
+ * (1 hour).
476
+ */
477
+ health_check_interval?: number;
478
+
479
+ /**
480
+ * Optional login page URL to skip discovery
481
+ */
482
+ login_url?: string;
483
+
484
+ /**
485
+ * Optional proxy configuration
486
+ */
487
+ proxy?: ManagedAuthCreateRequest.Proxy;
488
+ }
489
+
490
+ export namespace ManagedAuthCreateRequest {
491
+ /**
492
+ * Reference to credentials for managed auth. Use one of:
493
+ *
494
+ * - { name } for Kernel credentials
495
+ * - { provider, path } for external provider item
496
+ * - { provider, auto: true } for external provider domain lookup
497
+ */
498
+ export interface Credential {
499
+ /**
500
+ * If true, lookup by domain from the specified provider
501
+ */
502
+ auto?: boolean;
503
+
504
+ /**
505
+ * Kernel credential name
506
+ */
507
+ name?: string;
508
+
509
+ /**
510
+ * Provider-specific path (e.g., "VaultName/ItemName" for 1Password)
511
+ */
512
+ path?: string;
513
+
514
+ /**
515
+ * External provider name (e.g., "my-1p")
516
+ */
517
+ provider?: string;
518
+ }
519
+
520
+ /**
521
+ * Optional proxy configuration
522
+ */
523
+ export interface Proxy {
524
+ /**
525
+ * ID of the proxy to use
526
+ */
527
+ proxy_id?: string;
528
+ }
529
+ }
530
+
531
+ /**
532
+ * Request to submit field values for login
533
+ */
534
+ export interface SubmitFieldsRequest {
535
+ /**
536
+ * Map of field name to value
537
+ */
538
+ fields: { [key: string]: string };
539
+
540
+ /**
541
+ * Optional MFA option ID if user selected an MFA method
542
+ */
543
+ mfa_option_id?: string;
544
+
545
+ /**
546
+ * Optional XPath selector if user chose to click an SSO button instead
547
+ */
548
+ sso_button_selector?: string;
549
+ }
550
+
551
+ /**
552
+ * Response from submitting field values
553
+ */
554
+ export interface SubmitFieldsResponse {
555
+ /**
556
+ * Whether the submission was accepted for processing
557
+ */
558
+ accepted: boolean;
559
+ }
560
+
561
+ /**
562
+ * Union type representing any managed auth event.
563
+ */
564
+ export type ConnectionFollowResponse =
565
+ | ConnectionFollowResponse.ManagedAuthStateEvent
566
+ | Shared.ErrorEvent
567
+ | Shared.HeartbeatEvent;
568
+
569
+ export namespace ConnectionFollowResponse {
570
+ /**
571
+ * An event representing the current state of a managed auth flow.
572
+ */
573
+ export interface ManagedAuthStateEvent {
574
+ /**
575
+ * Event type identifier (always "managed_auth_state").
576
+ */
577
+ event: 'managed_auth_state';
578
+
579
+ /**
580
+ * Current flow status.
581
+ */
582
+ flow_status: 'IN_PROGRESS' | 'SUCCESS' | 'FAILED' | 'EXPIRED' | 'CANCELED';
583
+
584
+ /**
585
+ * Current step in the flow.
586
+ */
587
+ flow_step: 'DISCOVERING' | 'AWAITING_INPUT' | 'AWAITING_EXTERNAL_ACTION' | 'SUBMITTING' | 'COMPLETED';
588
+
589
+ /**
590
+ * Time the state was reported.
591
+ */
592
+ timestamp: string;
593
+
594
+ /**
595
+ * Fields awaiting input (present when flow_step=AWAITING_INPUT).
596
+ */
597
+ discovered_fields?: Array<AuthAPI.DiscoveredField>;
598
+
599
+ /**
600
+ * Error message (present when flow_status=FAILED).
601
+ */
602
+ error_message?: string;
603
+
604
+ /**
605
+ * Instructions for external action (present when
606
+ * flow_step=AWAITING_EXTERNAL_ACTION).
607
+ */
608
+ external_action_message?: string;
609
+
610
+ /**
611
+ * Type of the current flow.
612
+ */
613
+ flow_type?: 'LOGIN' | 'REAUTH';
614
+
615
+ /**
616
+ * URL to redirect user to for hosted login.
617
+ */
618
+ hosted_url?: string;
619
+
620
+ /**
621
+ * Browser live view URL for debugging.
622
+ */
623
+ live_view_url?: string;
624
+
625
+ /**
626
+ * MFA method options (present when flow_step=AWAITING_INPUT and MFA selection
627
+ * required).
628
+ */
629
+ mfa_options?: Array<ManagedAuthStateEvent.MfaOption>;
630
+
631
+ /**
632
+ * SSO buttons available (present when flow_step=AWAITING_INPUT).
633
+ */
634
+ pending_sso_buttons?: Array<ManagedAuthStateEvent.PendingSSOButton>;
635
+
636
+ /**
637
+ * URL where the browser landed after successful login.
638
+ */
639
+ post_login_url?: string;
640
+
641
+ /**
642
+ * Visible error message from the website (e.g., 'Incorrect password'). Present
643
+ * when the website displays an error during login.
644
+ */
645
+ website_error?: string;
646
+ }
647
+
648
+ export namespace ManagedAuthStateEvent {
649
+ /**
650
+ * An MFA method option for verification
651
+ */
652
+ export interface MfaOption {
653
+ /**
654
+ * The visible option text
655
+ */
656
+ label: string;
657
+
658
+ /**
659
+ * The MFA delivery method type (includes password for auth method selection pages)
660
+ */
661
+ type: 'sms' | 'call' | 'email' | 'totp' | 'push' | 'password';
662
+
663
+ /**
664
+ * Additional instructions from the site
665
+ */
666
+ description?: string | null;
667
+
668
+ /**
669
+ * The masked destination (phone/email) if shown
670
+ */
671
+ target?: string | null;
672
+ }
673
+
674
+ /**
675
+ * An SSO button for signing in with an external identity provider
676
+ */
677
+ export interface PendingSSOButton {
678
+ /**
679
+ * Visible button text
680
+ */
681
+ label: string;
682
+
683
+ /**
684
+ * Identity provider name
685
+ */
686
+ provider: string;
687
+
688
+ /**
689
+ * XPath selector for the button
690
+ */
691
+ selector: string;
692
+ }
693
+ }
694
+ }
695
+
696
+ export interface ConnectionCreateParams {
697
+ /**
698
+ * Domain for authentication
699
+ */
700
+ domain: string;
701
+
702
+ /**
703
+ * Name of the profile to manage authentication for
704
+ */
705
+ profile_name: string;
706
+
707
+ /**
708
+ * Additional domains valid for this auth flow (besides the primary domain). Useful
709
+ * when login pages redirect to different domains.
710
+ *
711
+ * The following SSO/OAuth provider domains are automatically allowed by default
712
+ * and do not need to be specified:
713
+ *
714
+ * - Google: accounts.google.com
715
+ * - Microsoft/Azure AD: login.microsoftonline.com, login.live.com
716
+ * - Okta: _.okta.com, _.oktapreview.com
717
+ * - Auth0: _.auth0.com, _.us.auth0.com, _.eu.auth0.com, _.au.auth0.com
718
+ * - Apple: appleid.apple.com
719
+ * - GitHub: github.com
720
+ * - Facebook/Meta: www.facebook.com
721
+ * - LinkedIn: www.linkedin.com
722
+ * - Amazon Cognito: \*.amazoncognito.com
723
+ * - OneLogin: \*.onelogin.com
724
+ * - Ping Identity: _.pingone.com, _.pingidentity.com
725
+ */
726
+ allowed_domains?: Array<string>;
727
+
728
+ /**
729
+ * Reference to credentials for managed auth. Use one of:
730
+ *
731
+ * - { name } for Kernel credentials
732
+ * - { provider, path } for external provider item
733
+ * - { provider, auto: true } for external provider domain lookup
734
+ */
735
+ credential?: ConnectionCreateParams.Credential;
736
+
737
+ /**
738
+ * Interval in seconds between automatic health checks. When set, the system
739
+ * periodically verifies the authentication status and triggers re-authentication
740
+ * if needed. Must be between 300 (5 minutes) and 86400 (24 hours). Default is 3600
741
+ * (1 hour).
742
+ */
743
+ health_check_interval?: number;
744
+
745
+ /**
746
+ * Optional login page URL to skip discovery
747
+ */
748
+ login_url?: string;
749
+
750
+ /**
751
+ * Optional proxy configuration
752
+ */
753
+ proxy?: ConnectionCreateParams.Proxy;
754
+ }
755
+
756
+ export namespace ConnectionCreateParams {
757
+ /**
758
+ * Reference to credentials for managed auth. Use one of:
759
+ *
760
+ * - { name } for Kernel credentials
761
+ * - { provider, path } for external provider item
762
+ * - { provider, auto: true } for external provider domain lookup
763
+ */
764
+ export interface Credential {
765
+ /**
766
+ * If true, lookup by domain from the specified provider
767
+ */
768
+ auto?: boolean;
769
+
770
+ /**
771
+ * Kernel credential name
772
+ */
773
+ name?: string;
774
+
775
+ /**
776
+ * Provider-specific path (e.g., "VaultName/ItemName" for 1Password)
777
+ */
778
+ path?: string;
779
+
780
+ /**
781
+ * External provider name (e.g., "my-1p")
782
+ */
783
+ provider?: string;
784
+ }
785
+
786
+ /**
787
+ * Optional proxy configuration
788
+ */
789
+ export interface Proxy {
790
+ /**
791
+ * ID of the proxy to use
792
+ */
793
+ proxy_id?: string;
794
+ }
795
+ }
796
+
797
+ export interface ConnectionListParams extends OffsetPaginationParams {
798
+ /**
799
+ * Filter by domain
800
+ */
801
+ domain?: string;
802
+
803
+ /**
804
+ * Filter by profile name
805
+ */
806
+ profile_name?: string;
807
+ }
808
+
809
+ export interface ConnectionLoginParams {
810
+ /**
811
+ * If provided, saves credentials under this name upon successful login
812
+ */
813
+ save_credential_as?: string;
814
+ }
815
+
816
+ export interface ConnectionSubmitParams {
817
+ /**
818
+ * Map of field name to value
819
+ */
820
+ fields: { [key: string]: string };
821
+
822
+ /**
823
+ * Optional MFA option ID if user selected an MFA method
824
+ */
825
+ mfa_option_id?: string;
826
+
827
+ /**
828
+ * Optional XPath selector if user chose to click an SSO button instead
829
+ */
830
+ sso_button_selector?: string;
831
+ }
832
+
833
+ export declare namespace Connections {
834
+ export {
835
+ type LoginRequest as LoginRequest,
836
+ type LoginResponse as LoginResponse,
837
+ type ManagedAuth as ManagedAuth,
838
+ type ManagedAuthCreateRequest as ManagedAuthCreateRequest,
839
+ type SubmitFieldsRequest as SubmitFieldsRequest,
840
+ type SubmitFieldsResponse as SubmitFieldsResponse,
841
+ type ConnectionFollowResponse as ConnectionFollowResponse,
842
+ type ManagedAuthsOffsetPagination as ManagedAuthsOffsetPagination,
843
+ type ConnectionCreateParams as ConnectionCreateParams,
844
+ type ConnectionListParams as ConnectionListParams,
845
+ type ConnectionLoginParams as ConnectionLoginParams,
846
+ type ConnectionSubmitParams as ConnectionSubmitParams,
847
+ };
848
+ }