Skip to content

Plugins and agents cannot run bounded scripts in BB Browser tabs #1843

Description

@brsbl

Summary

BB needs one general, bounded Browser-page runtime that both plugins and native agent tools can use against an exact Browser target. The Browser action remains the plugin-owned user entry point, but selection is a consumer of the runtime rather than a specialized core inspection API.

Canonical architecture

Exact Browser target

Every operation and mode state binds to the complete identity:

  • clientId
  • windowId
  • tabId
  • navigationEpoch

Logical tabId alone is never accepted. Navigation changes the epoch and invalidates stale work.

Browser-page runtime

  • execute cleanup-safe page scripts in an isolated world by default
  • accept and return bounded JSON only
  • enforce input, result, screenshot, execution-time, and concurrency limits
  • cancel on caller abort, navigation, tab detach, window close, client disconnect, or timeout
  • expose no Node, Electron, or BB app-shell objects to page code
  • retain experimental_browserAction as the plugin toolbar entry point, including its exact target

This is distinct from app.contentScripts, which runs trusted plugin code in the BB application shell.

Agent request/response broker

  • discover Browser targets available to the selected BB client
  • select and address the exact client/window/tab/navigation epoch
  • correlate concurrent calls with independent request IDs
  • route server-side agent tools to the exact desktop Browser tab
  • make active agent control visible and preserve normal BB tool permission/audit behavior

Inspection and control operations

The tool set uses the same runtime for DOM/interactive snapshots, click, type, keyboard, scroll, navigation, screenshot, and a bounded ephemeral custom-script path. Selection/annotation logic is plugin-owned in the Browser Context reusable page-script library.

Security and lifecycle boundaries

  • Plugin backend and agent tool code are full-trust BB extensions; page scripts are constrained to the selected Browser page and bounded transport.
  • Custom scripts do not bypass normal agent-tool permissions or timeline auditability.
  • Main-frame navigation invalidates the target epoch and every in-flight operation bound to it.
  • Renderer-local AbortSignal objects never cross IPC; cancellation uses serializable request IDs.
  • Native Browser-view visibility policy remains separate from temporary plugin overlays or agent activity.

Implementation stack

  • Foundation: PR #1869 at 7b27bdec8ac5dc3966c1a49a6be654635fd77a02 — Browser-page runtime, exact-target broker, agent control, Browser action, and SDK 0.4.9
  • Follow-up: PR #1870 at 9a6617ec517d2fa4b021b06f08326b36593765bd — generic inspectable mention UI
  • Native GitHub stack: #1871
  • First consumer: bb-plugins PR #72 at c6060ba54624a5da86679eba137d382903bee194

PRs #1642, #1643, and old bb-plugins PRs #31/#30 are superseded and must not be merged as this implementation.

Compatibility and provenance

  • The additive public Browser surface is @get-bb/plugin-sdk 0.4.9; 0.4.8 was already published.
  • Persisted 0.4.8 plugin manifests continue to load under 0.4.9.
  • Browser Context alone raises its SDK floor; unrelated plugins retain their capability-based versions.
  • Frozen top source: 9a6617ec517d2fa4b021b06f08326b36593765bd
  • @get-bb/plugin-sdk@0.4.9 SHA-256: 0c2023c099ea00a54066be9c9a0f701b6716336779cc0ff8ed05a6a9bedc5930
  • Matching bb plugin build@0.39.0 SHA-256: 7df5ca65550708db87443e65f87780ab08694811ac74f3fdad53dfd91ab7ece3

Completion criteria

  • core runtime, broker, and operations are tested across cancellation, navigation, disconnect, concurrency, and payload limits
  • real BB desktop QA proves plugin Browser actions and agent inspect/control at representative widths
  • Browser Context selection is implemented outside core on the general runtime
  • exact SDK and plugin-builder provenance is recorded for the consumer

Do not close this issue until the revised objective is merged.

Originating implementation thread: thr_p9qmfkggwm

AGENT GENERATED: by GPT-5.6-Sol

Metadata

Metadata

Assignees

No one assigned

    Labels

    desktopDesktop app, install, update, packagingenhancementNew feature or requestpluginsPlugin SDK, runtime, marketplaceuiApp shell, sidebar, composer, rendering

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions