Skip to content

BOX-186: browser api - #202

Merged
buggyhunter merged 5 commits into
mainfrom
BOX-186
Jul 28, 2026
Merged

BOX-186: browser api#202
buggyhunter merged 5 commits into
mainfrom
BOX-186

Conversation

@buggyhunter

Copy link
Copy Markdown
Contributor

No description provided.

@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown

BOX-186

Comment on lines +415 to +422
export class Tab {
/** CDP target id of this tab. */
readonly id: string;
/** Last known URL of this tab (from `tab.create`/`listTabs`; not live). */
readonly url?: string;
/** Last known title of this tab (from `tab.create`/`listTabs`; not live). */
readonly title?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client.ts has too many things, no need to split everything but can we at least put the new classes in new files?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, but I think we should do this splitting comprehensively in a seperate pr

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first-class box.browser API to the TypeScript SDK, enabling headless Chromium control (tab lifecycle, DOM content, screenshots, extraction/agent actions, and session recordings) plus supporting examples and tests.

Changes:

  • Introduces Tab and Box.browser APIs (tabs, screenshots, extract/observe/act/run, CDP/live-view URLs, recordings).
  • Extends SDK types/exports and Box.create config with browser?: boolean.
  • Adds unit + integration tests and multiple runnable examples; includes a changeset entry.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Workspace config updated to allow esbuild builds.
packages/sdk/src/types.ts Adds browser-related public types and BoxConfig.browser.
packages/sdk/src/index.ts Exports Tab and browser-related types from the public entrypoint.
packages/sdk/src/client.ts Implements Tab, box.browser namespace, recordings helpers, screenshot decoding, and JSON-schema conversion logic.
packages/sdk/src/tests/integration/browser.integration.test.ts Adds integration coverage for basic browser flows when API key is present.
packages/sdk/src/tests/helpers.test.ts Updates/extends toJsonSchema tests for Zod 3 + Zod 4.
packages/sdk/src/tests/box-create.test.ts Ensures browser: true is sent only when requested.
packages/sdk/src/tests/box-browser.test.ts Adds comprehensive unit tests for tab operations, screenshots, schema extraction, agent actions, and recordings.
packages/sdk/examples/headless-browser.ts New example demonstrating headless DOM ops + extraction + screenshots.
packages/sdk/examples/connect-test.ts New minimal example for CDP URL retrieval.
packages/sdk/examples/browser.ts New end-to-end example covering most of the Tab surface.
packages/sdk/examples/browser-screencast.ts New example for tab.liveViewUrl() usage.
packages/sdk/examples/browser-recording-demo.ts New example demonstrating recordings + a simple scripted flow.
packages/sdk/examples/browser-connect.ts New example showing Playwright CDP connection flow.
.changeset/browser-api-polish.md Patch changeset describing the new/updated browser features.
Comments suppressed due to low confidence (1)

packages/sdk/src/client.ts:705

  • This docstring says tab-scoped operations are limited to goto/content/screenshot/extract/observe/close, but the API also exposes act, run, and liveViewUrl on Tab. Updating the list will keep the public docs accurate.
   * tabs. All page operations (`goto`, `content`, `screenshot`, `extract`,
   * `observe`, `close`) live on the {@link Tab} handle returned here.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/sdk/src/client.ts
Comment thread packages/sdk/src/client.ts
Comment thread packages/sdk/src/client.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 35 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

packages/sdk/src/client.ts:2

  • Static import from zod/v4/core makes the SDK hard-require Zod v4 at module-load time. This conflicts with packages/sdk/package.json declaring zod as an optional peer (^3.25.0 || ^4.0.0): consumers with Zod v3 (or no Zod installed, if they don't use extract/run) will crash on import because zod/v4/core can't be resolved. Consider either (a) making the Zod v4 converter optional via lazy/dynamic import (so v3-only installs still work), or (b) tightening the peerDependency to ^4 / adding a direct dependency if v4 is now required.

Comment thread pnpm-workspace.yaml
Comment thread .changeset/browser-api-polish.md
Comment thread packages/python-sdk/pyproject.toml
@buggyhunter
buggyhunter merged commit 3890689 into main Jul 28, 2026
11 of 12 checks passed
@buggyhunter
buggyhunter deleted the BOX-186 branch July 28, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants