Skip to content

Codex/browser harness js runtime#416

Closed
Cheggin wants to merge 3 commits intomainfrom
codex/browser-harness-js-runtime
Closed

Codex/browser harness js runtime#416
Cheggin wants to merge 3 commits intomainfrom
codex/browser-harness-js-runtime

Conversation

@Cheggin
Copy link
Copy Markdown
Collaborator

@Cheggin Cheggin commented May 7, 2026

Summary by cubic

Switch desktop agents to the bundled browser-harness-js CDP runtime and retire TOOLS.json. Agents now drive the assigned browser via the vendored CLI, with better PATH/CLI resolution and clearer onboarding for engine installs.

  • New Features

    • Bundled browser-harness-js runtime under the harness; added to PATH via applyBrowserHarnessEnv with per-session CDP_REPL_PORT and log.
    • Updated engine adapters (browsercode, claude-code, codex) to inject the new env and guide agents to the CLI.
    • Replaced AGENTS.md content and added interaction skill guides (screenshots, iframes, tabs, uploads, etc.); helpers.js is now a thin bridge to the CLI.
    • Removed TOOLS.json and related watchers; UI logs now reference AGENTS.md.
    • Unified CLI launch resolution with resolveCliLaunch: enrich GUI PATHs and resolve Windows npm shims; used by spawns and Codex login. Added safer Windows installer spawn spec.
    • Added installEngine onboarding action and split CLI installation from authentication.
    • Excluded vendored SDK from TypeScript and ESLint; added targeted unit tests.
  • Migration

    • Use browser-harness-js 'await connectToAssignedTarget()' and call CDP domains (e.g., session.Page.navigate) instead of legacy tool APIs.
    • Do not reintroduce or rely on TOOLS.json; reference AGENTS.md and the new interaction skill docs for patterns.
    • No global skill installs needed; the CLI is provided and placed on PATH for the agent process.

Written for commit a5c568f. Summary will update on new commits.

Cheggin added 3 commits May 7, 2026 12:50
Codex and Claude onboarding now separate CLI installation from authentication, so missing CLIs show install actions instead of sign-in prompts. CLI launches use one high-level router that enriches GUI PATHs on macOS/Linux/Windows and resolves Windows npm shims before spawning.

Constraint: Electron GUI launches can miss user shell PATH entries, and Windows npm-installed CLIs often resolve to .cmd or .ps1 shims.

Rejected: Keep per-call Windows launch fixes | leaves Codex PTY login and future CLI calls easy to miss.

Confidence: high

Scope-risk: moderate

Tested: npm run test

Tested: task typecheck

Tested: npm run lint -- --quiet

Tested: git diff --check

Not-tested: Manual Windows/Linux Electron installer flow on physical machines
Agents need a local CDP runtime that does not depend on legacy helper tools or global skill installation. This vendors the upstream browser-harness-js runtime and interaction recipes, while excluding the bundled SDK from app TypeScript and ESLint passes because it is a runtime asset rather than app source.

Constraint: App-spawned agents run from userData/harness and need the CLI available relative to that harness.

Rejected: Install the upstream skill globally at task time | mutates the user's toolchain and makes launches depend on external setup.

Confidence: high

Scope-risk: moderate

Directive: Treat browser-harness-js/sdk as vendored runtime; update from upstream intentionally, not via incidental formatting or lint fixes.

Tested: cd app && npm run typecheck; targeted Vitest harness and adapter tests.

Not-tested: Fresh packaged production app launch.
The desktop app now gives agents a vendored browser-harness-js CLI, an assigned-target connection helper, and reference folders for browser mechanics and domain playbooks. This replaces the old helpers.js/TOOLS.json tool-extension path while preserving a narrow manual-edit escape hatch for real runtime blockers.

Constraint: Agents must drive only the BrowserPool-assigned CDP target identified by BU_TARGET_ID and BU_CDP_PORT.

Rejected: Keep regular helper APIs as the primary surface | it keeps encouraging agents to patch tools that the upstream CDP runtime already covers.

Confidence: high

Scope-risk: moderate

Directive: Do not reintroduce TOOLS.json as an agent-facing browser control surface; add browser mechanics as upstream browser-harness-js recipes or tightly scoped app runtime fixes.

Tested: cd app && npm run typecheck; cd app && npm run test -- --run tests/unit/hl/stock-helpers.test.ts tests/unit/hl/harnessBootstrap.test.ts tests/unit/hl/codexAdapter.test.ts tests/unit/hl/browsercodeAdapter.test.ts; task agent:run smoke opened example.com and returned Example Domain.

Not-tested: Fresh packaged production app launch.
@Cheggin
Copy link
Copy Markdown
Collaborator Author

Cheggin commented May 7, 2026

Closing duplicate. The intended stacked PR is #417, based on fix/onboarding-cli-launch-router.

@Cheggin Cheggin closed this May 7, 2026
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.

1 participant