Skip to content

Add ADE browser CLI proof flow#512

Merged
arul28 merged 2 commits into
mainfrom
ade/ade-browser-1d208e91
Jun 2, 2026
Merged

Add ADE browser CLI proof flow#512
arul28 merged 2 commits into
mainfrom
ade/ade-browser-1d208e91

Conversation

@arul28
Copy link
Copy Markdown
Owner

@arul28 arul28 commented Jun 2, 2026

Summary

  • Adds ADE built-in browser CLI control, session targeting, and proof registration flows.
  • Wires desktop browser IPC/preload/shared types with project-scoped browser profiles and WebAuthn/session handling.
  • Updates Work/chat prompt clipboard behavior, browser panel state, ADE browser skills/help, and proof docs.

Validation

  • npm --prefix apps/ade-cli run test
  • npm --prefix apps/ade-cli run typecheck
  • npm --prefix apps/ade-cli run build
  • npm --prefix apps/desktop run typecheck
  • npm --prefix apps/desktop run lint (passes with existing warnings)
  • npm --prefix apps/desktop run build
  • npx vitest run src/main/services/builtInBrowser/builtInBrowserService.test.ts src/main/services/builtInBrowser/builtInBrowserWebAuthn.test.ts src/main/services/computerUse/computerUseArtifactBrokerService.test.ts
  • npx vitest run src/renderer/components/chat/AgentChatComposer.test.tsx src/renderer/components/chat/AgentChatPane.test.tsx src/renderer/components/terminals/WorkSidebar.test.tsx src/renderer/components/terminals/WorkViewArea.test.tsx
  • post-rebase: npm --prefix apps/ade-cli run typecheck, npm --prefix apps/desktop run typecheck, and targeted desktop browser/chat tests

Risks

  • Browser attach/profile isolation is intentionally strict; attached webviews must match the current project browser profile partition.
  • Existing desktop lint warnings remain outside this lane scope.

ADE   Open in ADE  ·  ade/ade-browser-1d208e91 branch  ·  PR #512

Greptile Summary

This PR adds a comprehensive ADE browser agent control layer: project-scoped browser profiles (partition-per-project via SHA-256 key), session management (startSession/listSessions/endSession), a full observation pipeline (screenshot + DOM snapshot + element map + diagnostics written to .ade/cache/browser-observations), and agent action commands (click, fill, typeText, dispatchKey, scroll, clear, wait). The desktop bridge is extended to expose all new methods, the CLI gains ~830 lines of new sub-commands under browser session …, browser observe, browser proof, etc., and the renderer now shows per-tab ownership badges and reads the dynamic browser partition for webview creation.

  • Project-scoped browser profiles: each window's project root is hashed to an isolated Electron session partition; normalizeAdeBrowserWebviewPartition in main.ts validates that renderer-provided partition strings match the expected format before allowing them.
  • Session & observation system: writeObservation persists screenshots and DOM snapshots to disk, pruneObservationDirectory trims stale scratch files, element handles (obs-…:e:<n>) are verified through sanitizePathSegment and a tab-ID cross-check before any fs.readFile.
  • Chat composer draft migration: work-start replaces separate chat/cli storage keys for saved drafts; a multi-key read picks up the most-recently-updated snapshot for backward compatibility.

Confidence Score: 5/5

  • Safe to merge. The changes are well-isolated behind the desktop bridge allowlist and validated partition/path-segment guards.
  • The browser service correctly applies sanitizePathSegment to all user-derived path components, the webview partition is validated against a strict regex, tab leases enforce ownership without silent bypass, and the session/observation pipeline handles error cases (destroyed WebContents, missing project root, stale prune failures) gracefully. The draft-storage migration is backward-compatible via multi-key reads. No data-loss, auth, or correctness issues were found across the changed files.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/main/services/builtInBrowser/builtInBrowserService.ts Core service: adds project-scoped profiles, session lifecycle, observation write pipeline, agent action methods (click/fill/type/scroll/key/wait/clear), and tab-lease enforcement. Path-segment sanitization is applied on all user-derived values passed to path.join. Logic is well-guarded.
apps/ade-cli/src/cli.ts Adds 830+ lines of browser CLI sub-commands (session CRUD, observe, click, fill, type, key, scroll, wait, proof). Argument parsing is mutation-safe (each readValue/readFlag splices from args in place). The autoNewOwnedTab heuristic correctly creates isolated tabs for ADE-launched agents.
apps/desktop/src/main/main.ts Wires project-root-to-window resolution for the browser service; normalizeAdeBrowserWebviewPartition validates partition strings via regex before setting them on webviews; getWindowForProjectRoot now passes foreground: false to avoid unwanted focus side-effects on passive reads.
apps/desktop/src/renderer/components/chat/ChatBuiltInBrowserPanel.tsx Reads dynamic partition from statusRef.current?.partition for webview creation (project-scoped), adds per-tab ownership badge display, and updates navigation method signatures to accept BrowserTabTargetArgs.
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx Migrates composer draft and launch-config storage to a unified work-start key; readLatestComposerDraftSnapshot and readLatestLastLaunchConfig provide backward-compat multi-key reads picking the most recently updated snapshot.
apps/desktop/src/main/services/builtInBrowser/builtInBrowserWebAuthn.ts Extracts per-session WebAuthn config into configureBuiltInBrowserSessionWebAuthn; a WeakSet<Session> prevents duplicate listeners; Touch ID default now auto-enables on packaged builds without requiring the env var.
apps/ade-cli/src/services/builtInBrowser/desktopBridgeClient.ts Adds projectRoot injection via withProjectRoot wrapper on all bridge calls, enabling the desktop service to route to the correct per-project window service without the CLI knowing which window is active.
apps/desktop/src/shared/types/builtInBrowser.ts Adds types for sessions, observations, element snapshots, DOM snapshots, diagnostics, action traces, and agent action args; BuiltInBrowserStatus.partition now reflects the dynamic profile partition instead of a literal string type.

Sequence Diagram

sequenceDiagram
    participant CLI as ade-cli (browser commands)
    participant Bridge as desktopBridgeClient
    participant Server as desktopBridgeServer
    participant Outer as createBuiltInBrowserService (outer)
    participant Inner as createBuiltInBrowserWindowService (per-window)
    participant FS as Filesystem (.ade/cache)
    participant CDP as Electron WebContents (CDP)

    CLI->>Bridge: "callBridge("observe", { projectRoot, tabId, ... })"
    Bridge->>Bridge: withProjectRoot(params) – inject projectRoot
    Bridge->>Server: JSON-RPC built_in_browser.observe
    Server->>Outer: service.observe(params)
    Outer->>Outer: serviceForInput(input) – route by projectRoot → window
    Outer->>Inner: inner.observe(input)
    Inner->>CDP: capturePageScreenshot
    CDP-->>Inner: base64 PNG
    Inner->>CDP: Runtime.evaluate(BROWSER_DOM_FUNCTION)
    CDP-->>Inner: DOM snapshot
    Inner->>FS: "writeFile(obs-*.png)"
    Inner->>FS: "writeFile(obs-*.json)"
    Inner->>Inner: pruneObservationDirectory(dir, keepCount)
    Inner->>FS: "writeFile(obs-*.json) — update cleanup stats"
    Inner-->>Outer: BuiltInBrowserObservation
    Outer-->>Server: observation
    Server-->>Bridge: JSON-RPC result
    Bridge-->>CLI: observation (filePath, elementMap, dom, …)
Loading

Reviews (2): Last reviewed commit: "ship: iteration 1 - address browser revi..." | Re-trigger Greptile

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jun 2, 2026 7:35am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Warning

Review limit reached

@arul28, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 10 minutes and 48 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 935a3ec0-8ad0-4250-ac1c-b19940bdb51b

📥 Commits

Reviewing files that changed from the base of the PR and between d394fcb and 5647e78.

⛔ Files ignored due to path filters (5)
  • docs/ARCHITECTURE.md is excluded by !docs/**
  • docs/PRD.md is excluded by !docs/**
  • docs/features/agents/README.md is excluded by !docs/**
  • docs/features/chat/README.md is excluded by !docs/**
  • docs/features/proof.md is excluded by !docs/**
📒 Files selected for processing (35)
  • apps/ade-cli/src/bootstrap.ts
  • apps/ade-cli/src/cli.test.ts
  • apps/ade-cli/src/cli.ts
  • apps/ade-cli/src/services/builtInBrowser/desktopBridgeClient.test.ts
  • apps/ade-cli/src/services/builtInBrowser/desktopBridgeClient.ts
  • apps/ade-cli/src/services/builtInBrowser/desktopBridgeMethods.ts
  • apps/desktop/build/entitlements.mac.inherit.plist
  • apps/desktop/build/entitlements.mac.plist
  • apps/desktop/resources/ade-cli-help.txt
  • apps/desktop/resources/agent-skills/ade-browser/SKILL.md
  • apps/desktop/resources/agent-skills/ade-proof-artifacts/SKILL.md
  • apps/desktop/src/main/main.ts
  • apps/desktop/src/main/services/adeActions/registry.test.ts
  • apps/desktop/src/main/services/builtInBrowser/builtInBrowserConstants.ts
  • apps/desktop/src/main/services/builtInBrowser/builtInBrowserService.test.ts
  • apps/desktop/src/main/services/builtInBrowser/builtInBrowserService.ts
  • apps/desktop/src/main/services/builtInBrowser/builtInBrowserWebAuthn.test.ts
  • apps/desktop/src/main/services/builtInBrowser/builtInBrowserWebAuthn.ts
  • apps/desktop/src/main/services/computerUse/computerUseArtifactBrokerService.test.ts
  • apps/desktop/src/main/services/computerUse/computerUseArtifactBrokerService.ts
  • apps/desktop/src/main/services/ipc/registerIpc.ts
  • apps/desktop/src/preload/global.d.ts
  • apps/desktop/src/preload/preload.ts
  • apps/desktop/src/renderer/browserMock.ts
  • apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/components/chat/ChatBuiltInBrowserPanel.tsx
  • apps/desktop/src/renderer/components/terminals/WorkSidebar.test.tsx
  • apps/desktop/src/renderer/components/terminals/WorkSidebar.tsx
  • apps/desktop/src/renderer/components/terminals/WorkViewArea.test.tsx
  • apps/desktop/src/renderer/components/terminals/WorkViewArea.tsx
  • apps/desktop/src/shared/adeCliGuidance.ts
  • apps/desktop/src/shared/types/builtInBrowser.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/ade-browser-1d208e91

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@arul28 arul28 changed the title Ade Browser Add ADE browser CLI proof flow Jun 2, 2026
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented Jun 2, 2026

@copilot review but do not make fixes

Comment thread apps/desktop/src/main/main.ts
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented Jun 2, 2026

@copilot review but do not make fixes

@arul28 arul28 force-pushed the ade/ade-browser-1d208e91 branch from 6d1388f to 5647e78 Compare June 2, 2026 07:35
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented Jun 2, 2026

@copilot review but do not make fixes

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