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