This document contains the uncompromising, hard-truths of the v1 AgentBubble architecture and the research driving the v2 upgrade.
1. π SPA Navigation
The Flaw: Quartz uses client-side routing. agent-bubble.inline.ts bails out if the DOM elements exist. Thus, the iframeβs chatUrl gets locked to the very first page the user landed on.
The Fix: We CANNOT fix this by re-rendering the iframe (destroys UX). We MUST inject a MutationObserver or listen to document.addEventListener("nav") and push state via postMessage.
2. π§± Iframe Jail
The Flaw: Iframes are cross-origin sandboxes. The agent cannot βseeβ the page the user is on, nor can it highlight text or guide the user visually.
The Fix: A structured window.addEventListener("message") bridge inside the host script. This turns the host script into the βhands and eyesβ of the agent.
3. π¬ Comment Integration
How do we merge the AI Agent with the community comment system?
- β Bad (DOM Scraping): Fragile, breaks on Remark42 theme updates.
- π‘ Okay (API Fetching): Agent queries Remark42βs read API based on the current URL.
- π’ Genius (Native Bot): AgentBubble isnβt a floating FAB at all. The OMP Agent registers as a Remark42 user. It replies natively in comment threads when
@agentis mentioned. For floating chat, use the RPC Bridge to stream active comment context.