@onkernel/sdk 0.22.0 → 0.23.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 (106) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +15 -19
  3. package/client.d.mts +3 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +3 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -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 +294 -0
  21. package/resources/agents/auth/auth.d.mts.map +1 -0
  22. package/resources/agents/auth/auth.d.ts +294 -0
  23. package/resources/agents/auth/auth.d.ts.map +1 -0
  24. package/resources/agents/auth/auth.js +62 -0
  25. package/resources/agents/auth/auth.js.map +1 -0
  26. package/resources/agents/auth/auth.mjs +57 -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 +124 -0
  37. package/resources/agents/auth/invocations.d.mts.map +1 -0
  38. package/resources/agents/auth/invocations.d.ts +124 -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 +24 -23
  69. package/resources/browser-pools.d.mts.map +1 -1
  70. package/resources/browser-pools.d.ts +24 -23
  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/index.d.mts +1 -0
  81. package/resources/index.d.mts.map +1 -1
  82. package/resources/index.d.ts +1 -0
  83. package/resources/index.d.ts.map +1 -1
  84. package/resources/index.js +3 -1
  85. package/resources/index.js.map +1 -1
  86. package/resources/index.mjs +1 -0
  87. package/resources/index.mjs.map +1 -1
  88. package/resources/shared.d.mts +5 -5
  89. package/resources/shared.d.ts +5 -5
  90. package/src/client.ts +5 -0
  91. package/src/resources/agents/agents.ts +41 -0
  92. package/src/resources/agents/auth/auth.ts +385 -0
  93. package/src/resources/agents/auth/index.ts +24 -0
  94. package/src/resources/agents/auth/invocations.ts +167 -0
  95. package/src/resources/agents/auth.ts +3 -0
  96. package/src/resources/agents/index.ts +17 -0
  97. package/src/resources/agents.ts +3 -0
  98. package/src/resources/browser-pools.ts +24 -23
  99. package/src/resources/browsers/browsers.ts +38 -38
  100. package/src/resources/index.ts +1 -0
  101. package/src/resources/shared.ts +5 -5
  102. package/src/version.ts +1 -1
  103. package/version.d.mts +1 -1
  104. package/version.d.ts +1 -1
  105. package/version.js +1 -1
  106. package/version.mjs +1 -1
@@ -0,0 +1,294 @@
1
+ import { APIResource } from "../../../core/resource.mjs";
2
+ import * as InvocationsAPI from "./invocations.mjs";
3
+ import { InvocationCreateParams, InvocationDiscoverParams, InvocationExchangeParams, InvocationExchangeResponse, InvocationSubmitParams, Invocations } from "./invocations.mjs";
4
+ import { APIPromise } from "../../../core/api-promise.mjs";
5
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from "../../../core/pagination.mjs";
6
+ import { RequestOptions } from "../../../internal/request-options.mjs";
7
+ export declare class Auth extends APIResource {
8
+ invocations: InvocationsAPI.Invocations;
9
+ /**
10
+ * Creates a new auth agent for the specified domain and profile combination, or
11
+ * returns an existing one if it already exists. This is idempotent - calling with
12
+ * the same domain and profile will return the same agent. Does NOT start an
13
+ * invocation - use POST /agents/auth/invocations to start an auth flow.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const authAgent = await client.agents.auth.create({
18
+ * profile_name: 'user-123',
19
+ * target_domain: 'netflix.com',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body: AuthCreateParams, options?: RequestOptions): APIPromise<AuthAgent>;
24
+ /**
25
+ * Retrieve an auth agent by its ID. Returns the current authentication status of
26
+ * the managed profile.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const authAgent = await client.agents.auth.retrieve('id');
31
+ * ```
32
+ */
33
+ retrieve(id: string, options?: RequestOptions): APIPromise<AuthAgent>;
34
+ /**
35
+ * List auth agents with optional filters for profile_name and target_domain.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // Automatically fetches more pages as needed.
40
+ * for await (const authAgent of client.agents.auth.list()) {
41
+ * // ...
42
+ * }
43
+ * ```
44
+ */
45
+ list(query?: AuthListParams | null | undefined, options?: RequestOptions): PagePromise<AuthAgentsOffsetPagination, AuthAgent>;
46
+ }
47
+ export type AuthAgentsOffsetPagination = OffsetPagination<AuthAgent>;
48
+ /**
49
+ * Response from discover endpoint matching AuthBlueprint schema
50
+ */
51
+ export interface AgentAuthDiscoverResponse {
52
+ /**
53
+ * Whether discovery succeeded
54
+ */
55
+ success: boolean;
56
+ /**
57
+ * Error message if discovery failed
58
+ */
59
+ error_message?: string;
60
+ /**
61
+ * Discovered form fields (present when success is true)
62
+ */
63
+ fields?: Array<DiscoveredField>;
64
+ /**
65
+ * Whether user is already logged in
66
+ */
67
+ logged_in?: boolean;
68
+ /**
69
+ * URL of the discovered login page
70
+ */
71
+ login_url?: string;
72
+ /**
73
+ * Title of the login page
74
+ */
75
+ page_title?: string;
76
+ }
77
+ /**
78
+ * Response from get invocation endpoint
79
+ */
80
+ export interface AgentAuthInvocationResponse {
81
+ /**
82
+ * App name (org name at time of invocation creation)
83
+ */
84
+ app_name: string;
85
+ /**
86
+ * When the handoff code expires
87
+ */
88
+ expires_at: string;
89
+ /**
90
+ * Invocation status
91
+ */
92
+ status: 'IN_PROGRESS' | 'SUCCESS' | 'EXPIRED' | 'CANCELED';
93
+ /**
94
+ * Target domain for authentication
95
+ */
96
+ target_domain: string;
97
+ }
98
+ /**
99
+ * Response from submit endpoint matching SubmitResult schema
100
+ */
101
+ export interface AgentAuthSubmitResponse {
102
+ /**
103
+ * Whether submission succeeded
104
+ */
105
+ success: boolean;
106
+ /**
107
+ * Additional fields needed (e.g., OTP) - present when needs_additional_auth is
108
+ * true
109
+ */
110
+ additional_fields?: Array<DiscoveredField>;
111
+ /**
112
+ * App name (only present when logged_in is true)
113
+ */
114
+ app_name?: string;
115
+ /**
116
+ * Error message if submission failed
117
+ */
118
+ error_message?: string;
119
+ /**
120
+ * Whether user is now logged in
121
+ */
122
+ logged_in?: boolean;
123
+ /**
124
+ * Whether additional authentication fields are needed
125
+ */
126
+ needs_additional_auth?: boolean;
127
+ /**
128
+ * Target domain (only present when logged_in is true)
129
+ */
130
+ target_domain?: string;
131
+ }
132
+ /**
133
+ * An auth agent that manages authentication for a specific domain and profile
134
+ * combination
135
+ */
136
+ export interface AuthAgent {
137
+ /**
138
+ * Unique identifier for the auth agent
139
+ */
140
+ id: string;
141
+ /**
142
+ * Target domain for authentication
143
+ */
144
+ domain: string;
145
+ /**
146
+ * Name of the profile associated with this auth agent
147
+ */
148
+ profile_name: string;
149
+ /**
150
+ * Current authentication status of the managed profile
151
+ */
152
+ status: 'AUTHENTICATED' | 'NEEDS_AUTH';
153
+ /**
154
+ * When the last authentication check was performed
155
+ */
156
+ last_auth_check_at?: string;
157
+ }
158
+ /**
159
+ * Request to create or find an auth agent
160
+ */
161
+ export interface AuthAgentCreateRequest {
162
+ /**
163
+ * Name of the profile to use for this auth agent
164
+ */
165
+ profile_name: string;
166
+ /**
167
+ * Target domain for authentication
168
+ */
169
+ target_domain: string;
170
+ /**
171
+ * Optional login page URL. If provided, will be stored on the agent and used to
172
+ * skip discovery in future invocations.
173
+ */
174
+ login_url?: string;
175
+ /**
176
+ * Optional proxy configuration
177
+ */
178
+ proxy?: AuthAgentCreateRequest.Proxy;
179
+ }
180
+ export declare namespace AuthAgentCreateRequest {
181
+ /**
182
+ * Optional proxy configuration
183
+ */
184
+ interface Proxy {
185
+ /**
186
+ * ID of the proxy to use
187
+ */
188
+ proxy_id?: string;
189
+ }
190
+ }
191
+ /**
192
+ * Request to create an invocation for an existing auth agent
193
+ */
194
+ export interface AuthAgentInvocationCreateRequest {
195
+ /**
196
+ * ID of the auth agent to create an invocation for
197
+ */
198
+ auth_agent_id: string;
199
+ }
200
+ /**
201
+ * Response from creating an auth agent invocation
202
+ */
203
+ export interface AuthAgentInvocationCreateResponse {
204
+ /**
205
+ * When the handoff code expires
206
+ */
207
+ expires_at: string;
208
+ /**
209
+ * One-time code for handoff
210
+ */
211
+ handoff_code: string;
212
+ /**
213
+ * URL to redirect user to
214
+ */
215
+ hosted_url: string;
216
+ /**
217
+ * Unique identifier for the invocation
218
+ */
219
+ invocation_id: string;
220
+ }
221
+ /**
222
+ * A discovered form field
223
+ */
224
+ export interface DiscoveredField {
225
+ /**
226
+ * Field label
227
+ */
228
+ label: string;
229
+ /**
230
+ * Field name
231
+ */
232
+ name: string;
233
+ /**
234
+ * CSS selector for the field
235
+ */
236
+ selector: string;
237
+ /**
238
+ * Field type
239
+ */
240
+ type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code';
241
+ /**
242
+ * Field placeholder
243
+ */
244
+ placeholder?: string;
245
+ /**
246
+ * Whether field is required
247
+ */
248
+ required?: boolean;
249
+ }
250
+ export interface AuthCreateParams {
251
+ /**
252
+ * Name of the profile to use for this auth agent
253
+ */
254
+ profile_name: string;
255
+ /**
256
+ * Target domain for authentication
257
+ */
258
+ target_domain: string;
259
+ /**
260
+ * Optional login page URL. If provided, will be stored on the agent and used to
261
+ * skip discovery in future invocations.
262
+ */
263
+ login_url?: string;
264
+ /**
265
+ * Optional proxy configuration
266
+ */
267
+ proxy?: AuthCreateParams.Proxy;
268
+ }
269
+ export declare namespace AuthCreateParams {
270
+ /**
271
+ * Optional proxy configuration
272
+ */
273
+ interface Proxy {
274
+ /**
275
+ * ID of the proxy to use
276
+ */
277
+ proxy_id?: string;
278
+ }
279
+ }
280
+ export interface AuthListParams extends OffsetPaginationParams {
281
+ /**
282
+ * Filter by profile name
283
+ */
284
+ profile_name?: string;
285
+ /**
286
+ * Filter by target domain
287
+ */
288
+ target_domain?: string;
289
+ }
290
+ export declare namespace Auth {
291
+ export { type AgentAuthDiscoverResponse as AgentAuthDiscoverResponse, type AgentAuthInvocationResponse as AgentAuthInvocationResponse, type AgentAuthSubmitResponse as AgentAuthSubmitResponse, type AuthAgent as AuthAgent, type AuthAgentCreateRequest as AuthAgentCreateRequest, type AuthAgentInvocationCreateRequest as AuthAgentInvocationCreateRequest, type AuthAgentInvocationCreateResponse as AuthAgentInvocationCreateResponse, type DiscoveredField as DiscoveredField, type AuthAgentsOffsetPagination as AuthAgentsOffsetPagination, type AuthCreateParams as AuthCreateParams, type AuthListParams as AuthListParams, };
292
+ export { Invocations as Invocations, type InvocationExchangeResponse as InvocationExchangeResponse, type InvocationCreateParams as InvocationCreateParams, type InvocationDiscoverParams as InvocationDiscoverParams, type InvocationExchangeParams as InvocationExchangeParams, type InvocationSubmitParams as InvocationSubmitParams, };
293
+ }
294
+ //# sourceMappingURL=auth.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../../../src/resources/agents/auth/auth.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,cAAc;OACnB,EACL,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACZ;OACM,EAAE,UAAU,EAAE;OACd,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE;OAC9D,EAAE,cAAc,EAAE;AAGzB,qBAAa,IAAK,SAAQ,WAAW;IACnC,WAAW,EAAE,cAAc,CAAC,WAAW,CAAgD;IAEvF;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAA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D,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
@@ -0,0 +1,294 @@
1
+ import { APIResource } from "../../../core/resource.js";
2
+ import * as InvocationsAPI from "./invocations.js";
3
+ import { InvocationCreateParams, InvocationDiscoverParams, InvocationExchangeParams, InvocationExchangeResponse, InvocationSubmitParams, Invocations } from "./invocations.js";
4
+ import { APIPromise } from "../../../core/api-promise.js";
5
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from "../../../core/pagination.js";
6
+ import { RequestOptions } from "../../../internal/request-options.js";
7
+ export declare class Auth extends APIResource {
8
+ invocations: InvocationsAPI.Invocations;
9
+ /**
10
+ * Creates a new auth agent for the specified domain and profile combination, or
11
+ * returns an existing one if it already exists. This is idempotent - calling with
12
+ * the same domain and profile will return the same agent. Does NOT start an
13
+ * invocation - use POST /agents/auth/invocations to start an auth flow.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const authAgent = await client.agents.auth.create({
18
+ * profile_name: 'user-123',
19
+ * target_domain: 'netflix.com',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body: AuthCreateParams, options?: RequestOptions): APIPromise<AuthAgent>;
24
+ /**
25
+ * Retrieve an auth agent by its ID. Returns the current authentication status of
26
+ * the managed profile.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const authAgent = await client.agents.auth.retrieve('id');
31
+ * ```
32
+ */
33
+ retrieve(id: string, options?: RequestOptions): APIPromise<AuthAgent>;
34
+ /**
35
+ * List auth agents with optional filters for profile_name and target_domain.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * // Automatically fetches more pages as needed.
40
+ * for await (const authAgent of client.agents.auth.list()) {
41
+ * // ...
42
+ * }
43
+ * ```
44
+ */
45
+ list(query?: AuthListParams | null | undefined, options?: RequestOptions): PagePromise<AuthAgentsOffsetPagination, AuthAgent>;
46
+ }
47
+ export type AuthAgentsOffsetPagination = OffsetPagination<AuthAgent>;
48
+ /**
49
+ * Response from discover endpoint matching AuthBlueprint schema
50
+ */
51
+ export interface AgentAuthDiscoverResponse {
52
+ /**
53
+ * Whether discovery succeeded
54
+ */
55
+ success: boolean;
56
+ /**
57
+ * Error message if discovery failed
58
+ */
59
+ error_message?: string;
60
+ /**
61
+ * Discovered form fields (present when success is true)
62
+ */
63
+ fields?: Array<DiscoveredField>;
64
+ /**
65
+ * Whether user is already logged in
66
+ */
67
+ logged_in?: boolean;
68
+ /**
69
+ * URL of the discovered login page
70
+ */
71
+ login_url?: string;
72
+ /**
73
+ * Title of the login page
74
+ */
75
+ page_title?: string;
76
+ }
77
+ /**
78
+ * Response from get invocation endpoint
79
+ */
80
+ export interface AgentAuthInvocationResponse {
81
+ /**
82
+ * App name (org name at time of invocation creation)
83
+ */
84
+ app_name: string;
85
+ /**
86
+ * When the handoff code expires
87
+ */
88
+ expires_at: string;
89
+ /**
90
+ * Invocation status
91
+ */
92
+ status: 'IN_PROGRESS' | 'SUCCESS' | 'EXPIRED' | 'CANCELED';
93
+ /**
94
+ * Target domain for authentication
95
+ */
96
+ target_domain: string;
97
+ }
98
+ /**
99
+ * Response from submit endpoint matching SubmitResult schema
100
+ */
101
+ export interface AgentAuthSubmitResponse {
102
+ /**
103
+ * Whether submission succeeded
104
+ */
105
+ success: boolean;
106
+ /**
107
+ * Additional fields needed (e.g., OTP) - present when needs_additional_auth is
108
+ * true
109
+ */
110
+ additional_fields?: Array<DiscoveredField>;
111
+ /**
112
+ * App name (only present when logged_in is true)
113
+ */
114
+ app_name?: string;
115
+ /**
116
+ * Error message if submission failed
117
+ */
118
+ error_message?: string;
119
+ /**
120
+ * Whether user is now logged in
121
+ */
122
+ logged_in?: boolean;
123
+ /**
124
+ * Whether additional authentication fields are needed
125
+ */
126
+ needs_additional_auth?: boolean;
127
+ /**
128
+ * Target domain (only present when logged_in is true)
129
+ */
130
+ target_domain?: string;
131
+ }
132
+ /**
133
+ * An auth agent that manages authentication for a specific domain and profile
134
+ * combination
135
+ */
136
+ export interface AuthAgent {
137
+ /**
138
+ * Unique identifier for the auth agent
139
+ */
140
+ id: string;
141
+ /**
142
+ * Target domain for authentication
143
+ */
144
+ domain: string;
145
+ /**
146
+ * Name of the profile associated with this auth agent
147
+ */
148
+ profile_name: string;
149
+ /**
150
+ * Current authentication status of the managed profile
151
+ */
152
+ status: 'AUTHENTICATED' | 'NEEDS_AUTH';
153
+ /**
154
+ * When the last authentication check was performed
155
+ */
156
+ last_auth_check_at?: string;
157
+ }
158
+ /**
159
+ * Request to create or find an auth agent
160
+ */
161
+ export interface AuthAgentCreateRequest {
162
+ /**
163
+ * Name of the profile to use for this auth agent
164
+ */
165
+ profile_name: string;
166
+ /**
167
+ * Target domain for authentication
168
+ */
169
+ target_domain: string;
170
+ /**
171
+ * Optional login page URL. If provided, will be stored on the agent and used to
172
+ * skip discovery in future invocations.
173
+ */
174
+ login_url?: string;
175
+ /**
176
+ * Optional proxy configuration
177
+ */
178
+ proxy?: AuthAgentCreateRequest.Proxy;
179
+ }
180
+ export declare namespace AuthAgentCreateRequest {
181
+ /**
182
+ * Optional proxy configuration
183
+ */
184
+ interface Proxy {
185
+ /**
186
+ * ID of the proxy to use
187
+ */
188
+ proxy_id?: string;
189
+ }
190
+ }
191
+ /**
192
+ * Request to create an invocation for an existing auth agent
193
+ */
194
+ export interface AuthAgentInvocationCreateRequest {
195
+ /**
196
+ * ID of the auth agent to create an invocation for
197
+ */
198
+ auth_agent_id: string;
199
+ }
200
+ /**
201
+ * Response from creating an auth agent invocation
202
+ */
203
+ export interface AuthAgentInvocationCreateResponse {
204
+ /**
205
+ * When the handoff code expires
206
+ */
207
+ expires_at: string;
208
+ /**
209
+ * One-time code for handoff
210
+ */
211
+ handoff_code: string;
212
+ /**
213
+ * URL to redirect user to
214
+ */
215
+ hosted_url: string;
216
+ /**
217
+ * Unique identifier for the invocation
218
+ */
219
+ invocation_id: string;
220
+ }
221
+ /**
222
+ * A discovered form field
223
+ */
224
+ export interface DiscoveredField {
225
+ /**
226
+ * Field label
227
+ */
228
+ label: string;
229
+ /**
230
+ * Field name
231
+ */
232
+ name: string;
233
+ /**
234
+ * CSS selector for the field
235
+ */
236
+ selector: string;
237
+ /**
238
+ * Field type
239
+ */
240
+ type: 'text' | 'email' | 'password' | 'tel' | 'number' | 'url' | 'code';
241
+ /**
242
+ * Field placeholder
243
+ */
244
+ placeholder?: string;
245
+ /**
246
+ * Whether field is required
247
+ */
248
+ required?: boolean;
249
+ }
250
+ export interface AuthCreateParams {
251
+ /**
252
+ * Name of the profile to use for this auth agent
253
+ */
254
+ profile_name: string;
255
+ /**
256
+ * Target domain for authentication
257
+ */
258
+ target_domain: string;
259
+ /**
260
+ * Optional login page URL. If provided, will be stored on the agent and used to
261
+ * skip discovery in future invocations.
262
+ */
263
+ login_url?: string;
264
+ /**
265
+ * Optional proxy configuration
266
+ */
267
+ proxy?: AuthCreateParams.Proxy;
268
+ }
269
+ export declare namespace AuthCreateParams {
270
+ /**
271
+ * Optional proxy configuration
272
+ */
273
+ interface Proxy {
274
+ /**
275
+ * ID of the proxy to use
276
+ */
277
+ proxy_id?: string;
278
+ }
279
+ }
280
+ export interface AuthListParams extends OffsetPaginationParams {
281
+ /**
282
+ * Filter by profile name
283
+ */
284
+ profile_name?: string;
285
+ /**
286
+ * Filter by target domain
287
+ */
288
+ target_domain?: string;
289
+ }
290
+ export declare namespace Auth {
291
+ export { type AgentAuthDiscoverResponse as AgentAuthDiscoverResponse, type AgentAuthInvocationResponse as AgentAuthInvocationResponse, type AgentAuthSubmitResponse as AgentAuthSubmitResponse, type AuthAgent as AuthAgent, type AuthAgentCreateRequest as AuthAgentCreateRequest, type AuthAgentInvocationCreateRequest as AuthAgentInvocationCreateRequest, type AuthAgentInvocationCreateResponse as AuthAgentInvocationCreateResponse, type DiscoveredField as DiscoveredField, type AuthAgentsOffsetPagination as AuthAgentsOffsetPagination, type AuthCreateParams as AuthCreateParams, type AuthListParams as AuthListParams, };
292
+ export { Invocations as Invocations, type InvocationExchangeResponse as InvocationExchangeResponse, type InvocationCreateParams as InvocationCreateParams, type InvocationDiscoverParams as InvocationDiscoverParams, type InvocationExchangeParams as InvocationExchangeParams, type InvocationSubmitParams as InvocationSubmitParams, };
293
+ }
294
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/resources/agents/auth/auth.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,cAAc;OACnB,EACL,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACZ;OACM,EAAE,UAAU,EAAE;OACd,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE;OAC9D,EAAE,cAAc,EAAE;AAGzB,qBAAa,IAAK,SAAQ,WAAW;IACnC,WAAW,EAAE,cAAc,CAAC,WAAW,CAAgD;IAEvF;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;IAI/E;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;IAIrE;;;;;;;;;;OAUG;IACH,IAAI,CACF,KAAK,GAAE,cAAc,GAAG,IAAI,GAAG,SAAc,EAC7C,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,0BAA0B,EAAE,SAAS,CAAC;CAGtD;AAED,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,a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ED,yBAAiB,gBAAgB,CAAC;IAChC;;OAEG;IACH,UAAiB,KAAK;QACpB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;CACF;AAED,MAAM,WAAW,cAAe,SAAQ,sBAAsB;IAC5D;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Auth = void 0;
5
+ const tslib_1 = require("../../../internal/tslib.js");
6
+ const resource_1 = require("../../../core/resource.js");
7
+ const InvocationsAPI = tslib_1.__importStar(require("./invocations.js"));
8
+ const invocations_1 = require("./invocations.js");
9
+ const pagination_1 = require("../../../core/pagination.js");
10
+ const path_1 = require("../../../internal/utils/path.js");
11
+ class Auth extends resource_1.APIResource {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.invocations = new InvocationsAPI.Invocations(this._client);
15
+ }
16
+ /**
17
+ * Creates a new auth agent for the specified domain and profile combination, or
18
+ * returns an existing one if it already exists. This is idempotent - calling with
19
+ * the same domain and profile will return the same agent. Does NOT start an
20
+ * invocation - use POST /agents/auth/invocations to start an auth flow.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const authAgent = await client.agents.auth.create({
25
+ * profile_name: 'user-123',
26
+ * target_domain: 'netflix.com',
27
+ * });
28
+ * ```
29
+ */
30
+ create(body, options) {
31
+ return this._client.post('/agents/auth', { body, ...options });
32
+ }
33
+ /**
34
+ * Retrieve an auth agent by its ID. Returns the current authentication status of
35
+ * the managed profile.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const authAgent = await client.agents.auth.retrieve('id');
40
+ * ```
41
+ */
42
+ retrieve(id, options) {
43
+ return this._client.get((0, path_1.path) `/agents/auth/${id}`, options);
44
+ }
45
+ /**
46
+ * List auth agents with optional filters for profile_name and target_domain.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * // Automatically fetches more pages as needed.
51
+ * for await (const authAgent of client.agents.auth.list()) {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ list(query = {}, options) {
57
+ return this._client.getAPIList('/agents/auth', (pagination_1.OffsetPagination), { query, ...options });
58
+ }
59
+ }
60
+ exports.Auth = Auth;
61
+ Auth.Invocations = invocations_1.Invocations;
62
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/resources/agents/auth/auth.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,yEAAgD;AAChD,kDAOuB;AAEvB,4DAAsG;AAEtG,0DAAoD;AAEpD,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,gBAAW,GAA+B,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAkDzF,CAAC;IAhDC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAA2C,EAAE,EAC7C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,6BAA2B,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;CACF;AAnDD,oBAmDC;AAmSD,IAAI,CAAC,WAAW,GAAG,yBAAW,CAAC"}