Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c5343a4
feat(browser): add React Grab shared contracts, parser, prompt format…
sambitcreate Nov 22, 2026
68b31ad
feat(browser): add React Grab shared contracts, parser, prompt format…
sambitcreate Nov 22, 2026
9250841
feat(chat): persist, validate, serialize, and track React Grab elemen…
sambitcreate Nov 23, 2026
ac4bb3e
feat(composer): add React Grab chips, inspection popover, draft/queue…
sambitcreate Nov 23, 2026
88a3dd8
feat(browser): implement React Grab runtime, local source-map/sanitiz…
sambitcreate Nov 23, 2026
fd9ed5f
fix(composer): retain forked grab thumbnails across chat switches and…
sambitcreate Nov 23, 2026
0324f28
fix(browser): harden source-map fetch boundary, refocus host on grab …
sambitcreate Nov 23, 2026
aa2a294
Merge branch 'swarm-chat-pipeline-ea8de486' into react_grab_feature
sambitcreate Nov 23, 2026
636d711
Merge branch 'swarm-composer-ui-40c39527' into react_grab_feature
sambitcreate Nov 23, 2026
b0a39a0
feat(browser-grab): integrate analytics, E2E + a11y suites, CI regist…
sambitcreate Nov 23, 2026
a1f9ffc
fix(composer): align transcript grab popover to end so it stays clear…
sambitcreate Nov 23, 2026
dec3883
Merge remote-tracking branch 'origin/main' into react_grab_feature
sambitcreate Nov 23, 2026
cf57b0b
fix(browser): keep grab frames live under a covered window and restor…
sambitcreate Nov 24, 2026
98b99ab
fix(browser-grab): bind source maps to the page origin, redact creden…
sambitcreate Nov 24, 2026
f09ca76
test(browser-grab): scroll grab targets into view before clicking
sambitcreate Nov 24, 2026
41d79f1
Shield frames added inside shadow roots while grabbing
sambitcreate Nov 24, 2026
0a4ae90
Drop the grab throttling lease and refuse stale source hints
sambitcreate Nov 24, 2026
c81fd04
fix(browser-grab): intercept pointer input with top-layer overlay shi…
sambitcreate Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .memory/browser-react-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Browser Element Grab (React Grab)

Implemented 2026-11-22 for the embedded desktop Workspace Browser (`Environment → Browser`).

## Architecture & Decisions

- **Zero new preload IPC channels:** Reuses `browser:command` (`{ action: "grab", tabId, enabled, accent? }`) and `browser:event` (`grab`, `grab-ended`, `shortcut: "grab"`).
- **Zero Remote protocol revision required:** Stores structured metadata on `ChatMessage.grabbedElements?: GrabbedElementContextV1[]` (`renderer/shared/browser-element-grab.ts`) paired with an optional standard `kind: "image"` attachment whose id is `grab-thumb_<elementId>`.
- Desktop `MessageAttachments` filters out `grab-thumb_*` via `withoutGrabbedElementThumbnails()`, while `MessageBubble` renders read-only `<GrabbedElementChips>` pairing each element with its thumbnail by `thumbnailAttachmentId`.
- Paired iOS/Android clients continue to see the user message plus the cropped PNG image attachment without breaking `AttachmentKind`.
- **In-page grab runtime & loopback-only source maps:**
- Injected into the guest `WebContentsView` main world via `executeJavaScript` (works alongside open DevTools, CSP-immune via Closed Shadow DOM + inline `el.style`, zero page-context network calls).
- Supports React 16–19 (including React 19 `_debugStack` + RSC `_debugOwner`), Vue, Svelte, Astro, Preact, Solid, Angular, and plain HTML/CSS via getter-safe `Object.getOwnPropertyDescriptor` reads.
- `ArrowUp`/`ArrowDown` component-tree stepping, `Shift+Click` multi-grab (`keepActive: true`), `F` animation freeze, 2-rAF overlay hide before screenshot capture, and unstoppable Escape via main's `before-input-event`.
- Main-process Base64-VLQ source-map symbolication (`main/services/browser/grab-source-map.ts`) fetches only from the authoritative page's exact loopback origin (scheme, host, port), or `file://` only for a `file://` page with a workspace root and realpath containment, with `redirect: "error"`, 1500ms timeout, and LRU caching (2026-11-24, Pullfrog finding).
- While grabbing, every iframe/frame/embed gets inline `pointer-events: none !important` (`FrameShield` in `grab-runtime/index.ts`) so frame input lands on the top document and is suppressed; hit tests lift the shield synchronously to descend into same-origin frames. Props drop `value`/`defaultValue` always and all text on credential fields (`sensitiveTarget`).
- The shield's `MutationObserver` watches the document and every open shadow root its scans find, so frames added later inside a shadow tree are shielded too. A shadow root attached after the grab starts raises no mutation, so `pointerover`/`pointermove` run `FrameShield.adopt` on the event's innermost target (and the hit-test result) as a backstop: it walks up through shadow hosts and same-origin frames, shields any top-document frame and watches any unwatched open shadow root before the pointer reaches the frame (2026-11-24, Pullfrog finding; E2E in `browser-grab.spec.ts` frames test).
- Each overlay frame wait is capped at 100 ms (`nextFrame` in `overlay.ts`). The cap is a bound on a wait that could otherwise never end on a page that does not paint, not a fix for any observed failure. Grab takes no background-throttling lease of its own (the one added in cf57b0bb4 came from a disproven hypothesis and was removed); thumbnail capture takes its own lease. Region screenshots read the viewport in the isolated CDP world, not the page's main world.
- The service records the page URL when a grab starts (`tab.grab.pageUrl`) and passes it to `sanitizeRawGrabPayload` as `grabPageUrl`. If the page has since moved to another source authority (`sameGrabSourceAuthority` in `grab-source-map.ts`), no source hint is resolved or reported, so a stale stack is never judged against the new origin. A same-origin route change keeps the hints.
- The macOS-only E2E failure of the DevTools step (2026-11-24) was the test clicking #secret-form below the fold on the smaller hosted-runner display (the off-viewport click hit nothing, so the grab stayed active); the E2E now scrolls each target into view first. Reproduce by shrinking the main window to about 560px tall.
- Main-process thumbnail capture (`grab-thumbnail.ts`) clamps to viewport, handles Retina/zoom scaling, masks credential fields (`credential-fields.ts` + `credential-mask.ts`), and resizes to <= 640px / <= 512 KiB.
- In-page highlight color follows active Aiden `--fill-accent` / `--fill-accent-foreground` with automatic `#006AD6` / `#FFFFFF` fallback when accent saturation < 0.12 (`resolveGrabAccent`).
- **Composer & Transcript UI (`renderer/components/grabbed-element-chip.tsx`, `composer.tsx`, `chat-pane.tsx`):**
- Each chip renders two sibling `<button>`s (trigger + inline trailing `size-8` squircle `×`) with zero `nested-interactive` axe violations, matching Aiden's `@mention` and attachment chips.
- Inspection popover uses Aiden's `Popover` / `PopoverContent` (`data-slot="popover-content"` for `BROWSER_NATIVE_OCCLUDER_SELECTOR`), `side="top" align="start" sideOffset={8}`, borderless `rounded-popover bg-popover shadow-popover border-0`, `250ms` hover open / `140ms` grace close, click-to-pin, and auto-pin when expanding `"Show N more details"` or copying context.
- Expandable details use `useCollapsibleBody` with `--motion-duration` / `--motion-easing` and `:root[data-reduce-motion="true"]` parity.
- Delivered via `browserElementGrabDelivery` (`ComposerDeliveryRegistry`) fenced on `firstSendPendingRef || sendPendingRef || !available()`, deduplicated in place by `grabbedElementDedupKey`, capped at 10 elements / 256 KiB.
- Stored per-chat in memory in `composer-draft-store.ts` (never `localStorage`), preserved across failed sends, queued messages (`chat-message-queue.ts` + `queued-messages.tsx`), worktree sends (`draft-worktree-send-view.tsx`), and Edit in fork.
- Empty-text send is allowed; Steer is disabled and `/btw` is guarded while grabbed elements are attached; Backspace at caret 0 removes the last chip (after mentions).
- Never blocks text-only models (`visionSupported === false`): shows a non-blocking `"Text context only for this model"` note in the composer and popover while sending the full deterministic `<attached-browser-elements>` block (omitting `grab-thumb_*` image blocks and fallback lines).
- **Exclusions & Safety:** Refused in Bot browsers (`BOUNDARY_REFUSED_ACTIONS`, hidden on `variant="bot"`). Main supplies authoritative `pageUrl`/`pageTitle`, redacts sensitive values/attributes, and treats all grabbed fields as untrusted reference material.
- **Analytics & Onboarding:** Content-free events `browser_element_grabbed` and `browser_grab_sent` documented in `docs/analytics.md`; existing `browser` onboarding tile updated in `onboarding-feature-gallery.tsx` and `onboarding-art/create-art.tsx` (code-drawn, zero raster images).
1 change: 1 addition & 0 deletions PRODUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ First-run setup and Settings → Providers share an account, API key and local-m
- A provider's usage limit makes a reply wait, never switch to another model; limits that last days and billing problems fail at once with the reset time. Spending limits are the owner's: each chat, each Bot's month and each routine run can stop at a dollar amount counted from API-key requests only, and only the person can allow more (on the Mac or a paired phone). See [docs/usage-limits-and-spending.md](docs/usage-limits-and-spending.md).
- In chats with Web Search on, the agent can read a public web page. Opt-in extract mode, set up with the person's own Cloudflare account, returns only the named values it asks for, each with supporting page text; a value that is not on the page comes back as a guess, never as read.
- Design mode (desktop, on by default; `AIDEN_DESIGN_MODE=0` turns it off) puts a workspace chat beside an infinite design canvas. Pages stay workspace HTML files served only to that chat's canvas in a sandbox with no network; Aiden changes the canvas only in attended desktop turns, through its canvas tools or by an HTML page it writes, edits or makes with a command under the workspace's `design/` folder landing as a frame (and, when the person opens design mode, the pages the chat's earlier replies wrote landing on an empty canvas), and a comment or an in-place word edit the person makes goes to Aiden only with their next message, while plain word edits are written into the page's file and can be undone. The first time design mode is on in a workspace with no `design/tokens.css`, Aiden reads a few of its style files on the device and offers in chat to write a tokens file and a specimen page from the colours and fonts it found; it writes them only after the person agrees, and asks once per workspace.
- Browser element grab (desktop workspace browser, `⇧⌘G` / `Ctrl+Shift+G`, hidden on Bot browsers) lets people point and click live page elements to attach compact, inspectable context chips (`<Component />` or tag) with credential-masked cropped thumbnails to the composer. Framework inspection covers React 16–19 (including RSC and VLQ source-map resolution in main bound to the page's own loopback origin or workspace files), Vue, Svelte, Astro, Preact, Solid, Angular, and plain DOM alongside open DevTools, without blocking text-only models or adding a Remote protocol revision. See [browser behavior and controls](docs/environment-browser.md).
- Bot computers (Apple silicon): an opt-in macOS VM per Bot, which the Bot sees and uses with its own `computer` tool (screenshots and clicks, each step with a stated intent the rules read) and `computer_shell` tool, on routine runs too. The Bot panel's Computer tab shows it live with the Bot's avatar where it last pointed; the person's first click or key, or Take over, stops the Bot's current action until Give back, and Float over chat keeps the screen in view. Element control (Aiden's pinned cua-driver in the base computer, allowed once for Accessibility and Screen Recording and inherited by every Bot computer made from it) lets the Bot read an app's buttons and fields and click them by number, and the rules then also read the element acted on; skipping it keeps screen-only Bots. A Bot can ask the person to sign in on its own computer: Open hands the person the computer with Safari at the site, the Bot's computer tools wait, and the password never reaches the model. The onboarding tour introduces Bot computers only where they exist. See [docs/bot-computers.md](docs/bot-computers.md).
- On iPhone, an `svg` code block in a reply has View, which draws it with no scripts and no network. A workspace `.html` file opens on a themed Preview, with no network and a Source switch, and tapping a "File written" line in a workspace chat opens that file.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The installer selects the native package for your machine, checks its published
- **Aiden Live & on-device voice** — Start a voice session with **Aiden Live (Beta)** to talk through tasks, navigate Aiden, and answer approvals by voice, or use **Parakeet** dictation locally (with Metal GPU acceleration on Apple silicon).
- **Floating Quick Chat** — Summon a floating chat starter from any app (`⌘⇧Space` on macOS, `Ctrl+Shift+Space` on Linux) that morphs into a streaming mini-modal with tool approvals, expands into the main window mid-stream, and starts as a Temporary chat you can save or attach in-place to a workspace.
- **Aiden On The Go & headless server** — Pair iPhone, iPad, Android, or another Mac over your local Wi-Fi or Tailscale ([remote access guide](docs/aiden-on-the-go-remote-access.md)), or run [`aiden serve`](packages/cli/README.md) on a headless Linux/macOS box.
- **Extensibility & local-first privacy** — Bring your own hosted or local models, use `/commands`, `$skills` ([skills](docs/skills.md)), [hooks](docs/hooks.md), MCP connectors (including [Composio](docs/composio.md)), an embedded browser ([browser guide](docs/environment-browser.md)), and **Apps using Aiden** ([local MCP server](docs/aiden-mcp-server.md)). Chats stay local on disk and secrets live in OS encrypted storage; see [Privacy and trust](docs/privacy.md) and [Usage data](docs/analytics.md).
- **Extensibility & local-first privacy** — Bring your own hosted or local models, use `/commands`, `$skills` ([skills](docs/skills.md)), [hooks](docs/hooks.md), MCP connectors (including [Composio](docs/composio.md)), an embedded browser with live React/DOM element grab (`⇧⌘G` / `Ctrl+Shift+G`) ([browser guide](docs/environment-browser.md)), and **Apps using Aiden** ([local MCP server](docs/aiden-mcp-server.md)). Chats stay local on disk and secrets live in OS encrypted storage; see [Privacy and trust](docs/privacy.md) and [Usage data](docs/analytics.md).

## Why Aiden

Expand Down
2 changes: 2 additions & 0 deletions docs/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Feature events fire once, at the moment the action succeeded, from the service t
| `design_mode_exited` | A chat left design mode from the Design button, ⇧⌘L or `/design off` | none |
| `design_mode_declined` | Not now on Aiden's "Open design mode?" card. A card that times out or stops with the reply is not counted. | none |
| `design_comments_sent` | A desktop message carried design-canvas comments for Aiden | `count_bucket`: how many comments. Their notes, pages, files and elements stay on your device. |
| `browser_element_grabbed` | A person grabbed an element from the embedded workspace browser into the chat composer | `kind`: `react` or `dom`; `source`: `toolbar` or `shortcut`. The URL, component name, source path, HTML and screenshot stay on your device. |
| `browser_grab_sent` | A desktop message carried grabbed browser elements for Aiden | `count_bucket`: how many elements; `with_screenshot`: whether a cropped thumbnail accompanied them. Element metadata and images stay on your device. |
| `goal_started` | A keep-going goal was set in a chat | `source`: `slash`, `menu`, `proposal`, `phone` or `until`. The objective stays on your device. |
| `goal_settled` | A keep-going goal stopped: done, needs you, paused or cleared | `outcome`: `done`, `needs_you`, `paused` or `cleared`; `rounds`: how many rounds it ran, as `1`, `2-5`, `6-10`, `11-20`, `21-49` or `50`. The objective and the reviewer's reasons stay on your device. |
| `floating_chat_opened` | The floating Quick Chat window opened | `source`: hotkey (global shortcut) or command (command palette or in-app command) |
Expand Down
Loading
Loading