@parcha/agentrun-computer 0.1.0-beta.35 → 0.1.0-beta.37

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 (148) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +423 -323
  3. package/box/Dockerfile +3 -1
  4. package/box/agentrun-archil +59 -7
  5. package/box/build-agent37.mjs +177 -0
  6. package/box/build-daytona.py +20 -4
  7. package/dist/agent37.d.ts +165 -0
  8. package/dist/agent37.js +759 -0
  9. package/dist/attach.d.ts +146 -0
  10. package/dist/attach.js +469 -0
  11. package/dist/browser.d.ts +61 -10
  12. package/dist/browser.js +125 -3
  13. package/dist/browserbase.d.ts +46 -23
  14. package/dist/browserbase.js +162 -17
  15. package/dist/chrome.d.ts +3 -4
  16. package/dist/chrome.js +6 -11
  17. package/dist/client.d.ts +33 -1
  18. package/dist/client.js +53 -0
  19. package/dist/computerd-linux-amd64 +0 -0
  20. package/dist/computerd-linux-arm64 +0 -0
  21. package/dist/conformance/agent37.d.ts +96 -0
  22. package/dist/conformance/agent37.js +154 -0
  23. package/dist/conformance/cases/apps.d.ts +5 -0
  24. package/dist/conformance/cases/apps.js +160 -73
  25. package/dist/conformance/cases/health.js +14 -0
  26. package/dist/conformance/cases/index.js +2 -0
  27. package/dist/conformance/cases/provider.js +27 -1
  28. package/dist/conformance/cases/screen.d.ts +3 -0
  29. package/dist/conformance/cases/screen.js +18 -0
  30. package/dist/conformance/cases/settings.d.ts +29 -23
  31. package/dist/conformance/cases/settings.js +76 -58
  32. package/dist/conformance/cases/touch.js +19 -17
  33. package/dist/conformance/cases/ui.d.ts +2 -0
  34. package/dist/conformance/cases/ui.js +475 -0
  35. package/dist/conformance/cli.d.ts +9 -0
  36. package/dist/conformance/cli.js +28 -3
  37. package/dist/conformance/daytona.d.ts +4 -0
  38. package/dist/conformance/daytona.js +5 -0
  39. package/dist/conformance/e2b.d.ts +6 -0
  40. package/dist/conformance/e2b.js +9 -2
  41. package/dist/conformance/fixture.d.ts +1 -1
  42. package/dist/conformance/fixture.js +25 -1
  43. package/dist/conformance/modal.d.ts +17 -13
  44. package/dist/conformance/modal.js +18 -9
  45. package/dist/conformance/orgo.d.ts +3 -3
  46. package/dist/conformance/orgo.js +6 -8
  47. package/dist/conformance/phone-harness.d.ts +6 -2
  48. package/dist/conformance/phone-harness.js +21 -4
  49. package/dist/conformance/report.js +1 -1
  50. package/dist/conformance/runner.js +23 -4
  51. package/dist/conformance/sweep.d.ts +50 -0
  52. package/dist/conformance/sweep.js +187 -0
  53. package/dist/conformance/types.d.ts +11 -3
  54. package/dist/conformance/ui-fixture.d.ts +56 -0
  55. package/dist/conformance/ui-fixture.js +43 -0
  56. package/dist/create-requests.d.ts +51 -0
  57. package/dist/create-requests.js +121 -0
  58. package/dist/daytona.d.ts +15 -5
  59. package/dist/daytona.js +58 -38
  60. package/dist/descriptor.d.ts +29 -2
  61. package/dist/descriptor.js +13 -0
  62. package/dist/descriptors/agent37.d.ts +41 -0
  63. package/dist/descriptors/agent37.js +28 -0
  64. package/dist/descriptors/browserbase.d.ts +1 -0
  65. package/dist/descriptors/browserbase.js +2 -0
  66. package/dist/descriptors/daytona.d.ts +23 -2
  67. package/dist/descriptors/daytona.js +34 -2
  68. package/dist/descriptors/index.d.ts +66 -3
  69. package/dist/descriptors/index.js +5 -3
  70. package/dist/descriptors/kernel.d.ts +1 -0
  71. package/dist/descriptors/kernel.js +2 -0
  72. package/dist/descriptors/modal.d.ts +4 -0
  73. package/dist/descriptors/modal.js +11 -1
  74. package/dist/descriptors/orgo.d.ts +13 -1
  75. package/dist/descriptors/orgo.js +9 -3
  76. package/dist/descriptors/phone-harness.d.ts +6 -1
  77. package/dist/descriptors/phone-harness.js +5 -2
  78. package/dist/docker/egress.d.ts +4 -3
  79. package/dist/docker/egress.js +7 -6
  80. package/dist/docker.d.ts +7 -4
  81. package/dist/docker.js +278 -34
  82. package/dist/e2b.d.ts +9 -165
  83. package/dist/e2b.js +282 -1342
  84. package/dist/fake-ui-driver.d.ts +97 -0
  85. package/dist/fake-ui-driver.js +717 -0
  86. package/dist/host.d.ts +182 -0
  87. package/dist/host.js +1 -0
  88. package/dist/hosted/process.d.ts +67 -0
  89. package/dist/hosted/process.js +228 -0
  90. package/dist/hosted/provider.d.ts +146 -0
  91. package/dist/hosted/provider.js +1364 -0
  92. package/dist/hosted/scripts.d.ts +76 -0
  93. package/dist/{child.js → hosted/scripts.js} +93 -12
  94. package/dist/index.d.ts +11 -7
  95. package/dist/index.js +10 -7
  96. package/dist/janitor.d.ts +5 -4
  97. package/dist/janitor.js +1 -1
  98. package/dist/kernel.d.ts +17 -27
  99. package/dist/kernel.js +94 -18
  100. package/dist/kinds.d.ts +17 -5
  101. package/dist/kinds.js +20 -4
  102. package/dist/labels.d.ts +10 -2
  103. package/dist/labels.js +30 -7
  104. package/dist/local-chrome.d.ts +5 -5
  105. package/dist/local-chrome.js +10 -5
  106. package/dist/modal.d.ts +23 -181
  107. package/dist/modal.js +273 -1232
  108. package/dist/mount-archil.d.ts +25 -3
  109. package/dist/mount-archil.js +39 -8
  110. package/dist/orgo-channel.d.ts +3 -2
  111. package/dist/orgo-channel.js +5 -2
  112. package/dist/orgo-desktop.d.ts +23 -9
  113. package/dist/orgo-desktop.js +328 -66
  114. package/dist/orgo-names.d.ts +129 -3
  115. package/dist/orgo-names.js +211 -8
  116. package/dist/orgo-workspaces.d.ts +47 -0
  117. package/dist/orgo-workspaces.js +94 -0
  118. package/dist/orgo.d.ts +27 -10
  119. package/dist/orgo.js +411 -81
  120. package/dist/phone-harness.d.ts +31 -21
  121. package/dist/phone-harness.js +510 -681
  122. package/dist/png.d.ts +4 -0
  123. package/dist/png.js +27 -0
  124. package/dist/protocol.d.ts +338 -30
  125. package/dist/protocol.js +96 -3
  126. package/dist/provider.d.ts +97 -7
  127. package/dist/provider.js +24 -3
  128. package/dist/result.d.ts +1 -1
  129. package/dist/surface/api.d.ts +248 -0
  130. package/dist/surface/api.js +1 -0
  131. package/dist/surface/core.d.ts +42 -0
  132. package/dist/surface/core.js +393 -0
  133. package/dist/surface/index.d.ts +5 -0
  134. package/dist/surface/index.js +3 -0
  135. package/dist/surface/outline.d.ts +8 -0
  136. package/dist/surface/outline.js +50 -0
  137. package/dist/surface/script.d.ts +10 -0
  138. package/dist/surface/script.js +92 -0
  139. package/dist/ui-engine.d.ts +114 -0
  140. package/dist/ui-engine.js +798 -0
  141. package/package.json +17 -1
  142. package/dist/child.d.ts +0 -42
  143. package/dist/conformance/e2b-diagnose.d.ts +0 -16
  144. package/dist/conformance/e2b-diagnose.js +0 -61
  145. package/dist/conformance/e2b-sweep.d.ts +0 -18
  146. package/dist/conformance/e2b-sweep.js +0 -132
  147. package/dist/conformance/modal-sweep.d.ts +0 -22
  148. package/dist/conformance/modal-sweep.js +0 -213
package/dist/browser.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { type ComputerClient, type Group, type HelloResult } from "./protocol.js";
2
- import type { ComputerCapabilities, ComputerSpec, Refusal } from "./provider.js";
2
+ import type { BrowserFeatures, CallContext, ComputerCapabilities, ComputerProvider, ComputerRef, ComputerSpec, Refusal } from "./provider.js";
3
3
  import { type ComputerError, type ComputerErrorCode, type Result } from "./result.js";
4
4
  /**
5
- * Where a provider keeps the URLs it was handed, by session id, in memory only. Default a Map of its own; a host that
6
- * builds one provider per call passes one store to all of them (pi-browser's process-wide holdings).
5
+ * Where a provider keeps the URLs it was handed, by session id, in memory only: a Map of its own.
7
6
  */
8
7
  export interface UrlStore {
9
8
  get(id: string): string | undefined;
@@ -77,8 +76,9 @@ export declare const RECOVER_MS = 30000;
77
76
  export declare function recoverCreate(what: string, find: (signal: AbortSignal) => Promise<Result<string[]>>, release: (id: string) => Promise<Result<void>>, sleep: (ms: number) => Promise<void>): Promise<string>;
78
77
  /**
79
78
  * The checks every browser provider makes before a vendor call: the image is chromium, the lifetime is within the
80
- * vendor's cap (and at least min), the network is open, the labels are ones the vendor's metadata holds, and no field a
81
- * browser does not take (a size, a user, a workdir, a mount).
79
+ * vendor's cap (and at least min), the network is open, the labels are ones the vendor's metadata holds, the session's
80
+ * options are ones capabilities().browser declares (browserSpecRefusals), and no field a browser does not take (a size,
81
+ * a user, a workdir, a mount).
82
82
  */
83
83
  export declare function checkBrowser(spec: ComputerSpec, capabilities: ComputerCapabilities, vendor: string, minLifetimeMs?: number): Refusal[];
84
84
  /** hello for a browser: the provider's version, linux, kind browser and its groups. The vendor reports no arch. */
@@ -126,6 +126,12 @@ export declare function vendorFailure(vendor: string, name: string, call: string
126
126
  * redirects refused; this holds the CDP URL itself to the same.
127
127
  */
128
128
  export declare function cdpUrlProblem(url: unknown, name: string, domain: string): string | undefined;
129
+ /** What a REST call sends: a JSON body, a query and a signal. */
130
+ export interface RestInit {
131
+ body?: unknown;
132
+ query?: URLSearchParams;
133
+ signal?: AbortSignal;
134
+ }
129
135
  /** What the REST calls share: one request, never retried, read whole; a failure throws a BrowserVendorError. */
130
136
  export interface RestReply {
131
137
  status: number;
@@ -139,12 +145,57 @@ export declare function restCall(o: {
139
145
  fetch: typeof fetch;
140
146
  base: string;
141
147
  headers: Record<string, string>;
142
- }, method: string, route: string, call: string, init?: {
143
- body?: unknown;
144
- query?: URLSearchParams;
145
- signal?: AbortSignal;
146
- }): Promise<RestReply>;
148
+ }, method: string, route: string, call: string, init?: RestInit): Promise<RestReply>;
147
149
  /** An https base URL, with no trailing slash, so a key never crosses in the clear; throws in words on another. */
148
150
  export declare function httpsBase(url: string, what: string): string;
149
151
  /** A vendor's session id as a ref or attach gives it: a plain token, never a path. */
150
152
  export declare const idProblem: (id: unknown, vendor: string) => string | undefined;
153
+ /**
154
+ * A GET whose success is bytes, streamed (Accept application/octet-stream); undefined when the vendor answers 404. A
155
+ * redirect is followed once, to https only, and without the key's headers, so a storage host is never handed the key.
156
+ * A failure throws a BrowserVendorError that names the call and the status alone.
157
+ */
158
+ export declare function restBytes(o: {
159
+ vendor: string;
160
+ fetch: typeof fetch;
161
+ base: string;
162
+ headers: Record<string, string>;
163
+ }, route: string, call: string, signal?: AbortSignal): Promise<AsyncIterable<Uint8Array> | undefined>;
164
+ /** The bytes as they come, failing in words once they pass maxBytes: what reached the reader before then is all it gets. */
165
+ export declare function limitedBytes(body: AsyncIterable<Uint8Array>, maxBytes: number, what: string): AsyncIterable<Uint8Array>;
166
+ /** One file a session downloaded, as downloads.list gives it. */
167
+ export interface BrowserFile {
168
+ name: string;
169
+ sizeBytes: number;
170
+ modifiedAt: string | null;
171
+ }
172
+ /** Saved profiles: a pointer is a capability (whoever holds it opens the profile), so no error's words carry one. */
173
+ export interface BrowserProfiles {
174
+ create(context?: CallContext): Promise<Result<string>>;
175
+ /** A profile the vendor no longer knows is removed. */
176
+ remove(pointer: string, context?: CallContext): Promise<Result<void>>;
177
+ }
178
+ /** The files a session downloaded, kept by the vendor. */
179
+ export interface BrowserDownloads {
180
+ list(ref: ComputerRef, context?: CallContext): Promise<Result<BrowserFile[]>>;
181
+ /** The file's bytes, streamed; the stream fails in words once it passes maxBytes. */
182
+ read(ref: ComputerRef, name: string, maxBytes: number, context?: CallContext): Promise<Result<AsyncIterable<Uint8Array>>>;
183
+ }
184
+ /**
185
+ * A provider of browsers, with the members its features may bring: profiles where capabilities().browser declares
186
+ * profiles, downloads where it declares downloads.
187
+ */
188
+ export interface BrowserComputerProvider extends ComputerProvider {
189
+ readonly profiles?: BrowserProfiles;
190
+ readonly downloads?: BrowserDownloads;
191
+ }
192
+ /** Whether a provider is a browser provider: its capabilities are of kind browser and declare its sessions' features. */
193
+ export declare function isBrowserProvider(provider: ComputerProvider): provider is BrowserComputerProvider;
194
+ /** A profile's pointer as a provider takes it: a plain token, so it is a path segment and never a path. */
195
+ export declare const pointerOk: (pointer: unknown) => pointer is string;
196
+ /**
197
+ * Why spec.browser is not one this provider takes, field by field: a malformed option, or one its features
198
+ * (capabilities().browser) do not declare (a flag set false asks for nothing, so it is never refused). The words never
199
+ * carry a pointer.
200
+ */
201
+ export declare function browserSpecRefusals(session: unknown, features: BrowserFeatures, vendor: string): Refusal[];
package/dist/browser.js CHANGED
@@ -109,16 +109,18 @@ export async function recoverCreate(what, find, release, sleep) {
109
109
  }
110
110
  return words.join("; ");
111
111
  }
112
- const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "labels", "gpu"]);
112
+ const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "labels", "gpu", "browser"]);
113
113
  /**
114
114
  * The checks every browser provider makes before a vendor call: the image is chromium, the lifetime is within the
115
- * vendor's cap (and at least min), the network is open, the labels are ones the vendor's metadata holds, and no field a
116
- * browser does not take (a size, a user, a workdir, a mount).
115
+ * vendor's cap (and at least min), the network is open, the labels are ones the vendor's metadata holds, the session's
116
+ * options are ones capabilities().browser declares (browserSpecRefusals), and no field a browser does not take (a size,
117
+ * a user, a workdir, a mount).
117
118
  */
118
119
  export function checkBrowser(spec, capabilities, vendor, minLifetimeMs = 1) {
119
120
  const refusals = [];
120
121
  const given = (typeof spec === "object" && spec !== null ? spec : {});
121
122
  const { image, lifetimeMs, network, labels } = given;
123
+ refusals.push(...browserSpecRefusals(given.browser, capabilities.browser ?? { timeout: "wall-clock" }, vendor));
122
124
  if (image !== BROWSER_IMAGE)
123
125
  refusals.push({ field: "image", message: `a ${vendor} computer runs ${vendor}'s own Chromium: image is "${BROWSER_IMAGE}", not ${JSON.stringify(image)}` });
124
126
  const lifetime = checkLifetime(lifetimeMs, capabilities);
@@ -308,3 +310,123 @@ export function httpsBase(url, what) {
308
310
  }
309
311
  /** A vendor's session id as a ref or attach gives it: a plain token, never a path. */
310
312
  export const idProblem = (id, vendor) => typeof id === "string" && /^[A-Za-z0-9_.:-]{1,128}$/.test(id) ? undefined : `${typeof id === "string" ? JSON.stringify(id) : String(id)} is not a ${vendor} session's id`;
313
+ /**
314
+ * A GET whose success is bytes, streamed (Accept application/octet-stream); undefined when the vendor answers 404. A
315
+ * redirect is followed once, to https only, and without the key's headers, so a storage host is never handed the key.
316
+ * A failure throws a BrowserVendorError that names the call and the status alone.
317
+ */
318
+ export async function restBytes(o, route, call, signal) {
319
+ const get = (url, headers) => o.fetch(url, { method: "GET", headers: { ...headers, Accept: "application/octet-stream" }, redirect: "manual", ...(signal ? { signal } : {}) });
320
+ const drop = (response) => response.body?.cancel().catch(() => undefined);
321
+ let response;
322
+ try {
323
+ response = await get(`${o.base}${route}`, o.headers);
324
+ if (response.status >= 300 && response.status < 400) {
325
+ const location = response.headers.get("location");
326
+ await drop(response);
327
+ let next;
328
+ try {
329
+ next = location ? new URL(location, `${o.base}${route}`) : undefined;
330
+ }
331
+ catch {
332
+ next = undefined;
333
+ }
334
+ if (next === undefined)
335
+ throw new BrowserVendorError(o.vendor, call, response.status, "no_location");
336
+ if (next.protocol !== "https:")
337
+ throw new BrowserVendorError(o.vendor, call, response.status, "redirect_not_https");
338
+ response = await get(next.href, {});
339
+ }
340
+ }
341
+ catch (error) {
342
+ if (isAbort(error) || error instanceof BrowserVendorError)
343
+ throw error;
344
+ throw new BrowserVendorError(o.vendor, call, undefined, undefined, { cause: error });
345
+ }
346
+ if (response.status === 404) {
347
+ await drop(response);
348
+ return undefined;
349
+ }
350
+ if (!response.ok) {
351
+ await drop(response);
352
+ throw new BrowserVendorError(o.vendor, call, response.status);
353
+ }
354
+ if (response.body === null)
355
+ throw new BrowserVendorError(o.vendor, call, response.status, "no_body");
356
+ return response.body;
357
+ }
358
+ /** The bytes as they come, failing in words once they pass maxBytes: what reached the reader before then is all it gets. */
359
+ export async function* limitedBytes(body, maxBytes, what) {
360
+ let total = 0;
361
+ for await (const chunk of body) {
362
+ total += chunk.byteLength;
363
+ if (total > maxBytes)
364
+ throw new Error(`${what} is larger than the ${maxBytes}-byte limit`);
365
+ yield chunk;
366
+ }
367
+ }
368
+ /** Whether a provider is a browser provider: its capabilities are of kind browser and declare its sessions' features. */
369
+ export function isBrowserProvider(provider) {
370
+ let capabilities;
371
+ try {
372
+ capabilities = typeof provider?.capabilities === "function" ? provider.capabilities() : undefined;
373
+ }
374
+ catch {
375
+ return false;
376
+ }
377
+ const browser = capabilities?.browser;
378
+ return capabilities?.kind === "browser" && typeof browser === "object" && browser !== null;
379
+ }
380
+ /** A viewport's longest side, in pixels. */
381
+ const MAX_VIEWPORT = 10_000;
382
+ const SESSION_FIELDS = new Set(["viewport", "profile", "stealth", "headless"]);
383
+ /** A profile's pointer as a provider takes it: a plain token, so it is a path segment and never a path. */
384
+ export const pointerOk = (pointer) => typeof pointer === "string" && /^[A-Za-z0-9_.:-]{1,128}$/.test(pointer);
385
+ const only = (value, fields) => Object.keys(value).every((key) => fields.includes(key));
386
+ /**
387
+ * Why spec.browser is not one this provider takes, field by field: a malformed option, or one its features
388
+ * (capabilities().browser) do not declare (a flag set false asks for nothing, so it is never refused). The words never
389
+ * carry a pointer.
390
+ */
391
+ export function browserSpecRefusals(session, features, vendor) {
392
+ if (session === undefined)
393
+ return [];
394
+ if (typeof session !== "object" || session === null || Array.isArray(session))
395
+ return [{ field: "browser", message: "a browser's options are an object" }];
396
+ const refusals = [];
397
+ const given = session;
398
+ for (const [field, value] of Object.entries(given)) {
399
+ if (!SESSION_FIELDS.has(field) && value !== undefined)
400
+ refusals.push({ field: `browser.${field}`, message: `a browser takes no ${field}` });
401
+ }
402
+ const { viewport, profile } = given;
403
+ if (viewport !== undefined) {
404
+ const side = (n) => Number.isInteger(n) && n >= 1 && n <= MAX_VIEWPORT;
405
+ const v = viewport;
406
+ if (typeof v !== "object" || v === null || !only(v, ["width", "height"]) || !side(v.width) || !side(v.height)) {
407
+ refusals.push({ field: "browser.viewport", message: `a viewport is { width, height }, each a whole number of pixels from 1 to ${MAX_VIEWPORT}` });
408
+ }
409
+ }
410
+ const flags = [
411
+ ["stealth", "stealth mode"],
412
+ ["headless", "headless mode"],
413
+ ];
414
+ for (const [field, what] of flags) {
415
+ const value = given[field];
416
+ if (value === undefined)
417
+ continue;
418
+ if (typeof value !== "boolean")
419
+ refusals.push({ field: `browser.${field}`, message: `${field} is true or false` });
420
+ else if (value && features[field] !== true)
421
+ refusals.push({ field: `browser.${field}`, message: `a ${vendor} browser has no ${what}, so ${field} is refused` });
422
+ }
423
+ if (profile !== undefined) {
424
+ const p = profile;
425
+ if (features.profiles === undefined)
426
+ refusals.push({ field: "browser.profile", message: `a ${vendor} browser keeps no profile` });
427
+ else if (typeof p !== "object" || p === null || !only(p, ["pointer", "save"]) || !pointerOk(p.pointer) || typeof p.save !== "boolean") {
428
+ refusals.push({ field: "browser.profile", message: "a profile is { pointer, save }: a plain token profiles.create gave, and true or false" });
429
+ }
430
+ }
431
+ return refusals;
432
+ }
@@ -1,7 +1,7 @@
1
- import { type BrowserStream, type ReleaseConfirm, type UrlStore } from "./browser.js";
1
+ import { type BrowserComputerProvider, type BrowserDownloads, type BrowserProfiles, type BrowserStream, type ReleaseConfirm } from "./browser.js";
2
2
  import type { KindCapabilities } from "./kinds.js";
3
3
  import type { MountKind } from "./mount.js";
4
- import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
4
+ import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreateContext, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
5
5
  import { type Result } from "./result.js";
6
6
  export declare const BROWSERBASE_API_URL = "https://api.browserbase.com";
7
7
  /** The domain a Browserbase CDP URL is on (wss://connect.browserbase.com, read live 11-08): cdpUrlProblem holds it there. */
@@ -40,10 +40,18 @@ export interface BrowserbaseDebug {
40
40
  debuggerFullscreenUrl?: string;
41
41
  }>;
42
42
  }
43
+ /** One row of a session's downloads, as GET /v1/downloads answers it; only what the provider reads. */
44
+ export interface BrowserbaseDownload {
45
+ id: string;
46
+ filename: string;
47
+ size: number;
48
+ createdAt?: string;
49
+ }
43
50
  /**
44
51
  * The calls the provider makes, one Browserbase request each, never retried where a retry could open a second paid
45
52
  * browser. A failure throws, with the HTTP status as `status` when one came back; the provider returns it as a result
46
- * whose hidden cause is the thrown error, so a host that gave its own api rethrows its own error.
53
+ * whose hidden cause is the thrown error. The context calls back the profiles member, the download calls the downloads
54
+ * member.
47
55
  */
48
56
  export interface BrowserbaseApi {
49
57
  create(body: Record<string, unknown>, signal?: AbortSignal): Promise<BrowserbaseSession>;
@@ -56,6 +64,17 @@ export interface BrowserbaseApi {
56
64
  /** "gone" when Browserbase does not know the session (404). */
57
65
  release(id: string, signal?: AbortSignal): Promise<"gone" | "asked">;
58
66
  debug(id: string, signal?: AbortSignal): Promise<BrowserbaseDebug>;
67
+ /** Makes a context (POST /v1/contexts): its id. */
68
+ createContext(signal?: AbortSignal): Promise<string>;
69
+ /** "gone" when Browserbase does not know the context (404). */
70
+ deleteContext(id: string, signal?: AbortSignal): Promise<"gone" | "deleted">;
71
+ /** One page of a session's downloads, from offset, and how many there are in all. */
72
+ listDownloads(sessionId: string, offset: number, signal?: AbortSignal): Promise<{
73
+ downloads: BrowserbaseDownload[];
74
+ total: number;
75
+ }>;
76
+ /** A download's bytes, streamed; undefined when Browserbase does not know it (404). */
77
+ readDownload(id: string, signal?: AbortSignal): Promise<AsyncIterable<Uint8Array> | undefined>;
59
78
  }
60
79
  /** Browserbase's v1 REST API over fetch: the default api. */
61
80
  export declare function browserbaseRest({ apiKey, apiUrl, projectId, fetch: fetcher }: {
@@ -64,44 +83,49 @@ export declare function browserbaseRest({ apiKey, apiUrl, projectId, fetch: fetc
64
83
  projectId?: string;
65
84
  fetch?: typeof fetch;
66
85
  }): BrowserbaseApi;
86
+ /** How long after a saving session ends Browserbase may still be writing its context back. */
87
+ export declare const BROWSERBASE_PROFILE_SETTLE_MS = 5000;
88
+ /** The directory Browserbase syncs a session's downloads from: a driver sets the download behaviour into it. */
89
+ export declare const BROWSERBASE_DOWNLOADS_PATH = "downloads";
67
90
  export interface BrowserbaseProviderOptions {
68
- /** With apiUrl and fetch, the REST api is built from it; required unless api is given. */
91
+ /** With apiUrl and fetch, the REST api is built from it. */
69
92
  apiKey?: string;
70
- /** Named in every create and release; a key behind a credential proxy names none. */
93
+ /** Named in every create and release; none behind a gateway (env), whose key names the project. */
71
94
  projectId?: string;
95
+ /** Browserbase's API; default BROWSERBASE_BASE_URL in env (a gateway that fronts it), else Browserbase's own. */
72
96
  apiUrl?: string;
97
+ /**
98
+ * The host's own variables its descriptor declares (hostEnv): BROWSERBASE_BASE_URL, a gateway that fronts the API, and
99
+ * BROWSERBASE_CONNECT_BASE_URL, one that fronts the sessions' sockets. Behind either, the gateway's key names the
100
+ * project, so no projectId is sent.
101
+ */
102
+ env?: Readonly<Record<string, string | undefined>>;
73
103
  fetch?: typeof fetch;
74
- /** The calls, a host's own (pi-browser's SDK client); default the REST api. */
75
- api?: BrowserbaseApi;
76
- /** Where the signed connect URLs are held; default a Map of this provider's own. */
77
- urls?: UrlStore;
78
104
  confirm?: ReleaseConfirm;
79
105
  sleep?: (ms: number) => Promise<void>;
80
106
  }
81
- /** What a host may add to a session's create body: Browserbase's own settings (proxies, browserSettings, region, extensionId, a context). */
82
- export type BrowserbaseSessionSettings = Record<string, unknown>;
83
107
  /** Computers that are Browserbase sessions. */
84
- export declare class BrowserbaseProvider implements ComputerProvider {
108
+ export declare class BrowserbaseProvider implements ComputerProvider, BrowserComputerProvider {
85
109
  #private;
86
110
  readonly id = "browserbase";
87
111
  readonly version: string;
88
- constructor({ apiKey, projectId, apiUrl, fetch: fetcher, api, urls, confirm, sleep }: BrowserbaseProviderOptions);
112
+ readonly profiles: BrowserProfiles;
113
+ readonly downloads: BrowserDownloads;
114
+ constructor({ apiKey, projectId, apiUrl, env, fetch: fetcher, confirm, sleep }: BrowserbaseProviderOptions);
89
115
  /**
90
116
  * A browser: Browserbase ends a session at its timeout (lifetime vendor), at most 6 h; it reaches the open web; each
91
- * session is its own VM. Browserbase keeps a session's downloads, but the protocol has no method that reads them yet,
92
- * so downloads is not declared.
117
+ * session is its own VM. browser is what its sessions offer beyond the protocol. Its downloads are read through the
118
+ * downloads member (browser.downloads); the group stays undeclared until the kind registry's entry (kinds.ts)
119
+ * declares it too.
93
120
  */
94
121
  capabilities(): ComputerCapabilities;
95
122
  check(spec: ComputerSpec): Refusal[];
96
123
  /**
97
124
  * Makes a session at most once: with keepAlive, so a dropped CDP client never ends it, the lifetime as its timeout in
98
- * whole seconds, and the labels as its userMetadata. settings are Browserbase's own create fields a host adds (a
99
- * proxy, a viewport, an extension); what the protocol sets wins over them.
125
+ * whole seconds, and the labels as its userMetadata. spec.browser is the session's own options, each refused by check()
126
+ * unless declared.
100
127
  */
101
- create(spec: ComputerSpec, { signal, settings }?: {
102
- signal?: AbortSignal;
103
- settings?: BrowserbaseSessionSettings;
104
- }): Promise<Result<CreatedComputer>>;
128
+ create(spec: ComputerSpec, context: CreateContext): Promise<Result<CreatedComputer>>;
105
129
  /**
106
130
  * Settings' test: one read of the project's running sessions (GET /v1/sessions?status=RUNNING), which makes nothing.
107
131
  * A refused key is unauthorized and a Browserbase not reached unreachable; the words name the call, never the key.
@@ -131,8 +155,7 @@ export declare class BrowserbaseProvider implements ComputerProvider {
131
155
  }, { signal }?: CallContext): Promise<Result<BrowserStream>>;
132
156
  }
133
157
  /**
134
- * The provider, built from its options alone, the key included (options.apiKey, or options.api / options.request, a
135
- * host's own transport); it reads no environment, and throws in words when the key is missing, never echoing one.
158
+ * The provider, built from its options alone, the key included (options.apiKey); it reads no environment, and throws in words when the key is missing, never echoing one.
136
159
  */
137
160
  export declare function create(options: BrowserbaseProviderOptions): BrowserbaseProvider;
138
161
  /** The conformance CLI's module for Browserbase: its live switch, its image and its notes. */
@@ -1,6 +1,5 @@
1
1
  // Browserbase as a computer of kind browser: each computer is a Browserbase session, over Browserbase's v1 REST API with
2
- // fetch (no SDK), or through a BrowserbaseApi a host gives (pi-browser's SDK client). Labels ride the session's own
3
- // userMetadata; attach and list find a session by them; connect hands over the session's signed connectUrl, which a
2
+ // fetch (no SDK). Labels ride the session's own userMetadata; attach and list find a session by them; connect hands over the session's signed connectUrl, which a
4
3
  // driver dials; stream is its live view (the debugger's fullscreen URL). Both URLs are secrets: they stay in memory and
5
4
  // never reach a ref, a list, an error's words or a report.
6
5
  //
@@ -9,6 +8,11 @@
9
8
  // Browserbase answer 504 after 75 s), POST /v1/sessions/{id} with status REQUEST_RELEASE (release), and
10
9
  // GET /v1/sessions/{id}/debug (the live view). The key is the X-BB-API-Key header.
11
10
  //
11
+ // A session's own options (spec.browser): viewport and a profile ride browserSettings (a profile is a context,
12
+ // { id: pointer, persist: save }); stealth is Browserbase's Verified browser with its CAPTCHA solver (verified and
13
+ // solveCaptchas; the solver is off otherwise, as Browserbase's default is on). Profiles are contexts: POST /v1/contexts ({ projectId } when the provider has one) and DELETE /v1/contexts/{id}. Downloads are the session's
14
+ // synced files: GET /v1/downloads?sessionId=&limit=&offset= (paged by total) and GET /v1/downloads/{id}, the bytes.
15
+ //
12
16
  // A label's key is not its metadata key: Browserbase refuses a dot in a userMetadata key (POST /v1/sessions answered 400
13
17
  // "Key is not a valid metadata key: agentrun.conformance", found live on 11-08), and the protocol's labels are dotted
14
18
  // (agentrun.run, agentrun.epoch). metadataKey() writes each "." as "_", and labelKey() reads it back. check() takes a
@@ -17,7 +21,7 @@
17
21
  import { readFileSync } from "node:fs";
18
22
  import { BROWSERBASE } from "./descriptors/browserbase.js";
19
23
  import { BROWSER_IMAGE } from "./descriptors/shared.js";
20
- import { cdpUrlProblem, browserClient, browserHello, BrowserVendorError, CREATE_LABEL, carries, causeOf, checkBrowser, createLabelValue, createUncertain, DEFAULT_CONFIRM, defaultSleep, httpsBase, idProblem, labelsOf, labelsProblem, memoryUrls, queryable, recoverCreate, releaseConfirmed, restCall, causedFail, vendorFailure, withoutCreateLabel, } from "./browser.js";
24
+ import { cdpUrlProblem, browserClient, browserHello, BrowserVendorError, CREATE_LABEL, carries, causeOf, checkBrowser, createLabelValue, createUncertain, DEFAULT_CONFIRM, defaultSleep, httpsBase, idProblem, labelsOf, labelsProblem, limitedBytes, memoryUrls, pointerOk, queryable, recoverCreate, releaseConfirmed, restBytes, restCall, causedFail, vendorFailure, withoutCreateLabel, } from "./browser.js";
21
25
  import { runLifetimeMs, } from "./provider.js";
22
26
  import { failFor, ok, vendorFail } from "./result.js";
23
27
  import { connectionError } from "./test-connection.js";
@@ -64,6 +68,8 @@ export function browserbaseLabelsProblem(labels) {
64
68
  export const MOUNT = BROWSERBASE.mounts;
65
69
  /** The one configuration it offers, its descriptor's: a browser with a CDP target and a live view. */
66
70
  export const CAPABILITIES = BROWSERBASE.capabilities;
71
+ /** A plain id as Browserbase answers one (a context's, a download's): a token, never a path. */
72
+ const plainId = (id) => typeof id === "string" && /^[A-Za-z0-9_.:-]{1,128}$/.test(id);
67
73
  /** Browserbase's v1 REST API over fetch: the default api. */
68
74
  export function browserbaseRest({ apiKey, apiUrl = BROWSERBASE_API_URL, projectId, fetch: fetcher = fetch }) {
69
75
  const o = { vendor: NAME, fetch: fetcher, base: httpsBase(apiUrl, "the Browserbase API URL"), headers: { "X-BB-API-Key": apiKey } };
@@ -109,8 +115,42 @@ export function browserbaseRest({ apiKey, apiUrl = BROWSERBASE_API_URL, projectI
109
115
  throw new BrowserVendorError(NAME, call, 404);
110
116
  return (answer.json ?? {});
111
117
  },
118
+ async createContext(signal) {
119
+ const call = "POST /v1/contexts";
120
+ const answer = await restCall(o, "POST", "/v1/contexts", call, { body: projectId ? { projectId } : {}, ...(signal ? { signal } : {}) });
121
+ const id = answer.json?.id;
122
+ if (answer.status === 404 || !plainId(id))
123
+ throw new BrowserVendorError(NAME, call, answer.status, "no_context_id");
124
+ return id;
125
+ },
126
+ async deleteContext(id, signal) {
127
+ const answer = await restCall(o, "DELETE", `/v1/contexts/${encodeURIComponent(id)}`, "DELETE /v1/contexts/{id}", signal ? { signal } : {});
128
+ return answer.status === 404 ? "gone" : "deleted";
129
+ },
130
+ async listDownloads(sessionId, offset, signal) {
131
+ const call = "GET /v1/downloads";
132
+ const query = new URLSearchParams({ sessionId, limit: String(DOWNLOADS_PAGE), offset: String(offset) });
133
+ const answer = await restCall(o, "GET", "/v1/downloads", call, { query, ...(signal ? { signal } : {}) });
134
+ // A list is never "not found": a 404 is a wrong base URL, and an empty answer would hide every file.
135
+ if (answer.status === 404)
136
+ throw new BrowserVendorError(NAME, call, 404);
137
+ const page = answer.json;
138
+ if (!Array.isArray(page?.downloads) || !Number.isInteger(page.total))
139
+ throw new BrowserVendorError(NAME, call, answer.status, "not_a_list");
140
+ return { downloads: page.downloads, total: page.total };
141
+ },
142
+ async readDownload(id, signal) {
143
+ return restBytes(o, `/v1/downloads/${encodeURIComponent(id)}`, "GET /v1/downloads/{id}", signal);
144
+ },
112
145
  };
113
146
  }
147
+ /** Rows per downloads page, and the most pages a list reads before it fails rather than run on. */
148
+ const DOWNLOADS_PAGE = 100;
149
+ const MAX_PAGES = 100;
150
+ /** How long after a saving session ends Browserbase may still be writing its context back. */
151
+ export const BROWSERBASE_PROFILE_SETTLE_MS = 5_000;
152
+ /** The directory Browserbase syncs a session's downloads from: a driver sets the download behaviour into it. */
153
+ export const BROWSERBASE_DOWNLOADS_PATH = "downloads";
114
154
  const refOf = (s) => ({ id: s.id, name: s.id });
115
155
  const deadlineOf = (s) => {
116
156
  const at = typeof s.expiresAt === "string" ? new Date(s.expiresAt) : undefined;
@@ -120,24 +160,44 @@ const deadlineOf = (s) => {
120
160
  export class BrowserbaseProvider {
121
161
  id = "browserbase";
122
162
  version = VERSION;
163
+ /**
164
+ * A session ends at its timeout, a wall clock; it may be stealth (Verified, with the CAPTCHA solver); it opens a
165
+ * context as a profile (written back about 5 s after a saving session ends) and keeps what is saved into downloads/.
166
+ * capabilities().browser gives it.
167
+ */
168
+ #browser;
169
+ profiles;
170
+ downloads;
123
171
  #api;
124
172
  #projectId;
125
173
  #urls;
126
174
  #confirm;
127
175
  #sleep;
128
- constructor({ apiKey, projectId, apiUrl, fetch: fetcher, api, urls, confirm = DEFAULT_CONFIRM, sleep = defaultSleep }) {
129
- if (api === undefined && (typeof apiKey !== "string" || apiKey === ""))
130
- throw new Error("set options.apiKey to a Browserbase API key, or options.api to a host's own Browserbase calls: the provider reads no environment");
131
- this.#projectId = projectId || undefined;
132
- this.#api = api ?? browserbaseRest({ apiKey: apiKey, ...(apiUrl ? { apiUrl } : {}), ...(this.#projectId ? { projectId: this.#projectId } : {}), ...(fetcher ? { fetch: fetcher } : {}) });
133
- this.#urls = urls ?? memoryUrls();
176
+ constructor({ apiKey, projectId, apiUrl, env = {}, fetch: fetcher, confirm = DEFAULT_CONFIRM, sleep = defaultSleep }) {
177
+ if (typeof apiKey !== "string" || apiKey === "")
178
+ throw new Error("set options.apiKey to a Browserbase API key: the provider reads no environment");
179
+ const gateway = env.BROWSERBASE_BASE_URL?.trim() || undefined;
180
+ const behindGateway = Boolean(gateway || env.BROWSERBASE_CONNECT_BASE_URL?.trim());
181
+ this.#projectId = behindGateway ? undefined : projectId || undefined;
182
+ const base = apiUrl || gateway;
183
+ this.#api = browserbaseRest({ apiKey, ...(base ? { apiUrl: base } : {}), ...(this.#projectId ? { projectId: this.#projectId } : {}), ...(fetcher ? { fetch: fetcher } : {}) });
184
+ this.#urls = memoryUrls();
134
185
  this.#confirm = confirm;
135
186
  this.#sleep = sleep;
187
+ this.#browser = {
188
+ timeout: "wall-clock",
189
+ stealth: true,
190
+ profiles: { settleMs: BROWSERBASE_PROFILE_SETTLE_MS },
191
+ downloads: { path: BROWSERBASE_DOWNLOADS_PATH },
192
+ };
193
+ this.profiles = { create: (context) => this.#createProfile(context), remove: (pointer, context) => this.#removeProfile(pointer, context) };
194
+ this.downloads = { list: (ref, context) => this.#listDownloads(ref, context), read: (ref, name, maxBytes, context) => this.#readDownload(ref, name, maxBytes, context) };
136
195
  }
137
196
  /**
138
197
  * A browser: Browserbase ends a session at its timeout (lifetime vendor), at most 6 h; it reaches the open web; each
139
- * session is its own VM. Browserbase keeps a session's downloads, but the protocol has no method that reads them yet,
140
- * so downloads is not declared.
198
+ * session is its own VM. browser is what its sessions offer beyond the protocol. Its downloads are read through the
199
+ * downloads member (browser.downloads); the group stays undeclared until the kind registry's entry (kinds.ts)
200
+ * declares it too.
141
201
  */
142
202
  capabilities() {
143
203
  return {
@@ -150,6 +210,7 @@ export class BrowserbaseProvider {
150
210
  groups: [...CAPABILITIES[0].groups],
151
211
  maxLifetimeMs: BROWSERBASE_MAX_LIFETIME_MS,
152
212
  release: ["delete"],
213
+ browser: structuredClone(this.#browser),
153
214
  };
154
215
  }
155
216
  check(spec) {
@@ -164,18 +225,27 @@ export class BrowserbaseProvider {
164
225
  }
165
226
  /**
166
227
  * Makes a session at most once: with keepAlive, so a dropped CDP client never ends it, the lifetime as its timeout in
167
- * whole seconds, and the labels as its userMetadata. settings are Browserbase's own create fields a host adds (a
168
- * proxy, a viewport, an extension); what the protocol sets wins over them.
228
+ * whole seconds, and the labels as its userMetadata. spec.browser is the session's own options, each refused by check()
229
+ * unless declared.
169
230
  */
170
- async create(spec, { signal, settings = {} } = {}) {
231
+ async create(spec, context) {
232
+ const signal = context?.signal;
171
233
  const refusals = this.check(spec);
172
234
  if (refusals.length > 0)
173
235
  return fail("refused", refusals.map(({ field, message }) => `${field}: ${message}`).join("; "));
174
236
  if (signal?.aborted)
175
237
  return fail("aborted", "create was aborted before Browserbase was called");
238
+ const browser = spec.browser;
176
239
  const written = { [CREATE_LABEL]: createLabelValue(), ...spec.labels };
240
+ // Browserbase solves CAPTCHAs unless told not to: a browser's options say so either way, the solver only with stealth.
241
+ const browserSettings = {
242
+ ...(browser?.viewport ? { viewport: { width: browser.viewport.width, height: browser.viewport.height } } : {}),
243
+ ...(browser !== undefined ? { solveCaptchas: browser.stealth === true } : {}),
244
+ ...(browser?.stealth ? { verified: true } : {}),
245
+ ...(browser?.profile ? { context: { id: browser.profile.pointer, persist: browser.profile.save } } : {}),
246
+ };
177
247
  const body = {
178
- ...settings,
248
+ ...(Object.keys(browserSettings).length > 0 ? { browserSettings } : {}),
179
249
  timeout: Math.ceil(runLifetimeMs(spec) / 1000),
180
250
  keepAlive: true,
181
251
  userMetadata: toMetadata(written),
@@ -204,6 +274,82 @@ export class BrowserbaseProvider {
204
274
  this.#urls.set(made.id, made.connectUrl);
205
275
  return ok(refOf(made));
206
276
  }
277
+ /** A new context, a profile's pointer: one POST /v1/contexts, never retried. */
278
+ async #createProfile({ signal } = {}) {
279
+ try {
280
+ return ok(await this.#api.createContext(signal));
281
+ }
282
+ catch (error) {
283
+ return vendorFailure("browserbase", NAME, "POST /v1/contexts", error);
284
+ }
285
+ }
286
+ /** Deletes the context; one Browserbase no longer knows is removed. The words never carry the pointer. */
287
+ async #removeProfile(pointer, { signal } = {}) {
288
+ if (!pointerOk(pointer))
289
+ return fail("invalid", "a profile's pointer is a plain token, as profiles.create gave it");
290
+ try {
291
+ await this.#api.deleteContext(pointer, signal);
292
+ return ok(undefined);
293
+ }
294
+ catch (error) {
295
+ return vendorFailure("browserbase", NAME, "DELETE /v1/contexts/{id}", error);
296
+ }
297
+ }
298
+ /** Every row of a session's downloads, page by page until total; a page that cannot be read fails the whole list. */
299
+ async #downloadRows(id, signal) {
300
+ const problem = idProblem(id, NAME);
301
+ if (problem)
302
+ return fail("invalid", problem);
303
+ const rows = [];
304
+ for (let pages = 0; pages < MAX_PAGES; pages++) {
305
+ let got;
306
+ try {
307
+ got = await this.#api.listDownloads(id, rows.length, signal);
308
+ }
309
+ catch (error) {
310
+ return vendorFailure("browserbase", NAME, "GET /v1/downloads", error);
311
+ }
312
+ for (const row of got.downloads) {
313
+ if (!plainId(row?.id) || typeof row.filename !== "string" || row.filename === "" || !Number.isFinite(row.size) || row.size < 0) {
314
+ return vendorFail("browserbase", "Browserbase GET /v1/downloads answered a row that is not a download");
315
+ }
316
+ }
317
+ rows.push(...got.downloads);
318
+ if (got.downloads.length === 0 || rows.length >= got.total)
319
+ return ok(rows);
320
+ }
321
+ return vendorFail("browserbase", `Browserbase kept answering more pages of downloads past ${MAX_PAGES}`);
322
+ }
323
+ async #listDownloads(ref, { signal } = {}) {
324
+ const rows = await this.#downloadRows(ref?.id, signal);
325
+ if (!rows.ok)
326
+ return rows;
327
+ // Browserbase suffixes each name with a timestamp, so a name is one file in a session.
328
+ return ok(rows.value.map((d) => ({ name: d.filename, sizeBytes: d.size, modifiedAt: typeof d.createdAt === "string" ? d.createdAt : null })));
329
+ }
330
+ /** A download's bytes by its name: refused past maxBytes before it is fetched when its size says so, and cut once the stream passes it. */
331
+ async #readDownload(ref, name, maxBytes, { signal } = {}) {
332
+ if (!Number.isInteger(maxBytes) || maxBytes < 0)
333
+ return fail("invalid", "maxBytes is a whole number of bytes");
334
+ const rows = await this.#downloadRows(ref?.id, signal);
335
+ if (!rows.ok)
336
+ return rows;
337
+ const row = rows.value.find((d) => d.filename === name);
338
+ if (row === undefined)
339
+ return fail("not_found", `the Browserbase session ${ref.id} downloaded no file named ${JSON.stringify(name)}`);
340
+ if (row.size > maxBytes)
341
+ return fail("limit", `the download ${JSON.stringify(name)} is ${row.size} bytes, larger than the ${maxBytes}-byte limit`);
342
+ let body;
343
+ try {
344
+ body = await this.#api.readDownload(row.id, signal);
345
+ }
346
+ catch (error) {
347
+ return vendorFailure("browserbase", NAME, "GET /v1/downloads/{id}", error);
348
+ }
349
+ if (body === undefined)
350
+ return fail("not_found", `Browserbase no longer holds the download ${JSON.stringify(name)}`);
351
+ return ok(limitedBytes(body, maxBytes, `the download ${JSON.stringify(name)}`));
352
+ }
207
353
  /**
208
354
  * The sessions a lost create made, released: what recoverCreate says of them. They are found as list finds any, by
209
355
  * the labels the create wrote (its create label first, so the query names it, then the run's), through #sessions and
@@ -403,8 +549,7 @@ export class BrowserbaseProvider {
403
549
  }
404
550
  }
405
551
  /**
406
- * The provider, built from its options alone, the key included (options.apiKey, or options.api / options.request, a
407
- * host's own transport); it reads no environment, and throws in words when the key is missing, never echoing one.
552
+ * The provider, built from its options alone, the key included (options.apiKey); it reads no environment, and throws in words when the key is missing, never echoing one.
408
553
  */
409
554
  export function create(options) {
410
555
  return new BrowserbaseProvider(options ?? {});