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
Recover route-local X DM body commands
Emre Sokullue5f5fc068688
diff --git a/docs/social-publication-contract.md b/docs/social-publication-contract.mdindex 8852263bc..18ce912e3 100644--- a/docs/social-publication-contract.md+++ b/docs/social-publication-contract.md@@ -59,4 +59,4 @@ The config accepts the existing provider fields (`providerName`, `baseUrl`, `modCalls run sequentially. Reports distinguish first-response validity, repairs, semantic contract errors, audit false accepts/rejects, token usage, and median/p95 latency. First-call latency is reported separately without assuming a cold server. Default results are ignored local artifacts under `test/llm/results-social-publication/`, with a Markdown report, per-case JSONL, and prompt/fixture hashes. The runner never invokes a browser action or publishes a post.-X direct messages use their own message workflow, not the public publication contract. On `/i/chat/<conversation>`, the conversation header binds the recipient. An exact display-name or bare-username match resolves to that header's canonical handle during planning or before dispatch; subsequent verification requires the same handle, never a replacement account with the same display name. A send binds the exact body and the identities of all mounted message rows, including hidden and pending ones. An explicitly supplied body is required by the message-field classifier and is recovered from the approved task when a classifier response omits it. Completion requires a new matching outgoing row after the prior conversation tail with `data-send-status="sent"`, an empty composer, and the same conversation. The open X chat composer does not override that delivery evidence; other adapters retain their dialog checks. Workflow field requirements are loaded even when repeated-item tracking is disabled. Incoming, pending, failed, or pre-existing messages cannot satisfy it.+X direct messages use their own message workflow, not the public publication contract. On `/i/chat/<conversation>`, the conversation header binds the recipient. An exact display-name or bare-username match resolves to that header's canonical handle during planning or before dispatch; subsequent verification requires the same handle, never a replacement account with the same display name. A send binds the exact body and the identities of all mounted message rows, including hidden and pending ones. An explicitly supplied body is required by the message-field classifier and is recovered from the approved task when a classifier response omits it, including route-local commands such as `Send Alex: Hello there`. Completion requires a new matching outgoing row after the prior conversation tail with `data-send-status="sent"`, an empty composer, and the same conversation. The open X chat composer does not override that delivery evidence; other adapters retain their dialog checks. Workflow field requirements are loaded even when repeated-item tracking is disabled. Incoming, pending, failed, or pre-existing messages cannot satisfy it.diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 9af61b8e6..fad5557ca 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -28235,7 +28235,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d? scopedCandidates: (sawNamedSocialPlatform ? [] : rawCandidates);let bestBody = '';- const publishVerbPattern = `(?:${SOCIAL_PUBLISH_VERBS.source}|message|update)`;+ // A direct-message task can omit the platform when the active workflow+ // already binds the X conversation ("Send Alex: Hello there"). Treat+ // that imperative like the existing message/publish forms so an explicit+ // body remains subject to the same exact dispatch verification.+ const publishVerbPattern = `(?:${SOCIAL_PUBLISH_VERBS.source}|message|send|update)`;const quotedPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:β([\\s\\S]+?)β|γ([\\s\\S]+?)γ|γ([\\s\\S]+?)γ|Β«([\\s\\S]+?)Β»|"([\\s\\S]+?)")`, 'iu');const singleQuotePattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:(?<!\\p{L})'([\\s\\S]+?)'(?!\\p{L}))`, 'iu');const colonPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?<!https?|ftp|sftp)(?:(?<!\\d)[:οΌ]|[:οΌ](?!\\d{2}))(?!\\/\\/)\\s*([\\s\\S]+)$`, 'iu');diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex 7bba34188..8503f3fe6 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -25849,7 +25849,11 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d? scopedCandidates: (sawNamedSocialPlatform ? [] : rawCandidates);let bestBody = '';- const publishVerbPattern = `(?:${SOCIAL_PUBLISH_VERBS.source}|message|update)`;+ // A direct-message task can omit the platform when the active workflow+ // already binds the X conversation ("Send Alex: Hello there"). Treat+ // that imperative like the existing message/publish forms so an explicit+ // body remains subject to the same exact dispatch verification.+ const publishVerbPattern = `(?:${SOCIAL_PUBLISH_VERBS.source}|message|send|update)`;const quotedPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:β([\\s\\S]+?)β|γ([\\s\\S]+?)γ|γ([\\s\\S]+?)γ|Β«([\\s\\S]+?)Β»|"([\\s\\S]+?)")`, 'iu');const singleQuotePattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?:(?<!\\p{L})'([\\s\\S]+?)'(?!\\p{L}))`, 'iu');const colonPattern = new RegExp(`${publishVerbPattern}[\\s\\S]*?(?<!https?|ftp|sftp)(?:(?<!\\d)[:οΌ]|[:οΌ](?!\\d{2}))(?!\\/\\/)\\s*([\\s\\S]+)$`, 'iu');diff --git a/test/run.js b/test/run.jsindex a0107e319..c7c2ab388 100644--- a/test/run.js+++ b/test/run.js@@ -93887,7 +93887,9 @@ test('publication workflows classify and bind requested payload fields', async (const xTabId = 8987 + index;const xUrl = 'https://x.com/i/chat/123-456';- const xTask = 'Send Alex this exact message on X: "The release is ready."';+ // The active X route supplies the platform. The task itself can be the+ // concise direct-message command users naturally write.+ const xTask = 'Send Alex: Hello there';const xWorkflow = agent._resolvePlannerSiteWorkflow(xUrl, {request_kind: 'execute',requires_submission: true,@@ -93922,8 +93924,10 @@ test('publication workflows classify and bind requested payload fields', async (});assert.match(xPrompt, /siteContext\.workflow\.template="message"/,`${AgentClass.name}: the classifier did not require direct-message fields`);+ assert.equal(agent._extractWorkflowTaskBody(xTask, '', 'twitter'), 'Hello there',+ `${AgentClass.name}: a route-local Send command did not recover its explicit X DM body`);assert.deepEqual(xGuard.workflowMetadataRequirements, [- { field: 'body', value: 'The release is ready.' },+ { field: 'body', value: 'Hello there' },], `${AgentClass.name}: an explicit X DM body was not bound after an empty classifier response`);const xTerminal = (body) => {const workflowBinding = agent._workflowSubmitBindingForAttempt(xTabId, xUrl, {@@ -93949,7 +93953,7 @@ test('publication workflows classify and bind requested payload fields', async (};assert.equal(xTerminal('Changed message'), null,`${AgentClass.name}: a sent X DM drifted from the approved body`);- assert.equal(xTerminal('The release is ready.')?.verificationKind, 'message_sent',+ assert.equal(xTerminal('Hello there')?.verificationKind, 'message_sent',`${AgentClass.name}: the approved X DM body could not complete`);}});