Skip to content

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

fix(agent): include multilingual conjunctions in coordinated publication target scans

Emre Sokullu5101cbf5b24d
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index a35bba395..2d3edb93a 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -245,7 +245,7 @@ const SOCIAL_NOUN_LIKE_PUBLISH = new RegExp(
'iu',
);
const SOCIAL_NEGATION = new RegExp(
- `(?<![${SOCIAL_WORD_EDGE}])(?:not|never|neither|nor|don't|dont|do\\s+not|cannot|can't|cant|shouldn't|shouldnt|should\\s+not|mustn't|mustnt|must\\s+not|won't|wont|will\\s+not|avoid|refrain|stop|prevent|prohibit|no(?=\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|doubt|worries|hashtags?|tags?|links?|urls?\\b))|without(?=(?:\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|hesitation|doubt|fail|exception|interruption|warning|stopping|pause|regret|fear|hashtags?|tags?|links?|urls?\\b)|\\s*$))|sans(?=(?:\\s+(?!pièces?|photos?|images?|vidéos?|fichiers?|médias?|délai|doutes?|faute|retard\\b)|\\s*$))|sin(?=(?:\\s+(?!archivos?|adjuntos?|fotos?|imágenes?|videos?|medios?|demora|duda|falta|retraso\\b)|\\s*$))|sem(?=(?:\\s+(?!anexos?|fotos?|imagens?|vídeos?|arquivos?|mídia|demora|dúvida|falta|atraso\\b)|\\s*$))|senza(?=(?:\\s+(?!allegati?|foto|immagini?|video|file|media|ritardo|dubbio\\b)|\\s*$))|ohne(?=(?:\\s+(?!anhänge?|anhang|fotos?|bilder?|videos?|dateien?|medien?|verzögerung|zweifel\\b)|\\s*$))|без(?=(?:\\s+(?!вложений|вложения|фото|изображений|видео|файлов|задержки|сомнений\\b)|\\s*$))|ne|pas|ne\\s+pas|nunca|jamás|jamais|nicht|nie|kein|keine|non|mai|não|nao|hayır|asla|sakın|yapmayın|yapma|не|никогда|нет)(?![${SOCIAL_WORD_EDGE}])`
+ `(?<![${SOCIAL_WORD_EDGE}])(?:not|never|neither|nor|don't|dont|do\\s+not|cannot|can't|cant|shouldn't|shouldnt|should\\s+not|mustn't|mustnt|must\\s+not|won't|wont|will\\s+not|avoid|refrain|stop|prevent|prohibit|no(?=\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|doubt|worries|hashtags?|tags?|links?|urls?|x\\b|twitter\\b|bluesky\\b))|without(?=(?:\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|hesitation|doubt|fail|exception|interruption|warning|stopping|pause|regret|fear|hashtags?|tags?|links?|urls?\\b)|\\s*$))|sans(?=(?:\\s+(?!pièces?|photos?|images?|vidéos?|fichiers?|médias?|délai|doutes?|faute|retard\\b)|\\s*$))|sin(?=(?:\\s+(?!archivos?|adjuntos?|fotos?|imágenes?|videos?|medios?|demora|duda|falta|retraso\\b)|\\s*$))|sem(?=(?:\\s+(?!anexos?|fotos?|imagens?|vídeos?|arquivos?|mídia|demora|dúvida|falta|atraso\\b)|\\s*$))|senza(?=(?:\\s+(?!allegati?|foto|immagini?|video|file|media|ritardo|dubbio\\b)|\\s*$))|ohne(?=(?:\\s+(?!anhänge?|anhang|fotos?|bilder?|videos?|dateien?|medien?|verzögerung|zweifel\\b)|\\s*$))|без(?=(?:\\s+(?!вложений|вложения|фото|изображений|видео|файлов|задержки|сомнений\\b)|\\s*$))|ne|pas|ne\\s+pas|nunca|jamás|jamais|nicht|nie|kein|keine|non|mai|não|nao|hayır|asla|sakın|yapmayın|yapma|не|никогда|нет)(?![${SOCIAL_WORD_EDGE}])`
+ '|不要|别|不能|不可|不得|不用|请勿|勿|严禁|禁止|决不|绝不|決して'
+ '|하지\\s*마|하지\\s*마세요|금지',
'iu',
@@ -255,15 +255,15 @@ const SOCIAL_POST_NEGATION = new RegExp(
'iu',
);
const SOCIAL_CLAUSE_DELIMITER = new RegExp(
- `([.!?;:\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。|,)`,
+ `([.!?;:\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|e|ed|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。|,)`,
'iu',
);
const SOCIAL_COORDINATING_DELIMITER = new RegExp(
- `^(?:or|nor|and|neither|o|ou|oder|ni|nem|né|veya|ya\\s+da|или|ни|或|或者|または|もしくは|や|또는|이나|거나)$`,
+ `^(?:or|nor|and|neither|y|e|ed|et|und|ve|и|o|u|ou|oder|weder|noch|od|ni|nem|né|veya|ya\\s+da|или|ни|或|或者|和|与|與|及|以及|また|または|もしくは|や|と|および|及び|ならびに|並びに|또는|이나|거나|그리고|와|과)$`,
'iu',
);
const SOCIAL_CLAUSE_BREAK = new RegExp(
- `[.!?;:,\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。`,
+ `[.!?;:,\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|e|ed|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。`,
'iu',
);
@@ -15398,7 +15398,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
for (let bIdx = beforeClauses.length - 2; bIdx >= 0; bIdx--) {
const nextB = beforeClauses[bIdx + 1];
const isCoord = SOCIAL_COORDINATING_DELIMITER.test(nextB.delim || '')
- || (nextB.delim || '').trim() === ',';
+ || (nextB.delim || '').trim() === ','
+ || (nextB.delim || '').trim() === '、';
if (!isCoord) break;
const bClause = beforeClauses[bIdx];
if (bClause.isNegated) break;
@@ -15464,7 +15465,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const nextClause = clauses[nextIdx];
if (nextClause.isNegated) break;
const isCoord = SOCIAL_COORDINATING_DELIMITER.test(nextClause.delim || '')
- || (nextClause.delim || '').trim() === ',';
+ || (nextClause.delim || '').trim() === ','
+ || (nextClause.delim || '').trim() === '、';
if (!isCoord) break;
const nextTargetText = nextClause.maskedText || nextClause.text;
if (SOCIAL_READ_VERBS.test(nextTargetText)) break;
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 9b7b89242..171b73bfa 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -178,7 +178,7 @@ const SOCIAL_NOUN_LIKE_PUBLISH = new RegExp(
'iu',
);
const SOCIAL_NEGATION = new RegExp(
- `(?<![${SOCIAL_WORD_EDGE}])(?:not|never|neither|nor|don't|dont|do\\s+not|cannot|can't|cant|shouldn't|shouldnt|should\\s+not|mustn't|mustnt|must\\s+not|won't|wont|will\\s+not|avoid|refrain|stop|prevent|prohibit|no(?=\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|doubt|worries|hashtags?|tags?|links?|urls?\\b))|without(?=(?:\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|hesitation|doubt|fail|exception|interruption|warning|stopping|pause|regret|fear|hashtags?|tags?|links?|urls?\\b)|\\s*$))|sans(?=(?:\\s+(?!pièces?|photos?|images?|vidéos?|fichiers?|médias?|délai|doutes?|faute|retard\\b)|\\s*$))|sin(?=(?:\\s+(?!archivos?|adjuntos?|fotos?|imágenes?|videos?|medios?|demora|duda|falta|retraso\\b)|\\s*$))|sem(?=(?:\\s+(?!anexos?|fotos?|imagens?|vídeos?|arquivos?|mídia|demora|dúvida|falta|atraso\\b)|\\s*$))|senza(?=(?:\\s+(?!allegati?|foto|immagini?|video|file|media|ritardo|dubbio\\b)|\\s*$))|ohne(?=(?:\\s+(?!anhänge?|anhang|fotos?|bilder?|videos?|dateien?|medien?|verzögerung|zweifel\\b)|\\s*$))|без(?=(?:\\s+(?!вложений|вложения|фото|изображений|видео|файлов|задержки|сомнений\\b)|\\s*$))|ne|pas|ne\\s+pas|nunca|jamás|jamais|nicht|nie|kein|keine|non|mai|não|nao|hayır|asla|sakın|yapmayın|yapma|не|никогда|нет)(?![${SOCIAL_WORD_EDGE}])`
+ `(?<![${SOCIAL_WORD_EDGE}])(?:not|never|neither|nor|don't|dont|do\\s+not|cannot|can't|cant|shouldn't|shouldnt|should\\s+not|mustn't|mustnt|must\\s+not|won't|wont|will\\s+not|avoid|refrain|stop|prevent|prohibit|no(?=\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|doubt|worries|hashtags?|tags?|links?|urls?|x\\b|twitter\\b|bluesky\\b))|without(?=(?:\\s+(?!attachments?|photos?|images?|pictures?|videos?|files?|media|delays?|hesitation|doubt|fail|exception|interruption|warning|stopping|pause|regret|fear|hashtags?|tags?|links?|urls?\\b)|\\s*$))|sans(?=(?:\\s+(?!pièces?|photos?|images?|vidéos?|fichiers?|médias?|délai|doutes?|faute|retard\\b)|\\s*$))|sin(?=(?:\\s+(?!archivos?|adjuntos?|fotos?|imágenes?|videos?|medios?|demora|duda|falta|retraso\\b)|\\s*$))|sem(?=(?:\\s+(?!anexos?|fotos?|imagens?|vídeos?|arquivos?|mídia|demora|dúvida|falta|atraso\\b)|\\s*$))|senza(?=(?:\\s+(?!allegati?|foto|immagini?|video|file|media|ritardo|dubbio\\b)|\\s*$))|ohne(?=(?:\\s+(?!anhänge?|anhang|fotos?|bilder?|videos?|dateien?|medien?|verzögerung|zweifel\\b)|\\s*$))|без(?=(?:\\s+(?!вложений|вложения|фото|изображений|видео|файлов|задержки|сомнений\\b)|\\s*$))|ne|pas|ne\\s+pas|nunca|jamás|jamais|nicht|nie|kein|keine|non|mai|não|nao|hayır|asla|sakın|yapmayın|yapma|не|никогда|нет)(?![${SOCIAL_WORD_EDGE}])`
+ '|不要|别|不能|不可|不得|不用|请勿|勿|严禁|禁止|决不|绝不|決して'
+ '|하지\\s*마|하지\\s*마세요|금지',
'iu',
@@ -188,15 +188,15 @@ const SOCIAL_POST_NEGATION = new RegExp(
'iu',
);
const SOCIAL_CLAUSE_DELIMITER = new RegExp(
- `([.!?;:\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。|,)`,
+ `([.!?;:\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|e|ed|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。|,)`,
'iu',
);
const SOCIAL_COORDINATING_DELIMITER = new RegExp(
- `^(?:or|nor|and|neither|o|ou|oder|ni|nem|né|veya|ya\\s+da|или|ни|或|或者|または|もしくは|や|또는|이나|거나)$`,
+ `^(?:or|nor|and|neither|y|e|ed|et|und|ve|и|o|u|ou|oder|weder|noch|od|ni|nem|né|veya|ya\\s+da|или|ни|或|或者|和|与|與|及|以及|また|または|もしくは|や|と|および|及び|ならびに|並びに|또는|이나|거나|그리고|와|과)$`,
'iu',
);
const SOCIAL_CLAUSE_BREAK = new RegExp(
- `[.!?;:,\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。`,
+ `[.!?;:,\\n]|(?<![${SOCIAL_WORD_EDGE}])(?:and|then|but|or|nor|after|before|y|e|ed|luego|puis|et|ensuite|und|dann|poi|sonra|ve|затем|и)(?![${SOCIAL_WORD_EDGE}])|然后|然後|接着|そして|それから|または|、|。`,
'iu',
);
@@ -13198,7 +13198,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
for (let bIdx = beforeClauses.length - 2; bIdx >= 0; bIdx--) {
const nextB = beforeClauses[bIdx + 1];
const isCoord = SOCIAL_COORDINATING_DELIMITER.test(nextB.delim || '')
- || (nextB.delim || '').trim() === ',';
+ || (nextB.delim || '').trim() === ','
+ || (nextB.delim || '').trim() === '、';
if (!isCoord) break;
const bClause = beforeClauses[bIdx];
if (bClause.isNegated) break;
@@ -13264,7 +13265,8 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
const nextClause = clauses[nextIdx];
if (nextClause.isNegated) break;
const isCoord = SOCIAL_COORDINATING_DELIMITER.test(nextClause.delim || '')
- || (nextClause.delim || '').trim() === ',';
+ || (nextClause.delim || '').trim() === ','
+ || (nextClause.delim || '').trim() === '、';
if (!isCoord) break;
const nextTargetText = nextClause.maskedText || nextClause.text;
if (SOCIAL_READ_VERBS.test(nextTargetText)) break;
diff --git a/test/run.js b/test/run.js
index 717b4d3f4..db797a276 100644
--- a/test/run.js
+++ b/test/run.js
@@ -86410,6 +86410,30 @@ test('social publication workflow follows the live X or Bluesky destination and
'payload conjunction and before explicit social URL split command and destination into separate clauses'],
['Post research, development, and marketing news on X', ['twitter'],
'multiple payload conjunctions and commas before on X split command and destination into separate clauses'],
+ ['Publica noticias de investigación y desarrollo en X', ['twitter'],
+ 'Spanish payload conjunction y before en X was not recognized in coordinated clause scan'],
+ ['Publica noticias de investigación e innovación en X', ['twitter'],
+ 'Spanish payload conjunction e before en X was not recognized in coordinated clause scan'],
+ ['Publica noticias de investigación y desarrollo en https://x.com/home', ['twitter'],
+ 'Spanish payload conjunction y before explicit social URL was not recognized in coordinated clause scan'],
+ ['Publie des nouvelles de recherche et développement sur X', ['twitter'],
+ 'French payload conjunction et before sur X was not recognized in coordinated clause scan'],
+ ['Publie des nouvelles de recherche et développement sur https://x.com/home', ['twitter'],
+ 'French payload conjunction et before explicit social URL was not recognized in coordinated clause scan'],
+ ['Veröffentliche Neuigkeiten zu Forschung und Entwicklung auf X', ['twitter'],
+ 'German payload conjunction und before auf X was not recognized in coordinated clause scan'],
+ ['Veröffentliche Neuigkeiten zu Forschung und Entwicklung auf https://x.com/home', ['twitter'],
+ 'German payload conjunction und before explicit social URL was not recognized in coordinated clause scan'],
+ ['Publique notícias de pesquisa e desenvolvimento no X', ['twitter'],
+ 'Portuguese payload conjunction e before no X was not recognized in coordinated clause scan'],
+ ['Publique notícias de pesquisa e desenvolvimento em https://x.com/home', ['twitter'],
+ 'Portuguese payload conjunction e before explicit social URL was not recognized in coordinated clause scan'],
+ ['Não publique notícias de pesquisa e desenvolvimento no X', [],
+ 'negated Portuguese coordinated command was wrongly treated as a publish destination'],
+ ['Опубликуй новости о научных исследованиях и разработках в X', ['twitter'],
+ 'Russian payload conjunction и before в X was not recognized in coordinated clause scan'],
+ ['Опубликуй новости о научных исследованиях и разработках на https://x.com/home', ['twitter'],
+ 'Russian payload conjunction и before explicit social URL was not recognized in coordinated clause scan'],
]) {
assert.deepEqual(
[...agent._trustedSocialPublishTargetAdapters({ taskText })],