Skip to content

examples: a stock Puppeteer client, two more sites, and the failure paths - #5

Merged
kmjones1979 merged 1 commit into
1clawAI:mainfrom
redbotster:test/more-examples
Sep 9, 2026
Merged

kmjones1979 merged 1 commit into
1clawAI:mainfrom
redbotster:test/more-examples

Conversation

@redbotster

Copy link
Copy Markdown
Contributor

Three new examples alongside the shipped ones, covering territory they don't:

forum-post-puppeteer.mjs — a real puppeteer-core client, not the hand-rolled Agent, 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:

  • Playwright connects and navigates fine, but context.newCDPSession(page) calls Target.attachToBrowserTarget under the hood in connectOverCDP mode, 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.
  • Element-handle helpers ($eval, .type()) go through DOM.resolveNode, also not allowlisted (DOM.querySelector is, resolveNode isn't). All interaction here goes through page.evaluate(), same as the existing examples.

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, 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 with site_rejected_password and 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 typecheck and pnpm build are clean; these are plain .mjs examples like the existing ones, not part of the vitest suite.

Ran all three locally against Chrome on macOS — output:

forum-post-puppeteer.mjs:      OK (register, login, post — password never seen)
capture-attr-purchase.mjs:     OK (register, login, capture via attribute, purchase — nothing leaked)
failure-modes.mjs:             ALL OK (rejected password stores nothing; wrong password never authenticates)

…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.
@kmjones1979
kmjones1979 merged commit 9775a35 into 1clawAI:main Sep 9, 2026
4 checks passed
@redbotster
redbotster deleted the test/more-examples branch September 9, 2026 12:43
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.

2 participants