@browserbasehq/sdk 2.19.1 → 2.21.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 (70) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/index.d.mts +9 -0
  3. package/index.d.ts +9 -0
  4. package/index.d.ts.map +1 -1
  5. package/index.js +9 -0
  6. package/index.js.map +1 -1
  7. package/index.mjs +9 -0
  8. package/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/agents/agents.d.ts +4 -4
  11. package/resources/agents/runs.d.ts +24 -8
  12. package/resources/agents/runs.d.ts.map +1 -1
  13. package/resources/functions/functions.d.ts +10 -0
  14. package/resources/functions/functions.d.ts.map +1 -0
  15. package/resources/functions/functions.js +49 -0
  16. package/resources/functions/functions.js.map +1 -0
  17. package/resources/functions/functions.mjs +12 -0
  18. package/resources/functions/functions.mjs.map +1 -0
  19. package/resources/functions/index.d.ts +3 -0
  20. package/resources/functions/index.d.ts.map +1 -0
  21. package/resources/functions/index.js +9 -0
  22. package/resources/functions/index.js.map +1 -0
  23. package/resources/functions/index.mjs +4 -0
  24. package/resources/functions/index.mjs.map +1 -0
  25. package/resources/functions/secrets.d.ts +74 -0
  26. package/resources/functions/secrets.d.ts.map +1 -0
  27. package/resources/functions/secrets.js +39 -0
  28. package/resources/functions/secrets.js.map +1 -0
  29. package/resources/functions/secrets.mjs +35 -0
  30. package/resources/functions/secrets.mjs.map +1 -0
  31. package/resources/functions.d.ts +2 -0
  32. package/resources/functions.d.ts.map +1 -0
  33. package/resources/functions.js +19 -0
  34. package/resources/functions.js.map +1 -0
  35. package/resources/functions.mjs +3 -0
  36. package/resources/functions.mjs.map +1 -0
  37. package/resources/index.d.ts +3 -0
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +7 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +3 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/resources/search.d.ts +1 -1
  44. package/resources/secrets.d.ts +142 -0
  45. package/resources/secrets.d.ts.map +1 -0
  46. package/resources/secrets.js +50 -0
  47. package/resources/secrets.js.map +1 -0
  48. package/resources/secrets.mjs +46 -0
  49. package/resources/secrets.mjs.map +1 -0
  50. package/resources/webhooks.d.ts +147 -0
  51. package/resources/webhooks.d.ts.map +1 -0
  52. package/resources/webhooks.js +57 -0
  53. package/resources/webhooks.js.map +1 -0
  54. package/resources/webhooks.mjs +53 -0
  55. package/resources/webhooks.mjs.map +1 -0
  56. package/src/index.ts +51 -0
  57. package/src/resources/agents/agents.ts +4 -4
  58. package/src/resources/agents/runs.ts +25 -8
  59. package/src/resources/functions/functions.ts +20 -0
  60. package/src/resources/functions/index.ts +4 -0
  61. package/src/resources/functions/secrets.ts +117 -0
  62. package/src/resources/functions.ts +3 -0
  63. package/src/resources/index.ts +21 -0
  64. package/src/resources/search.ts +1 -1
  65. package/src/resources/secrets.ts +196 -0
  66. package/src/resources/webhooks.ts +241 -0
  67. package/src/version.ts +1 -1
  68. package/version.d.ts +1 -1
  69. package/version.js +1 -1
  70. package/version.mjs +1 -1
@@ -0,0 +1,196 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+
7
+ export class Secrets extends APIResource {
8
+ /**
9
+ * Create Secret
10
+ */
11
+ create(body: SecretCreateParams, options?: Core.RequestOptions): Core.APIPromise<Secret> {
12
+ return this._client.post('/v1/secrets', { body, ...options });
13
+ }
14
+
15
+ /**
16
+ * Get Secret
17
+ */
18
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Secret> {
19
+ return this._client.get(`/v1/secrets/${id}`, options);
20
+ }
21
+
22
+ /**
23
+ * Replace a secret's value. The name cannot be changed; to rename, create a new
24
+ * secret and delete the old one.
25
+ */
26
+ update(id: string, body: SecretUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Secret> {
27
+ return this._client.patch(`/v1/secrets/${id}`, { body, ...options });
28
+ }
29
+
30
+ /**
31
+ * List project secrets. Supports filtering by creation time.
32
+ */
33
+ list(query?: SecretListParams, options?: Core.RequestOptions): Core.APIPromise<SecretListResponse>;
34
+ list(options?: Core.RequestOptions): Core.APIPromise<SecretListResponse>;
35
+ list(
36
+ query: SecretListParams | Core.RequestOptions = {},
37
+ options?: Core.RequestOptions,
38
+ ): Core.APIPromise<SecretListResponse> {
39
+ if (isRequestOptions(query)) {
40
+ return this.list({}, query);
41
+ }
42
+ return this._client.get('/v1/secrets', { query, ...options });
43
+ }
44
+
45
+ /**
46
+ * Delete Secret
47
+ */
48
+ delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
49
+ return this._client.delete(`/v1/secrets/${id}`, {
50
+ ...options,
51
+ headers: { Accept: '*/*', ...options?.headers },
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Get Secrets Keypair
57
+ */
58
+ getPublicKey(options?: Core.RequestOptions): Core.APIPromise<SecretsKeypair> {
59
+ return this._client.get('/v1/secrets/keypair', options);
60
+ }
61
+ }
62
+
63
+ export interface Secret {
64
+ /**
65
+ * Unique identifier of the secret.
66
+ */
67
+ id: string;
68
+
69
+ /**
70
+ * The name the secret value is stored under.
71
+ */
72
+ secretKey: string;
73
+ }
74
+
75
+ export interface SecretsKeypair {
76
+ /**
77
+ * Identifier of the keypair the public key was minted from. Pass this back when
78
+ * creating a secret so the ciphertext records which keypair sealed it, which keeps
79
+ * decryption correct across keypair rotation.
80
+ */
81
+ id: string;
82
+
83
+ /**
84
+ * The project's HPKE public encryption key, base64-encoded. Encrypt secret values
85
+ * with this key before creating a secret.
86
+ */
87
+ publicKey: string;
88
+ }
89
+
90
+ /**
91
+ * A page of secrets.
92
+ */
93
+ export interface SecretListResponse {
94
+ /**
95
+ * The page of matching secrets.
96
+ */
97
+ data: Array<Secret>;
98
+
99
+ /**
100
+ * The maximum number of results returned in this page.
101
+ */
102
+ limit: number;
103
+
104
+ /**
105
+ * Cursor for the next page. Pass it back as `cursor` on the next request to
106
+ * continue paging. null when there are no more results.
107
+ */
108
+ nextCursor: string | null;
109
+ }
110
+
111
+ export interface SecretCreateParams {
112
+ /**
113
+ * The `id` returned by GET /v1/secrets/keypair, identifying the keypair whose
114
+ * public key encrypted the value. Recorded with the secret so decryption stays
115
+ * correct across keypair rotation.
116
+ */
117
+ keypairId: string;
118
+
119
+ /**
120
+ * The secret value encrypted with HPKE. In order to seal the secret value before
121
+ * sending, get the project's public key from GET /v1/secrets/keypair. Decode the
122
+ * publicKey using base64 into the raw 32-byte public key. Then, use HPKE Base mode
123
+ * (RFC 9180) with the following algorithm suite: DHKEM(X25519, HKDF-SHA256),
124
+ * HKDF-SHA256, and AES-256-GCM. Set both info and additional authenticated data
125
+ * (AAD) to an empty byte string. Then, create a new sender context using the
126
+ * public key and these settings, and encrypt the secret value as one message. Put
127
+ * the 32-byte encapsulated key before the ciphertext and keep the authentication
128
+ * tag at the end of the ciphertext. Encode the combined bytes with standard
129
+ * base64. Send the result as sealedSecretValue: base64(enc || ciphertext)
130
+ */
131
+ sealedSecretValue: string;
132
+
133
+ /**
134
+ * The name to store the secret value under.
135
+ */
136
+ secretKey: string;
137
+ }
138
+
139
+ export interface SecretUpdateParams {
140
+ /**
141
+ * The `id` returned by GET /v1/secrets/keypair, identifying the keypair whose
142
+ * public key encrypted the value. Recorded with the secret so decryption stays
143
+ * correct across keypair rotation.
144
+ */
145
+ keypairId: string;
146
+
147
+ /**
148
+ * The new secret value encrypted with HPKE. In order to seal the secret value
149
+ * before sending, get the project's public key from GET /v1/secrets/keypair.
150
+ * Decode the publicKey using base64 into the raw 32-byte public key. Then, use
151
+ * HPKE Base mode (RFC 9180) with the following algorithm suite: DHKEM(X25519,
152
+ * HKDF-SHA256), HKDF-SHA256, and AES-256-GCM. Set both info and additional
153
+ * authenticated data (AAD) to an empty byte string. Then, create a new sender
154
+ * context using the public key and these settings, and encrypt the secret value as
155
+ * one message. Put the 32-byte encapsulated key before the ciphertext and keep the
156
+ * authentication tag at the end of the ciphertext. Encode the combined bytes with
157
+ * standard base64. Send the result as sealedSecretValue: base64(enc || ciphertext)
158
+ */
159
+ sealedSecretValue: string;
160
+ }
161
+
162
+ export interface SecretListParams {
163
+ /**
164
+ * Pagination cursor. Pass the nextCursor from the previous response to fetch the
165
+ * next page. Omit to start from the first page.
166
+ */
167
+ cursor?: string;
168
+
169
+ /**
170
+ * Only return secrets created on or before this timestamp (inclusive). RFC 3339,
171
+ * e.g. 2026-01-20T00:00:00Z.
172
+ */
173
+ endAt?: string;
174
+
175
+ /**
176
+ * Maximum number of results to return.
177
+ */
178
+ limit?: number;
179
+
180
+ /**
181
+ * Only return secrets created on or after this timestamp (inclusive). RFC 3339,
182
+ * e.g. 2026-01-19T00:00:00Z.
183
+ */
184
+ startAt?: string;
185
+ }
186
+
187
+ export declare namespace Secrets {
188
+ export {
189
+ type Secret as Secret,
190
+ type SecretsKeypair as SecretsKeypair,
191
+ type SecretListResponse as SecretListResponse,
192
+ type SecretCreateParams as SecretCreateParams,
193
+ type SecretUpdateParams as SecretUpdateParams,
194
+ type SecretListParams as SecretListParams,
195
+ };
196
+ }
@@ -0,0 +1,241 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+
7
+ export class Webhooks extends APIResource {
8
+ /**
9
+ * Register an HTTPS endpoint to receive events for this project. The response
10
+ * includes the signing secret, which is shown only here and when the secret is
11
+ * rotated. Store it before discarding the response. An endpoint may only be
12
+ * registered once per project.
13
+ */
14
+ create(body: WebhookCreateParams, options?: Core.RequestOptions): Core.APIPromise<WebhookCreateResponse> {
15
+ return this._client.post('/v1/webhooks', { body, ...options });
16
+ }
17
+
18
+ /**
19
+ * Retrieve a single webhook by ID. The signing secret is not included; it is only
20
+ * ever returned on create and rotate.
21
+ */
22
+ retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Webhook> {
23
+ return this._client.get(`/v1/webhooks/${id}`, options);
24
+ }
25
+
26
+ /**
27
+ * Update a webhook's endpoint URL, its subscribed event types, or both. Omitted
28
+ * fields are left unchanged. `eventTypes` replaces the existing subscription
29
+ * rather than adding to it. The signing secret is unaffected.
30
+ */
31
+ update(id: string, body: WebhookUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Webhook> {
32
+ return this._client.patch(`/v1/webhooks/${id}`, { body, ...options });
33
+ }
34
+
35
+ /**
36
+ * List the project's webhooks, newest first. Signing secrets are not included.
37
+ * Page by passing the previous response's `nextCursor` as `cursor`; a null
38
+ * `nextCursor` means there are no further pages.
39
+ */
40
+ list(query?: WebhookListParams, options?: Core.RequestOptions): Core.APIPromise<WebhookListResponse>;
41
+ list(options?: Core.RequestOptions): Core.APIPromise<WebhookListResponse>;
42
+ list(
43
+ query: WebhookListParams | Core.RequestOptions = {},
44
+ options?: Core.RequestOptions,
45
+ ): Core.APIPromise<WebhookListResponse> {
46
+ if (isRequestOptions(query)) {
47
+ return this.list({}, query);
48
+ }
49
+ return this._client.get('/v1/webhooks', { query, ...options });
50
+ }
51
+
52
+ /**
53
+ * Delete a webhook. Deliveries stop immediately and the signing secret is retired.
54
+ * Events that occurred before the delete are not replayed if the endpoint is
55
+ * registered again.
56
+ */
57
+ delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
58
+ return this._client.delete(`/v1/webhooks/${id}`, {
59
+ ...options,
60
+ headers: { Accept: '*/*', ...options?.headers },
61
+ });
62
+ }
63
+
64
+ /**
65
+ * Issue a new signing secret for a webhook. By default the previous secret keeps
66
+ * verifying for 24 hours so a receiver can be updated without dropping deliveries;
67
+ * pass `revokeImmediately` to end that window at once. The new secret is returned
68
+ * only here.
69
+ */
70
+ rotateSecret(
71
+ id: string,
72
+ body?: WebhookRotateSecretParams,
73
+ options?: Core.RequestOptions,
74
+ ): Core.APIPromise<WebhookRotateSecretResponse>;
75
+ rotateSecret(id: string, options?: Core.RequestOptions): Core.APIPromise<WebhookRotateSecretResponse>;
76
+ rotateSecret(
77
+ id: string,
78
+ body: WebhookRotateSecretParams | Core.RequestOptions = {},
79
+ options?: Core.RequestOptions,
80
+ ): Core.APIPromise<WebhookRotateSecretResponse> {
81
+ if (isRequestOptions(body)) {
82
+ return this.rotateSecret(id, {}, body);
83
+ }
84
+ return this._client.post(`/v1/webhooks/${id}/secret`, { body, ...options });
85
+ }
86
+ }
87
+
88
+ /**
89
+ * A delivery endpoint for a project. Browserbase POSTs a signed event to it
90
+ * whenever one of its subscribed event types occurs. The signing secret is
91
+ * returned only when it is created or rotated.
92
+ */
93
+ export interface Webhook {
94
+ /**
95
+ * Unique identifier for the webhook.
96
+ */
97
+ id: string;
98
+
99
+ createdAt: string;
100
+
101
+ /**
102
+ * HTTPS URL that event deliveries are POSTed to. Must be publicly reachable.
103
+ */
104
+ endpoint: string;
105
+
106
+ /**
107
+ * Event types this webhook subscribes to. Unknown types are rejected.
108
+ */
109
+ eventTypes: Array<
110
+ | 'functions.builds.running'
111
+ | 'functions.builds.completed'
112
+ | 'functions.builds.failed'
113
+ | 'functions.invocations.pending'
114
+ | 'functions.invocations.running'
115
+ | 'functions.invocations.completed'
116
+ | 'functions.invocations.failed'
117
+ >;
118
+
119
+ /**
120
+ * The project the webhook belongs to.
121
+ */
122
+ projectId: string;
123
+
124
+ updatedAt: string;
125
+ }
126
+
127
+ /**
128
+ * The created webhook, including its signing secret.
129
+ */
130
+ export interface WebhookCreateResponse extends Webhook {
131
+ /**
132
+ * HMAC-SHA256 signing secret, prefixed `whsec_`. Shown once here; store it now.
133
+ * Use it to verify the signature on every delivery.
134
+ */
135
+ secret: string;
136
+ }
137
+
138
+ /**
139
+ * A page of webhooks. Signing secrets are not included.
140
+ */
141
+ export interface WebhookListResponse {
142
+ /**
143
+ * The page of webhooks, newest first.
144
+ */
145
+ data: Array<Webhook>;
146
+
147
+ /**
148
+ * The maximum number of results returned in this page.
149
+ */
150
+ limit: number;
151
+
152
+ /**
153
+ * Cursor for the next page. Pass it back as `cursor` to continue paging. null when
154
+ * there are no more results.
155
+ */
156
+ nextCursor: string | null;
157
+ }
158
+
159
+ /**
160
+ * The new signing secret. Shown once; store it now.
161
+ */
162
+ export interface WebhookRotateSecretResponse {
163
+ /**
164
+ * The new signing secret, prefixed `whsec_`.
165
+ */
166
+ secret: string;
167
+ }
168
+
169
+ export interface WebhookCreateParams {
170
+ /**
171
+ * HTTPS URL that event deliveries are POSTed to. Must be publicly reachable.
172
+ */
173
+ endpoint: string;
174
+
175
+ /**
176
+ * Event types this webhook subscribes to. Unknown types are rejected.
177
+ */
178
+ eventTypes: Array<
179
+ | 'functions.builds.running'
180
+ | 'functions.builds.completed'
181
+ | 'functions.builds.failed'
182
+ | 'functions.invocations.pending'
183
+ | 'functions.invocations.running'
184
+ | 'functions.invocations.completed'
185
+ | 'functions.invocations.failed'
186
+ >;
187
+ }
188
+
189
+ export interface WebhookUpdateParams {
190
+ /**
191
+ * HTTPS URL that event deliveries are POSTed to. Must be publicly reachable.
192
+ */
193
+ endpoint?: string;
194
+
195
+ /**
196
+ * Event types this webhook subscribes to. Unknown types are rejected.
197
+ */
198
+ eventTypes?: Array<
199
+ | 'functions.builds.running'
200
+ | 'functions.builds.completed'
201
+ | 'functions.builds.failed'
202
+ | 'functions.invocations.pending'
203
+ | 'functions.invocations.running'
204
+ | 'functions.invocations.completed'
205
+ | 'functions.invocations.failed'
206
+ >;
207
+ }
208
+
209
+ export interface WebhookListParams {
210
+ /**
211
+ * Cursor from a previous response's `nextCursor`. Omit for the first page.
212
+ */
213
+ cursor?: string;
214
+
215
+ /**
216
+ * Maximum number of results to return.
217
+ */
218
+ limit?: number;
219
+ }
220
+
221
+ export interface WebhookRotateSecretParams {
222
+ /**
223
+ * Expire the old secret at once instead of honouring it for 24 hours. Use when
224
+ * responding to a leak; deliveries signed with the old secret stop verifying
225
+ * immediately.
226
+ */
227
+ revokeImmediately?: boolean;
228
+ }
229
+
230
+ export declare namespace Webhooks {
231
+ export {
232
+ type Webhook as Webhook,
233
+ type WebhookCreateResponse as WebhookCreateResponse,
234
+ type WebhookListResponse as WebhookListResponse,
235
+ type WebhookRotateSecretResponse as WebhookRotateSecretResponse,
236
+ type WebhookCreateParams as WebhookCreateParams,
237
+ type WebhookUpdateParams as WebhookUpdateParams,
238
+ type WebhookListParams as WebhookListParams,
239
+ type WebhookRotateSecretParams as WebhookRotateSecretParams,
240
+ };
241
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.19.1'; // x-release-please-version
1
+ export const VERSION = '2.21.0'; // x-release-please-version
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.19.1";
1
+ export declare const VERSION = "2.21.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.19.1'; // x-release-please-version
4
+ exports.VERSION = '2.21.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.19.1'; // x-release-please-version
1
+ export const VERSION = '2.21.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map