Skip to content

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

fix(social-publish): multiline bodies, together-with grammar, plus destinations

Barack Sokullu8b50678ed297
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 3ea6beef5..3424e67fc 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -315,7 +315,7 @@ const GENERIC_ATTACHMENT_WORDS = new Set([
'item', 'items', 'piece', 'pieces', 'upload', 'uploads', 'asset', 'assets',
'enclosure', 'enclosures', 'document', 'documents', 'documento', 'documentos',
'a', 'an', 'the', 'of', 'in', 'with', 'some', 'any',
- 'and', 'but', 'or', 'either', 'neither', 'nor', 'plus', 'also', 'as', 'well', 'between', 'from', 'to',
+ 'and', 'but', 'or', 'either', 'neither', 'nor', 'plus', 'also', 'as', 'well', 'together', 'between', 'from', 'to',
'no', 'not', 'without', 'zero', 'none',
'only', 'just', 'solely', 'exactly', 'exact', 'precisely',
'sin', 'sans', 'sem', 'senza', 'ohne', 'kein', 'keine', 'keinen', 'aucun', 'aucune', 'ningun', 'ninguna', 'ningún', 'nenhum', 'nenhuma', 'nessun', 'nessuno', 'nessuna', 'nie', 'без', 'нет',
@@ -17945,7 +17945,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// matching would leave it unbound.
const publishesTo = (platform) => {
const destPreps = '(?:on|onto|to|via|in|at|en|sur|sobre|\u00e0|au|auf|su|em|na|no|nos|nas|para|\u0432|\u043d\u0430)';
- const coordConj = '(?:and|und|et|e|y|ve|и|oder|or|ou|o|as\\s+well\\s+as|alongside|together\\s+with|&|\\/)';
+ const coordConj = '(?:and|und|et|e|y|ve|и|oder|or|ou|o|plus|as\\s+well\\s+as|alongside|together\\s+with|&|\\/)';
const listModifiers = '(?:both|either|all|one\\s+of(?:\\s+the)?|ambos|ambas|entrambi|entrambe|beide|beiden|les\\s+deux|tous\\s+les\\s+deux|\u043e\u0431\u0430|\u043e\u0431\u0435|\u4e24\u8005|\u4e24\u4e2a|\u4e24|\u4e21\u65b9|\u4e21\u8005|\u4e21|\ub458\\s*\ub2e4|\ub458|\uc591\uc790|\uc591)';
const coordItem = `(?:the\\s+)?(?:${listModifiers}\\s+)?[a-z0-9_.-]+(?:\\s+page|\\s+account|\\s+profile)?`;
const coordPrefix = `(?:${coordItem}(?:\\s*,\\s*${coordItem})*\\s*(?:,\\s*${coordConj}|,|;|\\s+${coordConj})\\s+(?:the\\s+)?)`;
@@ -26682,6 +26682,19 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const next = clauses[nextIndex];
if ((next.delim || '').trim() === ':') {
scoped += `:${next.text}`;
+ // Bodies may continue on following lines ("Post on X:\nhello
+ // \nworld"): newline clauses carry no terminator of their own,
+ // so they extend the same body unless a new publication clause
+ // for another destination begins.
+ for (let bodyIndex = nextIndex + 1; bodyIndex < clauses.length; bodyIndex++) {
+ const bodyClause = clauses[bodyIndex];
+ if ((bodyClause.delim || '') !== '') break;
+ const bodyMasked = bodyClause.maskedText || bodyClause.text || '';
+ if (SOCIAL_PUBLISH_VERBS.test(bodyMasked)
+ && anyPlatformPattern.test(bodyMasked)
+ && !platformPattern.test(bodyMasked)) break;
+ scoped += `\n${bodyClause.text}`;
+ }
break;
}
if (SOCIAL_COORDINATING_DELIMITER.test(next.delim || '')
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 286c0f8fe..aada4ad52 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -249,7 +249,7 @@ const GENERIC_ATTACHMENT_WORDS = new Set([
'item', 'items', 'piece', 'pieces', 'upload', 'uploads', 'asset', 'assets',
'enclosure', 'enclosures', 'document', 'documents', 'documento', 'documentos',
'a', 'an', 'the', 'of', 'in', 'with', 'some', 'any',
- 'and', 'but', 'or', 'either', 'neither', 'nor', 'plus', 'also', 'as', 'well', 'between', 'from', 'to',
+ 'and', 'but', 'or', 'either', 'neither', 'nor', 'plus', 'also', 'as', 'well', 'together', 'between', 'from', 'to',
'no', 'not', 'without', 'zero', 'none',
'only', 'just', 'solely', 'exactly', 'exact', 'precisely',
'sin', 'sans', 'sem', 'senza', 'ohne', 'kein', 'keine', 'keinen', 'aucun', 'aucune', 'ningun', 'ninguna', 'ningún', 'nenhum', 'nenhuma', 'nessun', 'nessuno', 'nessuna', 'nie', 'без', 'нет',
@@ -15744,7 +15744,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// matching would leave it unbound.
const publishesTo = (platform) => {
const destPreps = '(?:on|onto|to|via|in|at|en|sur|sobre|\u00e0|au|auf|su|em|na|no|nos|nas|para|\u0432|\u043d\u0430)';
- const coordConj = '(?:and|und|et|e|y|ve|и|oder|or|ou|o|as\\s+well\\s+as|alongside|together\\s+with|&|\\/)';
+ const coordConj = '(?:and|und|et|e|y|ve|и|oder|or|ou|o|plus|as\\s+well\\s+as|alongside|together\\s+with|&|\\/)';
const listModifiers = '(?:both|either|all|one\\s+of(?:\\s+the)?|ambos|ambas|entrambi|entrambe|beide|beiden|les\\s+deux|tous\\s+les\\s+deux|\u043e\u0431\u0430|\u043e\u0431\u0435|\u4e24\u8005|\u4e24\u4e2a|\u4e24|\u4e21\u65b9|\u4e21\u8005|\u4e21|\ub458\\s*\ub2e4|\ub458|\uc591\uc790|\uc591)';
const coordItem = `(?:the\\s+)?(?:${listModifiers}\\s+)?[a-z0-9_.-]+(?:\\s+page|\\s+account|\\s+profile)?`;
const coordPrefix = `(?:${coordItem}(?:\\s*,\\s*${coordItem})*\\s*(?:,\\s*${coordConj}|,|;|\\s+${coordConj})\\s+(?:the\\s+)?)`;
@@ -24289,6 +24289,19 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const next = clauses[nextIndex];
if ((next.delim || '').trim() === ':') {
scoped += `:${next.text}`;
+ // Bodies may continue on following lines ("Post on X:\nhello
+ // \nworld"): newline clauses carry no terminator of their own,
+ // so they extend the same body unless a new publication clause
+ // for another destination begins.
+ for (let bodyIndex = nextIndex + 1; bodyIndex < clauses.length; bodyIndex++) {
+ const bodyClause = clauses[bodyIndex];
+ if ((bodyClause.delim || '') !== '') break;
+ const bodyMasked = bodyClause.maskedText || bodyClause.text || '';
+ if (SOCIAL_PUBLISH_VERBS.test(bodyMasked)
+ && anyPlatformPattern.test(bodyMasked)
+ && !platformPattern.test(bodyMasked)) break;
+ scoped += `\n${bodyClause.text}`;
+ }
break;
}
if (SOCIAL_COORDINATING_DELIMITER.test(next.delim || '')
diff --git a/test/run.js b/test/run.js
index f8eeb8b2f..1898abf5f 100644
--- a/test/run.js
+++ b/test/run.js
@@ -91016,6 +91016,8 @@ test('social publication workflow follows the live X or Bluesky destination and
// Multi-platform coordination across conjunctions
['Post on X and Bluesky', ['twitter', 'bluesky'],
'coordinated destinations on X and Bluesky should both be targeted'],
+ ['Post on X plus Bluesky', ['twitter', 'bluesky'],
+ 'coordinated destinations on X plus Bluesky should both be targeted'],
['Post on X, then on Bluesky', ['twitter', 'bluesky'],
'sequential destinations on X then Bluesky should both be targeted'],
['Post on https://x.com/home, then on https://bsky.app/', ['twitter', 'bluesky'],
@@ -91164,6 +91166,10 @@ test('social destination rebinding refreshes platform-specific payload and uploa
AgentClass.name + ': destination-first publish clause lost the shared X body');
assert.equal(agent._extractWorkflowTaskBody('On X and Bluesky, publish: Launch now', '', 'bluesky'), 'Launch now',
AgentClass.name + ': destination-first publish clause lost the shared Bluesky body');
+ assert.equal(agent._extractWorkflowTaskBody('Post on X:\nhello\nworld', '', 'twitter'), 'hello\nworld',
+ AgentClass.name + ': multiline body after the colon was lost');
+ assert.equal(agent._extractWorkflowTaskBody('Post on X: hello\nworld', '', 'twitter'), 'hello\nworld',
+ AgentClass.name + ': body continuation line after inline colon text was lost');
assert.equal(guard.workflowMetadataRequirementsResolved, true);
assert.deepEqual(guard.workflowSocialUploadEvidence, [],
AgentClass.name + ': X upload provenance leaked into the Bluesky binding');
@@ -91354,6 +91360,7 @@ test('alternative social destinations require one verified publication, not ever
for (const taskText of [
'Post this on X alongside Bluesky.',
'Post this on X together with Bluesky.',
+ 'Post on X plus Bluesky.',
]) {
const conjunctiveList = { ...guard, taskText };
assert.deepEqual(
@@ -93188,6 +93195,11 @@ test('upper-bound attachment qualifiers verify as maximum counts', () => {
{ value: 'one image and no more than one video' }, { attachments },
), expected, AgentClass.name + ': ' + message);
}
+ assert.equal(agent._parseWorkflowAttachmentRequirement('one image together with one video').isGeneric, true,
+ AgentClass.name + ': together-with conjunction was parsed as a filename');
+ assert.equal(agent._workflowSocialPublishedAttachmentObserved(
+ { value: 'one image together with one video' }, { attachments: [image(1), video(1)] }), true,
+ AgentClass.name + ': one image together with one video was rejected');
const unrestrictedOrPngImage = agent._parseWorkflowAttachmentRequirement('one image or one PNG image');
assert.equal(unrestrictedOrPngImage.mediaAlternativeBranches.length, 2,
AgentClass.name + ': a format token consumed the noun slot of a whole-media alternative');