Skip to content

feat(perception): perception/interact, a persistent browser session a citizen drives and sees after each step (card 3569675f) - #4551

Merged
joelteply merged 3 commits into
canaryfrom
feat/perception-session
Sep 29, 2026
Merged

joelteply merged 3 commits into
canaryfrom
feat/perception-session

Conversation

@joelteply

@joelteply joelteply commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Card 3569675f (first slice). Joel asked: "we actually need to help her do screenshots and stuff. Continuum could help here. It's gonna do similar playwright automation."

The gap

Continuum already had the capability: @continuum/perception's PerceptionSession over a Playwright DomSurface (pixels, element tree, and a driver). But no persona-callable command could act on a page across calls. perception/observe and perception/hot-edit reopen the page every time. So a citizen couldn't click through her own site's flow, couldn't produce visual evidence that a slice works, and her product had no Continuum verb for the job-site automation it needs.

What this adds

  • perception/interact (native, AiSafe, Provided, served by an eye-node):
    • The first call passes target: it opens a session and returns a session handle with the page's image and element tree.
    • Later calls pass session and actions (click, type, press, hover, goto, with CSS selectors aimed at the tree) and return the page after them plus delta, the before/after pixel fraction.
  • perception/session-close (catalog only): releases a browser early.
  • Eye-node session registry (apps/eye-node/src/interactAdapter.ts):
    • handle to live PerceptionSession;
    • at most 8 sessions (a ninth is refused with the reason, never an eviction of someone's live page);
    • idle sessions closed after 10 minutes, all closed on stop();
    • a failed step keeps the page open.
  • DomSurface gains goto, which navigates the same live page with its cookies and storage kept.
  • PerceptionAction is a closed serde enum that mirrors the DomAction kinds. Bindings are in protocol/typescript/perception/. The eye-node README and PERCEPTION-SURFACE.md §7 step 5 are updated.

Evidence

Per Joel's rule today (done means evidence it ran):

  • Typecheck: tsc --noEmit passes for apps/eye-node (including the new spec) and packages/perception, under Node 22.
  • Real browser: a scratch script drove the actual chain InteractSessions → PerceptionSession → DomSurface → Playwright, with the IntelMac's installed Chrome, against a local page:
    open:  true Tracker session true image true
    click: true delta 0.9953 h1 contains approved: true   (type "rust" into the input, click Approve)
    goto:  true Second http://127.0.0.1:…/second
    close: { success: true, closed: true } sessions open: 0
    
  • Unit spec: interactAdapter.spec.ts covers persist, bounds, idle expiry, a failed step keeping the page, and the action mapping, using a fake session. I couldn't run it on the IntelMac: its vitest bundler has no darwin-x64 native binding in the shared install. It typechecks.

Gaps this exposes (follow-up cards)

  • No CI runs the TS packages. ci.yml targets the legacy src/ tree, and no required check runs apps/eye-node or packages/perception typecheck or tests. So TS changes like this one ship verified only by whoever ran them locally. A required typecheck-and-vitest job for the workspace packages would close that.
  • The 5090's eye-node: card 4e8b1a92 (npx.cmd spawn; the eye reaper kills Playwright browsers) may keep this from working on Kimi's node. That needs checking there before she relies on it.
  • Later slices of 3569675f: evidence receipts (a capture attached to a card or PR per Accepts line), and handing a live session to a human for captcha, login or a final submit, then back.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

joelteply added a commit that referenced this pull request Sep 28, 2026
…ed it, and opens only http(s) pages (Fable on #4551)

- The core stamps the VERIFIED caller into provided params as _callerPeerId
  (runtime::provided_provider::with_verified_caller, on both the socket and
  the persona route), removing any value the request supplied. A session
  records its opener and refuses interact or close from anyone else, so a
  handle pasted into a room cannot let another citizen drive her logged-in
  job-site session.
- target and goto must be http(s): a file:// page would render local files
  (config.env, keys) into her observation. Public pages stay open.

Evidence: eye-node typechecks under Node 22; the real-browser run now also
shows another caller refused ("belongs to another citizen") and file:// refused,
with the owner's session unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Sep 28, 2026
… process, so a sibling test's child cannot hold its writer (card 64ca188f) (#4556)

windows_launch::tests::detached_child_closes_unrelated_pipe_and_preserves_launch_contract
makes an INHERITABLE pipe writer on purpose, to prove the detached child does
not receive it. But std spawns every process with handle inheritance on, so any
sibling test in the same binary that spawned a process during that window
inherited the writer and held the pipe open, and the check failed on a child that
was not the one under test. It failed on four heads on 2026-09-28 (#4540, #4550,
#4551 and the canary tip a0c43bf, where a red tip makes the deploy tracker
RefuseRed and blocks every deploy).

The test now re-execs the test binary with --exact <itself> --test-threads=1
and a marker env var, and asserts that run succeeds; only the isolated run
performs the check. Nothing else runs in that process, so nothing else can
spawn while the inheritable writer exists. The check itself is unchanged.


Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply and others added 2 commits September 28, 2026 19:02
… citizen drives and sees after each step (card 3569675f)

Joel: help Kimi screenshot and drive her own site, the same Playwright-style
automation her product needs. observe and hot-edit reopen the page per call;
nothing persona-callable could click, type or navigate across calls.

- perception/interact (native, AiSafe, Provided): the first call opens a
  session at `target` and returns its handle with the observation; later
  calls pass `session` + `actions` (click, type, press, hover, goto) and get
  the page after them plus the before/after pixel delta.
- perception/session-close (catalog only) releases a browser early.
- The eye-node holds sessions behind handles (interactAdapter.ts): at most 8
  open, a ninth refused with the reason, idle ones closed after 10 minutes, all
  closed on stop, and a failed step keeps the page.
- DomSurface gains `goto`, navigating the same live page.
- Typed PerceptionAction (a closed serde enum matching the DomAction kinds),
  bindings in protocol/typescript/perception, README and PERCEPTION-SURFACE
  step 5 updated.

Evidence: eye-node and perception typecheck under Node 22; a real-browser run
through InteractSessions -> PerceptionSession -> DomSurface -> Playwright
(installed Chrome) opened a local page, typed and clicked (the h1 read
"approved: rust", delta 0.995), navigated with goto, and closed the browser.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ed it, and opens only http(s) pages (Fable on #4551)

- The core stamps the VERIFIED caller into provided params as _callerPeerId
  (runtime::provided_provider::with_verified_caller, on both the socket and
  the persona route), removing any value the request supplied. A session
  records its opener and refuses interact or close from anyone else, so a
  handle pasted into a room cannot let another citizen drive her logged-in
  job-site session.
- target and goto must be http(s): a file:// page would render local files
  (config.env, keys) into her observation. Public pages stay open.

Evidence: eye-node typechecks under Node 22; the real-browser run now also
shows another caller refused ("belongs to another citizen") and file:// refused,
with the owner's session unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the feat/perception-session branch from ddedb18 to 01f8f74 Compare September 29, 2026 00:02
…3610 over work/create (#4551 rebase)

The rebase onto #4550 put perception/interact on top of work/create; CI measured
the combined surface at 13610 guard tokens (ceiling was 13500). Pinned to the
measured sum, not a rounded guess.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply merged commit dba7652 into canary Sep 29, 2026
8 checks passed
@joelteply
joelteply deleted the feat/perception-session branch September 29, 2026 01:34
joelteply added a commit that referenced this pull request Sep 29, 2026
…batch tip, naming #4557's wording (#4568)

Canary ac65b92 is red: the batch combined #4551's 13610 pin (measured with work/create
and perception/interact) with #4557's work/submit help text, +14 tokens. The words are
the fix for Kimi's stalled submit, so the ceiling is re-pinned to the measured value
with the addition named, per the test's own instruction.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant