examples: a stock Puppeteer client, two more sites, and the failure paths - #5
Merged
Merged
Conversation
…aths The shipped examples all use the hand-rolled Agent and the happy path. These three exercise different territory: - forum-post-puppeteer.mjs: a real puppeteer-core client (not the hand-rolled Agent) registers, logs in, and posts a comment while authenticated. Notes what it took to get there: Playwright's newCDPSession() calls Target.attachToBrowserTarget in connectOverCDP mode, which isn't allowlisted (correctly, since it's broader than a per-target attach); and element-handle helpers ($eval, .type()) go through DOM.resolveNode, also not allowlisted, so interaction here goes through page.evaluate() throughout. - capture-attr-purchase.mjs: a third site, the --value-attr capture variant (a "copy button" carrying the value in data-clipboard-text rather than element text), and a purchase as the closing activity via the execution intent stand-in. - failure-modes.mjs: the safety paths, not the happy path. A site whose password policy always rejects the bridge's generated password aborts with site_rejected_password and stores nothing; a binding holding a wrong password never actually authenticates against the site's own login, even though the bridge reports the mechanical fill as "filled". All three: register/login credentials never appear in any tool result, checked programmatically the same way the shipped examples check it, not by eyeballing the output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three new examples alongside the shipped ones, covering territory they don't:
forum-post-puppeteer.mjs— a realpuppeteer-coreclient, not the hand-rolledAgent, registers, logs in, and posts a comment while authenticated (a different site shape and a different activity than the profile-update example). Two things I ran into worth documenting inline for the next person:context.newCDPSession(page)callsTarget.attachToBrowserTargetunder the hood inconnectOverCDPmode, which isn't on the allowlist — correctly refused, since it's broader than the per-target attach Puppeteer uses. That's why this uses Puppeteer rather than Playwright.$eval,.type()) go throughDOM.resolveNode, also not allowlisted (DOM.querySelectoris,resolveNodeisn't). All interaction here goes throughpage.evaluate(), same as the existing examples.capture-attr-purchase.mjs— a third site, the--value-attrcapture variant (a "copy button" carrying the value indata-clipboard-textrather than element text), and a purchase as the closing activity via the execution-intent stand-in, instead of the weather-API example's read-only call.failure-modes.mjs— the safety paths, not the happy path. A site whose password policy always rejects the bridge's generated password aborts withsite_rejected_passwordand stores nothing (checked against the vault directly, not just the tool response). A binding holding a wrong password mechanically reports"filled"but the site itself never actually authenticates — worth having explicit, since a control nobody's watched fail is a control nobody's checked.All three assert the same invariant the shipped examples do: the password/key/token never appears in any tool result, checked programmatically.
pnpm typecheckandpnpm buildare clean; these are plain.mjsexamples like the existing ones, not part of the vitest suite.Ran all three locally against Chrome on macOS — output: