Skip to content

E13: cua_repl drives the in-app browser (primitive server, retained semantics, the six browser tools retired) - #1

Merged
SSFSKIM merged 34 commits into
masterfrom
e13-cua-in-app-browser
Oct 9, 2026
Merged

SSFSKIM merged 34 commits into
masterfrom
e13-cua-in-app-browser

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Part of SSFSKIM/cua#13 (the cua half is SSFSKIM/cua#91). This PR carries no closing keyword, because the ticket lives in the cua repository.

Summary

cua's cua_repl now drives MAWS's in-app browser, replacing MAWS's own six browser tools. This is the owner's decision of 2026-10-08. MAWS's main process serves the Chrome extension's primitive protocol on one 0700 Unix socket per app session, and cua's host connects to it. The design and its record are in cua's spec docs/doperpowers/specs/2026-10-08-maws-in-app-browser-design.md; MAWS's pointer to it is docs/doperpowers/plans/2026-10-08-e13-cua-in-app-browser.md.

  • M2, the primitive server (src/main/browser/cua/).
    • Each connection owns its tabs and its leases. Tabs it creates are reserved to it, and only the owning connection can close them.
    • TabDebugger is lease-counted. Each tab has one automation owner.
    • Commands pass through a filter that refuses Browser.*, Storage.*, SystemInfo.*, Tethering.* and the cookie-jar Network.* methods. Target.* is emulated. Tabs are parked by lease.
    • Before a lease is released, everything the connection switched on is undone, including file-chooser interception.
    • Held commands are cancelled at their deadline, on disconnect, at turn end, and when the tab closes.
    • CUA_BROWSER_BACKENDS goes into each session's launch through extraSettings.env.
    • Spikes S1 (dialogs) and S2 (file chooser) both PROMOTE on Electron 44.4.5.
  • M3, what the person sees and keeps.
    • Control follows the lease. The takeover gate uses acting and reading commands with personHolds, and holds are bounded.
    • The cursor follows cursor.move, and it is hidden before every agent screenshot (capture or screencast).
    • browser.agent.activity produces transcript rows under the cua_repl js call. They stay in view after the turn folds, and a 500-entry buffer per session plus browser.agent.activities.list lets them survive a reload.
    • Agent downloads go to ~/Downloads with Chrome's (1) naming and are recorded as deliverables (maws.download.recorded).
    • Dialogs are held for the vendor, with a 30 s default answered through the held callback (A-53).
    • A person who takes a leased tab over keeps the native dialogs, the save dialog and their own navigations.
    • Agent tabs carry an "agent" badge. The tab cap spares leased tabs. The Browser panel opens on an agent's first acting command (owner decision) and leaves the tab unselected.
  • M4, the cut-over.
    • The maws server no longer lists browser_* tools.
    • The Playwright driver, bridge, IPC and playwright-core are removed.
    • Historical mcp__maws__browser_* names, schemas and rows stay frozen, so old journals and X8 fixtures render unchanged.
    • Bindings changed: P1 rows A-51 to A-54 amend A-19, A-42, A-43 and X9. Charter §19 gets a 2026-10-08 entry and §16's shim-bundling line is replaced. The tracker and the owner-script note are updated.

Validation Evidence

  • Typecheck and lint. pnpm typecheck and pnpm lint at fb56e80 both exit 0.
  • Unit tests. pnpm test at a47603a (the M5 run): 9778 passed, 1 skipped. The fixer's full run had 2 failures, both in pause-take-over.pty.test.ts, a known load flake that has a tracker row; it passes 6/6 alone.
  • e2e. pnpm e2e:browser-cua passed 3/3: the fake-host primitive case; takeover and cursor through the seam; and the Browser panel opening with the tab unselected. pnpm e2e:tools passed 8/8, and the handshake lists seven tools with no browser_*.
  • Acceptance 12. The replay snapshot of test/fixtures/transcripts/p1-maws-browser.jsonl, the pass3 snapshot and the conformance fixtures all pass with the snapshot and fixture files unchanged (vitest 241/241 in M5).
  • Live harness. cua's scripts/accept/maws-features.mjs ran against this branch built at a47603a, on bare Electron with its own userData, through the real vendor runtime. All 11 steps pass, including download, alert, confirm, chooser and two-session isolation. A recording proxy showed 9 Page.startScreencast and 0 Page.captureScreenshot, one Screenshot row per tab.screenshot(), and no cursor in an agent screenshot. All six cookie-jar methods answer Method not allowed. Evidence: cua docs/evidence/2026-10-08-maws-in-app-browser.md.
  • Live 30 s dialog default. An unanswered confirm closed at 31.6 s with false.
  • pnpm test:live. It ran at M4 and passed 39/40. The failing case is W1 delivered next steer on disk: engine 2.1.295 adds delivery_id to the on-disk record, and the case asserts that record exactly. This is engine drift, not this change, and it is listed under Residue.
  • BLOCKED, waiting on the owner's sitting (the steps are in the cua evidence file): items that need a session whose engine loads the 0.5.0 cua plugin. These are the panel badge screenshot, takeover and cursor by hand, the transcript rows in a real session, the download's deliverable listing, two sessions started from the UI, and reconnect with a real engine.

Unresolved Review Findings

All of these are logged in docs/tech-debt-tracker.md, and all were judged real but too minor to fix in this branch:

  • Late undo under focus emulation. With MAWS's own focus emulation on (off by default), an undo command that answers after the 1 s bound can clear a toggle the next lease has just re-enabled. Not seen in any run.
  • One-off e2e flake. e2e:browser-cua once failed with "Target page has been closed" at the activity poll. It has passed in every run since (7+).
  • Activity merge key. The merge key (at, tabId, kind) can collapse two same-millisecond, same-kind activities into one. Negligible.
  • Per-site cookie exposure. A direct socket client can still read one site's cookies at a time from request events it enables. Blocking those events would break the vendor.
  • Screenshot during a person's hold (finding E, in cua's tracker). It takes about 1.6 s, because the vendor's devicePixelRatio read is classed as acting.
  • Tab attach counts as acting (whole-branch review, log-only). The vendor's per-attach setup commands are acting, so an attach alone opens the Browser panel. It opens at most once per turn, and on the agent's own tab.

Residue

  • Activity rows across an app restart. Activity rows survive a window reload but not an app restart. Persisting them needs a journal or store for browser.agent.activity. This was out of scope by the coordinator's decision.
  • test:live W1 engine drift. W1 delivered next steer on disk asserts the on-disk record exactly, and engine 2.1.295 adds delivery_id. The case or the engine pin needs updating. This predates this change.
  • Socket peer authentication. Every process the session starts can reach the session's browser socket through its path in the environment. A per-launch token that the cua shim presents, or a signed-peer check like the Codex app's, would narrow that. This is security hardening beyond A-51/A-52, so it deserves its own design.

SSFSKIM added a commit that referenced this pull request Oct 9, 2026
…istered as P1's thirteenth child; E11 M8 records as A-55; P1 closes at E13's landing; landing order and rebase anchors
SSFSKIM added a commit that referenced this pull request Oct 9, 2026
…5 (A-51 to A-54 reserved for E13's PR #1); E13 registered as P1's thirteenth child in §9 and §13; §14 surprises; §15 written at E11's close; charter §13 P1 contracts X9 to X15, §19 landing line and nine Decision Log lines, §20 P1 at E11
@SSFSKIM
SSFSKIM force-pushed the e13-cua-in-app-browser branch from fb56e80 to 8c288a7 Compare October 9, 2026 03:12
SSFSKIM added 24 commits October 8, 2026 20:12
…ecution pointer for the in-app browser driven by cua_repl
…pening while the -run-dialog callback is held and Page.handleJavaScriptDialog answers the page; file-chooser interception passes through webContents.debugger (both PROMOTE)
…, lease-counted TabDebugger, one automation owner per tab, parking by lease, and CUA_BROWSER_BACKENDS in each session's launch
…host (create, navigate, click, cross-origin frame, filter, isolation, ownership, reset, close, disconnect)
…browser agent loses its unused env; spikes/cua-backend/serve-dev.mjs for the live proof
… go waits for that release and takes a fresh lease (was alreadyHeld, then Debugger is not attached); tracker rows for the flaky pause-take-over pty case and the e2e tsconfig include gap
…ctron's callback and the vendor answers through CDP (S1); the 30 s default answers through the held callback, not through CDP
…ua, typed text as a count) and BrowserTab's agentBadge
…nished download as a file deliverable, once per path
…mmands, personHolds, bounded holds), the cursor by cua.move and released with the lease, activity synthesis to browser.agent.activity, agent downloads to ~/Downloads reported to the host and recorded as deliverables, a leased tab's dialogs held for the vendor with the 30 s default through the held callback, the agent badge, and the tab cap sparing tabs under a cua lease
…a_repl js call (else as a row of its own), and the Browser panel badges an agent's tabs
…s steps PASS, the 30 s dialog default live), serve-plain.cjs for a MAWS with no Playwright client on its pages
…one skipped: the agent cursor's overlay was being named), and the e2e case reads the window's activity (opened, navigated, screenshot, labelled click, typing as a count)
…s's dialog steps on a MAWS with no Playwright client (A-53)
…ivity kept for the app's life (the last 500, oldest first)
…ile the agent holds the tab (personHolds keeps the person's native box; A-53 restated), a navigation the person holds is not the agent's activity, Chrome's macOS ' (1)' download suffix, and main keeps each session's last 500 activities for browser.agent.activities.list
…(under the js call while it runs, in view after the turn folds; the js cell still folds and counts), and a session's transcript lists main's kept activity on mount so a reload shows them again
…r on 2026-10-08 (cua_repl drives the in-app browser); no other tool moved; the historical names, schemas, event and row stay frozen for old journals
…the maws.browser.* IPC and the engine host's bridge, main's Playwright driver and bridge, playwright-core, the row's live waiting line and browser.agent.acting go; the dialogs' wrap, parking and the e2e seam are re-homed as the agent's presence; the historical mcp__maws__browser_* names, schemas, event and row stay frozen so old journals and X8 fixtures render unchanged; the tools' e2e, live test and stand-in retire
…eding 2026-10-05's browser-tool choice) and §16's bundled shim replaced by the user-installed plugin; tracker rows the removal settles closed; the interface ledger and plugins/cua README follow
…cursor's overlay: the server hides the cursor and waits the overlay's 50 ms grace before forwarding Page.captureScreenshot; the agent's next mouse event draws it again (Design §9, the spec's Cursor paragraph)
…g items that prompt the maws browser tools (A11, D7, D11, F1, A12.1, A12.2, Q8 to Q10); the -run-dialog re-verify row names what now exercises the routes; P-5 carries its A-54 pointer
SSFSKIM added 10 commits October 8, 2026 20:12
…hods are refused through the primitive server
… (its commands read, the cursor hidden with its grace before Page.startScreencast, one Screenshot row at the first frame after a start or at a capture); the cookie-jar Network methods are refused (A-51, amended); an agent download follows the personHolds rule of dialogs and navigations
…t, tab.screenshot and the AX state's screenshot) hides the cursor and is a Screenshot row; the vendor's own unbounded capture of the surface after each cell (its response metadata, BS:65063) is neither
…cting returns, emitted on a cua lease's first acting command; the agent's tab stays unselected
…el follows the agent again: a cua lease's first acting command tells the windows browser.agent.acting (E4c's event and renderer handler, restored), so the shown session's Browser tool opens; the agent's tab is not selected
…ast frames in about 20 ms once its page reads visible, parked included under the vendor's focus emulation; the live screencast path measured (66-74 ms per agent screenshot on a parked tab, one row each, the vendor's own unbounded capture no row)
…tivity-poll e2e flake, the activity merge key, per-site cookies from request events)
@SSFSKIM
SSFSKIM force-pushed the e13-cua-in-app-browser branch from 8c288a7 to a706d1f Compare October 9, 2026 03:14
@SSFSKIM
SSFSKIM merged commit 1d2111b into master Oct 9, 2026
SSFSKIM added a commit that referenced this pull request Oct 9, 2026
…on after its rebase) recorded as A-56; spec status, §9 and §13 E13 landed, §14 one line, §15 completed with the E13 paragraph and a retrospective delta; ledger §5 E13 row and §7 line; charter §13 X9's tool list rewritten to the seven tools, §19 landing line, §20 P1 closed paragraph; the cua_repl session's residue PRs #2 to #4 (bb6f953) noted; tracker: the cua #97 crash row removed as fixed, a row for the load-sensitive c7 dialogs case at the landing gate
SSFSKIM added a commit that referenced this pull request Oct 19, 2026
…n those files alone, and a publish moves only the files it changed
SSFSKIM added a commit that referenced this pull request Nov 1, 2026
…, flock(1) with a named refusal, uninstall under the lock, loss checked synchronously (PR #428 panel scalpel-2 #1, #2; sweep #3)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 1, 2026
…ller's own open file description, locked by flock 3 (PR #428 panel scalpel-2 #1, #2, final round)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 1, 2026
…er's own open file description, locked by flock 3 (PR #428 panel scalpel-2 #1, #2, final round)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 17, 2026
…here they are in the restored text

messagePrefill parsed the image placeholders from the display and cut them from the display as typed (asTyped, every
U+2060 removed), so each joiner the person typed or pasted before a placeholder moved the cut one character early: "a
<U+2060>b [Image #1]" came back to the editor as "ab [" (three joiners, "ab [Im"). The placeholders are now parsed from
the restored text, the string that is cut. The red cases of the previous commit pass.

Sminos-Session: ux-wave#10d85d03 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 20, 2026
… and scalpel-3 #1 to #4

Subagent rows carry their conversation's and agent's ids in the suites; a follow names the
conversation that drew its link. Red against the branch head.

Sminos-Session: ux-wave#10d85d03 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 20, 2026
…nversation and holds a follow's bounds until its work settles

- scalpel-2 #1: only records that carry the conversation's and the agent's ids count, so a file
  put in the found file's place between the walk and the open names nothing.
- scalpel-2 #3 (the daemon's half): namesInAgent takes the conversation that drew the link and
  answers not named unless it is the transcript the session is bound to; a follow naming none
  links nothing.
- scalpel-3 #1: a Markdown source's admission asks the search with a located callback; the
  follow's place and the proof's turn are kept until the locator's call settles.
- scalpel-3 #2: the search waits with the follow's own end, aborted at its patience.
- scalpel-3 #3: the proof's open and whole-file read stop at the first file system call after
  the follow has ended.
- scalpel-3 #4: admittedFolder answers only once both git discoveries (and every work tree's
  resolution) have settled.

Sminos-Session: ux-wave#10d85d03 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 20, 2026
…the manifest unchanged); the register case's search ends with its client; the viewer's red cases for scalpel-4 #1, #3 and #4

Sminos-Session: ux-wave#10d85d03 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 20, 2026
…#3, #4)

- #1: only a load that can still land holds a revisit back; a superseded one in flight does not,
  so the link's click reads after its follow.
- #3: a Save that answers while a load issued since it began is out (the tab moved to another
  session, its read waiting on a follow) issues that load again after the write, so the tab
  shows the new session's answer.
- #4: a continuation that found an outside file changed, answered read-only, is compared with
  the follows; once a follow found the link the file is read again, whole.

Sminos-Session: ux-wave#10d85d03 (MAWS on macbook)
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