@onkernel/sdk 0.23.0 → 0.25.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 (89) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +1 -1
  3. package/README.md +7 -2
  4. package/client.d.mts +7 -4
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +7 -4
  7. package/client.d.ts.map +1 -1
  8. package/client.js +3 -0
  9. package/client.js.map +1 -1
  10. package/client.mjs +3 -0
  11. package/client.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/agents/agents.d.mts +2 -2
  14. package/resources/agents/agents.d.mts.map +1 -1
  15. package/resources/agents/agents.d.ts +2 -2
  16. package/resources/agents/agents.d.ts.map +1 -1
  17. package/resources/agents/agents.js.map +1 -1
  18. package/resources/agents/agents.mjs.map +1 -1
  19. package/resources/agents/auth/auth.d.mts +146 -70
  20. package/resources/agents/auth/auth.d.mts.map +1 -1
  21. package/resources/agents/auth/auth.d.ts +146 -70
  22. package/resources/agents/auth/auth.d.ts.map +1 -1
  23. package/resources/agents/auth/auth.js +21 -2
  24. package/resources/agents/auth/auth.js.map +1 -1
  25. package/resources/agents/auth/auth.mjs +21 -2
  26. package/resources/agents/auth/auth.mjs.map +1 -1
  27. package/resources/agents/auth/index.d.mts +2 -2
  28. package/resources/agents/auth/index.d.mts.map +1 -1
  29. package/resources/agents/auth/index.d.ts +2 -2
  30. package/resources/agents/auth/index.d.ts.map +1 -1
  31. package/resources/agents/auth/index.js.map +1 -1
  32. package/resources/agents/auth/index.mjs.map +1 -1
  33. package/resources/agents/auth/invocations.d.mts +26 -31
  34. package/resources/agents/auth/invocations.d.mts.map +1 -1
  35. package/resources/agents/auth/invocations.d.ts +26 -31
  36. package/resources/agents/auth/invocations.d.ts.map +1 -1
  37. package/resources/agents/auth/invocations.js +5 -20
  38. package/resources/agents/auth/invocations.js.map +1 -1
  39. package/resources/agents/auth/invocations.mjs +5 -20
  40. package/resources/agents/auth/invocations.mjs.map +1 -1
  41. package/resources/agents/index.d.mts +1 -1
  42. package/resources/agents/index.d.mts.map +1 -1
  43. package/resources/agents/index.d.ts +1 -1
  44. package/resources/agents/index.d.ts.map +1 -1
  45. package/resources/agents/index.js.map +1 -1
  46. package/resources/agents/index.mjs.map +1 -1
  47. package/resources/browser-pools.d.mts +63 -98
  48. package/resources/browser-pools.d.mts.map +1 -1
  49. package/resources/browser-pools.d.ts +63 -98
  50. package/resources/browser-pools.d.ts.map +1 -1
  51. package/resources/credentials.d.mts +254 -0
  52. package/resources/credentials.d.mts.map +1 -0
  53. package/resources/credentials.d.ts +254 -0
  54. package/resources/credentials.d.ts.map +1 -0
  55. package/resources/credentials.js +101 -0
  56. package/resources/credentials.js.map +1 -0
  57. package/resources/credentials.mjs +97 -0
  58. package/resources/credentials.mjs.map +1 -0
  59. package/resources/index.d.mts +3 -2
  60. package/resources/index.d.mts.map +1 -1
  61. package/resources/index.d.ts +3 -2
  62. package/resources/index.d.ts.map +1 -1
  63. package/resources/index.js +3 -1
  64. package/resources/index.js.map +1 -1
  65. package/resources/index.mjs +1 -0
  66. package/resources/index.mjs.map +1 -1
  67. package/resources/proxies.d.mts +137 -1
  68. package/resources/proxies.d.mts.map +1 -1
  69. package/resources/proxies.d.ts +137 -1
  70. package/resources/proxies.d.ts.map +1 -1
  71. package/resources/proxies.js +6 -0
  72. package/resources/proxies.js.map +1 -1
  73. package/resources/proxies.mjs +6 -0
  74. package/resources/proxies.mjs.map +1 -1
  75. package/src/client.ts +27 -8
  76. package/src/resources/agents/agents.ts +0 -2
  77. package/src/resources/agents/auth/auth.ts +170 -73
  78. package/src/resources/agents/auth/index.ts +0 -2
  79. package/src/resources/agents/auth/invocations.ts +25 -36
  80. package/src/resources/agents/index.ts +0 -1
  81. package/src/resources/browser-pools.ts +72 -115
  82. package/src/resources/credentials.ts +314 -0
  83. package/src/resources/index.ts +12 -4
  84. package/src/resources/proxies.ts +228 -0
  85. package/src/version.ts +1 -1
  86. package/version.d.mts +1 -1
  87. package/version.d.ts +1 -1
  88. package/version.js +1 -1
  89. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"proxies.mjs","sourceRoot":"","sources":["../src/resources/proxies.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;OAEG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,YAAY,EAAE,EAAE,EAAE;YAC/C,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"proxies.mjs","sourceRoot":"","sources":["../src/resources/proxies.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;OAEG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,YAAY,EAAE,EAAE,EAAE;YAC/C,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,EAAU,EAAE,OAAwB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF"}
package/src/client.ts CHANGED
@@ -22,18 +22,25 @@ import { AppListParams, AppListResponse, AppListResponsesOffsetPagination, Apps
22
22
  import {
23
23
  BrowserPool,
24
24
  BrowserPoolAcquireParams,
25
- BrowserPoolAcquireRequest,
26
25
  BrowserPoolAcquireResponse,
27
26
  BrowserPoolCreateParams,
28
27
  BrowserPoolDeleteParams,
29
28
  BrowserPoolListResponse,
30
29
  BrowserPoolReleaseParams,
31
- BrowserPoolReleaseRequest,
32
- BrowserPoolRequest,
33
30
  BrowserPoolUpdateParams,
34
- BrowserPoolUpdateRequest,
35
31
  BrowserPools,
36
32
  } from './resources/browser-pools';
33
+ import {
34
+ CreateCredentialRequest,
35
+ Credential,
36
+ CredentialCreateParams,
37
+ CredentialListParams,
38
+ CredentialTotpCodeResponse,
39
+ CredentialUpdateParams,
40
+ Credentials,
41
+ CredentialsOffsetPagination,
42
+ UpdateCredentialRequest,
43
+ } from './resources/credentials';
37
44
  import {
38
45
  DeploymentCreateParams,
39
46
  DeploymentCreateResponse,
@@ -71,6 +78,7 @@ import {
71
78
  import { ProfileCreateParams, ProfileListResponse, Profiles } from './resources/profiles';
72
79
  import {
73
80
  Proxies,
81
+ ProxyCheckResponse,
74
82
  ProxyCreateParams,
75
83
  ProxyCreateResponse,
76
84
  ProxyListResponse,
@@ -861,6 +869,7 @@ export class Kernel {
861
869
  extensions: API.Extensions = new API.Extensions(this);
862
870
  browserPools: API.BrowserPools = new API.BrowserPools(this);
863
871
  agents: API.Agents = new API.Agents(this);
872
+ credentials: API.Credentials = new API.Credentials(this);
864
873
  }
865
874
 
866
875
  Kernel.Deployments = Deployments;
@@ -872,6 +881,7 @@ Kernel.Proxies = Proxies;
872
881
  Kernel.Extensions = Extensions;
873
882
  Kernel.BrowserPools = BrowserPools;
874
883
  Kernel.Agents = Agents;
884
+ Kernel.Credentials = Credentials;
875
885
 
876
886
  export declare namespace Kernel {
877
887
  export type RequestOptions = Opts.RequestOptions;
@@ -942,6 +952,7 @@ export declare namespace Kernel {
942
952
  type ProxyCreateResponse as ProxyCreateResponse,
943
953
  type ProxyRetrieveResponse as ProxyRetrieveResponse,
944
954
  type ProxyListResponse as ProxyListResponse,
955
+ type ProxyCheckResponse as ProxyCheckResponse,
945
956
  type ProxyCreateParams as ProxyCreateParams,
946
957
  };
947
958
 
@@ -956,10 +967,6 @@ export declare namespace Kernel {
956
967
  export {
957
968
  BrowserPools as BrowserPools,
958
969
  type BrowserPool as BrowserPool,
959
- type BrowserPoolAcquireRequest as BrowserPoolAcquireRequest,
960
- type BrowserPoolReleaseRequest as BrowserPoolReleaseRequest,
961
- type BrowserPoolRequest as BrowserPoolRequest,
962
- type BrowserPoolUpdateRequest as BrowserPoolUpdateRequest,
963
970
  type BrowserPoolListResponse as BrowserPoolListResponse,
964
971
  type BrowserPoolAcquireResponse as BrowserPoolAcquireResponse,
965
972
  type BrowserPoolCreateParams as BrowserPoolCreateParams,
@@ -971,6 +978,18 @@ export declare namespace Kernel {
971
978
 
972
979
  export { Agents as Agents };
973
980
 
981
+ export {
982
+ Credentials as Credentials,
983
+ type CreateCredentialRequest as CreateCredentialRequest,
984
+ type Credential as Credential,
985
+ type UpdateCredentialRequest as UpdateCredentialRequest,
986
+ type CredentialTotpCodeResponse as CredentialTotpCodeResponse,
987
+ type CredentialsOffsetPagination as CredentialsOffsetPagination,
988
+ type CredentialCreateParams as CredentialCreateParams,
989
+ type CredentialUpdateParams as CredentialUpdateParams,
990
+ type CredentialListParams as CredentialListParams,
991
+ };
992
+
974
993
  export type AppAction = API.AppAction;
975
994
  export type BrowserExtension = API.BrowserExtension;
976
995
  export type BrowserProfile = API.BrowserProfile;
@@ -3,7 +3,6 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as AuthAPI from './auth/auth';
5
5
  import {
6
- AgentAuthDiscoverResponse,
7
6
  AgentAuthInvocationResponse,
8
7
  AgentAuthSubmitResponse,
9
8
  Auth,
@@ -26,7 +25,6 @@ Agents.Auth = Auth;
26
25
  export declare namespace Agents {
27
26
  export {
28
27
  Auth as Auth,
29
- type AgentAuthDiscoverResponse as AgentAuthDiscoverResponse,
30
28
  type AgentAuthInvocationResponse as AgentAuthInvocationResponse,
31
29
  type AgentAuthSubmitResponse as AgentAuthSubmitResponse,
32
30
  type AuthAgent as AuthAgent,
@@ -4,7 +4,6 @@ import { APIResource } from '../../../core/resource';
4
4
  import * as InvocationsAPI from './invocations';
5
5
  import {
6
6
  InvocationCreateParams,
7
- InvocationDiscoverParams,
8
7
  InvocationExchangeParams,
9
8
  InvocationExchangeResponse,
10
9
  InvocationSubmitParams,
@@ -12,6 +11,7 @@ import {
12
11
  } from './invocations';
13
12
  import { APIPromise } from '../../../core/api-promise';
14
13
  import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../../core/pagination';
14
+ import { buildHeaders } from '../../../internal/headers';
15
15
  import { RequestOptions } from '../../../internal/request-options';
16
16
  import { path } from '../../../internal/utils/path';
17
17
 
@@ -27,8 +27,8 @@ export class Auth extends APIResource {
27
27
  * @example
28
28
  * ```ts
29
29
  * const authAgent = await client.agents.auth.create({
30
+ * domain: 'netflix.com',
30
31
  * profile_name: 'user-123',
31
- * target_domain: 'netflix.com',
32
32
  * });
33
33
  * ```
34
34
  */
@@ -50,7 +50,7 @@ export class Auth extends APIResource {
50
50
  }
51
51
 
52
52
  /**
53
- * List auth agents with optional filters for profile_name and target_domain.
53
+ * List auth agents with optional filters for profile_name and domain.
54
54
  *
55
55
  * @example
56
56
  * ```ts
@@ -66,109 +66,136 @@ export class Auth extends APIResource {
66
66
  ): PagePromise<AuthAgentsOffsetPagination, AuthAgent> {
67
67
  return this._client.getAPIList('/agents/auth', OffsetPagination<AuthAgent>, { query, ...options });
68
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
+ }
69
88
  }
70
89
 
71
90
  export type AuthAgentsOffsetPagination = OffsetPagination<AuthAgent>;
72
91
 
73
92
  /**
74
- * Response from discover endpoint matching AuthBlueprint schema
93
+ * Response from get invocation endpoint
75
94
  */
76
- export interface AgentAuthDiscoverResponse {
77
- /**
78
- * Whether discovery succeeded
79
- */
80
- success: boolean;
81
-
95
+ export interface AgentAuthInvocationResponse {
82
96
  /**
83
- * Error message if discovery failed
97
+ * App name (org name at time of invocation creation)
84
98
  */
85
- error_message?: string;
99
+ app_name: string;
86
100
 
87
101
  /**
88
- * Discovered form fields (present when success is true)
102
+ * Domain for authentication
89
103
  */
90
- fields?: Array<DiscoveredField>;
104
+ domain: string;
91
105
 
92
106
  /**
93
- * Whether user is already logged in
107
+ * When the handoff code expires
94
108
  */
95
- logged_in?: boolean;
109
+ expires_at: string;
96
110
 
97
111
  /**
98
- * URL of the discovered login page
112
+ * Invocation status
99
113
  */
100
- login_url?: string;
114
+ status: 'IN_PROGRESS' | 'SUCCESS' | 'EXPIRED' | 'CANCELED' | 'FAILED';
101
115
 
102
116
  /**
103
- * Title of the login page
117
+ * Current step in the invocation workflow
104
118
  */
105
- page_title?: string;
106
- }
119
+ step:
120
+ | 'initialized'
121
+ | 'discovering'
122
+ | 'awaiting_input'
123
+ | 'awaiting_external_action'
124
+ | 'submitting'
125
+ | 'completed'
126
+ | 'expired';
107
127
 
108
- /**
109
- * Response from get invocation endpoint
110
- */
111
- export interface AgentAuthInvocationResponse {
112
128
  /**
113
- * App name (org name at time of invocation creation)
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)
114
134
  */
115
- app_name: string;
135
+ type: 'login' | 'auto_login' | 'reauth';
116
136
 
117
137
  /**
118
- * When the handoff code expires
138
+ * Error message explaining why the invocation failed (present when status=FAILED)
119
139
  */
120
- expires_at: string;
140
+ error_message?: string | null;
121
141
 
122
142
  /**
123
- * Invocation status
143
+ * Instructions for user when external action is required (present when
144
+ * step=awaiting_external_action)
124
145
  */
125
- status: 'IN_PROGRESS' | 'SUCCESS' | 'EXPIRED' | 'CANCELED';
146
+ external_action_message?: string | null;
126
147
 
127
148
  /**
128
- * Target domain for authentication
149
+ * Browser live view URL for debugging the invocation
129
150
  */
130
- target_domain: string;
131
- }
151
+ live_view_url?: string | null;
132
152
 
133
- /**
134
- * Response from submit endpoint matching SubmitResult schema
135
- */
136
- export interface AgentAuthSubmitResponse {
137
153
  /**
138
- * Whether submission succeeded
154
+ * Fields currently awaiting input (present when step=awaiting_input)
139
155
  */
140
- success: boolean;
156
+ pending_fields?: Array<DiscoveredField> | null;
141
157
 
142
158
  /**
143
- * Additional fields needed (e.g., OTP) - present when needs_additional_auth is
144
- * true
159
+ * SSO buttons available on the page (present when step=awaiting_input)
145
160
  */
146
- additional_fields?: Array<DiscoveredField>;
161
+ pending_sso_buttons?: Array<AgentAuthInvocationResponse.PendingSSOButton> | null;
147
162
 
148
163
  /**
149
- * App name (only present when logged_in is true)
164
+ * Names of fields that have been submitted (present when step=submitting or later)
150
165
  */
151
- app_name?: string;
166
+ submitted_fields?: Array<string> | null;
167
+ }
152
168
 
169
+ export namespace AgentAuthInvocationResponse {
153
170
  /**
154
- * Error message if submission failed
171
+ * An SSO button for signing in with an external identity provider
155
172
  */
156
- error_message?: string;
173
+ export interface PendingSSOButton {
174
+ /**
175
+ * Visible button text
176
+ */
177
+ label: string;
157
178
 
158
- /**
159
- * Whether user is now logged in
160
- */
161
- logged_in?: boolean;
179
+ /**
180
+ * Identity provider name
181
+ */
182
+ provider: string;
162
183
 
163
- /**
164
- * Whether additional authentication fields are needed
165
- */
166
- needs_additional_auth?: boolean;
184
+ /**
185
+ * XPath selector for the button
186
+ */
187
+ selector: string;
188
+ }
189
+ }
167
190
 
191
+ /**
192
+ * Response from submit endpoint - returns immediately after submission is accepted
193
+ */
194
+ export interface AgentAuthSubmitResponse {
168
195
  /**
169
- * Target domain (only present when logged_in is true)
196
+ * Whether the submission was accepted for processing
170
197
  */
171
- target_domain?: string;
198
+ accepted: boolean;
172
199
  }
173
200
 
174
201
  /**
@@ -196,6 +223,34 @@ export interface AuthAgent {
196
223
  */
197
224
  status: 'AUTHENTICATED' | 'NEEDS_AUTH';
198
225
 
226
+ /**
227
+ * Additional domains that are valid for this auth agent's authentication flow
228
+ * (besides the primary domain). Useful when login pages redirect to different
229
+ * domains.
230
+ */
231
+ allowed_domains?: Array<string>;
232
+
233
+ /**
234
+ * Whether automatic re-authentication is possible (has credential_id, selectors,
235
+ * and login_url)
236
+ */
237
+ can_reauth?: boolean;
238
+
239
+ /**
240
+ * ID of the linked credential for automatic re-authentication
241
+ */
242
+ credential_id?: string;
243
+
244
+ /**
245
+ * Name of the linked credential for automatic re-authentication
246
+ */
247
+ credential_name?: string;
248
+
249
+ /**
250
+ * Whether this auth agent has stored selectors for deterministic re-authentication
251
+ */
252
+ has_selectors?: boolean;
253
+
199
254
  /**
200
255
  * When the last authentication check was performed
201
256
  */
@@ -206,15 +261,29 @@ export interface AuthAgent {
206
261
  * Request to create or find an auth agent
207
262
  */
208
263
  export interface AuthAgentCreateRequest {
264
+ /**
265
+ * Domain for authentication
266
+ */
267
+ domain: string;
268
+
209
269
  /**
210
270
  * Name of the profile to use for this auth agent
211
271
  */
212
272
  profile_name: string;
213
273
 
214
274
  /**
215
- * Target domain for authentication
275
+ * Additional domains that are valid for this auth agent's authentication flow
276
+ * (besides the primary domain). Useful when login pages redirect to different
277
+ * domains.
278
+ */
279
+ allowed_domains?: Array<string>;
280
+
281
+ /**
282
+ * Optional name of an existing credential to use for this auth agent. If provided,
283
+ * the credential will be linked to the agent and its values will be used to
284
+ * auto-fill the login form on invocation.
216
285
  */
217
- target_domain: string;
286
+ credential_name?: string;
218
287
 
219
288
  /**
220
289
  * Optional login page URL. If provided, will be stored on the agent and used to
@@ -248,31 +317,47 @@ export interface AuthAgentInvocationCreateRequest {
248
317
  * ID of the auth agent to create an invocation for
249
318
  */
250
319
  auth_agent_id: string;
320
+
321
+ /**
322
+ * If provided, saves the submitted credentials under this name upon successful
323
+ * login. The credential will be linked to the auth agent for automatic
324
+ * re-authentication.
325
+ */
326
+ save_credential_as?: string;
251
327
  }
252
328
 
253
329
  /**
254
- * Response from creating an auth agent invocation
330
+ * Response from creating an invocation. Always returns an invocation_id.
255
331
  */
256
332
  export interface AuthAgentInvocationCreateResponse {
257
333
  /**
258
- * When the handoff code expires
334
+ * When the handoff code expires.
259
335
  */
260
336
  expires_at: string;
261
337
 
262
338
  /**
263
- * One-time code for handoff
339
+ * One-time code for handoff.
264
340
  */
265
341
  handoff_code: string;
266
342
 
267
343
  /**
268
- * URL to redirect user to
344
+ * URL to redirect user to.
269
345
  */
270
346
  hosted_url: string;
271
347
 
272
348
  /**
273
- * Unique identifier for the invocation
349
+ * Unique identifier for the invocation.
274
350
  */
275
351
  invocation_id: string;
352
+
353
+ /**
354
+ * The invocation type:
355
+ *
356
+ * - login: First-time authentication
357
+ * - reauth: Re-authentication for previously authenticated agents
358
+ * - auto_login: Legacy type (no longer created, kept for backward compatibility)
359
+ */
360
+ type: 'login' | 'auto_login' | 'reauth';
276
361
  }
277
362
 
278
363
  /**
@@ -297,7 +382,7 @@ export interface DiscoveredField {
297
382
  /**
298
383
  * Field type
299
384
  */
300
- type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code';
385
+ type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code' | 'totp';
301
386
 
302
387
  /**
303
388
  * Field placeholder
@@ -311,15 +396,29 @@ export interface DiscoveredField {
311
396
  }
312
397
 
313
398
  export interface AuthCreateParams {
399
+ /**
400
+ * Domain for authentication
401
+ */
402
+ domain: string;
403
+
314
404
  /**
315
405
  * Name of the profile to use for this auth agent
316
406
  */
317
407
  profile_name: string;
318
408
 
319
409
  /**
320
- * Target domain for authentication
410
+ * Additional domains that are valid for this auth agent's authentication flow
411
+ * (besides the primary domain). Useful when login pages redirect to different
412
+ * domains.
413
+ */
414
+ allowed_domains?: Array<string>;
415
+
416
+ /**
417
+ * Optional name of an existing credential to use for this auth agent. If provided,
418
+ * the credential will be linked to the agent and its values will be used to
419
+ * auto-fill the login form on invocation.
321
420
  */
322
- target_domain: string;
421
+ credential_name?: string;
323
422
 
324
423
  /**
325
424
  * Optional login page URL. If provided, will be stored on the agent and used to
@@ -347,21 +446,20 @@ export namespace AuthCreateParams {
347
446
 
348
447
  export interface AuthListParams extends OffsetPaginationParams {
349
448
  /**
350
- * Filter by profile name
449
+ * Filter by domain
351
450
  */
352
- profile_name?: string;
451
+ domain?: string;
353
452
 
354
453
  /**
355
- * Filter by target domain
454
+ * Filter by profile name
356
455
  */
357
- target_domain?: string;
456
+ profile_name?: string;
358
457
  }
359
458
 
360
459
  Auth.Invocations = Invocations;
361
460
 
362
461
  export declare namespace Auth {
363
462
  export {
364
- type AgentAuthDiscoverResponse as AgentAuthDiscoverResponse,
365
463
  type AgentAuthInvocationResponse as AgentAuthInvocationResponse,
366
464
  type AgentAuthSubmitResponse as AgentAuthSubmitResponse,
367
465
  type AuthAgent as AuthAgent,
@@ -378,7 +476,6 @@ export declare namespace Auth {
378
476
  Invocations as Invocations,
379
477
  type InvocationExchangeResponse as InvocationExchangeResponse,
380
478
  type InvocationCreateParams as InvocationCreateParams,
381
- type InvocationDiscoverParams as InvocationDiscoverParams,
382
479
  type InvocationExchangeParams as InvocationExchangeParams,
383
480
  type InvocationSubmitParams as InvocationSubmitParams,
384
481
  };
@@ -2,7 +2,6 @@
2
2
 
3
3
  export {
4
4
  Auth,
5
- type AgentAuthDiscoverResponse,
6
5
  type AgentAuthInvocationResponse,
7
6
  type AgentAuthSubmitResponse,
8
7
  type AuthAgent,
@@ -18,7 +17,6 @@ export {
18
17
  Invocations,
19
18
  type InvocationExchangeResponse,
20
19
  type InvocationCreateParams,
21
- type InvocationDiscoverParams,
22
20
  type InvocationExchangeParams,
23
21
  type InvocationSubmitParams,
24
22
  } from './invocations';
@@ -28,8 +28,8 @@ export class Invocations extends APIResource {
28
28
  }
29
29
 
30
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.
31
+ * Returns invocation details including status, app_name, and domain. Supports both
32
+ * API key and JWT (from exchange endpoint) authentication.
33
33
  *
34
34
  * @example
35
35
  * ```ts
@@ -43,27 +43,6 @@ export class Invocations extends APIResource {
43
43
  return this._client.get(path`/agents/auth/invocations/${invocationID}`, options);
44
44
  }
45
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
46
  /**
68
47
  * Validates the handoff code and returns a JWT token for subsequent requests. No
69
48
  * authentication required (the handoff code serves as the credential).
@@ -86,8 +65,9 @@ export class Invocations extends APIResource {
86
65
  }
87
66
 
88
67
  /**
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.
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.
91
71
  *
92
72
  * @example
93
73
  * ```ts
@@ -132,14 +112,13 @@ export interface InvocationCreateParams {
132
112
  * ID of the auth agent to create an invocation for
133
113
  */
134
114
  auth_agent_id: string;
135
- }
136
115
 
137
- export interface InvocationDiscoverParams {
138
116
  /**
139
- * Optional login page URL. If provided, will override the stored login URL for
140
- * this discovery invocation and skip Phase 1 discovery.
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.
141
120
  */
142
- login_url?: string;
121
+ save_credential_as?: string;
143
122
  }
144
123
 
145
124
  export interface InvocationExchangeParams {
@@ -149,18 +128,28 @@ export interface InvocationExchangeParams {
149
128
  code: string;
150
129
  }
151
130
 
152
- export interface InvocationSubmitParams {
153
- /**
154
- * Values for the discovered login fields
155
- */
156
- field_values: { [key: string]: string };
131
+ export type InvocationSubmitParams = InvocationSubmitParams.Variant0 | InvocationSubmitParams.Variant1;
132
+
133
+ export declare namespace InvocationSubmitParams {
134
+ export interface Variant0 {
135
+ /**
136
+ * Values for the discovered login fields
137
+ */
138
+ field_values: { [key: string]: string };
139
+ }
140
+
141
+ export interface Variant1 {
142
+ /**
143
+ * Selector of SSO button to click
144
+ */
145
+ sso_button: string;
146
+ }
157
147
  }
158
148
 
159
149
  export declare namespace Invocations {
160
150
  export {
161
151
  type InvocationExchangeResponse as InvocationExchangeResponse,
162
152
  type InvocationCreateParams as InvocationCreateParams,
163
- type InvocationDiscoverParams as InvocationDiscoverParams,
164
153
  type InvocationExchangeParams as InvocationExchangeParams,
165
154
  type InvocationSubmitParams as InvocationSubmitParams,
166
155
  };
@@ -3,7 +3,6 @@
3
3
  export { Agents } from './agents';
4
4
  export {
5
5
  Auth,
6
- type AgentAuthDiscoverResponse,
7
6
  type AgentAuthInvocationResponse,
8
7
  type AgentAuthSubmitResponse,
9
8
  type AuthAgent,