Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

feat(adapters): generic-first recipient guard on any site

Gaurav Singh0b1913ff4367
diff --git a/src/chrome/src/agent/adapters.js b/src/chrome/src/agent/adapters.js
index a59b82848..d254b0c25 100644
--- a/src/chrome/src/agent/adapters.js
+++ b/src/chrome/src/agent/adapters.js
@@ -18187,6 +18187,29 @@ export function getFullPageCapturePolicy(url) {
}
}
+/**
+ * Messaging / webmail surfaces that have no first-party adapter but still get
+ * the same recipient verification and confirm-then-send flow. Matched against
+ * `hostname + pathname`, so it covers both known providers and generic
+ * messaging routes on any site (/messages, /chat, /dm, /compose, /inbox, ...).
+ */
+const GENERIC_MESSAGING_SURFACE_RE = new RegExp(
+ '(?:^|\\.)(?:mail|webmail|outlook|hotmail|yahoo|proton|zoho|fastmail|icloud|gmx|tutanota|roundcube|horde|zimbra)\\b'
+ + '|(?:^|\\.)(?:whatsapp|telegram|discord|slack|messenger|wechat|signal|skype|teams|element|mattermost)\\.'
+ + '|/(?:mail|messages?|chats?|dm|direct|inbox|compose|conversations?)(?:/|$)',
+ 'i',
+);
+// Mail-like surfaces carry a To/Cc/Bcc set; chat-like surfaces address one
+// conversation. Only the verification shape differs — both get the same
+// confirm-then-send flow.
+const GENERIC_MESSAGING_MAIL_LIKE_RE = new RegExp(
+ '(?:^|\\.)(?:mail|webmail|outlook|hotmail|yahoo|proton|zoho|fastmail|icloud|gmx|tutanota|roundcube|horde|zimbra)\\b'
+ + '|/(?:mail|compose|inbox)(?:/|$)',
+ 'i',
+);
+
+
+
/**
* Return the machine-readable recipient-safety policy for a messaging page.
* Unlike adapter notes, this is enforced by the runtime before dispatch.
@@ -18200,7 +18223,32 @@ export function getMessageRecipientGuardPolicy(url) {
} catch {
enabled = false;
}
- if (!enabled) return null;
+ if (!enabled) {
+ // Any page on the web may host a messaging or mail surface. The recipient
+ // guard is therefore generic-first: arm it everywhere and let the
+ // content-side recipient extraction decide whether this page is actually
+ // sending something. If it finds no address and no conversation header,
+ // nothing is a send and no action is blocked; when it does find one, the
+ // same verify → ask → authorize flow used by Gmail applies. These entries
+ // only pick the verification shape (single conversation identity vs a
+ // To/Cc/Bcc set).
+ let mailLike = false;
+ let chatLike = false;
+ try {
+ const parsed = new URL(url);
+ const hostPath = `${parsed.hostname}${parsed.pathname}`;
+ mailLike = GENERIC_MESSAGING_MAIL_LIKE_RE.test(hostPath);
+ chatLike = !mailLike && GENERIC_MESSAGING_SURFACE_RE.test(hostPath);
+ } catch {
+ mailLike = false;
+ chatLike = false;
+ }
+ return {
+ adapterName: adapter?.name || 'generic-messaging',
+ verifyActiveRecipient: true,
+ ...(mailLike || chatLike ? { supportsRecipientSets: true } : {}),
+ };
+ }
return {
adapterName: adapter.name,
verifyActiveRecipient: true,