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(social-publish): preserve join controls in exact bodies
Barack Sokullua1bd6a84075f
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 8b567b88d..78a1a6e21 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -2345,10 +2345,12 @@ export class Agent extends LoopDetector {// Same pipeline as _workflowMessageBody, but NFC instead of NFKC: exact// social-body verification must keep visibly distinct payloads (circled- // digits, fullwidth letters, ligatures) distinct. Keep the two in sync.+ // digits, fullwidth letters, ligatures) distinct. Only genuinely ignorable+ // characters are stripped: zero-width join controls shape visible text+ // (joined emoji, Indic scripts) and are preserved. Keep the two in sync._workflowSocialExactBody(value) {let text = String(value ?? '')- .replace(new RegExp('[\\u200b-\\u200d\\ufeff]', 'g'), '')+ .replace(new RegExp('[\\u200b\\ufeff]', 'g'), '').replace(/\r\n?/g, '\n').split('\n').map(line => line.replace(/\s+/g, ' ').trim())diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex 0b67f1994..5aa07e1fc 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -2060,10 +2060,12 @@ export class Agent extends LoopDetector {// Same pipeline as _workflowMessageBody, but NFC instead of NFKC: exact// social-body verification must keep visibly distinct payloads (circled- // digits, fullwidth letters, ligatures) distinct. Keep the two in sync.+ // digits, fullwidth letters, ligatures) distinct. Only genuinely ignorable+ // characters are stripped: zero-width join controls shape visible text+ // (joined emoji, Indic scripts) and are preserved. Keep the two in sync._workflowSocialExactBody(value) {let text = String(value ?? '')- .replace(new RegExp('[\\u200b-\\u200d\\ufeff]', 'g'), '')+ .replace(new RegExp('[\\u200b\\ufeff]', 'g'), '').replace(/\r\n?/g, '\n').split('\n').map(line => line.replace(/\s+/g, ' ').trim())diff --git a/test/run.js b/test/run.jsindex 09cb521b7..00a93d430 100644--- a/test/run.js+++ b/test/run.js@@ -91661,6 +91661,14 @@ test('X and Bluesky same-route publication accepts only one new permalink with t{ field: 'body', value: 'Hello world' },{ bodyText: 'Hello world' },), true, AgentClass.name + ': an identical body stopped verifying');+ assert.equal(agent._workflowSocialPublishedBodyObserved(+ { field: 'body', value: 'Family: π¨π©π§' },+ { bodyText: 'Family: π¨βπ©βπ§' },+ ), false, AgentClass.name + ': a ZWJ-stripped body verified against joined emoji');+ assert.equal(agent._workflowSocialPublishedBodyObserved(+ { field: 'body', value: 'Family: π¨βπ©βπ§' },+ { bodyText: 'Family: π¨βπ©βπ§' },+ ), true, AgentClass.name + ': joined emoji stopped verifying');assert.equal(agent._workflowSocialPublishedBodyObserved({ field: 'body', value: '1', rawValue: 'β ' },{ bodyText: '1' },