Skip to content

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

fix: cover VK mobile and login hosts

Barack Sokullu93b287ee5d70
diff --git a/src/chrome/src/agent/adapters.js b/src/chrome/src/agent/adapters.js
index 8edbecd7a..174bbdcee 100644
--- a/src/chrome/src/agent/adapters.js
+++ b/src/chrome/src/agent/adapters.js
@@ -17656,7 +17656,7 @@ const ADAPTERS = [
{
name: 'vk',
category: 'general',
- matches: (url) => /^https?:\/\/(www\.|m\.)?vk\.com\//.test(url) || /^https?:\/\/(www\.)?vk\.ru\//.test(url),
+ matches: (url) => /^https?:\/\/(?:vk\.(?:com|ru)|(?:www|m)\.vk\.(?:com|ru)|id\.vk\.ru)\//.test(url),
notes: `
- VK (vk.com) is Russia/CIS social + services (Feed, Messages, Communities, Video, Market, Mini-apps). Login is phone/QR; 2FA may appear — surface it to the user and stop, do not loop.
- Messages: dialog list on the LEFT, active chat on the RIGHT; input is a contenteditable box, Enter sends. DO NOT send unless the user named the recipient AND the exact body in this conversation.
diff --git a/src/firefox/src/agent/adapters.js b/src/firefox/src/agent/adapters.js
index 19269fe6b..eb63a46a9 100644
--- a/src/firefox/src/agent/adapters.js
+++ b/src/firefox/src/agent/adapters.js
@@ -17654,7 +17654,7 @@ const ADAPTERS = [
{
name: 'vk',
category: 'general',
- matches: (url) => /^https?:\/\/(www\.|m\.)?vk\.com\//.test(url) || /^https?:\/\/(www\.)?vk\.ru\//.test(url),
+ matches: (url) => /^https?:\/\/(?:vk\.(?:com|ru)|(?:www|m)\.vk\.(?:com|ru)|id\.vk\.ru)\//.test(url),
notes: `
- VK (vk.com) is Russia/CIS social + services (Feed, Messages, Communities, Video, Market, Mini-apps). Login is phone/QR; 2FA may appear — surface it to the user and stop, do not loop.
- Messages: dialog list on the LEFT, active chat on the RIGHT; input is a contenteditable box, Enter sends. DO NOT send unless the user named the recipient AND the exact body in this conversation.
diff --git a/test/run.js b/test/run.js
index 6d1d8d977..cfa334419 100644
--- a/test/run.js
+++ b/test/run.js
@@ -10226,6 +10226,28 @@ test('report-driven adapter notes remain bounded and do not overfit low-evidence
assert.equal(getActiveAdapter('https://naukrigulf.com.evil.example/job/1'), null);
});
+test('VK adapter covers canonical, mobile, and login hosts without trusting lookalikes', () => {
+ const trustedUrls = [
+ 'https://vk.com/feed',
+ 'https://www.vk.com/im',
+ 'https://m.vk.com/messages',
+ 'https://vk.ru/feed',
+ 'https://www.vk.ru/im',
+ 'https://m.vk.ru/messages',
+ 'https://id.vk.ru/auth',
+ ];
+ const lookalikeUrls = [
+ 'https://id.vk.com.evil.example/auth',
+ 'https://m.vk.ru.evil.example/messages',
+ 'https://example.com/?next=https://id.vk.ru/auth',
+ ];
+
+ for (const getAdapter of [getActiveAdapter, getActiveAdapterFx]) {
+ for (const url of trustedUrls) assert.equal(getAdapter(url)?.name, 'vk', url);
+ for (const url of lookalikeUrls) assert.notEqual(getAdapter(url)?.name, 'vk', url);
+ }
+});
+
test('adapter-match trace metadata is content-free, queued before tracing, and de-duplicated per run', () => {
for (const [label, AgentClass] of [['chrome', AgentCh], ['firefox', AgentFx]]) {
const agent = new AgentClass({});