Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
fix: reject invisible Unicode clarification options
Barack Sokullub84d134037c9
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 08b308262..228413696 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -33853,7 +33853,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai}const rawOptions = Array.isArray(args?.options) ? args.options.slice(0, 4) : [];const normalizedOptions = rawOptions.map(s => String(s).trim().slice(0, 200));- const hasVisibleOptionContent = option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option.replace(/[\p{Cf}\u2800]/gu, ''));+ const hasVisibleOptionContent = option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option.replace(/[\p{Default_Ignorable_Code_Point}\u2800]/gu, ''));const options = normalizedOptions.every(hasVisibleOptionContent)? normalizedOptions: [];diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex 680a87b93..b27c55b4c 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -30562,7 +30562,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d}const rawOptions = Array.isArray(args?.options) ? args.options.slice(0, 4) : [];const normalizedOptions = rawOptions.map(s => String(s).trim().slice(0, 200));- const hasVisibleOptionContent = option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option.replace(/[\p{Cf}\u2800]/gu, ''));+ const hasVisibleOptionContent = option => /[\p{L}\p{N}\p{P}\p{S}]/u.test(option.replace(/[\p{Default_Ignorable_Code_Point}\u2800]/gu, ''));const options = normalizedOptions.every(hasVisibleOptionContent)? normalizedOptions: [];diff --git a/test/run.js b/test/run.jsindex 05832e149..3a1686bb5 100644--- a/test/run.js+++ b/test/run.js@@ -48831,6 +48831,20 @@ test('clarify result distinguishes waited timeout from user and Instant authoriz);assert.equal(brailleBlankOptionTimeout.authorized, false, `${AgentClass.name}: braille blank safe_first option was accepted`);+ for (const filler of ['\u115F', '\u1160', '\u3164', '\uFFA0']) {+ await agent._recordClarificationAuthorization(tabId, 'user');+ const fillerTimeout = await agent.executeTool(+ tabId,+ 'clarify',+ { question: 'Continue?', options: [filler], safe_first: true },+ (type, data) => {+ if (type === 'clarify') agent.submitClarifyResponse(tabId, data.clarifyId, filler, 'timeout');+ },+ );+ assert.equal(fillerTimeout.authorized, false, `${AgentClass.name}: U+${filler.codePointAt(0).toString(16)} filler safe_first option was accepted`);+ assert.equal(agent._clarificationAuthorizationGuards.get(tabId)?.authorized, false, `${AgentClass.name}: filler timeout did not arm a guard`);+ }+await agent._recordClarificationAuthorization(tabId, 'user');const emojiOptionTimeout = await agent.executeTool(tabId,