Skip to content

MAWS in-app browser driven by cua_repl: client-mode host, MAWS backend discovery, maws profile (#13) - #91

Merged
SSFSKIM merged 35 commits into
mainfrom
maws-in-app-browser-13
Oct 9, 2026
Merged

SSFSKIM merged 35 commits into
mainfrom
maws-in-app-browser-13

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #13

Summary

This PR is the cua half of the MAWS in-app browser change. A Claude Code session running inside MAWS now drives MAWS's own browser tabs through cua_repl, using the same vendor browser API it uses for Chrome. The design and its living record are in the spec docs/doperpowers/specs/2026-10-08-maws-in-app-browser-design.md; its Decision Log lists every decision taken during execution.

The MAWS half is SSFSKIM/MAWS#1.

  • Client mode: cua serve and cua profiles list read CUA_BROWSER_BACKENDS, a list of MAWS session sockets. For each socket they run the host in client mode: connect, wait up to 5 s for hello, then retry every 5 s. Each process listens on its own socket under chrome/m/, and nothing scans that directory, so no process can list another process's MAWS backend.
  • Discovery: the client-mode sockets are listed in BROWSER_USE_BACKEND_PATHS before the hello arrives. On the vendor route the /tmp/codex-browser-use sockets are added as well.
  • Default selection: the trusted wrapper resolves an unqualified browser selection at the moment of selection. It takes the exact MAWS instance if listed, otherwise the first listed maws: instance, otherwise the vendor's own "unavailable" error. It never selects Chrome. When the user names a Chrome profile, that selection passes through unchanged.
  • profiles_list: gains maws entries, either ready or maws_unreachable. The maws and maws-<n> keys are reserved. The tool description gets a MAWS line and stays at 1,194 characters, under the 2,048 cap.
  • Host changes for a MAWS peer: the host now forwards moveMouse as cursor.move. It handles tabs.adopted, which the host owns and which creates no duplicate tab. It passes timeoutMs on debugger.sendCommand and puts profileName in getInfo. The Chrome route behaves identically: a hello without profileName changes nothing, and the extension ignores timeoutMs.
  • Harnesses:
    • scripts/accept/maws-features.mjs covers profiles, createTab, locator, viewport, popup, download, alert, confirm, chooser and cleanup, plus isolation via --other.
    • scripts/accept/maws-selection.mjs covers the default-selection pins, including a MAWS that starts late.
    • test/helpers/fake-maws-peer.mjs provides a fake MAWS peer.
  • Docs and version: README "For MAWS" and "Profiles" are updated, plugin and marketplace are at 0.5.0, and the evidence file is docs/evidence/2026-10-08-maws-in-app-browser.md.

Validation Evidence

  • Unit and integration suite. npm test at fabc6b3: # tests 1034, # pass 1033, # fail 0, # skipped 1 (the skip was already there). I ran it 5 times at this head. One of the five runs had a single failure that did not recur in the other four, and I did not identify which test it was.

  • Selection probe. CUA_HOME=/tmp/cua-h13 node scripts/accept/maws-selection.mjs passed 11/11 against the real vendor runtime 26.928.40906, with a fake MAWS peer and a Chrome-shaped fake peer. It covers: the default is maws; MAWS down reads as maws_unreachable; the default fails closed; an explicit Chrome selection still works; reconnect is ready within 10 s; the default is restored in the same REPL heap; and a cua serve started while MAWS is down picks MAWS up once it returns.

  • Live harness. CUA_HOME=/tmp/cua-h13 CUA_BROWSER_BACKENDS=<dev MAWS session socket> node scripts/accept/maws-features.mjs --report … --other <second session socket> ran against a MAWS built from the MAWS branch at a47603a4 and the real vendor runtime. It returned {"profiles":"PASS","createTab":"PASS","locator":"PASS","viewport":"PASS","popup":"PASS","download":"PASS","alert":"PASS","confirm":"PASS","chooser":"PASS","cleanup":"PASS","isolation":"PASS"}. The download's sha256 matches the fixture, no save dialog appeared, and the file was removed afterwards.

  • Per-item results. All acceptance items that need no app session passed. The evidence file has a section for each of items 1-15, with commands, outputs, the probes under docs/evidence/2026-10-08-maws-in-app-browser/probes/ and their JSON outputs.

  • BLOCKED, waiting on the owner's sitting. These need a MAWS session whose engine loads the 0.5.0 plugin:

    • item 1 inside the app;
    • item 4's deliverable listing;
    • items 8-10 by hand, with screenshots;
    • item 11 with two sessions started from the UI;
    • item 13 with a real engine;
    • item 14 with a real Chrome profile.

    The sitting's steps (S1-S7) are in the evidence file. They load the plugin with the engine's --plugin-dir, which leaves the installed plugin and its cache untouched.

Unresolved Review Findings

  • Unparsable profiles.json (M1, logged in tech-debt-tracker.md). A profiles.json that does not parse hides the maws entry. Left because a broken registry is already reported by doctor.
  • Per-process host logs (M1, logged in tech-debt-tracker.md). Each client-mode host process writes its own log file, and nothing prunes them. Left because the files are small and doctor already sweeps stale status records.
  • Finding E (M5, logged in tech-debt-tracker.md; the fix would be in MAWS). A screenshot taken while the person holds the tab takes about 1.6 s. The vendor's devicePixelRatio read is classed as acting, so MAWS holds it and then refuses it. Left because the person stays protected and the agent still gets its screenshot. Making it immediate needs an exact-expression exception pinned to the 0.1.1 vendor.

Residue

  • Release after merge. Push the 0.5.0 marketplace entry and refresh the plugin cache on the owner's Mac. Both are deliberately held until this PR and the MAWS PR merge (see the spec's "execution pre-flight" entry).

SSFSKIM added 30 commits October 8, 2026 09:48
…exclusive automation ownership, tabs.adopted, takeover classes, closeTarget, A-42, vendor API names)
…sonHolds gate, closeTarget acting, chooser reset)
…ENDS, its discovery and default selection, and the maws entry in profiles_list

cua serve and cua profiles list connect to each configured MAWS socket and run the host over it in-process,
listening at chrome/m/<name>-<pid>.sock while connected and retrying every 5 s. The launch lists those hosts first
and prefers the first backend's instance; the trusted browser wrapper rewrites an unqualified selection to it, so
cua.getBrowser() is the in-app browser or the vendor's unavailable error, never a Chrome profile. The host turns
moveMouse into cursor.move for a peer whose hello names its profile, forwards timeoutMs on debugger.sendCommand and
owns tabs.adopted popups. profiles_list lists maws first (ready or maws_unreachable) with the MAWS rule in its
description; maws keys are reserved; bind and readiness ignore maws: instances; doctor reports maws.hosts.
…e, features page additions, README For MAWS, plugin 0.5.0

scripts/accept/maws-features.mjs drives a configured backend as an agent inside MAWS would (profiles, createTab,
locator, viewport, popup, cleanup, isolation with --other; download, alert, confirm and chooser are M3's slots).
scripts/accept/maws-selection.mjs proves the default selection against a fake MAWS peer and a Chrome-shaped one with
the real vendor runtime. The features page gains #name, #submit, #popup and /popup.
CUA_BROWSER_DEFAULT_INSTANCE carries the first backend's instance id, or the bare marker maws: when no hello arrived
before launch. The trusted wrapper resolves an unqualified selection when it is made: the listed browser with that
instance id, else the first listed maws: browser, else the vendor's own unavailable error; never a Chrome profile. A
cua serve started while MAWS was down now selects MAWS once it returns, without a restart (maws-selection.mjs
late-start steps, live against the real runtime).
… JPEG (the vendor's tab.screenshot answers JPEG; found by M2's first run against real MAWS)
…rome route's feature cells on the created tab; the served page's own file transfers accepted; the downloaded file removed once proven the run's)
…vidence per item (1-15), the probes and their outputs, the inside-MAWS sitting for the blocked items; README For MAWS: a held tab as the agent sees it and a session-scoped plugin; tech-debt row
…ots rowed and cursor-free, keyboard typing rowed, takeover as revised, a screenshot during a hold, the cookie jar refused, the panel-opens e2e; findings A-C updated, E added; the cookie-jar probe
…ld select the owner's Chrome; whole-branch review)
@SSFSKIM
SSFSKIM merged commit d149217 into main Oct 9, 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.

Phase D: MAWS in-app browser adapter

1 participant