Skip to content

chore: refresh TypeScript CDP and retire hidden surfaces#2014

Merged
Nikhil (shadowfax92) merged 8 commits into
mainfrom
chore/refresh-ts-cdp-retire-hidden
Jul 23, 2026
Merged

chore: refresh TypeScript CDP and retire hidden surfaces#2014
Nikhil (shadowfax92) merged 8 commits into
mainfrom
chore/refresh-ts-cdp-retire-hidden

Conversation

@shadowfax92

Copy link
Copy Markdown
Contributor

Summary

  • regenerate @browseros/cdp-protocol from the exact 58-domain combined Chromium protocol, with validated input provenance and deterministic formatting
  • keep compatibility-only hidden members in generated wire definitions while projecting them out of BrowserOS-owned page state
  • retire hidden tab/window controls across TypeScript core, scheduled-task handling, MCP schemas, structured results, descriptions, and tests

Design

The generated CDP package remains the complete mixed-version wire contract. Browser core now explicitly projects generated TabInfo into the narrower owned PageInfo, so compatibility fields cannot leak into application or MCP payloads. Scheduled runs use managed background pages, while normal/background and explicit-window creation semantics remain intact.

Test plan

  • CDP_PROTOCOL_JSON=/Users/shadowfax/code/chromium-checkouts/chromium-1/src/out/Default_arm64/gen/third_party/blink/public/devtools_protocol/protocol.json bun run gen:cdp
  • bun run check
  • bun run test
  • bun run test:main
  • targeted browser-core, browser-mcp, server, parser, schema, and structured-contract tests/typechecks
  • ownership scans and git diff --check

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Claude (@claude) review

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Greptile (@greptileai) review

@github-actions github-actions Bot added the chore label Jul 23, 2026
@claude

claude Bot commented Jul 23, 2026

Copy link
Copy Markdown

Claude finished Nikhil (@shadowfax92)'s task in 2m 51s —— View job


Claude's Review

I reviewed the diff against origin/main for this PR, focusing on the CDP codegen refresh and the hidden-tab/window retirement across the TypeScript packages.

Tasks

  • Gather context (repo guidelines, diff)
  • Review CDP codegen changes
  • Review browser-core / pages.ts / windows.ts changes
  • Review browser-mcp changes (tabs.ts, windows.ts, tests)
  • Review server changes (chat-service, prompt, session-store)
  • Attempt bun run check / bun run test (blocked — see note below)
  • Post review feedback

Overall

This is a clean, well-scoped refactor. The projection pattern in pages.ts (pageInfoFromProtocol) is a good way to keep the generated wire contract's compatibility-only fields (isHidden, hidden, includeHidden, showTab, setWindowVisibility) from leaking into PageInfo/MCP results, while the Rust-side browseros_protocol.json (crates/browseros-cdp/...) still defines those fields as optional — so wire backward-compatibility is preserved even though the TS core no longer emits/consumes them. The hidden-tab/window removal is consistently threaded through browser-core, browser-mcp tool schemas, server session/chat-service code, and tests — I didn't find dangling references to hiddenPageId, isHidden, showTab, or setWindowVisibility left behind on the TS side.

Findings

  1. packages/browseros-agent/packages/browser-core/src/core/pages.ts:381-402pageInfoFromProtocol no longer falls back to the previous index/groupId when the protocol response omits them.
    Previously list()/updateFromTab() used {...existing, ...tab} (or Object.assign), so if a TabInfo response ever omitted the optional index/groupId keys, the previously cached values were preserved. The old in-code comment only called out windowId as needing this treatment ("CDP omits windowId for hidden tabs — preserve the cached value"), and the new helper only preserves windowId/url via fallback. If index/groupId are ever transiently absent from a Browser.getTabs/getTabInfo response (e.g., a tab not currently in a tab-strip/group), the new code will drop the field to undefined instead of keeping the last known value, whereas the old code wouldn't have. Given the domain comment suggests only windowId was known to be intermittently omitted, this is likely fine, but worth double-checking against real CDP behavior before merge since it's a silent behavior change.

  2. packages/browseros-agent/apps/claw-app/tsconfig.json:5-7 — removal of "paths": {"@/*": ["./*"]} looks unrelated to this PR's stated scope (CDP protocol refresh / hidden-surface retirement). I confirmed there are no @/... imports left in apps/claw-app, so it's not a build break, but it's worth a sentence in the PR description (or a separate commit) since it's scope creep from an otherwise focused refactor — it landed via the "repair TypeScript verification baselines" commit rather than the hidden-retirement work.

  3. Minor: protocol-api-emitter.ts switched domain sorting from localeCompare to manual </> comparison — reasonable for deterministic, locale-independent codegen output (matches the PR's "deterministic formatting" goal), just flagging so it's confirmed intentional rather than incidental.

Test coverage

The new/updated tests (browser.test.ts, pages.test.ts, protocol-parser.test.ts) look meaningful — they assert on actual call arguments (e.g., getTabs() called with no args, createWindow() called with no hidden option) rather than just re-asserting mocked returns, and the new protocol-parser.test.ts covers malformed/incomplete/duplicate-domain JSON well.

Note on verification

I was not able to execute bun run check / bun run test / bun run test:main in this sandbox (shell command execution beyond basic read-only git commands required approval that wasn't available in this run). The PR description states these were run locally with a passing result; I'd recommend confirming CI is green before merge rather than relying solely on this review. If you'd like me to attempt running the suite, you can update the --allowedTools config to permit Bash(bun *).

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Refreshes the generated TypeScript CDP contract and removes hidden tab/window surfaces.

  • Regenerates the complete 58-domain CDP package with stricter input validation and deterministic formatting.
  • Projects generated tab data into BrowserOS-owned page state so compatibility-only fields do not leak into structured results.
  • Replaces scheduled hidden pages with managed background pages and removes hidden tab/window controls from core, MCP schemas, prompts, and tests.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code defect identified.

The generated protocol refresh, owned page-state projection, scheduled background-page lifecycle, and reduced MCP schemas are coordinated across implementation and contract tests without an established broken caller or runtime invariant.

Important Files Changed

Filename Overview
packages/browseros-agent/scripts/codegen/cdp-protocol.ts Adds source provenance, validation, hashing, deterministic formatting, and regenerated package exports.
packages/browseros-agent/scripts/codegen/lib/protocol-parser.ts Changes parsing to accept source text and reject malformed versions, domains, and duplicate domain names.
packages/browseros-agent/packages/browser-core/src/core/pages.ts Removes hidden-page handling and explicitly projects generated TabInfo values into the narrower PageInfo model.
packages/browseros-agent/packages/browser-core/src/browser.ts Removes hidden page creation and routes new pages to an existing visible window or a newly created normal window.
packages/browseros-agent/apps/server/src/api/services/chat-service.ts Migrates scheduled-task lifecycle tracking from hidden pages to managed background pages.
packages/browseros-agent/packages/browser-mcp/src/tools/tabs.ts Removes the hidden tab option while retaining background tab creation.
packages/browseros-agent/packages/browser-mcp/src/tools/windows.ts Removes hidden-window creation and window visibility mutation from the MCP contract.
packages/browseros-agent/packages/cdp-protocol/package.json Adds exports for the newly generated CrashReportContext and WebMCP domains.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Chromium["Combined Chromium CDP protocol"] --> Generator["Validated deterministic generator"]
  Generator --> CDP["@browseros/cdp-protocol"]
  CDP --> Core["browser-core projection"]
  Core --> PageInfo["Owned PageInfo without compatibility-only fields"]
  PageInfo --> MCP["browser-mcp structured results"]
  Server["Scheduled task"] --> Background["Managed background page"]
  Background --> Core
Loading

Reviews (1): Last reviewed commit: "chore: merge latest main" | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Refreshes the generated TypeScript CDP contract and removes hidden browser surfaces.

  • Regenerates the 58-domain CDP package with source validation, hashing, deterministic ordering, formatting, and new domain exports.
  • Projects generated protocol tab data into the narrower BrowserOS-owned PageInfo shape.
  • Replaces scheduled hidden pages with managed background pages and removes hidden tab/window controls from browser core, MCP schemas, prompts, structured results, and tests.
  • Updates TypeScript and release-test baselines for the refreshed toolchain and contracts.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable issues identified in the changed behavior.

The generated protocol exports remain coordinated, BrowserOS-owned page state explicitly excludes compatibility-only fields, and hidden-surface removal is consistently propagated through core, server, MCP contracts, prompts, and tests.

Important Files Changed

Filename Overview
packages/browseros-agent/scripts/codegen/cdp-protocol.ts Adds explicit protocol-source validation, SHA-256 provenance logging, deterministic regeneration, and formatting.
packages/browseros-agent/scripts/codegen/lib/protocol-parser.ts Changes parsing to accept source text and validates the top-level version and unique domain structure.
packages/browseros-agent/packages/browser-core/src/core/pages.ts Removes hidden-page management and explicitly projects generated TabInfo values into owned PageInfo state.
packages/browseros-agent/packages/browser-core/src/browser.ts Narrows page-creation options and resolves new pages into an existing visible window or a newly created normal window.
packages/browseros-agent/packages/browser-mcp/src/tools/tabs.ts Removes hidden-tab input while retaining list, active, background creation, and close behavior.
packages/browseros-agent/packages/browser-mcp/src/tools/windows.ts Retires hidden-window creation and visibility mutation from the MCP window tool.
packages/browseros-agent/apps/server/src/api/services/chat-service.ts Migrates scheduled-task lifecycle tracking from hidden pages to managed background pages.
packages/browseros-agent/packages/cdp-protocol/package.json Adds exports for newly generated CrashReportContext and WebMCP domains and APIs.
packages/browseros-agent/apps/claw-app/tsconfig.json Removes the local path-alias override while continuing to extend WXT's generated TypeScript configuration.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Chromium["Chromium combined CDP protocol"] --> Generator["Validated deterministic generator"]
  Generator --> Wire["@browseros/cdp-protocol<br/>complete wire contract"]
  Wire --> Projection["browser-core TabInfo projection"]
  Projection --> PageInfo["BrowserOS PageInfo<br/>hidden compatibility fields omitted"]
  PageInfo --> MCP["Browser MCP structured results"]
  Scheduler["Scheduled task"] --> Background["Managed background page"]
  Background --> Projection
Loading

Reviews (2): Last reviewed commit: "chore: merge latest main" | Re-trigger Greptile

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

✅ Tests passed — 1694/1698

Suite Passed Failed Skipped
agent 350/350 0 0
build 34/34 0 0
claw-app 215/215 0 0
⚠️ claw-mcp 0/0 0 0
⚠️ claw-onboard 0/0 0 0
⚠️ claw-server-rust-quality 0/0 0 0
⚠️ claw-server-rust 0/0 0 0
server-agent 313/313 0 0
server-api 171/171 0 0
server-browser 10/10 0 0
server-integration 10/10 0 0
server-lib 299/300 0 1
server-root 38/41 0 3
server-tools 254/254 0 0

View workflow run

@shadowfax92
Nikhil (shadowfax92) merged commit 171feb6 into main Jul 23, 2026
22 checks passed
Dani Akash (DaniAkash) added a commit that referenced this pull request Jul 24, 2026
* chore(deps): bump golang.org/x/crypto to v0.52.0 in apps/cli (#1994)

Refresh go.sum and the x/sys transitive dependency.

* chore(deps): bump the uv group across 1 directory with 5 updates (#1995)

Bumps the uv group with 5 updates in the /packages/browseros directory:

| Package | From | To |
| --- | --- | --- |
| [requests](https://github.com/psf/requests) | `2.32.5` | `2.33.0` |
| [python-dotenv](https://github.com/theskumar/python-dotenv) | `1.2.1` | `1.2.2` |
| [cryptography](https://github.com/pyca/cryptography) | `46.0.3` | `48.0.1` |
| [idna](https://github.com/kjd/idna) | `3.11` | `3.15` |
| [urllib3](https://github.com/urllib3/urllib3) | `2.5.0` | `2.7.0` |



Updates `requests` from 2.32.5 to 2.33.0
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.5...v2.33.0)

Updates `python-dotenv` from 1.2.1 to 1.2.2
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/main/CHANGELOG.md)
- [Commits](theskumar/python-dotenv@v1.2.1...v1.2.2)

Updates `cryptography` from 46.0.3 to 48.0.1
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@46.0.3...48.0.1)

Updates `idna` from 3.11 to 3.15
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](kjd/idna@v3.11...v3.15)

Updates `urllib3` from 2.5.0 to 2.7.0
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.5.0...2.7.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.0
  dependency-type: direct:production
  dependency-group: uv
- dependency-name: python-dotenv
  dependency-version: 1.2.2
  dependency-type: direct:production
  dependency-group: uv
- dependency-name: cryptography
  dependency-version: 48.0.1
  dependency-type: direct:production
  dependency-group: uv
- dependency-name: idna
  dependency-version: '3.15'
  dependency-type: indirect
  dependency-group: uv
- dependency-name: urllib3
  dependency-version: 2.7.0
  dependency-type: indirect
  dependency-group: uv
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): pin transitive dependency resolutions in browseros-agent (#1997)

Refresh a batch of pinned transitive resolutions to their current patch
releases via overrides and update bun.lock.

* Revert "fix(claw-app): scale Audit tab navigation (#1987)" (#1998)

This reverts commit ee46ec4.

* feat(claw): rewrite BrowserClaw harness skill (#1999)

Frontmatter description now carries the standing instruction — default to
BrowserClaw for browser work unprompted, over in-app browser surfaces —
and the body becomes a compact operating manual: session etiquette,
task-owned tabs, the snapshot -> act -> verify loop, read/grep and tool
escalation, failure handling, and the untrusted-page-content rule.
Validation test probes and line budget updated to match.

* fix(agent): reconcile aliased skill targets by identity (#2001)

* fix(agent): reconcile aliased skill targets by identity

* fix(claw): use app resources in local launchers

* test(claw): assert physical skill manifest paths

* fix: address review findings for browserclaw-skill-target-identity

* feat(claw): show total tokens consumed on Audit surfaces (#2000)

* feat(claw): show total tokens consumed on Audit surfaces

Materialize per-session token estimates (input+output, summed across
dispatches) onto the tasks table via recompute_task, so the total is
available live and not only from the post-teardown efficiency projection.
Expose it through the canonical OpenAPI path as an optional SessionSummary
tokenUsage field, present only when the session has dispatches and every one
carries token-estimator v1 (legacy/unmeasured sessions omit it).

Both Audit surfaces render it from the one shared field: a compact Tokens
column on the session list (exact count on hover, em dash when unmeasured)
and a Tokens entry on the session-detail summary card.

* fix(claw): sort unmeasured token totals last in both directions

The Tokens-column accessor mapped unmeasured sessions to 0, which only
sank them on a descending sort — an ascending sort surfaced them ahead of
every measured session. Return undefined and use tanstack's
sortUndefined:'last' so unmeasured rows stay at the bottom either way.

* fix(claw): hide tokens in audit list (#2002)

* fix(claw): ground screenshot token baseline (#2003)

* fix(claw): ground screenshot token baseline

* test(claw): update cockpit efficiency expectation

* test(claw): preserve signed savings coverage

* feat(claw): move audit observation off the tool path (#2005)

* refactor(claw): separate tool observers from effects

* feat(claw): queue audit observations in bounded worker

* fix(claw): flush coalesced audit previews on session close

* test(claw): verify async audit shutdown lifecycle

* fix: address review findings for 260723-1154_async_audit_observer

* fix(claw): sum tool durations for human time saved (#2004)

* fix(claw): sum tool durations for time saved

* fix(claw): preserve retained efficiency history

* fix(claw): guard efficiency backfill from session reuse

* fix(claw): stop cockpit saved-stats labels from overlapping (#2006)

Both the "used" and "screenshot-first" token labels were absolutely
positioned inside the same overflow-hidden budget track. Around the
mid-range their text occupied the same pixels and painted through each
other (e.g. "used 63.2K" over "112.3K").

Lift both numbers into a legend row above the bar — a flex
justify-between row that wraps to two lines before the labels could ever
meet — and keep the track as a pure gauge: accent fill = what
BrowserClaw used, striped remainder = what a screenshot-first agent
would have spent. The bar carries no text now, so nothing can collide or
clip at any used/total ratio or label length.

Accessibility, reduced-motion (the pulsing dot keeps motion-reduce),
theme tokens, and the stats/API contract are unchanged. Tests assert the
structural invariant (no labels inside the bounded bar) across low, mid,
and full ratios, and the fill width replaces the old marker-position
assertions.

* refactor(patches): retire hidden window implementation (#2007)

* refactor(patches): retire hidden window implementation

* fix(patches): preserve single-close window teardown

* chore: sync internal-docs submodule (#2008)

Co-authored-by: browseros-bot <bot@browseros.ai>

* chore: sync internal-docs submodule (#2009)

Co-authored-by: browseros-bot <bot@browseros.ai>

* fix(claw): use session duration for human time saved (#2010)

* fix(claw): use session duration for saved time

* fix(claw): backfill saved time from task durations

* perf(core): acquire snapshots concurrently (#2011)

* perf(core): batch cursor backend-node resolution

* refactor(core): separate snapshot frame acquisition

* perf(core): acquire snapshot sibling frames concurrently

* perf(core): trace concurrent snapshot capture

* fix: address review findings for snapshot-concurrent-acquisition

* fix: address review findings for snapshot-concurrent-acquisition

* fix: address review findings for snapshot-concurrent-acquisition

* fix: suppress intentional cursor asset expression

* fix(core): clear frame sessions after reconnect

* fix(core): address snapshot PR review notes

* feat(claw-app): default replays to 2x (#2015)

* chore: refresh TypeScript CDP and retire hidden surfaces (#2014)

* chore(cdp): refresh TypeScript protocol definitions

* refactor(server): use background pages for scheduled tasks

* refactor(browser-core): retire hidden page and window behavior

* refactor(browser-mcp): remove hidden tab and window controls

* test: repair TypeScript verification baselines

* test(claw-app): prepare WXT aliases before tests

* fix(claw): exclude red from automatic tab-group colors (#2016)

* fix(claw): exclude red from automatic tab groups

* test(claw): update automatic tab color fixture

* test(claw): cover snapshot concurrency contracts (#2017)

* test(claw): add snapshot concurrency fixtures

* test(claw): cover live cursor snapshot acquisition

* test(claw): cover concurrent iframe snapshot contracts

* test(claw): stress overlapping snapshot contracts

* fix: address review findings for snapshot-concurrency-contract-tests

* fix: address review findings for snapshot-concurrency-contract-tests

* refactor: refresh Rust CDP and retire hidden windows (#2013)

* chore(cdp): sync Rust protocol from Chromium

* refactor(core): retire hidden window state

* refactor(mcp): remove hidden window controls

* refactor(server): drop hidden window runtime references

* test(core): align getProperties fixtures with protocol

* test(mcp): retire hidden conformance cases

* chore(release): build v0.48.3 [skip ci]

Automated nightly macOS version bump.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nikhil <nikhilsv92@gmail.com>
Co-authored-by: browseros-bot <bot@browseros.ai>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant