@onkernel/sdk 0.30.0 → 0.33.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 (154) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/client.d.mts +8 -7
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -7
  5. package/client.d.ts.map +1 -1
  6. package/client.js +12 -5
  7. package/client.js.map +1 -1
  8. package/client.mjs +12 -5
  9. package/client.mjs.map +1 -1
  10. package/package.json +3 -2
  11. package/resources/auth/auth.d.mts +10 -0
  12. package/resources/auth/auth.d.mts.map +1 -0
  13. package/resources/auth/auth.d.ts +10 -0
  14. package/resources/auth/auth.d.ts.map +1 -0
  15. package/resources/auth/auth.js +17 -0
  16. package/resources/auth/auth.js.map +1 -0
  17. package/resources/auth/auth.mjs +12 -0
  18. package/resources/auth/auth.mjs.map +1 -0
  19. package/resources/auth/connections.d.mts +793 -0
  20. package/resources/auth/connections.d.mts.map +1 -0
  21. package/resources/auth/connections.d.ts +793 -0
  22. package/resources/auth/connections.d.ts.map +1 -0
  23. package/resources/auth/connections.js +118 -0
  24. package/resources/auth/connections.js.map +1 -0
  25. package/resources/auth/connections.mjs +114 -0
  26. package/resources/auth/connections.mjs.map +1 -0
  27. package/resources/auth/index.d.mts +3 -0
  28. package/resources/auth/index.d.mts.map +1 -0
  29. package/resources/auth/index.d.ts +3 -0
  30. package/resources/auth/index.d.ts.map +1 -0
  31. package/resources/{agents/auth → auth}/index.js +3 -3
  32. package/resources/auth/index.js.map +1 -0
  33. package/resources/auth/index.mjs +4 -0
  34. package/resources/auth/index.mjs.map +1 -0
  35. package/resources/{agents/auth.d.mts.map → auth.d.mts.map} +1 -1
  36. package/resources/auth.d.ts.map +1 -0
  37. package/resources/{agents/auth.js → auth.js} +1 -1
  38. package/resources/auth.js.map +1 -0
  39. package/resources/auth.mjs.map +1 -0
  40. package/resources/browsers/browsers.d.mts +2 -2
  41. package/resources/browsers/browsers.d.mts.map +1 -1
  42. package/resources/browsers/browsers.d.ts +2 -2
  43. package/resources/browsers/browsers.d.ts.map +1 -1
  44. package/resources/browsers/browsers.js.map +1 -1
  45. package/resources/browsers/browsers.mjs.map +1 -1
  46. package/resources/browsers/computer.d.mts +199 -1
  47. package/resources/browsers/computer.d.mts.map +1 -1
  48. package/resources/browsers/computer.d.ts +199 -1
  49. package/resources/browsers/computer.d.ts.map +1 -1
  50. package/resources/browsers/computer.js +31 -0
  51. package/resources/browsers/computer.js.map +1 -1
  52. package/resources/browsers/computer.mjs +31 -0
  53. package/resources/browsers/computer.mjs.map +1 -1
  54. package/resources/browsers/index.d.mts +1 -1
  55. package/resources/browsers/index.d.mts.map +1 -1
  56. package/resources/browsers/index.d.ts +1 -1
  57. package/resources/browsers/index.d.ts.map +1 -1
  58. package/resources/browsers/index.js.map +1 -1
  59. package/resources/browsers/index.mjs.map +1 -1
  60. package/resources/credential-providers.d.mts +66 -1
  61. package/resources/credential-providers.d.mts.map +1 -1
  62. package/resources/credential-providers.d.ts +66 -1
  63. package/resources/credential-providers.d.ts.map +1 -1
  64. package/resources/credential-providers.js +21 -6
  65. package/resources/credential-providers.js.map +1 -1
  66. package/resources/credential-providers.mjs +21 -6
  67. package/resources/credential-providers.mjs.map +1 -1
  68. package/resources/credentials.d.mts +4 -0
  69. package/resources/credentials.d.mts.map +1 -1
  70. package/resources/credentials.d.ts +4 -0
  71. package/resources/credentials.d.ts.map +1 -1
  72. package/resources/index.d.mts +2 -2
  73. package/resources/index.d.mts.map +1 -1
  74. package/resources/index.d.ts +2 -2
  75. package/resources/index.d.ts.map +1 -1
  76. package/resources/index.js +3 -3
  77. package/resources/index.js.map +1 -1
  78. package/resources/index.mjs +1 -1
  79. package/resources/index.mjs.map +1 -1
  80. package/src/client.ts +24 -9
  81. package/src/resources/auth/auth.ts +41 -0
  82. package/src/resources/auth/connections.ts +973 -0
  83. package/src/resources/auth/index.ts +17 -0
  84. package/src/resources/browsers/browsers.ts +4 -0
  85. package/src/resources/browsers/computer.ts +257 -0
  86. package/src/resources/browsers/index.ts +2 -0
  87. package/src/resources/credential-providers.ts +88 -6
  88. package/src/resources/credentials.ts +5 -0
  89. package/src/resources/index.ts +3 -1
  90. package/src/version.ts +1 -1
  91. package/version.d.mts +1 -1
  92. package/version.d.ts +1 -1
  93. package/version.js +1 -1
  94. package/version.mjs +1 -1
  95. package/resources/agents/agents.d.mts +0 -10
  96. package/resources/agents/agents.d.mts.map +0 -1
  97. package/resources/agents/agents.d.ts +0 -10
  98. package/resources/agents/agents.d.ts.map +0 -1
  99. package/resources/agents/agents.js +0 -17
  100. package/resources/agents/agents.js.map +0 -1
  101. package/resources/agents/agents.mjs +0 -12
  102. package/resources/agents/agents.mjs.map +0 -1
  103. package/resources/agents/auth/auth.d.mts +0 -405
  104. package/resources/agents/auth/auth.d.mts.map +0 -1
  105. package/resources/agents/auth/auth.d.ts +0 -405
  106. package/resources/agents/auth/auth.d.ts.map +0 -1
  107. package/resources/agents/auth/auth.js +0 -81
  108. package/resources/agents/auth/auth.js.map +0 -1
  109. package/resources/agents/auth/auth.mjs +0 -76
  110. package/resources/agents/auth/auth.mjs.map +0 -1
  111. package/resources/agents/auth/index.d.mts +0 -3
  112. package/resources/agents/auth/index.d.mts.map +0 -1
  113. package/resources/agents/auth/index.d.ts +0 -3
  114. package/resources/agents/auth/index.d.ts.map +0 -1
  115. package/resources/agents/auth/index.js.map +0 -1
  116. package/resources/agents/auth/index.mjs +0 -4
  117. package/resources/agents/auth/index.mjs.map +0 -1
  118. package/resources/agents/auth/invocations.d.mts +0 -125
  119. package/resources/agents/auth/invocations.d.mts.map +0 -1
  120. package/resources/agents/auth/invocations.d.ts +0 -125
  121. package/resources/agents/auth/invocations.d.ts.map +0 -1
  122. package/resources/agents/auth/invocations.js +0 -79
  123. package/resources/agents/auth/invocations.js.map +0 -1
  124. package/resources/agents/auth/invocations.mjs +0 -75
  125. package/resources/agents/auth/invocations.mjs.map +0 -1
  126. package/resources/agents/auth.d.ts.map +0 -1
  127. package/resources/agents/auth.js.map +0 -1
  128. package/resources/agents/auth.mjs.map +0 -1
  129. package/resources/agents/index.d.mts +0 -3
  130. package/resources/agents/index.d.mts.map +0 -1
  131. package/resources/agents/index.d.ts +0 -3
  132. package/resources/agents/index.d.ts.map +0 -1
  133. package/resources/agents/index.js +0 -9
  134. package/resources/agents/index.js.map +0 -1
  135. package/resources/agents/index.mjs +0 -4
  136. package/resources/agents/index.mjs.map +0 -1
  137. package/resources/agents.d.mts +0 -2
  138. package/resources/agents.d.mts.map +0 -1
  139. package/resources/agents.d.ts +0 -2
  140. package/resources/agents.d.ts.map +0 -1
  141. package/resources/agents.js +0 -6
  142. package/resources/agents.js.map +0 -1
  143. package/resources/agents.mjs +0 -3
  144. package/resources/agents.mjs.map +0 -1
  145. package/src/resources/agents/agents.ts +0 -39
  146. package/src/resources/agents/auth/auth.ts +0 -524
  147. package/src/resources/agents/auth/index.ts +0 -22
  148. package/src/resources/agents/auth/invocations.ts +0 -166
  149. package/src/resources/agents/index.ts +0 -16
  150. package/src/resources/agents.ts +0 -3
  151. /package/resources/{agents/auth.d.mts → auth.d.mts} +0 -0
  152. /package/resources/{agents/auth.d.ts → auth.d.ts} +0 -0
  153. /package/resources/{agents/auth.mjs → auth.mjs} +0 -0
  154. /package/src/resources/{agents/auth.ts → auth.ts} +0 -0
@@ -1,524 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../../core/resource';
4
- import * as InvocationsAPI from './invocations';
5
- import {
6
- InvocationCreateParams,
7
- InvocationExchangeParams,
8
- InvocationExchangeResponse,
9
- InvocationSubmitParams,
10
- Invocations,
11
- } from './invocations';
12
- import { APIPromise } from '../../../core/api-promise';
13
- import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../../core/pagination';
14
- import { buildHeaders } from '../../../internal/headers';
15
- import { RequestOptions } from '../../../internal/request-options';
16
- import { path } from '../../../internal/utils/path';
17
-
18
- export class Auth extends APIResource {
19
- invocations: InvocationsAPI.Invocations = new InvocationsAPI.Invocations(this._client);
20
-
21
- /**
22
- * Creates a new auth agent for the specified domain and profile combination, or
23
- * returns an existing one if it already exists. This is idempotent - calling with
24
- * the same domain and profile will return the same agent. Does NOT start an
25
- * invocation - use POST /agents/auth/invocations to start an auth flow.
26
- *
27
- * @example
28
- * ```ts
29
- * const authAgent = await client.agents.auth.create({
30
- * domain: 'netflix.com',
31
- * profile_name: 'user-123',
32
- * });
33
- * ```
34
- */
35
- create(body: AuthCreateParams, options?: RequestOptions): APIPromise<AuthAgent> {
36
- return this._client.post('/agents/auth', { body, ...options });
37
- }
38
-
39
- /**
40
- * Retrieve an auth agent by its ID. Returns the current authentication status of
41
- * the managed profile.
42
- *
43
- * @example
44
- * ```ts
45
- * const authAgent = await client.agents.auth.retrieve('id');
46
- * ```
47
- */
48
- retrieve(id: string, options?: RequestOptions): APIPromise<AuthAgent> {
49
- return this._client.get(path`/agents/auth/${id}`, options);
50
- }
51
-
52
- /**
53
- * List auth agents with optional filters for profile_name and domain.
54
- *
55
- * @example
56
- * ```ts
57
- * // Automatically fetches more pages as needed.
58
- * for await (const authAgent of client.agents.auth.list()) {
59
- * // ...
60
- * }
61
- * ```
62
- */
63
- list(
64
- query: AuthListParams | null | undefined = {},
65
- options?: RequestOptions,
66
- ): PagePromise<AuthAgentsOffsetPagination, AuthAgent> {
67
- return this._client.getAPIList('/agents/auth', OffsetPagination<AuthAgent>, { query, ...options });
68
- }
69
-
70
- /**
71
- * Deletes an auth agent and terminates its workflow. This will:
72
- *
73
- * - Soft delete the auth agent record
74
- * - Gracefully terminate the agent's Temporal workflow
75
- * - Cancel any in-progress invocations
76
- *
77
- * @example
78
- * ```ts
79
- * await client.agents.auth.delete('id');
80
- * ```
81
- */
82
- delete(id: string, options?: RequestOptions): APIPromise<void> {
83
- return this._client.delete(path`/agents/auth/${id}`, {
84
- ...options,
85
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
86
- });
87
- }
88
- }
89
-
90
- export type AuthAgentsOffsetPagination = OffsetPagination<AuthAgent>;
91
-
92
- /**
93
- * Response from get invocation endpoint
94
- */
95
- export interface AgentAuthInvocationResponse {
96
- /**
97
- * App name (org name at time of invocation creation)
98
- */
99
- app_name: string;
100
-
101
- /**
102
- * Domain for authentication
103
- */
104
- domain: string;
105
-
106
- /**
107
- * When the handoff code expires
108
- */
109
- expires_at: string;
110
-
111
- /**
112
- * Invocation status
113
- */
114
- status: 'IN_PROGRESS' | 'SUCCESS' | 'EXPIRED' | 'CANCELED' | 'FAILED';
115
-
116
- /**
117
- * Current step in the invocation workflow
118
- */
119
- step:
120
- | 'initialized'
121
- | 'discovering'
122
- | 'awaiting_input'
123
- | 'awaiting_external_action'
124
- | 'submitting'
125
- | 'completed'
126
- | 'expired';
127
-
128
- /**
129
- * The invocation type:
130
- *
131
- * - login: First-time authentication
132
- * - reauth: Re-authentication for previously authenticated agents
133
- * - auto_login: Legacy type (no longer created, kept for backward compatibility)
134
- */
135
- type: 'login' | 'auto_login' | 'reauth';
136
-
137
- /**
138
- * Error message explaining why the invocation failed (present when status=FAILED)
139
- */
140
- error_message?: string | null;
141
-
142
- /**
143
- * Instructions for user when external action is required (present when
144
- * step=awaiting_external_action)
145
- */
146
- external_action_message?: string | null;
147
-
148
- /**
149
- * Browser live view URL for debugging the invocation
150
- */
151
- live_view_url?: string | null;
152
-
153
- /**
154
- * MFA method options to choose from (present when step=awaiting_input and MFA
155
- * selection is required)
156
- */
157
- mfa_options?: Array<AgentAuthInvocationResponse.MfaOption> | null;
158
-
159
- /**
160
- * Fields currently awaiting input (present when step=awaiting_input)
161
- */
162
- pending_fields?: Array<DiscoveredField> | null;
163
-
164
- /**
165
- * SSO buttons available on the page (present when step=awaiting_input)
166
- */
167
- pending_sso_buttons?: Array<AgentAuthInvocationResponse.PendingSSOButton> | null;
168
-
169
- /**
170
- * SSO provider being used for authentication (e.g., google, github, microsoft)
171
- */
172
- sso_provider?: string | null;
173
-
174
- /**
175
- * Names of fields that have been submitted (present when step=submitting or later)
176
- */
177
- submitted_fields?: Array<string> | null;
178
- }
179
-
180
- export namespace AgentAuthInvocationResponse {
181
- /**
182
- * An MFA method option for verification
183
- */
184
- export interface MfaOption {
185
- /**
186
- * The visible option text
187
- */
188
- label: string;
189
-
190
- /**
191
- * The MFA delivery method type
192
- */
193
- type: 'sms' | 'call' | 'email' | 'totp' | 'push' | 'security_key';
194
-
195
- /**
196
- * Additional instructions from the site
197
- */
198
- description?: string | null;
199
-
200
- /**
201
- * The masked destination (phone/email) if shown
202
- */
203
- target?: string | null;
204
- }
205
-
206
- /**
207
- * An SSO button for signing in with an external identity provider
208
- */
209
- export interface PendingSSOButton {
210
- /**
211
- * Visible button text
212
- */
213
- label: string;
214
-
215
- /**
216
- * Identity provider name
217
- */
218
- provider: string;
219
-
220
- /**
221
- * XPath selector for the button
222
- */
223
- selector: string;
224
- }
225
- }
226
-
227
- /**
228
- * Response from submit endpoint - returns immediately after submission is accepted
229
- */
230
- export interface AgentAuthSubmitResponse {
231
- /**
232
- * Whether the submission was accepted for processing
233
- */
234
- accepted: boolean;
235
- }
236
-
237
- /**
238
- * An auth agent that manages authentication for a specific domain and profile
239
- * combination
240
- */
241
- export interface AuthAgent {
242
- /**
243
- * Unique identifier for the auth agent
244
- */
245
- id: string;
246
-
247
- /**
248
- * Target domain for authentication
249
- */
250
- domain: string;
251
-
252
- /**
253
- * Name of the profile associated with this auth agent
254
- */
255
- profile_name: string;
256
-
257
- /**
258
- * Current authentication status of the managed profile
259
- */
260
- status: 'AUTHENTICATED' | 'NEEDS_AUTH';
261
-
262
- /**
263
- * Additional domains that are valid for this auth agent's authentication flow
264
- * (besides the primary domain). Useful when login pages redirect to different
265
- * domains.
266
- */
267
- allowed_domains?: Array<string>;
268
-
269
- /**
270
- * Whether automatic re-authentication is possible (has credential_id, selectors,
271
- * and login_url)
272
- */
273
- can_reauth?: boolean;
274
-
275
- /**
276
- * ID of the linked credential for automatic re-authentication
277
- */
278
- credential_id?: string;
279
-
280
- /**
281
- * Name of the linked credential for automatic re-authentication
282
- */
283
- credential_name?: string;
284
-
285
- /**
286
- * Whether this auth agent has stored selectors for deterministic re-authentication
287
- */
288
- has_selectors?: boolean;
289
-
290
- /**
291
- * When the last authentication check was performed
292
- */
293
- last_auth_check_at?: string;
294
-
295
- /**
296
- * URL where the browser landed after successful login. Query parameters and
297
- * fragments are stripped for privacy.
298
- */
299
- post_login_url?: string;
300
- }
301
-
302
- /**
303
- * Request to create or find an auth agent
304
- */
305
- export interface AuthAgentCreateRequest {
306
- /**
307
- * Domain for authentication
308
- */
309
- domain: string;
310
-
311
- /**
312
- * Name of the profile to use for this auth agent
313
- */
314
- profile_name: string;
315
-
316
- /**
317
- * Additional domains that are valid for this auth agent's authentication flow
318
- * (besides the primary domain). Useful when login pages redirect to different
319
- * domains.
320
- */
321
- allowed_domains?: Array<string>;
322
-
323
- /**
324
- * Optional name of an existing credential to use for this auth agent. If provided,
325
- * the credential will be linked to the agent and its values will be used to
326
- * auto-fill the login form on invocation.
327
- */
328
- credential_name?: string;
329
-
330
- /**
331
- * Optional login page URL. If provided, will be stored on the agent and used to
332
- * skip discovery in future invocations.
333
- */
334
- login_url?: string;
335
-
336
- /**
337
- * Optional proxy configuration
338
- */
339
- proxy?: AuthAgentCreateRequest.Proxy;
340
- }
341
-
342
- export namespace AuthAgentCreateRequest {
343
- /**
344
- * Optional proxy configuration
345
- */
346
- export interface Proxy {
347
- /**
348
- * ID of the proxy to use
349
- */
350
- proxy_id?: string;
351
- }
352
- }
353
-
354
- /**
355
- * Request to create an invocation for an existing auth agent
356
- */
357
- export interface AuthAgentInvocationCreateRequest {
358
- /**
359
- * ID of the auth agent to create an invocation for
360
- */
361
- auth_agent_id: string;
362
-
363
- /**
364
- * If provided, saves the submitted credentials under this name upon successful
365
- * login. The credential will be linked to the auth agent for automatic
366
- * re-authentication.
367
- */
368
- save_credential_as?: string;
369
- }
370
-
371
- /**
372
- * Response from creating an invocation. Always returns an invocation_id.
373
- */
374
- export interface AuthAgentInvocationCreateResponse {
375
- /**
376
- * When the handoff code expires.
377
- */
378
- expires_at: string;
379
-
380
- /**
381
- * One-time code for handoff.
382
- */
383
- handoff_code: string;
384
-
385
- /**
386
- * URL to redirect user to.
387
- */
388
- hosted_url: string;
389
-
390
- /**
391
- * Unique identifier for the invocation.
392
- */
393
- invocation_id: string;
394
-
395
- /**
396
- * The invocation type:
397
- *
398
- * - login: First-time authentication
399
- * - reauth: Re-authentication for previously authenticated agents
400
- * - auto_login: Legacy type (no longer created, kept for backward compatibility)
401
- */
402
- type: 'login' | 'auto_login' | 'reauth';
403
- }
404
-
405
- /**
406
- * A discovered form field
407
- */
408
- export interface DiscoveredField {
409
- /**
410
- * Field label
411
- */
412
- label: string;
413
-
414
- /**
415
- * Field name
416
- */
417
- name: string;
418
-
419
- /**
420
- * CSS selector for the field
421
- */
422
- selector: string;
423
-
424
- /**
425
- * Field type
426
- */
427
- type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code' | 'totp';
428
-
429
- /**
430
- * Field placeholder
431
- */
432
- placeholder?: string;
433
-
434
- /**
435
- * Whether field is required
436
- */
437
- required?: boolean;
438
- }
439
-
440
- export interface AuthCreateParams {
441
- /**
442
- * Domain for authentication
443
- */
444
- domain: string;
445
-
446
- /**
447
- * Name of the profile to use for this auth agent
448
- */
449
- profile_name: string;
450
-
451
- /**
452
- * Additional domains that are valid for this auth agent's authentication flow
453
- * (besides the primary domain). Useful when login pages redirect to different
454
- * domains.
455
- */
456
- allowed_domains?: Array<string>;
457
-
458
- /**
459
- * Optional name of an existing credential to use for this auth agent. If provided,
460
- * the credential will be linked to the agent and its values will be used to
461
- * auto-fill the login form on invocation.
462
- */
463
- credential_name?: string;
464
-
465
- /**
466
- * Optional login page URL. If provided, will be stored on the agent and used to
467
- * skip discovery in future invocations.
468
- */
469
- login_url?: string;
470
-
471
- /**
472
- * Optional proxy configuration
473
- */
474
- proxy?: AuthCreateParams.Proxy;
475
- }
476
-
477
- export namespace AuthCreateParams {
478
- /**
479
- * Optional proxy configuration
480
- */
481
- export interface Proxy {
482
- /**
483
- * ID of the proxy to use
484
- */
485
- proxy_id?: string;
486
- }
487
- }
488
-
489
- export interface AuthListParams extends OffsetPaginationParams {
490
- /**
491
- * Filter by domain
492
- */
493
- domain?: string;
494
-
495
- /**
496
- * Filter by profile name
497
- */
498
- profile_name?: string;
499
- }
500
-
501
- Auth.Invocations = Invocations;
502
-
503
- export declare namespace Auth {
504
- export {
505
- type AgentAuthInvocationResponse as AgentAuthInvocationResponse,
506
- type AgentAuthSubmitResponse as AgentAuthSubmitResponse,
507
- type AuthAgent as AuthAgent,
508
- type AuthAgentCreateRequest as AuthAgentCreateRequest,
509
- type AuthAgentInvocationCreateRequest as AuthAgentInvocationCreateRequest,
510
- type AuthAgentInvocationCreateResponse as AuthAgentInvocationCreateResponse,
511
- type DiscoveredField as DiscoveredField,
512
- type AuthAgentsOffsetPagination as AuthAgentsOffsetPagination,
513
- type AuthCreateParams as AuthCreateParams,
514
- type AuthListParams as AuthListParams,
515
- };
516
-
517
- export {
518
- Invocations as Invocations,
519
- type InvocationExchangeResponse as InvocationExchangeResponse,
520
- type InvocationCreateParams as InvocationCreateParams,
521
- type InvocationExchangeParams as InvocationExchangeParams,
522
- type InvocationSubmitParams as InvocationSubmitParams,
523
- };
524
- }
@@ -1,22 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export {
4
- Auth,
5
- type AgentAuthInvocationResponse,
6
- type AgentAuthSubmitResponse,
7
- type AuthAgent,
8
- type AuthAgentCreateRequest,
9
- type AuthAgentInvocationCreateRequest,
10
- type AuthAgentInvocationCreateResponse,
11
- type DiscoveredField,
12
- type AuthCreateParams,
13
- type AuthListParams,
14
- type AuthAgentsOffsetPagination,
15
- } from './auth';
16
- export {
17
- Invocations,
18
- type InvocationExchangeResponse,
19
- type InvocationCreateParams,
20
- type InvocationExchangeParams,
21
- type InvocationSubmitParams,
22
- } from './invocations';
@@ -1,166 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../../core/resource';
4
- import * as AuthAPI from './auth';
5
- import { APIPromise } from '../../../core/api-promise';
6
- import { RequestOptions } from '../../../internal/request-options';
7
- import { path } from '../../../internal/utils/path';
8
-
9
- export class Invocations extends APIResource {
10
- /**
11
- * Creates a new authentication invocation for the specified auth agent. This
12
- * starts the auth flow and returns a hosted URL for the user to complete
13
- * authentication.
14
- *
15
- * @example
16
- * ```ts
17
- * const authAgentInvocationCreateResponse =
18
- * await client.agents.auth.invocations.create({
19
- * auth_agent_id: 'abc123xyz',
20
- * });
21
- * ```
22
- */
23
- create(
24
- body: InvocationCreateParams,
25
- options?: RequestOptions,
26
- ): APIPromise<AuthAPI.AuthAgentInvocationCreateResponse> {
27
- return this._client.post('/agents/auth/invocations', { body, ...options });
28
- }
29
-
30
- /**
31
- * Returns invocation details including status, app_name, and domain. Supports both
32
- * API key and JWT (from exchange endpoint) authentication.
33
- *
34
- * @example
35
- * ```ts
36
- * const agentAuthInvocationResponse =
37
- * await client.agents.auth.invocations.retrieve(
38
- * 'invocation_id',
39
- * );
40
- * ```
41
- */
42
- retrieve(invocationID: string, options?: RequestOptions): APIPromise<AuthAPI.AgentAuthInvocationResponse> {
43
- return this._client.get(path`/agents/auth/invocations/${invocationID}`, options);
44
- }
45
-
46
- /**
47
- * Validates the handoff code and returns a JWT token for subsequent requests. No
48
- * authentication required (the handoff code serves as the credential).
49
- *
50
- * @example
51
- * ```ts
52
- * const response =
53
- * await client.agents.auth.invocations.exchange(
54
- * 'invocation_id',
55
- * { code: 'abc123xyz' },
56
- * );
57
- * ```
58
- */
59
- exchange(
60
- invocationID: string,
61
- body: InvocationExchangeParams,
62
- options?: RequestOptions,
63
- ): APIPromise<InvocationExchangeResponse> {
64
- return this._client.post(path`/agents/auth/invocations/${invocationID}/exchange`, { body, ...options });
65
- }
66
-
67
- /**
68
- * Submits field values for the discovered login form. Returns immediately after
69
- * submission is accepted. Poll the invocation endpoint to track progress and get
70
- * results.
71
- *
72
- * @example
73
- * ```ts
74
- * const agentAuthSubmitResponse =
75
- * await client.agents.auth.invocations.submit(
76
- * 'invocation_id',
77
- * {
78
- * field_values: {
79
- * email: 'user@example.com',
80
- * password: '********',
81
- * },
82
- * },
83
- * );
84
- * ```
85
- */
86
- submit(
87
- invocationID: string,
88
- body: InvocationSubmitParams,
89
- options?: RequestOptions,
90
- ): APIPromise<AuthAPI.AgentAuthSubmitResponse> {
91
- return this._client.post(path`/agents/auth/invocations/${invocationID}/submit`, { body, ...options });
92
- }
93
- }
94
-
95
- /**
96
- * Response from exchange endpoint
97
- */
98
- export interface InvocationExchangeResponse {
99
- /**
100
- * Invocation ID
101
- */
102
- invocation_id: string;
103
-
104
- /**
105
- * JWT token with invocation_id claim (30 minute TTL)
106
- */
107
- jwt: string;
108
- }
109
-
110
- export interface InvocationCreateParams {
111
- /**
112
- * ID of the auth agent to create an invocation for
113
- */
114
- auth_agent_id: string;
115
-
116
- /**
117
- * If provided, saves the submitted credentials under this name upon successful
118
- * login. The credential will be linked to the auth agent for automatic
119
- * re-authentication.
120
- */
121
- save_credential_as?: string;
122
- }
123
-
124
- export interface InvocationExchangeParams {
125
- /**
126
- * Handoff code from start endpoint
127
- */
128
- code: string;
129
- }
130
-
131
- export type InvocationSubmitParams =
132
- | InvocationSubmitParams.Variant0
133
- | InvocationSubmitParams.Variant1
134
- | InvocationSubmitParams.Variant2;
135
-
136
- export declare namespace InvocationSubmitParams {
137
- export interface Variant0 {
138
- /**
139
- * Values for the discovered login fields
140
- */
141
- field_values: { [key: string]: string };
142
- }
143
-
144
- export interface Variant1 {
145
- /**
146
- * Selector of SSO button to click
147
- */
148
- sso_button: string;
149
- }
150
-
151
- export interface Variant2 {
152
- /**
153
- * The MFA delivery method type
154
- */
155
- selected_mfa_type: 'sms' | 'call' | 'email' | 'totp' | 'push' | 'security_key';
156
- }
157
- }
158
-
159
- export declare namespace Invocations {
160
- export {
161
- type InvocationExchangeResponse as InvocationExchangeResponse,
162
- type InvocationCreateParams as InvocationCreateParams,
163
- type InvocationExchangeParams as InvocationExchangeParams,
164
- type InvocationSubmitParams as InvocationSubmitParams,
165
- };
166
- }