Skip to content

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

fix(social-publish): publish-verb body scope and in-addition-to grammar

Barack Sokullub751cf50494c
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index afbb0c51d..895a6b934 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', 'together', 'along', 'between', 'from', 'to',
+ 'and', 'but', 'or', 'either', 'neither', 'nor', 'plus', 'also', 'as', 'well', 'together', 'along', 'addition', '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', 'без', 'нет',
@@ -26694,9 +26694,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const bodyDelim = bodyClause.delim || '';
if (bodyDelim === '') {
const bodyMasked = bodyClause.maskedText || bodyClause.text || '';
+ // Only a new publication command ends the body: a publish
+ // verb governing a platform. Bare verbs ("We publish
+ // weekly.") are body prose, not a new destination.
if (SOCIAL_PUBLISH_VERBS.test(bodyMasked)
- && anyPlatformPattern.test(bodyMasked)
- && !platformPattern.test(bodyMasked)) break;
+ && anyPlatformPattern.test(bodyMasked)) break;
scoped += `\n${bodyClause.text}`;
continue;
}
@@ -26706,7 +26708,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (SOCIAL_COORDINATING_DELIMITER.test(bodyDelim)
&& anyPlatformPattern.test(bodyMasked)
&& (SOCIAL_PUBLISH_VERBS.test(bodyMasked) || hasQuotedPayload(bodyClause.text))) break;
- if (SOCIAL_PUBLISH_VERBS.test(bodyMasked)) break;
+ if (SOCIAL_PUBLISH_VERBS.test(bodyMasked) && anyPlatformPattern.test(bodyMasked)) break;
if (/^[.!?;:,、,。;:]$/.test(bodyDelim)) scoped += `${bodyDelim}${bodyClause.text}`;
else scoped += ` ${bodyDelim}${bodyClause.text}`;
}
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index a47a631ce..78cfbf33e 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', 'together', 'along', 'between', 'from', 'to',
+ 'and', 'but', 'or', 'either', 'neither', 'nor', 'plus', 'also', 'as', 'well', 'together', 'along', 'addition', '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', 'без', 'нет',
@@ -24301,9 +24301,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const bodyDelim = bodyClause.delim || '';
if (bodyDelim === '') {
const bodyMasked = bodyClause.maskedText || bodyClause.text || '';
+ // Only a new publication command ends the body: a publish
+ // verb governing a platform. Bare verbs ("We publish
+ // weekly.") are body prose, not a new destination.
if (SOCIAL_PUBLISH_VERBS.test(bodyMasked)
- && anyPlatformPattern.test(bodyMasked)
- && !platformPattern.test(bodyMasked)) break;
+ && anyPlatformPattern.test(bodyMasked)) break;
scoped += `\n${bodyClause.text}`;
continue;
}
@@ -24313,7 +24315,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
if (SOCIAL_COORDINATING_DELIMITER.test(bodyDelim)
&& anyPlatformPattern.test(bodyMasked)
&& (SOCIAL_PUBLISH_VERBS.test(bodyMasked) || hasQuotedPayload(bodyClause.text))) break;
- if (SOCIAL_PUBLISH_VERBS.test(bodyMasked)) break;
+ if (SOCIAL_PUBLISH_VERBS.test(bodyMasked) && anyPlatformPattern.test(bodyMasked)) break;
if (/^[.!?;:,、,。;:]$/.test(bodyDelim)) scoped += `${bodyDelim}${bodyClause.text}`;
else scoped += ` ${bodyDelim}${bodyClause.text}`;
}
diff --git a/test/run.js b/test/run.js
index be17e1363..588666b06 100644
--- a/test/run.js
+++ b/test/run.js
@@ -91174,6 +91174,8 @@ test('social destination rebinding refreshes platform-specific payload and uploa
AgentClass.name + ': body continuation line after inline colon text was lost');
assert.equal(agent._extractWorkflowTaskBody('Post on X: hello, world', '', 'twitter'), 'hello, world',
AgentClass.name + ': comma-delimited body text after the colon was lost');
+ assert.equal(agent._extractWorkflowTaskBody('Post on X: Hello. We publish weekly.', '', 'twitter'), 'Hello. We publish weekly.',
+ AgentClass.name + ': body sentence with a bare publish verb was cut off');
assert.equal(guard.workflowMetadataRequirementsResolved, true);
assert.deepEqual(guard.workflowSocialUploadEvidence, [],
AgentClass.name + ': X upload provenance leaked into the Bluesky binding');
@@ -93223,6 +93225,11 @@ test('upper-bound attachment qualifiers verify as maximum counts', () => {
assert.equal(agent._workflowSocialPublishedAttachmentObserved(
{ value: 'one image along with one video' }, { attachments: [image(1), video(1)] }), true,
AgentClass.name + ': one image along with one video was rejected');
+ assert.equal(agent._parseWorkflowAttachmentRequirement('one image in addition to one video').isGeneric, true,
+ AgentClass.name + ': in-addition-to conjunction was parsed as a filename');
+ assert.equal(agent._workflowSocialPublishedAttachmentObserved(
+ { value: 'one image in addition to one video' }, { attachments: [image(1), video(1)] }), true,
+ AgentClass.name + ': one image in addition to 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');