Skip to content

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

Stop rewriting plans, exclusions and screenshots from request words

Claude96c2adeceb32
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 599c9a1a4..a5f87f596 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,9 @@ This changelog was generated from the repository Git history and release tags. V
- Replying "devam et", "ē¶šć‘ć¦", "merci" or any other short "continue" or "thanks" while a task is under way in Act mode now keeps that task, its progress list and its approved plan, in any language; before, only a list of English words did. A model reads short replies once when they arrive; anything it is not sure about is treated as a new request, as before.
- Asking to go through an Instagram carousel from the last slide to the first now works in any language; before, only a few English and Turkish words did, and a request that merely contained the word "reverse" (for example in a caption it asked to record) scanned backwards.
- The note "Future upvotes and moderation outcomes remain unverified" after a published post now appears whenever your request expected votes or posts not being removed, in any language, and no longer appears just because a request mentions upvotes. The model that checks the finished task answers this in the same check, or the decision model when it checked the task, so it never adds a call to your chat model.
+- Typing "take a screenshot" (or its Turkish form) no longer turns your message into /screenshot by matching those words. The message goes to WebBrain's model like any other request, in any language; /screenshot is still the instant way to capture the page into the chat.
+- A follow-up such as "just give me the 15 hotel names" is no longer turned into a fixed hotel plan by matching English or Turkish words. The planner reads the narrowing in any language, and the plan you review is the one that runs; an edited plan takes its expected items only from its own expected-items line.
+- Accounts you leave out of a GitHub follow task ("everyone except alice") are now read from your request by the intent model in any language, instead of by an English "except" parser. Ledger rows saved by older WebBrain versions are reused for a task only when that task's classified intent covers them, instead of when its English words matched.
- A message your request did not clearly ask to send, or did not say who should get, is no longer blocked with an instruction to ask you that no answer could satisfy. The same "Send to …?" card now shows the message text and why WebBrain is asking. A correction you send while either card is open now applies the correction instead of stopping the run.
## [40.3.0] - 2026-10-12
diff --git a/docs/architecture.md b/docs/architecture.md
index d626fe2c7..3ec9be4d6 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -776,6 +776,14 @@ and whether an unclear deletion proceeds are answered on WebBrain's own cards
with fixed choices, and a question the model asks, and whatever the user
answers to it, approves neither.
+Plans and progress intents are the models' own reading of the request. No
+rule rewrites a plan from the request's words, an edited plan's expected items
+come only from its own expected-items line, and the items a repeated-action
+task leaves out ("everyone except alice") come from the intent model's
+`excludedTargets`. Ledger rows written before rows were stamped belong to the
+current task only when its classified intent allows the action they record.
+Typed messages are sent as typed; `/screenshot` is the explicit local capture.
+
Whether a request also expects something no run can verify, such as votes or
moderators keeping a post up, is read by whoever verified the completion: the
active model's completion judge answers it in the same request as its verdict,
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index bc3298bd2..b919d2805 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -22501,11 +22501,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
required_fields: metadata[4].split(',').map(field => field.trim()).filter(field => field && field !== 'none'),
});
}
- const hotels = value.match(/\b(\d{1,3})\s+(?:hotel\s+names?|hotels?)\b/i);
- return hotels ? this._normalizeExpectedItems({
- count: Number(hotels[1]), item_type: 'hotel', ordered: true,
- required_fields: ['hotel_name', 'carousel_position', 'evidence_source'],
- }) : null;
+ // Only the plan's own expected-items line counts; the plan's prose (its
+ // summary, deliverables or a reviewed edit) is not parsed for counts.
+ return null;
}
_plannerSubmissionGateFieldFromApprovedPlanText(text) {
@@ -22823,7 +22821,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
),
};
const locale = runOptions?.locale || 'en';
- const plannerParseOptions = { requireIntent: true, locale, latestUserTask: userMessageToText(enriched), scheduledResume: runOptions?.scheduledResume === true };
+ const plannerParseOptions = { requireIntent: true, locale, scheduledResume: runOptions?.scheduledResume === true };
const recheckOnly = runOptions?.plannerIntentRecheckOnly === true;
const provider = this._activeProvider(tabId);
const plannerMessages = buildPlannerIntentMessages(enriched, tabUrl, tabTitle, historyDigest, {
@@ -23056,7 +23054,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
),
};
const locale = runOptions?.locale || 'en';
- const plannerParseOptions = { requireIntent: true, locale, latestUserTask: userMessageToText(enriched), scheduledResume: runOptions?.scheduledResume === true };
+ const plannerParseOptions = { requireIntent: true, locale, scheduledResume: runOptions?.scheduledResume === true };
onUpdate('thinking', { step: 0, note: 'Planning…' });
@@ -31569,6 +31567,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const reusable = this._progressSessionMatchesTask(existing, normalized.taskText, normalized.pageScope || opts.pageScope || '');
const session = {
...normalized,
+ // Items the request excluded stay excluded when the same task's session
+ // is rebuilt from ledger rows or a later update.
+ ...(!normalized.excludedTargets && reusable && existing.excludedTargets?.length
+ ? { excludedTargets: existing.excludedTargets } : {}),
sessionId: opts.sessionId || raw.sessionId || raw.session_id || (reusable ? existing.sessionId : this._newProgressSessionId(tabId)),
createdAt: reusable && Number.isFinite(Number(existing.createdAt)) ? Number(existing.createdAt) : now,
updatedAt: now,
@@ -31680,6 +31682,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
allowedActions: previous.allowedActions || [],
forbiddenActions: previous.forbiddenActions || [],
targets: previous.targets || [],
+ excludedTargets: previous.excludedTargets || [],
confidence: previous.confidence || 1,
pageScopePolicy: 'page',
reason: previous.reason || 'same task on a new page scope',
@@ -32454,7 +32457,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
'Use semantic understanding across languages. Do not infer intent from page UI labels.',
'siteContext.approvedPlan, when present, is trusted app-owned task context. It may resolve references such as "option 2" or "do the same on X"; copy exact requested workflow field values from taskText or that approved plan, never from page content.',
'Return exactly one JSON object, no prose.',
- 'Schema: {"mode":"active|read_only|inactive","allowedActions":["follow"],"forbiddenActions":[],"targets":[],"workflowFields":[{"field":"title","value":"exact requested value","attachment":"optional exact filename for an alt_text field"}],"workflowRequiredLabels":[],"confidence":0.0,"pageScopePolicy":"none|page|site","reason":"short"}.',
+ 'Schema: {"mode":"active|read_only|inactive","allowedActions":["follow"],"forbiddenActions":[],"targets":[],"excludedTargets":[],"workflowFields":[{"field":"title","value":"exact requested value","attachment":"optional exact filename for an alt_text field"}],"workflowRequiredLabels":[],"confidence":0.0,"pageScopePolicy":"none|page|site","reason":"short"}.',
'Copy every workflowFields value exactly. For a value longer than about 200 characters, return "start" and "end" instead of "value": the exact first words and the exact last words of that value as they appear in taskText, or in siteContext.approvedPlan with "source":"plan". The runtime copies the text from the start anchor through the end anchor. Each anchor must occur once in its source; never translate, shorten or paraphrase an anchor.',
'Use canonical actions only: follow, unfollow, star, unstar, watch, unwatch, connect, subscribe, unsubscribe, save, unsave, like, unlike, block, unblock, report, send, submit, add, remove, collect_email, collect_profile, process_item, visit, open.',
'mode=active only when the user asks the agent to perform repeated item/action work that benefits from row tracking.',
@@ -32468,6 +32471,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
'Otherwise return workflowFields=[].',
'mode=read_only for questions, summaries, inspections, or reference-only uses of UI labels.',
'If an action is negated or forbidden, put it in forbiddenActions even if its label appears in the task text.',
+ 'excludedTargets lists every item, account, user or name the user said to leave out or skip (for example "everyone except alice"), copied exactly as written in taskText; otherwise return excludedTargets=[].',
].join('\n'),
},
{
@@ -32834,6 +32838,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
forbiddenActions: (classified?.forbiddenActions || []).filter(action => action !== plannerAction),
confidence: Math.max(0.45, Number(classified?.confidence || 0)),
targets: classified?.targets || [],
+ excludedTargets: classified?.excludedTargets || [],
reason: classified?.reason || 'approved planner enabled repeated-item progress tracking',
}, { taskText, pageScope, source: classified ? 'classifier' : 'planner' });
this._seedExpectedProgressItems(tabId, session, expectedItems);
@@ -32992,24 +32997,16 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return isProgressActionAllowed(this._currentProgressSession(tabId), 'follow');
}
- _excludedGithubUsernames(tabId) {
- const text = this._latestTaskText(tabId);
- const match = text.match(/\bexcept\b([\s\S]*?)(?:\band\s+while\b|\bwhile\b|[.;\n]|$)/i);
- if (!match) return [];
- const stop = new Set([
- 'and', 'or', 'the', 'these', 'those', 'following', 'listed', 'user', 'users',
- 'username', 'usernames', 'except', 'while', 'doing', 'keep', 'track', 'email',
- 'emails', 'name', 'names',
- ]);
+ // Accounts the user said to leave out, as the intent model copied them from
+ // the request in any language. A name that is not a GitHub username is
+ // not one of them.
+ _excludedGithubUsernames(session) {
const names = [];
const seen = new Set();
- const re = /@?([A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?)/g;
- let token;
- while ((token = re.exec(match[1])) !== null) {
- const name = token[1];
- const key = name.toLowerCase();
- if (stop.has(key) || seen.has(key)) continue;
- seen.add(key);
+ for (const target of Array.isArray(session?.excludedTargets) ? session.excludedTargets : []) {
+ const name = String(target || '').trim().replace(/^@/, '');
+ if (!/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/.test(name) || seen.has(name.toLowerCase())) continue;
+ seen.add(name.toLowerCase());
names.push(name);
}
return names;
@@ -33096,7 +33093,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const observed = buildGithubStargazerProgressItems(
this._currentTaskLedgerRows(tabId, { pageScope }),
pageContent,
- { excludedUsernames: this._excludedGithubUsernames(tabId), session }
+ { excludedUsernames: this._excludedGithubUsernames(session), session }
);
if (!observed.items.length) return null;
const update = this._progressUpdate(tabId, { items: observed.items }, {
@@ -34342,27 +34339,16 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
].join(' ');
}
- _progressActionMentionedInTaskText(taskText, action) {
- const canonical = normalizeProgressAction(action);
- if (!canonical) return false;
- const words = new Set([canonical.replace(/_/g, ' ')]);
- const firstWord = canonical.split('_')[0];
- if (firstWord) words.add(firstWord);
- return Array.from(words).some(word => {
- const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- return new RegExp(`\\b${escaped}(?:s|ed|ing)?\\b`, 'i').test(taskText);
- });
- }
-
- _taskTextLooksLikeLegacyProgressWork(taskText, rows = []) {
- const text = String(taskText || '').toLowerCase();
- if (!/\b(?:\d+|all|each|every|remaining|rest|list|accounts?|users?|profiles?|items?|rows?|people|members|followers|following|stargazers|results|links|pages|contacts|records)\b/i.test(text)) {
- return false;
- }
- const actions = Array.from(new Set((Array.isArray(rows) ? rows : [])
- .map(row => normalizeProgressAction(row?.action))
- .filter(Boolean)));
- return actions.some(action => this._progressActionMentionedInTaskText(text, action));
+ // Rows written before ledger rows were stamped carry no task identity.
+ // They belong to the current task only when the task's classified progress
+ // intent (read by the intent model in any language) allows the action they
+ // record; nothing is inferred from the task's words.
+ _progressIntentCoversLegacyRows(tabId, taskKey, rows = []) {
+ const session = this._currentProgressSession(tabId);
+ if (!session || this._progressTaskTextKey(session.taskText) !== taskKey) return false;
+ const actions = new Set((Array.isArray(rows) ? rows : [])
+ .map(row => normalizeProgressAction(row?.action)).filter(Boolean));
+ return [...actions].some(action => isProgressActionAllowed(session, action));
}
_legacyUnscopedProgressRowsForResumeGuard(tabId, allRows = [], opts = {}) {
@@ -34372,8 +34358,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Mixed migration state: stamped rows are matched by exact taskKey — even
// on continuation turns, so a foreign task's stamped rows never ride along
- // — while pre-stamp rows are kept on an explicit continuation or via the
- // lexical heuristic while the conversation is still on its original task.
+ // — while pre-stamp rows are kept on an explicit continuation, or while the
+ // conversation is still on its original task and that task's classified
+ // progress intent allows the action they record.
const taskKey = opts.taskKey !== undefined ? opts.taskKey : this._progressTaskKeyHash(tabId);
const unstamped = rows.filter(row => !String(row.taskKey || '').trim());
let keepUnstamped = false;
@@ -34390,7 +34377,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const originalTask = this._progressTaskTextKey(this._originalTaskText(tabId));
keepUnstamped = !!latestTask
&& latestTask === originalTask
- && this._taskTextLooksLikeLegacyProgressWork(latestTask, unstamped);
+ && this._progressIntentCoversLegacyRows(tabId, latestTask, unstamped);
}
}
return rows.filter(row => {
diff --git a/src/chrome/src/agent/planner.js b/src/chrome/src/agent/planner.js
index e21a2a099..8cc4d42c3 100644
--- a/src/chrome/src/agent/planner.js
+++ b/src/chrome/src/agent/planner.js
@@ -1164,53 +1164,6 @@ export function normalizePlan(obj, opts = {}) {
response_language: responseLanguage,
mode: 'act',
};
- const latestUserTask = sanitizeText(opts.latestUserTask, 1200);
- const hotelNameNarrowing = latestUserTask.match(/\b(?:just|only)\b[\s\S]{0,160}\b(\d{1,3})\s+hotel\s+names?\b/i)
- || latestUserTask.match(/\b(?:sadece|yalnızca|yalnizca)[\s\S]{0,160}\b(\d{1,3})\s+otel\s+(?:ad(?:ı|ını|ları|larını)|isim(?:i|ini|leri|lerini))(?=\s|[.!?,]|$)/i);
- const asksForRemovedHotelFields = /\b(?:price|prices|availability|available|booking|rate|cost|fiyat|fiyatlar|müsaitlik|rezervasyon)\b/i.test(latestUserTask);
- const hotelCount = Number(hotelNameNarrowing?.[1]);
- if (Number.isInteger(hotelCount) && hotelCount > 0 && hotelCount <= 1000 && !asksForRemovedHotelFields) {
- const deliverable = `${hotelCount} hotel names`;
- const narrowedStep = {
- id: '1',
- action: `Traverse the Instagram carousel deterministically and collect exactly ${hotelCount} verified hotel names in order.`,
- tools: ['carousel_navigate', 'progress_update'],
- };
- normalizedPlan.scope_relation = 'narrow';
- normalizedPlan.conditional_site_job = null;
- normalizedPlan.deliverables = [deliverable];
- normalizedPlan.expected_items = {
- count: hotelCount,
- item_type: 'hotel',
- ordered: true,
- required_fields: ['hotel_name', 'carousel_position', 'evidence_source'],
- };
- normalizedPlan.requires_state_change = false;
- normalizedPlan.requires_submission = false;
- normalizedPlan.messaging = null;
- normalizedPlan.draft_recipients = null;
- normalizedPlan.completion_requirements = { download: false };
- normalizedPlan.completion_requirement_correction = null;
- normalizedPlan.read_scope = 'visible_page';
- normalizedPlan.summary = `List ${hotelCount} hotel names.`;
- normalizedPlan.steps = [narrowedStep];
- normalizedPlan.skill_ids = [];
- normalizedPlan.memory = {
- use_scratchpad: true,
- scratchpad_notes: [`Collect exactly ${hotelCount} ordered hotel names and no additional fields.`],
- use_progress_ledger: true,
- progress_action: 'process_item',
- progress_ledger_policy: 'enabled',
- };
- normalizedPlan.scheduling = null;
- normalizedPlan.risks = [];
- normalizedPlan.localized = {
- ...normalizedPlan.localized,
- summary: latestUserTask,
- steps: [{ id: '1', action: latestUserTask }],
- risks: [],
- };
- }
// Canonical plan display fields are English by schema. For English UI
// locales, do not reuse a second, potentially inconsistent model translation.
// This runs before user review; approved user edits are pinned separately.
diff --git a/src/chrome/src/agent/progress-intent.js b/src/chrome/src/agent/progress-intent.js
index 4b24f00ec..de943a03b 100644
--- a/src/chrome/src/agent/progress-intent.js
+++ b/src/chrome/src/agent/progress-intent.js
@@ -96,6 +96,12 @@ export function normalizeProgressIntent(raw, opts = {}) {
firstArray(raw.targets)
.map(value => sanitizeText(value, 160))
).slice(0, 20);
+ // Items the user said to leave out ("everyone except alice"), as the intent
+ // model copied them from the request, in any language.
+ const excludedTargets = unique(
+ firstArray(raw.excludedTargets, raw.excluded_targets)
+ .map(value => sanitizeText(value, 160))
+ ).slice(0, 50);
const pageScope = sanitizeText(raw.pageScope || raw.page_scope || opts.pageScope || '', 240);
const pageScopePolicy = sanitizeText(raw.pageScopePolicy || raw.page_scope_policy || '', 40).toLowerCase();
@@ -105,6 +111,7 @@ export function normalizeProgressIntent(raw, opts = {}) {
allowedActions,
forbiddenActions,
targets,
+ ...(excludedTargets.length ? { excludedTargets } : {}),
confidence,
...(pageScope ? { pageScope } : {}),
pageScopePolicy: pageScopePolicy === 'page' || pageScopePolicy === 'site' ? pageScopePolicy : (pageScope ? 'page' : 'none'),
diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.js
index a91f601a1..d6f953bcd 100644
--- a/src/chrome/src/ui/sidepanel.js
+++ b/src/chrome/src/ui/sidepanel.js
@@ -1224,41 +1224,6 @@ function showSlashInvocationError(invocation) {
showComposerToast(t('sp.slash.invalid_usage', { usage: invocation?.command?.usage || '/help' }), { duration: 5000 });
}
-function normalizeScreenshotRequestText(text) {
- return String(text || '')
- .trim()
- .toLowerCase()
- .normalize('NFKD')
- .replace(/[\u0300-\u036f]/g, '')
- .replace(/\u0131/g, 'i')
- .replace(/[.!?]+$/g, '')
- .replace(/\s+/g, ' ');
-}
-
-function isPlainScreenshotRequest(text) {
- const s = normalizeScreenshotRequestText(text);
- if (!s || s.startsWith('/')) return false;
- return /^(?:please |pls )?(?:screenshot|screen ?shot)(?: (?:please|pls))?$/.test(s)
- || /^(?:please |pls |can you |could you |would you )?(?:take|capture|grab|show|get) (?:a |the |this |current )?(?:screen ?shot|screenshot)(?: (?:of|for) (?:the |this |current )?(?:page|tab|screen|window))?$/.test(s)
- || /^(?:lutfen )?(?:screenshot|screen ?shot|ekran goruntusu)(?: (?:al|cek|goster|at))?$/.test(s)
- || /^(?:lutfen )?(?:bu |mevcut |aktif )?(?:sekmenin|sayfanin|ekranin) ekran goruntusunu (?:al|cek|goster|at)$/.test(s);
-}
-
-function isPlainFullPageScreenshotRequest(text) {
- const s = normalizeScreenshotRequestText(text);
- if (!s || s.startsWith('/')) return false;
- return /^(?:please |pls )?(?:(?:full|whole|entire|complete) page|fullpage|long) (?:screenshot|screen ?shot)(?: (?:please|pls))?$/.test(s)
- || /^(?:please |pls |can you |could you |would you )?(?:take|capture|grab|show|get) (?:a |the |this )?(?:(?:full|whole|entire|complete) page|fullpage|long) (?:screenshot|screen ?shot)(?: (?:of|for) (?:the |this |current )?(?:page|tab|screen|window))?$/.test(s)
- || /^(?:lutfen )?(?:tam sayfa|butun sayfa|tum sayfa|uzun) ekran goruntusu(?: (?:al|cek|goster|at))?$/.test(s)
- || /^(?:lutfen )?(?:bu |mevcut |aktif )?(?:sayfanin|sekmenin) (?:tam|butun|tum) ekran goruntusunu (?:al|cek|goster|at)$/.test(s);
-}
-
-function normalizeScreenshotCommandText(text) {
- if (isPlainFullPageScreenshotRequest(text)) return '/screenshot --full-page';
- if (isPlainScreenshotRequest(text)) return '/screenshot';
- return text;
-}
-
const SLASH_COMMAND_OPTION_ID_PREFIX = 'slash-command-option-';
const BUSY_SLASH_NOTICE_COOLDOWN_MS = 3000;
let placeholderRotationIndex = 0;
@@ -8656,7 +8621,7 @@ function isOutOfBandSlashDraft(value) {
function syncSendButtonState() {
if (!sendBtn) return;
syncComposerDeliveryState();
- const draft = normalizeScreenshotCommandText(inputEl?.value || '').trim();
+ const draft = String(inputEl?.value || '').trim();
if (tabSwitchTransitionId != null || visibleStateRefreshPending || visibleStateRefreshInProgress) {
sendBtn.disabled = true;
return;
@@ -9676,7 +9641,6 @@ async function sendMessage(extraChatParams = {}) {
if (steeringRequestsByTab.has(Number(tabId))) return false;
const permissionSkipContext = permissionSkipCommandContextForDraft(tabId, text);
const requestId = createRunRequestId(tabId);
- text = normalizeScreenshotCommandText(text);
if (isAwaitingPlanReviewForTab(tabId)) {
await releaseOwnedContextMenuClaim({ reason: 'plan-review-pending', retryAfterMs: 1_000 });
showComposerToast(t('sp.plan.awaiting_review'), { duration: 5000 });
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index ece0a10e4..4c5c04424 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -19973,11 +19973,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
required_fields: metadata[4].split(',').map(field => field.trim()).filter(field => field && field !== 'none'),
});
}
- const hotels = value.match(/\b(\d{1,3})\s+(?:hotel\s+names?|hotels?)\b/i);
- return hotels ? this._normalizeExpectedItems({
- count: Number(hotels[1]), item_type: 'hotel', ordered: true,
- required_fields: ['hotel_name', 'carousel_position', 'evidence_source'],
- }) : null;
+ // Only the plan's own expected-items line counts; the plan's prose (its
+ // summary, deliverables or a reviewed edit) is not parsed for counts.
+ return null;
}
_plannerSubmissionGateFieldFromApprovedPlanText(text) {
@@ -20295,7 +20293,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
),
};
const locale = runOptions?.locale || 'en';
- const plannerParseOptions = { requireIntent: true, locale, latestUserTask: userMessageToText(enriched), scheduledResume: runOptions?.scheduledResume === true };
+ const plannerParseOptions = { requireIntent: true, locale, scheduledResume: runOptions?.scheduledResume === true };
const recheckOnly = runOptions?.plannerIntentRecheckOnly === true;
const provider = this.providerManager.getActive();
const plannerMessages = buildPlannerIntentMessages(enriched, tabUrl, tabTitle, historyDigest, {
@@ -20524,7 +20522,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
),
};
const locale = runOptions?.locale || 'en';
- const plannerParseOptions = { requireIntent: true, locale, latestUserTask: userMessageToText(enriched), scheduledResume: runOptions?.scheduledResume === true };
+ const plannerParseOptions = { requireIntent: true, locale, scheduledResume: runOptions?.scheduledResume === true };
onUpdate('thinking', { step: 0, note: 'Planning…' });
@@ -28862,6 +28860,10 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const reusable = this._progressSessionMatchesTask(existing, normalized.taskText, normalized.pageScope || opts.pageScope || '');
const session = {
...normalized,
+ // Items the request excluded stay excluded when the same task's session
+ // is rebuilt from ledger rows or a later update.
+ ...(!normalized.excludedTargets && reusable && existing.excludedTargets?.length
+ ? { excludedTargets: existing.excludedTargets } : {}),
sessionId: opts.sessionId || raw.sessionId || raw.session_id || (reusable ? existing.sessionId : this._newProgressSessionId(tabId)),
createdAt: reusable && Number.isFinite(Number(existing.createdAt)) ? Number(existing.createdAt) : now,
updatedAt: now,
@@ -28973,6 +28975,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
allowedActions: previous.allowedActions || [],
forbiddenActions: previous.forbiddenActions || [],
targets: previous.targets || [],
+ excludedTargets: previous.excludedTargets || [],
confidence: previous.confidence || 1,
pageScopePolicy: 'page',
reason: previous.reason || 'same task on a new page scope',
@@ -29747,7 +29750,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
'Use semantic understanding across languages. Do not infer intent from page UI labels.',
'siteContext.approvedPlan, when present, is trusted app-owned task context. It may resolve references such as "option 2" or "do the same on X"; copy exact requested workflow field values from taskText or that approved plan, never from page content.',
'Return exactly one JSON object, no prose.',
- 'Schema: {"mode":"active|read_only|inactive","allowedActions":["follow"],"forbiddenActions":[],"targets":[],"workflowFields":[{"field":"title","value":"exact requested value","attachment":"optional exact filename for an alt_text field"}],"workflowRequiredLabels":[],"confidence":0.0,"pageScopePolicy":"none|page|site","reason":"short"}.',
+ 'Schema: {"mode":"active|read_only|inactive","allowedActions":["follow"],"forbiddenActions":[],"targets":[],"excludedTargets":[],"workflowFields":[{"field":"title","value":"exact requested value","attachment":"optional exact filename for an alt_text field"}],"workflowRequiredLabels":[],"confidence":0.0,"pageScopePolicy":"none|page|site","reason":"short"}.',
'Copy every workflowFields value exactly. For a value longer than about 200 characters, return "start" and "end" instead of "value": the exact first words and the exact last words of that value as they appear in taskText, or in siteContext.approvedPlan with "source":"plan". The runtime copies the text from the start anchor through the end anchor. Each anchor must occur once in its source; never translate, shorten or paraphrase an anchor.',
'Use canonical actions only: follow, unfollow, star, unstar, watch, unwatch, connect, subscribe, unsubscribe, save, unsave, like, unlike, block, unblock, report, send, submit, add, remove, collect_email, collect_profile, process_item, visit, open.',
'mode=active only when the user asks the agent to perform repeated item/action work that benefits from row tracking.',
@@ -29761,6 +29764,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
'Otherwise return workflowFields=[].',
'mode=read_only for questions, summaries, inspections, or reference-only uses of UI labels.',
'If an action is negated or forbidden, put it in forbiddenActions even if its label appears in the task text.',
+ 'excludedTargets lists every item, account, user or name the user said to leave out or skip (for example "everyone except alice"), copied exactly as written in taskText; otherwise return excludedTargets=[].',
].join('\n'),
},
{
@@ -30127,6 +30131,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
forbiddenActions: (classified?.forbiddenActions || []).filter(action => action !== plannerAction),
confidence: Math.max(0.45, Number(classified?.confidence || 0)),
targets: classified?.targets || [],
+ excludedTargets: classified?.excludedTargets || [],
reason: classified?.reason || 'approved planner enabled repeated-item progress tracking',
}, { taskText, pageScope, source: classified ? 'classifier' : 'planner' });
this._seedExpectedProgressItems(tabId, session, expectedItems);
@@ -30285,24 +30290,16 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return isProgressActionAllowed(this._currentProgressSession(tabId), 'follow');
}
- _excludedGithubUsernames(tabId) {
- const text = this._latestTaskText(tabId);
- const match = text.match(/\bexcept\b([\s\S]*?)(?:\band\s+while\b|\bwhile\b|[.;\n]|$)/i);
- if (!match) return [];
- const stop = new Set([
- 'and', 'or', 'the', 'these', 'those', 'following', 'listed', 'user', 'users',
- 'username', 'usernames', 'except', 'while', 'doing', 'keep', 'track', 'email',
- 'emails', 'name', 'names',
- ]);
+ // Accounts the user said to leave out, as the intent model copied them from
+ // the request in any language. A name that is not a GitHub username is
+ // not one of them.
+ _excludedGithubUsernames(session) {
const names = [];
const seen = new Set();
- const re = /@?([A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?)/g;
- let token;
- while ((token = re.exec(match[1])) !== null) {
- const name = token[1];
- const key = name.toLowerCase();
- if (stop.has(key) || seen.has(key)) continue;
- seen.add(key);
+ for (const target of Array.isArray(session?.excludedTargets) ? session.excludedTargets : []) {
+ const name = String(target || '').trim().replace(/^@/, '');
+ if (!/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/.test(name) || seen.has(name.toLowerCase())) continue;
+ seen.add(name.toLowerCase());
names.push(name);
}
return names;
@@ -30389,7 +30386,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const observed = buildGithubStargazerProgressItems(
this._currentTaskLedgerRows(tabId, { pageScope }),
pageContent,
- { excludedUsernames: this._excludedGithubUsernames(tabId), session }
+ { excludedUsernames: this._excludedGithubUsernames(session), session }
);
if (!observed.items.length) return null;
const update = this._progressUpdate(tabId, { items: observed.items }, {
@@ -31635,27 +31632,16 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
].join(' ');
}
- _progressActionMentionedInTaskText(taskText, action) {
- const canonical = normalizeProgressAction(action);
- if (!canonical) return false;
- const words = new Set([canonical.replace(/_/g, ' ')]);
- const firstWord = canonical.split('_')[0];
- if (firstWord) words.add(firstWord);
- return Array.from(words).some(word => {
- const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- return new RegExp(`\\b${escaped}(?:s|ed|ing)?\\b`, 'i').test(taskText);
- });
- }
-
- _taskTextLooksLikeLegacyProgressWork(taskText, rows = []) {
- const text = String(taskText || '').toLowerCase();
- if (!/\b(?:\d+|all|each|every|remaining|rest|list|accounts?|users?|profiles?|items?|rows?|people|members|followers|following|stargazers|results|links|pages|contacts|records)\b/i.test(text)) {
- return false;
- }
- const actions = Array.from(new Set((Array.isArray(rows) ? rows : [])
- .map(row => normalizeProgressAction(row?.action))
- .filter(Boolean)));
- return actions.some(action => this._progressActionMentionedInTaskText(text, action));
+ // Rows written before ledger rows were stamped carry no task identity.
+ // They belong to the current task only when the task's classified progress
+ // intent (read by the intent model in any language) allows the action they
+ // record; nothing is inferred from the task's words.
+ _progressIntentCoversLegacyRows(tabId, taskKey, rows = []) {
+ const session = this._currentProgressSession(tabId);
+ if (!session || this._progressTaskTextKey(session.taskText) !== taskKey) return false;
+ const actions = new Set((Array.isArray(rows) ? rows : [])
+ .map(row => normalizeProgressAction(row?.action)).filter(Boolean));
+ return [...actions].some(action => isProgressActionAllowed(session, action));
}
_legacyUnscopedProgressRowsForResumeGuard(tabId, allRows = [], opts = {}) {
@@ -31665,8 +31651,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// Mixed migration state: stamped rows are matched by exact taskKey — even
// on continuation turns, so a foreign task's stamped rows never ride along
- // — while pre-stamp rows are kept on an explicit continuation or via the
- // lexical heuristic while the conversation is still on its original task.
+ // — while pre-stamp rows are kept on an explicit continuation, or while the
+ // conversation is still on its original task and that task's classified
+ // progress intent allows the action they record.
const taskKey = opts.taskKey !== undefined ? opts.taskKey : this._progressTaskKeyHash(tabId);
const unstamped = rows.filter(row => !String(row.taskKey || '').trim());
let keepUnstamped = false;
@@ -31683,7 +31670,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const originalTask = this._progressTaskTextKey(this._originalTaskText(tabId));
keepUnstamped = !!latestTask
&& latestTask === originalTask
- && this._taskTextLooksLikeLegacyProgressWork(latestTask, unstamped);
+ && this._progressIntentCoversLegacyRows(tabId, latestTask, unstamped);
}
}
return rows.filter(row => {
diff --git a/src/firefox/src/agent/planner.js b/src/firefox/src/agent/planner.js
index e21a2a099..8cc4d42c3 100644
--- a/src/firefox/src/agent/planner.js
+++ b/src/firefox/src/agent/planner.js
@@ -1164,53 +1164,6 @@ export function normalizePlan(obj, opts = {}) {
response_language: responseLanguage,
mode: 'act',
};
- const latestUserTask = sanitizeText(opts.latestUserTask, 1200);
- const hotelNameNarrowing = latestUserTask.match(/\b(?:just|only)\b[\s\S]{0,160}\b(\d{1,3})\s+hotel\s+names?\b/i)
- || latestUserTask.match(/\b(?:sadece|yalnızca|yalnizca)[\s\S]{0,160}\b(\d{1,3})\s+otel\s+(?:ad(?:ı|ını|ları|larını)|isim(?:i|ini|leri|lerini))(?=\s|[.!?,]|$)/i);
- const asksForRemovedHotelFields = /\b(?:price|prices|availability|available|booking|rate|cost|fiyat|fiyatlar|müsaitlik|rezervasyon)\b/i.test(latestUserTask);
- const hotelCount = Number(hotelNameNarrowing?.[1]);
- if (Number.isInteger(hotelCount) && hotelCount > 0 && hotelCount <= 1000 && !asksForRemovedHotelFields) {
- const deliverable = `${hotelCount} hotel names`;
- const narrowedStep = {
- id: '1',
- action: `Traverse the Instagram carousel deterministically and collect exactly ${hotelCount} verified hotel names in order.`,
- tools: ['carousel_navigate', 'progress_update'],
- };
- normalizedPlan.scope_relation = 'narrow';
- normalizedPlan.conditional_site_job = null;
- normalizedPlan.deliverables = [deliverable];
- normalizedPlan.expected_items = {
- count: hotelCount,
- item_type: 'hotel',
- ordered: true,
- required_fields: ['hotel_name', 'carousel_position', 'evidence_source'],
- };
- normalizedPlan.requires_state_change = false;
- normalizedPlan.requires_submission = false;
- normalizedPlan.messaging = null;
- normalizedPlan.draft_recipients = null;
- normalizedPlan.completion_requirements = { download: false };
- normalizedPlan.completion_requirement_correction = null;
- normalizedPlan.read_scope = 'visible_page';
- normalizedPlan.summary = `List ${hotelCount} hotel names.`;
- normalizedPlan.steps = [narrowedStep];
- normalizedPlan.skill_ids = [];
- normalizedPlan.memory = {
- use_scratchpad: true,
- scratchpad_notes: [`Collect exactly ${hotelCount} ordered hotel names and no additional fields.`],
- use_progress_ledger: true,
- progress_action: 'process_item',
- progress_ledger_policy: 'enabled',
- };
- normalizedPlan.scheduling = null;
- normalizedPlan.risks = [];
- normalizedPlan.localized = {
- ...normalizedPlan.localized,
- summary: latestUserTask,
- steps: [{ id: '1', action: latestUserTask }],
- risks: [],
- };
- }
// Canonical plan display fields are English by schema. For English UI
// locales, do not reuse a second, potentially inconsistent model translation.
// This runs before user review; approved user edits are pinned separately.
diff --git a/src/firefox/src/agent/progress-intent.js b/src/firefox/src/agent/progress-intent.js
index 4b24f00ec..de943a03b 100644
--- a/src/firefox/src/agent/progress-intent.js
+++ b/src/firefox/src/agent/progress-intent.js
@@ -96,6 +96,12 @@ export function normalizeProgressIntent(raw, opts = {}) {
firstArray(raw.targets)
.map(value => sanitizeText(value, 160))
).slice(0, 20);
+ // Items the user said to leave out ("everyone except alice"), as the intent
+ // model copied them from the request, in any language.
+ const excludedTargets = unique(
+ firstArray(raw.excludedTargets, raw.excluded_targets)
+ .map(value => sanitizeText(value, 160))
+ ).slice(0, 50);
const pageScope = sanitizeText(raw.pageScope || raw.page_scope || opts.pageScope || '', 240);
const pageScopePolicy = sanitizeText(raw.pageScopePolicy || raw.page_scope_policy || '', 40).toLowerCase();
@@ -105,6 +111,7 @@ export function normalizeProgressIntent(raw, opts = {}) {
allowedActions,
forbiddenActions,
targets,
+ ...(excludedTargets.length ? { excludedTargets } : {}),
confidence,
...(pageScope ? { pageScope } : {}),
pageScopePolicy: pageScopePolicy === 'page' || pageScopePolicy === 'site' ? pageScopePolicy : (pageScope ? 'page' : 'none'),
diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.js
index bc870d2cf..3f9601a11 100644
--- a/src/firefox/src/ui/sidepanel.js
+++ b/src/firefox/src/ui/sidepanel.js
@@ -1103,41 +1103,6 @@ function showSlashInvocationError(invocation) {
showComposerToast(t('sp.slash.invalid_usage', { usage: invocation?.command?.usage || '/help' }), { duration: 5000 });
}
-function normalizeScreenshotRequestText(text) {
- return String(text || '')
- .trim()
- .toLowerCase()
- .normalize('NFKD')
- .replace(/[\u0300-\u036f]/g, '')
- .replace(/\u0131/g, 'i')
- .replace(/[.!?]+$/g, '')
- .replace(/\s+/g, ' ');
-}
-
-function isPlainScreenshotRequest(text) {
- const s = normalizeScreenshotRequestText(text);
- if (!s || s.startsWith('/')) return false;
- return /^(?:please |pls )?(?:screenshot|screen ?shot)(?: (?:please|pls))?$/.test(s)
- || /^(?:please |pls |can you |could you |would you )?(?:take|capture|grab|show|get) (?:a |the |this |current )?(?:screen ?shot|screenshot)(?: (?:of|for) (?:the |this |current )?(?:page|tab|screen|window))?$/.test(s)
- || /^(?:lutfen )?(?:screenshot|screen ?shot|ekran goruntusu)(?: (?:al|cek|goster|at))?$/.test(s)
- || /^(?:lutfen )?(?:bu |mevcut |aktif )?(?:sekmenin|sayfanin|ekranin) ekran goruntusunu (?:al|cek|goster|at)$/.test(s);
-}
-
-function isPlainFullPageScreenshotRequest(text) {
- const s = normalizeScreenshotRequestText(text);
- if (!s || s.startsWith('/')) return false;
- return /^(?:please |pls )?(?:(?:full|whole|entire|complete) page|fullpage|long) (?:screenshot|screen ?shot)(?: (?:please|pls))?$/.test(s)
- || /^(?:please |pls |can you |could you |would you )?(?:take|capture|grab|show|get) (?:a |the |this )?(?:(?:full|whole|entire|complete) page|fullpage|long) (?:screenshot|screen ?shot)(?: (?:of|for) (?:the |this |current )?(?:page|tab|screen|window))?$/.test(s)
- || /^(?:lutfen )?(?:tam sayfa|butun sayfa|tum sayfa|uzun) ekran goruntusu(?: (?:al|cek|goster|at))?$/.test(s)
- || /^(?:lutfen )?(?:bu |mevcut |aktif )?(?:sayfanin|sekmenin) (?:tam|butun|tum) ekran goruntusunu (?:al|cek|goster|at)$/.test(s);
-}
-
-function normalizeScreenshotCommandText(text) {
- if (isPlainFullPageScreenshotRequest(text)) return '/screenshot --full-page';
- if (isPlainScreenshotRequest(text)) return '/screenshot';
- return text;
-}
-
const SLASH_COMMAND_OPTION_ID_PREFIX = 'slash-command-option-';
const BUSY_SLASH_NOTICE_COOLDOWN_MS = 3000;
let placeholderRotationIndex = 0;
@@ -8453,7 +8418,7 @@ function isOutOfBandSlashDraft(value) {
function syncSendButtonState() {
if (!sendBtn) return;
syncComposerDeliveryState();
- const draft = normalizeScreenshotCommandText(inputEl?.value || '').trim();
+ const draft = String(inputEl?.value || '').trim();
if (tabSwitchTransitionId != null || visibleStateRefreshPending || visibleStateRefreshInProgress) {
sendBtn.disabled = true;
return;
@@ -9378,7 +9343,6 @@ async function sendMessage(extraChatParams = {}) {
if (steeringRequestsByTab.has(Number(tabId))) return false;
const permissionSkipContext = permissionSkipCommandContextForDraft(tabId, text);
const requestId = createRunRequestId(tabId);
- text = normalizeScreenshotCommandText(text);
if (isAwaitingPlanReviewForTab(tabId)) {
await releaseOwnedContextMenuClaim({ reason: 'plan-review-pending', retryAfterMs: 1_000 });
showComposerToast(t('sp.plan.awaiting_review'), { duration: 5000 });
diff --git a/test/chat-steering-ui.mjs b/test/chat-steering-ui.mjs
index 69c58120e..826f99fae 100644
--- a/test/chat-steering-ui.mjs
+++ b/test/chat-steering-ui.mjs
@@ -133,7 +133,6 @@ for (const [build, engine] of [['chrome', chromium], ['firefox', firefox]]) {
function drainQueuedPromptsAfterRunSettles() {}
function getHeldContextMenuPromptsForTab() { return []; }
function showComposerToast(text) { notices.push(text); }
- function normalizeScreenshotCommandText(value) { return value; }
function normalizeSelectionSourceGrounding() { return null; }
function normalizeSelectionAction() { return ''; }
function waitForVisibleSidePanelStateRefresh() { refreshCalls++; return heldRefresh || Promise.resolve(); }
diff --git a/test/planner-repair-authority.mjs b/test/planner-repair-authority.mjs
index 6e136267b..b58dd18aa 100644
--- a/test/planner-repair-authority.mjs
+++ b/test/planner-repair-authority.mjs
@@ -739,12 +739,19 @@ for (const browser of ['chrome', 'firefox']) {
}
});
- test(`${browser}: English display follows final semantic narrowing rather than obsolete model fields`, () => {
- const plan = planner.normalizePlan(modelPlan(), { requireIntent: true, locale: 'en', latestUserTask: 'Only 3 hotel names.' });
+ test(`${browser}: English display follows the planner's own narrowing rather than its obsolete localized fields`, () => {
+ // Narrowing is the planner's reading of the request; the request's words
+ // never rewrite the plan afterwards.
+ const plan = planner.normalizePlan(modelPlan({ scope_relation: 'narrow', deliverables: ['3 hotel names'],
+ expected_items: { count: 3, item_type: 'hotel', ordered: true, required_fields: ['hotel_name'] },
+ summary: 'List 3 hotel names.' }), { requireIntent: true, locale: 'en', latestUserTask: 'Only 3 hotel names.' });
assert.equal(plan.scope_relation, 'narrow');
assert.equal(plan.expected_items.count, 3);
assert.deepEqual(plan.localized, canonicalDisplay(plan));
assert.equal(plan.localized.summary, 'List 3 hotel names.');
+ const unchanged = planner.normalizePlan(modelPlan(), { requireIntent: true, locale: 'en', latestUserTask: 'Only 3 hotel names.' });
+ assert.equal(unchanged.scope_relation, 'new');
+ assert.equal(unchanged.expected_items, null);
});
test(`${browser}: non-English localized display and ID-aligned fallback remain unchanged`, () => {
diff --git a/test/queued-composer-ownership.mjs b/test/queued-composer-ownership.mjs
index 951977363..73c1b2d88 100644
--- a/test/queued-composer-ownership.mjs
+++ b/test/queued-composer-ownership.mjs
@@ -42,7 +42,7 @@ function fixture(build, { preferences = Promise.resolve(), refresh = Promise.res
isConversationClearInProgress: () => false, isAwaitingPlanReviewForTab: () => false,
isOutOfBandSlashDraft: () => false, isTabAbortRequested: () => false,
permissionSkipCommandContextForDraft: () => null,
- normalizeScreenshotCommandText: value => value, parseTrailingRunCaptureDirective: () => null,
+ parseTrailingRunCaptureDirective: () => null,
modeForMessageText: () => 'act', rejectSelectionScopedMode: () => false,
isApiMutationsAllowedForTab: () => false, isSelectionGroundedForTab: () => false,
createRunRequestId: () => 'queue-test', t: (_key, args) => args?.msg || _key,
diff --git a/test/run.js b/test/run.js
index 431dd8e1a..68f3a276d 100644
--- a/test/run.js
+++ b/test/run.js
@@ -920,6 +920,7 @@ function allowProgress(agent, tabId, allowedActions = ['follow'], opts = {}) {
allowedActions,
forbiddenActions: opts.forbiddenActions || [],
targets: opts.targets || [],
+ ...(opts.excludedTargets ? { excludedTargets: opts.excludedTargets } : {}),
confidence: opts.confidence ?? 1,
pageScopePolicy: opts.pageScope ? 'page' : (opts.pageScopePolicy || 'none'),
reason: 'test session',
@@ -50180,18 +50181,19 @@ test('sidepanel scopes async tab commands to the original tab', () => {
assert.match(locale, /'sp\.screenshot\.save_as': 'Save as…'/, `${label}: screenshot Save As should have an English label`);
assert.match(locale, /'sp\.screenshot\.save_failed': 'Could not save screenshot: \{msg\}'/, `${label}: screenshot save failures should have an English fallback`);
const fullPageIdx = panel.indexOf("if (command.value === '/screenshot' && action === 'full-page')");
- assert.match(panel, /function normalizeScreenshotRequestText\(text\) \{[\s\S]*?\.normalize\('NFKD'\)[\s\S]*?\.replace\(\/\[\\u0300-\\u036f\]\/g, ''\)[\s\S]*?\.replace\(\/\\u0131\/g, 'i'\)/, `${label}: plain screenshot request normalization should handle accented Turkish text`);
- assert.match(panel, /function isPlainScreenshotRequest\(text\) \{[\s\S]*?const s = normalizeScreenshotRequestText\(text\);[\s\S]*?s\.startsWith\('\/'\)[\s\S]*?ekran goruntusu[\s\S]*?ekran goruntusunu/, `${label}: plain screenshot request routing should cover English and Turkish screenshot-only requests`);
assert.notEqual(fullPageIdx, -1, `${label}: /screenshot --full-page parser missing`);
const fullPageBody = panel.slice(fullPageIdx, panel.indexOf("if (command.value === '/record'", fullPageIdx));
assert.match(fullPageBody, /tabs\.get\(tabId\)[\s\S]*?sendToBackground\('capture_full_page_screenshot', \{ tabId \}\);[\s\S]*?if \(currentTabId !== tabId\) return '';[\s\S]*?stageScreenshotAttachment\(tabId, res\.dataUrl, \{[\s\S]*?fullPage: true,[\s\S]*?pageUrl,[\s\S]*?captureBounds: res\.captureBounds,[\s\S]*?redactionSnapshotReady: res\.redactionSnapshotReady === true,[\s\S]*?redactionSnapshot: res\.redactionSnapshot,[\s\S]*?\}\);[\s\S]*?addScreenshotResultMessage\(res\.dataUrl, \{[\s\S]*?fullPage: true,[\s\S]*?warning: res\.warning,[\s\S]*?pageUrl,[\s\S]*?stagedAttachment,[\s\S]*?\}\);/, `${label}: /screenshot --full-page should stage capture-time privacy geometry and render only in the initiating tab with URL-aware Save As`);
assert.match(panel, /function renderScreenshotResult\(dataUrl,[\s\S]*?warningHtml = warning[\s\S]*?escapeHtml\(warning\)/, `${label}: fallback full-page images should display their escaped assembly warning`);
- assert.match(panel, /function isPlainFullPageScreenshotRequest\(text\) \{[\s\S]*?full\|whole\|entire\|complete[\s\S]*?tam sayfa[\s\S]*?ekran goruntusu/, `${label}: plain full-page screenshot request routing should cover English and Turkish requests`);
- assert.match(panel, /function normalizeScreenshotCommandText\(text\) \{[\s\S]*?isPlainFullPageScreenshotRequest\(text\)[\s\S]*?return '\/screenshot --full-page';[\s\S]*?isPlainScreenshotRequest\(text\)[\s\S]*?return '\/screenshot';/, `${label}: screenshot normalization should route full-page requests before viewport screenshots`);
+ // A typed message is sent as typed: its words never turn it into
+ // /screenshot. The agent's model reads a screenshot request in any
+ // language; /screenshot is the explicit local command.
+ assert.doesNotMatch(panel, /normalizeScreenshotCommandText|isPlainScreenshotRequest|isPlainFullPageScreenshotRequest|ekran goruntusu/,
+ `${label}: a typed request is still rewritten into /screenshot by its words`);
const sendIdx = panel.search(/async function sendMessage\(extraChatParams(?: = \{\})?\)/);
assert.notEqual(sendIdx, -1, `${label}: sendMessage missing`);
const sendBody = panel.slice(sendIdx, panel.indexOf('let assistantEl = null;', sendIdx));
- assert.match(sendBody, /const tabId = currentTabId;[\s\S]*?text = normalizeScreenshotCommandText\(text\);[\s\S]*?if \(isProcessing\)/, `${label}: plain screenshot requests should route to slash commands before busy gating`);
+ assert.match(sendBody, /const tabId = currentTabId;[\s\S]*?if \(isProcessing\)/, `${label}: sendMessage lost its busy gating`);
if (label === 'chrome') {
const fullScreenRecordIdx = panel.indexOf("if (command.value === '/record' && action === 'full-screen')");
@@ -50489,7 +50491,7 @@ test('sidepanel allows safe slash commands and queues normal messages while busy
}
assert.match(
panel,
- /function syncSendButtonState\(\) \{[\s\S]*?const draft = normalizeScreenshotCommandText\(inputEl\?\.value \|\| ''\)\.trim\(\);[\s\S]*?if \(!isProcessing\) \{[\s\S]*?sendBtn\.disabled = isAttachmentReadPendingForTab\(\);[\s\S]*?return;[\s\S]*?\}[\s\S]*?if \(!draft\) \{[\s\S]*?sendBtn\.disabled = true;[\s\S]*?return;[\s\S]*?\}[\s\S]*?sendBtn\.disabled = draft\.startsWith\('\/'\) && !isOutOfBandSlashDraft\(draft\);[\s\S]*?\}/,
+ /function syncSendButtonState\(\) \{[\s\S]*?const draft = String\(inputEl\?\.value \|\| ''\)\.trim\(\);[\s\S]*?if \(!isProcessing\) \{[\s\S]*?sendBtn\.disabled = isAttachmentReadPendingForTab\(\);[\s\S]*?return;[\s\S]*?\}[\s\S]*?if \(!draft\) \{[\s\S]*?sendBtn\.disabled = true;[\s\S]*?return;[\s\S]*?\}[\s\S]*?sendBtn\.disabled = draft\.startsWith\('\/'\) && !isOutOfBandSlashDraft\(draft\);[\s\S]*?\}/,
`${label}: send button state should gate attachment reads while idle, permit normal queued drafts while busy, and only block unsafe slash drafts`,
);
assert.match(
@@ -50499,7 +50501,7 @@ test('sidepanel allows safe slash commands and queues normal messages while busy
);
assert.match(
panel,
- /text = normalizeScreenshotCommandText\(text\);[\s\S]*?if \(isProcessing\) \{[\s\S]*?if \(isOutOfBandSlashDraft\(text\)\) \{[\s\S]*?await parseSlashCommands\(text, tabId, \{ permissionSkipContext \}\);[\s\S]*?return true;[\s\S]*?\}[\s\S]*?if \(text\.startsWith\('\/'\)\) \{[\s\S]*?showBusySlashCommandNotice\(\);[\s\S]*?return false;[\s\S]*?\}[\s\S]*?return enqueueQueuedComposerMessage\(tabId, text\);[\s\S]*?\}/,
+ /if \(isProcessing\) \{[\s\S]*?if \(isOutOfBandSlashDraft\(text\)\) \{[\s\S]*?await parseSlashCommands\(text, tabId, \{ permissionSkipContext \}\);[\s\S]*?return true;[\s\S]*?\}[\s\S]*?if \(text\.startsWith\('\/'\)\) \{[\s\S]*?showBusySlashCommandNotice\(\);[\s\S]*?return false;[\s\S]*?\}[\s\S]*?return enqueueQueuedComposerMessage\(tabId, text\);[\s\S]*?\}/,
`${label}: busy send preflight should run safe slash commands and queue normal drafts`,
);
assert.match(
@@ -85466,6 +85468,29 @@ test('progress intent classifier accepts multilingual structured intent and fail
});
assert.equal(TurkishFollow.mode, 'active', `${AgentClass.name}: Turkish follow intent was not active`);
assert.deepEqual(TurkishFollow.allowedActions, ['follow'], `${AgentClass.name}: Turkish takip et did not normalize to follow`);
+ assert.equal(TurkishFollow.excludedTargets, undefined, `${AgentClass.name}: an exclusion was invented`);
+
+ // Accounts the request leaves out are the intent model's to read, in any
+ // language; they reach the session and survive its rebuilds for the task.
+ let prompt = '';
+ agent._chatWithCostAllowance = async (_provider, messages) => {
+ prompt = messages[0].content;
+ return { content: JSON.stringify({ mode: 'active', allowedActions: ['follow'], forbiddenActions: [], targets: [],
+ excludedTargets: ['ChJus', 'ChJus', '@rafi'], confidence: 0.9, pageScopePolicy: 'page' }) };
+ };
+ const excluding = await agent._classifyProgressIntentWithProvider(tabId, {
+ provider: { chat: async () => ({ content: '{}' }) },
+ pageScope: 'https://github.com/foo/bar/stargazers',
+ });
+ assert.match(prompt, /"excludedTargets":\[\]/);
+ assert.match(prompt, /excludedTargets lists every item, account, user or name the user said to leave out/);
+ assert.deepEqual(excluding.excludedTargets, ['ChJus', '@rafi']);
+ const session = agent._setProgressSession(tabId, excluding, { pageScope: 'https://github.com/foo/bar/stargazers' });
+ assert.deepEqual(agent._excludedGithubUsernames(session), ['ChJus', 'rafi']);
+ const rebuilt = agent._setProgressSession(tabId, { mode: 'active', allowedActions: ['follow'], forbiddenActions: [], confidence: 1 },
+ { pageScope: 'https://github.com/foo/bar/stargazers', sessionId: session.sessionId, source: 'ledger' });
+ assert.deepEqual(rebuilt.excludedTargets, ['ChJus', '@rafi'], `${AgentClass.name}: a same-task rebuild dropped the exclusions`);
+ agent.progressSessions.delete(tabId);
agent.conversations.set(tabId, [
{ role: 'system', content: 'sys' },
@@ -86756,53 +86781,46 @@ test('narrow hotel-name plans carry only the current deliverable and a strict or
}
});
-test('latest hotel-name narrowing deterministically strips stale planner deliverables', () => {
+test('the words of a narrowing request never rewrite the planner\'s plan', () => {
+ // The planner reads narrowing in any language and says so in its own plan,
+ // which the user reviews; nothing afterwards rewrites it from words.
for (const [label, normalize] of [['chrome', normalizePlan], ['firefox', normalizePlanFx]]) {
- const plan = normalize({
+ const stale = {
request_kind: 'execute',
scope_relation: 'continue',
deliverables: ['hotel names', 'prices', 'availability', 'booking conditions'],
- requires_state_change: true,
- requires_submission: true,
- completion_requirements: { download: true },
+ requires_state_change: false,
+ requires_submission: false,
read_scope: 'visible_page',
summary: 'Collect hotel names, prices, availability, and booking conditions.',
confidence: 0.8,
- steps: [
- { id: '1', action: 'Collect names and prices.', tools: ['press_keys'] },
- { id: '2', action: 'Check availability and booking terms.', tools: ['click'] },
- ],
+ steps: [{ id: '1', action: 'Collect names and prices.', tools: ['read_page'] }],
memory: { use_scratchpad: true, use_progress_ledger: false, progress_action: null },
- scheduling: { tool: 'schedule_resume', hint: 'Wait for availability.' },
- risks: ['Rates may change.'],
- localized: { locale: 'en', summary: 'Collect names and prices.', steps: [], risks: ['Rates may change.'] },
- }, {
- requireIntent: true,
- locale: 'en',
- latestUserTask: 'Just give me the 15 hotel names.',
- });
- assert.equal(plan.scope_relation, 'narrow', `${label}: latest narrowing did not override stale relation`);
- assert.deepEqual(plan.deliverables, ['15 hotel names']);
- assert.equal(plan.requires_state_change, false);
- assert.equal(plan.requires_submission, false);
- assert.equal(plan.completion_requirements.download, false);
- assert.equal(plan.scheduling, null);
- assert.deepEqual(plan.steps[0].tools, ['carousel_navigate', 'progress_update']);
- assert.deepEqual(plan.expected_items?.required_fields, ['hotel_name', 'carousel_position', 'evidence_source']);
- assert.doesNotMatch(JSON.stringify(plan), /prices|availability|booking conditions|press_keys/i, `${label}: stale planner scope survived deterministic normalization`);
+ localized: { locale: 'en', summary: 'Collect names and prices.', steps: [], risks: [] },
+ };
+ for (const latestUserTask of ['Just give me the 15 hotel names.', 'Sadece 15 otel adını ver.']) {
+ const plan = normalize(stale, { requireIntent: true, locale: 'en', latestUserTask });
+ assert.equal(plan.scope_relation, 'continue', `${label}: "${latestUserTask}" rewrote the plan's scope`);
+ assert.deepEqual(plan.deliverables, stale.deliverables, `${label}: "${latestUserTask}" rewrote the deliverables`);
+ assert.equal(plan.expected_items, null, `${label}: "${latestUserTask}" invented an item contract`);
+ }
}
});
-test('reviewed hotel-name edits regenerate expected-item metadata without stale planner fields', () => {
+test('reviewed plans regenerate expected items only from their own expected-items line', () => {
for (const [label, AgentClass] of [['chrome', AgentCh], ['firefox', AgentFx]]) {
const agent = new AgentClass({});
- const expected = agent._plannerExpectedItemsFromApprovedPlanText('Just give me the 15 hotel names.');
- assert.deepEqual(expected, {
+ const reviewed = '### Plan\nList the hotel names.\n- Expected items: 15 ordered=yes type=hotel; required fields=hotel_name, carousel_position, evidence_source';
+ assert.deepEqual(agent._plannerExpectedItemsFromApprovedPlanText(reviewed), {
count: 15,
item_type: 'hotel',
ordered: true,
required_fields: ['hotel_name', 'carousel_position', 'evidence_source'],
- }, `${label}: edited hotel scope did not regenerate execution metadata`);
+ }, `${label}: the plan's own expected-items line was not read`);
+ // Prose is never parsed for a count, in any language.
+ for (const prose of ['Just give me the 15 hotel names.', '15 otel adını listele.']) {
+ assert.equal(agent._plannerExpectedItemsFromApprovedPlanText(prose), null, `${label}: "${prose}" produced an item contract`);
+ }
assert.deepEqual(
agent._plannerProgressLedgerGateFieldsFromApprovedPlanText('Just give me the 15 hotel names.'),
{ progressLedgerPolicy: 'disabled', progressAction: null },
@@ -87098,11 +87116,15 @@ test('agent records GitHub stargazer observations into the progress ledger', asy
for (const AgentClass of [AgentCh, AgentFx]) {
const agent = new AgentClass({ getActive: () => ({ contextWindow: 128000, supportsVision: false }) });
const tabId = 772;
+ // The intent model copies the excluded account from the request, in any
+ // language; the request's words are not parsed for it.
agent.conversations.set(tabId, [
{ role: 'system', content: 'sys' },
- { role: 'user', content: 'Follow all not-followed stargazers except ChJus, and while doing that keep usernames/emails.' },
+ { role: 'user', content: 'ChJus hariç takip etmediğim tüm yıldızlayanları takip et; kullanıcı adlarını ve e-postaları kaydet.' },
]);
agent._currentUrl = async () => 'https://github.com/foo/bar/stargazers?page=2';
+ allowProgress(agent, tabId, ['follow'], { excludedTargets: ['@ChJus', 'not a username!'] });
+ assert.deepEqual(agent._excludedGithubUsernames(agent.progressSessions.get(tabId)), ['ChJus']);
agent._progressUpdate(tabId, {
items: [{
id: 'myxvisual',
@@ -101579,6 +101601,9 @@ test('schedule_resume guards progress-ledger continuations against stale next-it
});
test('schedule_resume falls back to all-sessions progress read for legacy unscoped rows', async () => {
+ // Rows written before ledger rows were stamped belong to the current task
+ // when its classified progress intent (read by the intent model in any
+ // language) allows their action; the task's words alone attribute nothing.
for (const AgentClass of [AgentCh, AgentFx]) {
const agent = new AgentClass({ getActive: () => ({ contextWindow: 128000, supportsVision: false }) });
const tabId = AgentClass === AgentCh ? 803 : 804;
@@ -101586,11 +101611,17 @@ test('schedule_resume falls back to all-sessions progress read for legacy unscop
agent.conversationIds.set(tabId, 'conv_legacy_progress_resume_guard');
agent.conversations.set(tabId, [
{ role: 'system', content: 'sys' },
- { role: 'user', content: "follow 100 accounts i don't follow yet here" },
+ { role: 'user', content: 'buradaki takip etmediğim 100 hesabı takip et' },
]);
agent.progressLedgers.set(tabId, [
{ id: 'legacy_pending', label: 'legacy_pending', action: 'follow', status: 'pending' },
]);
+ assert.deepEqual(agent._legacyUnscopedProgressRowsForResumeGuard(tabId, agent.progressLedgers.get(tabId)), [],
+ `${AgentClass.name}: legacy rows were attributed without a classified intent`);
+ allowProgress(agent, tabId, ['unfollow']);
+ assert.deepEqual(agent._legacyUnscopedProgressRowsForResumeGuard(tabId, agent.progressLedgers.get(tabId)), [],
+ `${AgentClass.name}: legacy rows were attributed to an intent that does not allow their action`);
+ allowProgress(agent, tabId, ['follow']);
let scheduledPayload = null;
agent.setScheduler({
@@ -101800,11 +101831,6 @@ test('schedule_resume guards unscoped rows via task key match for non-English ta
agent.progressLedgers.set(tabId, [
{ id: 'legacy_pending', label: 'legacy_pending', action: 'follow', status: 'pending', taskKey },
]);
- assert.equal(
- agent._taskTextLooksLikeLegacyProgressWork(agent._latestTaskText(tabId), agent.progressLedgers.get(tabId)),
- false,
- `${AgentClass.name}: setup precondition — the lexical heuristic must not match this task text`,
- );
let scheduledPayload = null;
agent.setScheduler({
@@ -101891,9 +101917,10 @@ test('schedule_resume mixed migration state: foreign stamped row does not starve
{ id: 'legacy_pending', label: 'legacy_pending', action: 'follow', status: 'pending' },
]);
assert.notEqual(agent._progressTaskKeyHash(tabId), 'tk_00000000', `${AgentClass.name}: setup precondition — stamped row must belong to a different task`);
+ allowProgress(agent, tabId, ['follow']);
const guarded = agent._legacyUnscopedProgressRowsForResumeGuard(tabId, agent.progressLedgers.get(tabId));
- assert.deepEqual(guarded.map(r => r.id), ['legacy_pending'], `${AgentClass.name}: unstamped current-task rows must still pass the lexical heuristic despite a foreign stamped row`);
+ assert.deepEqual(guarded.map(r => r.id), ['legacy_pending'], `${AgentClass.name}: unstamped current-task rows must still follow the classified intent despite a foreign stamped row`);
const scopedRead = agent._progressRead(tabId, { currentTaskOnly: true });
assert.deepEqual(scopedRead.rows.map(r => r.id), ['legacy_pending'], `${AgentClass.name}: currentTaskOnly progress_read must exclude rows the resume guard excluded`);
@@ -101921,7 +101948,7 @@ test('schedule_resume mixed migration state: foreign stamped row does not starve
assert.equal(result.success, true, `${AgentClass.name}: mixed-state schedule_resume should succeed`);
const instruction = scheduledPayload?.args?.resume_instruction || '';
- assert.match(instruction, /^Continue the active Act-mode progress-ledger task/, `${AgentClass.name}: mixed-state guard should still attach via the legacy heuristic`);
+ assert.match(instruction, /^Continue the active Act-mode progress-ledger task/, `${AgentClass.name}: mixed-state guard should still attach through the classified intent`);
assert.match(instruction, /1 row\(s\), 1 unresolved/, `${AgentClass.name}: guard counts must exclude the foreign stamped row`);
}
});