@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
@@ -162,7 +162,7 @@ export interface BrowserPool {
162
162
  /**
163
163
  * Configuration used to create all browsers in this pool
164
164
  */
165
- browser_pool_config: BrowserPoolRequest;
165
+ browser_pool_config: BrowserPool.BrowserPoolConfig;
166
166
 
167
167
  /**
168
168
  * Timestamp when the browser pool was created
@@ -175,118 +175,79 @@ export interface BrowserPool {
175
175
  name?: string;
176
176
  }
177
177
 
178
- /**
179
- * Request body for acquiring a browser from the pool.
180
- */
181
- export interface BrowserPoolAcquireRequest {
182
- /**
183
- * Maximum number of seconds to wait for a browser to be available. Defaults to the
184
- * calculated time it would take to fill the pool at the currently configured fill
185
- * rate.
186
- */
187
- acquire_timeout_seconds?: number;
188
- }
189
-
190
- /**
191
- * Request body for releasing a browser back to the pool.
192
- */
193
- export interface BrowserPoolReleaseRequest {
194
- /**
195
- * Browser session ID to release back to the pool
196
- */
197
- session_id: string;
198
-
199
- /**
200
- * Whether to reuse the browser instance or destroy it and create a new one.
201
- * Defaults to true.
202
- */
203
- reuse?: boolean;
204
- }
205
-
206
- /**
207
- * Parameters for creating a browser pool. All browsers in the pool will be created
208
- * with the same configuration.
209
- */
210
- export interface BrowserPoolRequest {
211
- /**
212
- * Number of browsers to create in the pool
213
- */
214
- size: number;
215
-
216
- /**
217
- * List of browser extensions to load into the session. Provide each by id or name.
218
- */
219
- extensions?: Array<Shared.BrowserExtension>;
220
-
221
- /**
222
- * Percentage of the pool to fill per minute. Defaults to 10%.
223
- */
224
- fill_rate_per_minute?: number;
225
-
226
- /**
227
- * If true, launches the browser using a headless image. Defaults to false.
228
- */
229
- headless?: boolean;
230
-
231
- /**
232
- * If true, launches the browser in kiosk mode to hide address bar and tabs in live
233
- * view.
234
- */
235
- kiosk_mode?: boolean;
236
-
237
- /**
238
- * Optional name for the browser pool. Must be unique within the organization.
239
- */
240
- name?: string;
241
-
242
- /**
243
- * Profile selection for the browser session. Provide either id or name. If
244
- * specified, the matching profile will be loaded into the browser session.
245
- * Profiles must be created beforehand.
246
- */
247
- profile?: Shared.BrowserProfile;
248
-
178
+ export namespace BrowserPool {
249
179
  /**
250
- * Optional proxy to associate to the browser session. Must reference a proxy
251
- * belonging to the caller's org.
252
- */
253
- proxy_id?: string;
254
-
255
- /**
256
- * If true, launches the browser in stealth mode to reduce detection by anti-bot
257
- * mechanisms.
258
- */
259
- stealth?: boolean;
260
-
261
- /**
262
- * Default idle timeout in seconds for browsers acquired from this pool before they
263
- * are destroyed. Defaults to 600 seconds if not specified
264
- */
265
- timeout_seconds?: number;
266
-
267
- /**
268
- * Initial browser window size in pixels with optional refresh rate. If omitted,
269
- * image defaults apply (1920x1080@25). Only specific viewport configurations are
270
- * supported. The server will reject unsupported combinations. Supported
271
- * resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
272
- * 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
273
- * automatically determined from the width and height if they match a supported
274
- * configuration exactly. Note: Higher resolutions may affect the responsiveness of
275
- * live view browser
276
- */
277
- viewport?: Shared.BrowserViewport;
278
- }
279
-
280
- /**
281
- * Parameters for updating a browser pool. All browsers in the pool will be created
282
- * with the same configuration.
283
- */
284
- export interface BrowserPoolUpdateRequest extends BrowserPoolRequest {
285
- /**
286
- * Whether to discard all idle browsers and rebuild the pool immediately. Defaults
287
- * to false.
180
+ * Configuration used to create all browsers in this pool
288
181
  */
289
- discard_all_idle?: boolean;
182
+ export interface BrowserPoolConfig {
183
+ /**
184
+ * Number of browsers to create in the pool
185
+ */
186
+ size: number;
187
+
188
+ /**
189
+ * List of browser extensions to load into the session. Provide each by id or name.
190
+ */
191
+ extensions?: Array<Shared.BrowserExtension>;
192
+
193
+ /**
194
+ * Percentage of the pool to fill per minute. Defaults to 10%.
195
+ */
196
+ fill_rate_per_minute?: number;
197
+
198
+ /**
199
+ * If true, launches the browser using a headless image. Defaults to false.
200
+ */
201
+ headless?: boolean;
202
+
203
+ /**
204
+ * If true, launches the browser in kiosk mode to hide address bar and tabs in live
205
+ * view.
206
+ */
207
+ kiosk_mode?: boolean;
208
+
209
+ /**
210
+ * Optional name for the browser pool. Must be unique within the organization.
211
+ */
212
+ name?: string;
213
+
214
+ /**
215
+ * Profile selection for the browser session. Provide either id or name. If
216
+ * specified, the matching profile will be loaded into the browser session.
217
+ * Profiles must be created beforehand.
218
+ */
219
+ profile?: Shared.BrowserProfile;
220
+
221
+ /**
222
+ * Optional proxy to associate to the browser session. Must reference a proxy
223
+ * belonging to the caller's org.
224
+ */
225
+ proxy_id?: string;
226
+
227
+ /**
228
+ * If true, launches the browser in stealth mode to reduce detection by anti-bot
229
+ * mechanisms.
230
+ */
231
+ stealth?: boolean;
232
+
233
+ /**
234
+ * Default idle timeout in seconds for browsers acquired from this pool before they
235
+ * are destroyed. Defaults to 600 seconds if not specified
236
+ */
237
+ timeout_seconds?: number;
238
+
239
+ /**
240
+ * Initial browser window size in pixels with optional refresh rate. If omitted,
241
+ * image defaults apply (1920x1080@25). Only specific viewport configurations are
242
+ * supported. The server will reject unsupported combinations. Supported
243
+ * resolutions are: 2560x1440@10, 1920x1080@25, 1920x1200@25, 1440x900@25,
244
+ * 1024x768@60, 1200x800@60 If refresh_rate is not provided, it will be
245
+ * automatically determined from the width and height if they match a supported
246
+ * configuration exactly. Note: Higher resolutions may affect the responsiveness of
247
+ * live view browser
248
+ */
249
+ viewport?: Shared.BrowserViewport;
250
+ }
290
251
  }
291
252
 
292
253
  export type BrowserPoolListResponse = Array<BrowserPool>;
@@ -546,10 +507,6 @@ export interface BrowserPoolReleaseParams {
546
507
  export declare namespace BrowserPools {
547
508
  export {
548
509
  type BrowserPool as BrowserPool,
549
- type BrowserPoolAcquireRequest as BrowserPoolAcquireRequest,
550
- type BrowserPoolReleaseRequest as BrowserPoolReleaseRequest,
551
- type BrowserPoolRequest as BrowserPoolRequest,
552
- type BrowserPoolUpdateRequest as BrowserPoolUpdateRequest,
553
510
  type BrowserPoolListResponse as BrowserPoolListResponse,
554
511
  type BrowserPoolAcquireResponse as BrowserPoolAcquireResponse,
555
512
  type BrowserPoolCreateParams as BrowserPoolCreateParams,
@@ -0,0 +1,314 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination';
6
+ import { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ export class Credentials extends APIResource {
11
+ /**
12
+ * Create a new credential for storing login information.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const credential = await client.credentials.create({
17
+ * domain: 'netflix.com',
18
+ * name: 'my-netflix-login',
19
+ * values: {
20
+ * username: 'user@example.com',
21
+ * password: 'mysecretpassword',
22
+ * },
23
+ * });
24
+ * ```
25
+ */
26
+ create(body: CredentialCreateParams, options?: RequestOptions): APIPromise<Credential> {
27
+ return this._client.post('/credentials', { body, ...options });
28
+ }
29
+
30
+ /**
31
+ * Retrieve a credential by its ID or name. Credential values are not returned.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const credential = await client.credentials.retrieve(
36
+ * 'id_or_name',
37
+ * );
38
+ * ```
39
+ */
40
+ retrieve(idOrName: string, options?: RequestOptions): APIPromise<Credential> {
41
+ return this._client.get(path`/credentials/${idOrName}`, options);
42
+ }
43
+
44
+ /**
45
+ * Update a credential's name or values. When values are provided, they are merged
46
+ * with existing values (new keys are added, existing keys are overwritten).
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const credential = await client.credentials.update(
51
+ * 'id_or_name',
52
+ * );
53
+ * ```
54
+ */
55
+ update(idOrName: string, body: CredentialUpdateParams, options?: RequestOptions): APIPromise<Credential> {
56
+ return this._client.patch(path`/credentials/${idOrName}`, { body, ...options });
57
+ }
58
+
59
+ /**
60
+ * List credentials owned by the caller's organization. Credential values are not
61
+ * returned.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * // Automatically fetches more pages as needed.
66
+ * for await (const credential of client.credentials.list()) {
67
+ * // ...
68
+ * }
69
+ * ```
70
+ */
71
+ list(
72
+ query: CredentialListParams | null | undefined = {},
73
+ options?: RequestOptions,
74
+ ): PagePromise<CredentialsOffsetPagination, Credential> {
75
+ return this._client.getAPIList('/credentials', OffsetPagination<Credential>, { query, ...options });
76
+ }
77
+
78
+ /**
79
+ * Delete a credential by its ID or name.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await client.credentials.delete('id_or_name');
84
+ * ```
85
+ */
86
+ delete(idOrName: string, options?: RequestOptions): APIPromise<void> {
87
+ return this._client.delete(path`/credentials/${idOrName}`, {
88
+ ...options,
89
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
90
+ });
91
+ }
92
+
93
+ /**
94
+ * Returns the current 6-digit TOTP code for a credential with a configured
95
+ * totp_secret. Use this to complete 2FA setup on sites or when you need a fresh
96
+ * code.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const response = await client.credentials.totpCode(
101
+ * 'id_or_name',
102
+ * );
103
+ * ```
104
+ */
105
+ totpCode(idOrName: string, options?: RequestOptions): APIPromise<CredentialTotpCodeResponse> {
106
+ return this._client.get(path`/credentials/${idOrName}/totp-code`, options);
107
+ }
108
+ }
109
+
110
+ export type CredentialsOffsetPagination = OffsetPagination<Credential>;
111
+
112
+ /**
113
+ * Request to create a new credential
114
+ */
115
+ export interface CreateCredentialRequest {
116
+ /**
117
+ * Target domain this credential is for
118
+ */
119
+ domain: string;
120
+
121
+ /**
122
+ * Unique name for the credential within the organization
123
+ */
124
+ name: string;
125
+
126
+ /**
127
+ * Field name to value mapping (e.g., username, password)
128
+ */
129
+ values: { [key: string]: string };
130
+
131
+ /**
132
+ * If set, indicates this credential should be used with the specified SSO provider
133
+ * (e.g., google, github, microsoft). When the target site has a matching SSO
134
+ * button, it will be clicked first before filling credential values on the
135
+ * identity provider's login page.
136
+ */
137
+ sso_provider?: string;
138
+
139
+ /**
140
+ * Base32-encoded TOTP secret for generating one-time passwords. Used for automatic
141
+ * 2FA during login.
142
+ */
143
+ totp_secret?: string;
144
+ }
145
+
146
+ /**
147
+ * A stored credential for automatic re-authentication
148
+ */
149
+ export interface Credential {
150
+ /**
151
+ * Unique identifier for the credential
152
+ */
153
+ id: string;
154
+
155
+ /**
156
+ * When the credential was created
157
+ */
158
+ created_at: string;
159
+
160
+ /**
161
+ * Target domain this credential is for
162
+ */
163
+ domain: string;
164
+
165
+ /**
166
+ * Unique name for the credential within the organization
167
+ */
168
+ name: string;
169
+
170
+ /**
171
+ * When the credential was last updated
172
+ */
173
+ updated_at: string;
174
+
175
+ /**
176
+ * Whether this credential has a TOTP secret configured for automatic 2FA
177
+ */
178
+ has_totp_secret?: boolean;
179
+
180
+ /**
181
+ * If set, indicates this credential should be used with the specified SSO provider
182
+ * (e.g., google, github, microsoft). When the target site has a matching SSO
183
+ * button, it will be clicked first before filling credential values on the
184
+ * identity provider's login page.
185
+ */
186
+ sso_provider?: string | null;
187
+
188
+ /**
189
+ * Current 6-digit TOTP code. Only included in create/update responses when
190
+ * totp_secret was just set.
191
+ */
192
+ totp_code?: string;
193
+
194
+ /**
195
+ * When the totp_code expires. Only included when totp_code is present.
196
+ */
197
+ totp_code_expires_at?: string;
198
+ }
199
+
200
+ /**
201
+ * Request to update an existing credential
202
+ */
203
+ export interface UpdateCredentialRequest {
204
+ /**
205
+ * New name for the credential
206
+ */
207
+ name?: string;
208
+
209
+ /**
210
+ * If set, indicates this credential should be used with the specified SSO
211
+ * provider. Set to empty string or null to remove.
212
+ */
213
+ sso_provider?: string | null;
214
+
215
+ /**
216
+ * Base32-encoded TOTP secret for generating one-time passwords. Spaces and
217
+ * formatting are automatically normalized. Set to empty string to remove.
218
+ */
219
+ totp_secret?: string;
220
+
221
+ /**
222
+ * Field name to value mapping. Values are merged with existing values (new keys
223
+ * added, existing keys overwritten).
224
+ */
225
+ values?: { [key: string]: string };
226
+ }
227
+
228
+ export interface CredentialTotpCodeResponse {
229
+ /**
230
+ * Current 6-digit TOTP code
231
+ */
232
+ code: string;
233
+
234
+ /**
235
+ * When this code expires (ISO 8601 timestamp)
236
+ */
237
+ expires_at: string;
238
+ }
239
+
240
+ export interface CredentialCreateParams {
241
+ /**
242
+ * Target domain this credential is for
243
+ */
244
+ domain: string;
245
+
246
+ /**
247
+ * Unique name for the credential within the organization
248
+ */
249
+ name: string;
250
+
251
+ /**
252
+ * Field name to value mapping (e.g., username, password)
253
+ */
254
+ values: { [key: string]: string };
255
+
256
+ /**
257
+ * If set, indicates this credential should be used with the specified SSO provider
258
+ * (e.g., google, github, microsoft). When the target site has a matching SSO
259
+ * button, it will be clicked first before filling credential values on the
260
+ * identity provider's login page.
261
+ */
262
+ sso_provider?: string;
263
+
264
+ /**
265
+ * Base32-encoded TOTP secret for generating one-time passwords. Used for automatic
266
+ * 2FA during login.
267
+ */
268
+ totp_secret?: string;
269
+ }
270
+
271
+ export interface CredentialUpdateParams {
272
+ /**
273
+ * New name for the credential
274
+ */
275
+ name?: string;
276
+
277
+ /**
278
+ * If set, indicates this credential should be used with the specified SSO
279
+ * provider. Set to empty string or null to remove.
280
+ */
281
+ sso_provider?: string | null;
282
+
283
+ /**
284
+ * Base32-encoded TOTP secret for generating one-time passwords. Spaces and
285
+ * formatting are automatically normalized. Set to empty string to remove.
286
+ */
287
+ totp_secret?: string;
288
+
289
+ /**
290
+ * Field name to value mapping. Values are merged with existing values (new keys
291
+ * added, existing keys overwritten).
292
+ */
293
+ values?: { [key: string]: string };
294
+ }
295
+
296
+ export interface CredentialListParams extends OffsetPaginationParams {
297
+ /**
298
+ * Filter by domain
299
+ */
300
+ domain?: string;
301
+ }
302
+
303
+ export declare namespace Credentials {
304
+ export {
305
+ type CreateCredentialRequest as CreateCredentialRequest,
306
+ type Credential as Credential,
307
+ type UpdateCredentialRequest as UpdateCredentialRequest,
308
+ type CredentialTotpCodeResponse as CredentialTotpCodeResponse,
309
+ type CredentialsOffsetPagination as CredentialsOffsetPagination,
310
+ type CredentialCreateParams as CredentialCreateParams,
311
+ type CredentialUpdateParams as CredentialUpdateParams,
312
+ type CredentialListParams as CredentialListParams,
313
+ };
314
+ }
@@ -11,10 +11,6 @@ export {
11
11
  export {
12
12
  BrowserPools,
13
13
  type BrowserPool,
14
- type BrowserPoolAcquireRequest,
15
- type BrowserPoolReleaseRequest,
16
- type BrowserPoolRequest,
17
- type BrowserPoolUpdateRequest,
18
14
  type BrowserPoolListResponse,
19
15
  type BrowserPoolAcquireResponse,
20
16
  type BrowserPoolCreateParams,
@@ -36,6 +32,17 @@ export {
36
32
  type BrowserLoadExtensionsParams,
37
33
  type BrowserListResponsesOffsetPagination,
38
34
  } from './browsers/browsers';
35
+ export {
36
+ Credentials,
37
+ type CreateCredentialRequest,
38
+ type Credential,
39
+ type UpdateCredentialRequest,
40
+ type CredentialTotpCodeResponse,
41
+ type CredentialCreateParams,
42
+ type CredentialUpdateParams,
43
+ type CredentialListParams,
44
+ type CredentialsOffsetPagination,
45
+ } from './credentials';
39
46
  export {
40
47
  Deployments,
41
48
  type DeploymentStateEvent,
@@ -75,5 +82,6 @@ export {
75
82
  type ProxyCreateResponse,
76
83
  type ProxyRetrieveResponse,
77
84
  type ProxyListResponse,
85
+ type ProxyCheckResponse,
78
86
  type ProxyCreateParams,
79
87
  } from './proxies';