Skip to content

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

Answer page-text questions in the composer and chat harness providers

Claude6acd9b6d2702
diff --git a/test/quality/bluesky-composer-mv3.mjs b/test/quality/bluesky-composer-mv3.mjs
index 8c0bcf585..3a92d6e4a 100644
--- a/test/quality/bluesky-composer-mv3.mjs
+++ b/test/quality/bluesky-composer-mv3.mjs
@@ -4,6 +4,7 @@ import http from 'node:http';
import os from 'node:os';
import path from 'node:path';
import { chromium } from 'playwright';
+import { fixturePageTextReply } from '../semantic-decision-stub.mjs';
import { build as bundle } from 'esbuild';
// Real installed MV3 background, Agent, monitor and CDP input. The editor is
@@ -66,6 +67,9 @@ const server = http.createServer(async (request, response) => {
let completion;
if (system.startsWith('Extract stable user preferences for WebBrain memory.'))
completion = { role: 'assistant', content: '{"memories":[]}' };
+ // What a status on the page says, read the way a model would read it.
+ // These questions carry page text only, never the task.
+ else if (fixturePageTextReply(input.messages)) completion = { role: 'assistant', content: fixturePageTextReply(input.messages) };
else {
assert.ok(current && JSON.stringify(input.messages).includes(current.marker), 'Inference must retain the exact owned Bluesky task.');
const body = current.body;
diff --git a/test/quality/inline-social-composer-mv3.mjs b/test/quality/inline-social-composer-mv3.mjs
index a40006e81..21f921660 100644
--- a/test/quality/inline-social-composer-mv3.mjs
+++ b/test/quality/inline-social-composer-mv3.mjs
@@ -5,6 +5,7 @@ import { createRequire } from 'node:module';
import os from 'node:os';
import path from 'node:path';
import { chromium } from 'playwright';
+import { fixturePageTextReply } from '../semantic-decision-stub.mjs';
// The actual installed MV3 background, monitor, Agent and CDP input operate on
// React/DraftJS document nodes. Only inference and owned HTTP responses are
@@ -93,6 +94,16 @@ const server = http.createServer(async (request, response) => {
usage: { prompt_tokens: 100, completion_tokens: 10 } }));
return;
}
+ // What a status on the page says, read the way a model would read it.
+ // These questions carry page text only, never the task.
+ const pageTextReply = fixturePageTextReply(input.messages);
+ if (pageTextReply) {
+ auxiliaryRequests.push(input);
+ response.writeHead(200, { 'Content-Type': 'application/json' }).end(JSON.stringify({ id: 'owned-inline-page-text',
+ choices: [{ message: { role: 'assistant', content: pageTextReply }, finish_reason: 'stop' }],
+ usage: { prompt_tokens: 100, completion_tokens: 10 } }));
+ return;
+ }
current.requests.push(input);
assert.ok(current && JSON.stringify(input.messages).includes(current.marker), `Inference must retain this owned task authority: ${system.slice(0, 160)}`);
let completion;
diff --git a/test/quality/native-chat-mv3.mjs b/test/quality/native-chat-mv3.mjs
index e66b79893..2042247dc 100644
--- a/test/quality/native-chat-mv3.mjs
+++ b/test/quality/native-chat-mv3.mjs
@@ -5,6 +5,7 @@ import os from 'node:os';
import path from 'node:path';
import { chromium } from 'playwright';
import { telegramLab, telegramRaceLab } from './native-chat-fixture.mjs';
+import { fixturePageTextReply } from '../semantic-decision-stub.mjs';
// Whole installed background -> intent planner -> Agent -> native content
// dispatch -> completion. Only the provider is deterministic; no Agent gate,
@@ -77,6 +78,15 @@ const server = http.createServer(async (request, response) => {
}
let body = ''; for await (const chunk of request) body += chunk;
const input = JSON.parse(body);
+ // What a status on the page says, read the way a model would read it.
+ // These questions carry page text only, never a tab's task.
+ const pageTextReply = fixturePageTextReply(input.messages);
+ if (pageTextReply) {
+ response.writeHead(200, { 'Content-Type': 'application/json' });
+ response.end(JSON.stringify({ id: 'owned-page-text', choices: [{ message: { role: 'assistant', content: pageTextReply }, finish_reason: 'stop' }],
+ usage: { prompt_tokens: 100, completion_tokens: 10 } }));
+ return;
+ }
const authority = JSON.stringify(input.messages || []);
const matches = [...cases.values()].filter(entry => authority.includes(entry.marker));
assert.equal(matches.length, 1, 'Every provider request must retain exactly its own tab task authority.');
diff --git a/test/quality/native-chat-presubmit-mv3.mjs b/test/quality/native-chat-presubmit-mv3.mjs
index 18476deba..4bd99e71e 100644
--- a/test/quality/native-chat-presubmit-mv3.mjs
+++ b/test/quality/native-chat-presubmit-mv3.mjs
@@ -6,6 +6,7 @@ import path from 'node:path';
import { createHash } from 'node:crypto';
import { chromium } from 'playwright';
import { telegramLab, telegramRaceLab } from './native-chat-fixture.mjs';
+import { fixturePageTextReply } from '../semantic-decision-stub.mjs';
// Whole installed background -> intent planner -> Agent -> native content
// dispatch -> completion. Only the provider is deterministic; no Agent gate,
@@ -166,6 +167,15 @@ const server = http.createServer(async (request, response) => {
}
let body = ''; for await (const chunk of request) body += chunk;
const input = JSON.parse(body);
+ // What a status on the page says, read the way a model would read it.
+ // These questions carry page text only, never a tab's task.
+ const pageTextReply = fixturePageTextReply(input.messages);
+ if (pageTextReply) {
+ response.writeHead(200, { 'Content-Type': 'application/json' });
+ response.end(JSON.stringify({ id: 'owned-page-text', choices: [{ message: { role: 'assistant', content: pageTextReply }, finish_reason: 'stop' }],
+ usage: { prompt_tokens: 100, completion_tokens: 10 } }));
+ return;
+ }
const authority = JSON.stringify(input.messages || []);
const matches = [...cases.values()].filter(entry => authority.includes(entry.marker));
assert.equal(matches.length, 1, 'Every provider request must retain exactly its own tab task authority.');