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
merge main and retain page feedback steering
Barack Sokullufba5ae026aa9
diff --cc src/chrome/src/agent/agent.jsindex 391cae9e1,6cc04ce0c..aa5659780--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@@ -12255,11 -12443,10 +12451,11 @@@ Rules: no prose intro, no conclusion, nreturn { action: 'abort', value };}-- if (this._hasPendingSteering(tabId)) {++ if (this._hasPendingSteering(tabId) || this._hasPendingPageFeedback(tabId)) {this._appendSyntheticToolResults(tabId, toolCalls, toolIndex, messages, onUpdate, step, () => ({success: false, skipped: true, dispatched: false, noDispatch: true,- error: 'Skipped because the user steered the current task. Reconsider the remaining actions using the latest user message.',+ pageFeedbackPending: this._hasPendingPageFeedback(tabId),+ error: 'Skipped because the user steered the current task or the browser changed. Reconsider remaining actions using the latest feedback.',}));return { action: 'continue' };}@@@ -13308,7 -13496,7 +13505,7 @@@this._throwIfAborted(abortSignal);// Permission, checkpoint and preflight waits can receive a correction.// Recheck after all preparation, before marking or invoking dispatch.-- if (this._hasPendingSteering(tabId)) return { steered: true };++ if (this._hasPendingSteering(tabId) || this._hasPendingPageFeedback(tabId)) return { steered: true };if (!pipelineToolbarPreflight.block && !socialDispatchBlock) callState.invoked = true;const pipelineRawToolResult = pipelineToolbarPreflight.block || socialDispatchBlock || await this.executeTool(tabId,@@@ -43414,7 -43689,7 +43757,8 @@@ If the user has already named or confirsteps++;lastTraceStep = steps;- await this._applyPendingRunFeedback(tabId, messages, onUpdate);++ await this._applyPendingPageFeedback(tabId, messages, onUpdate);+ if (this._hasPendingSteering(tabId)) { steps--; continue; }onUpdate('thinking', { step: steps });if (runId) trace.recordStepStart(runId, steps, {});@@@ -43611,7 -43886,7 +43955,8 @@@break;}- if (steps < this.maxSteps && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {- if (this._applyPendingSteering(tabId, messages, onUpdate)) {++ if ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate)) {onUpdate('text', { content: '', replace: true });continue;}@@@ -43715,8 -43990,8 +44060,9 @@@const batchResult = await this._executeToolBatch(tabId, result.toolCalls, messages, onUpdate, provider, assistantToolContent, allowedToolNames, steps, runOptions, toolSchemas);- if (['continue', 'return'].includes(batchResult.action) && !batchResult.status && steps < this.maxSteps- && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {+ if (['continue', 'return'].includes(batchResult.action) && !batchResult.status- && this._applyPendingSteering(tabId, messages, onUpdate)) {++ && ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate))) {onUpdate('text', { content: '', replace: true });continue;}@@@ -44583,7 -44890,7 +44961,8 @@@steps++;lastTraceStep = steps;- if (await this._applyPendingRunFeedback(tabId, messages, onUpdate)) pendingVisionFallbackMessages = null;++ if (await this._applyPendingPageFeedback(tabId, messages, onUpdate)) pendingVisionFallbackMessages = null;+ if (this._hasPendingSteering(tabId)) { steps--; continue; }onUpdate('thinking', { step: steps });if (runId) trace.recordStepStart(runId, steps, {});let traceStepClosed = false;@@@ -44731,7 -45038,7 +45110,8 @@@toolCalls: streamedToolCalls,}));- if (steps < this.maxSteps && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {- if (this._applyPendingSteering(tabId, messages, onUpdate)) {++ if ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate)) {onUpdate('text', { content: '', replace: true });continue;}@@@ -44821,8 -45128,8 +45201,9 @@@const batchResult = await this._executeToolBatch(tabId, toolCalls, messages, onUpdate, provider, fullText, allowedToolNames, steps, runOptions, toolSchemas);- if (['continue', 'return'].includes(batchResult.action) && !batchResult.status && steps < this.maxSteps- && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {+ if (['continue', 'return'].includes(batchResult.action) && !batchResult.status- && this._applyPendingSteering(tabId, messages, onUpdate)) {++ && ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate))) {onUpdate('text', { content: '', replace: true });continue;}diff --cc src/firefox/src/agent/agent.jsindex 3b69c621a,90b8e2366..15838c504--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@@ -10948,11 -11136,10 +11144,11 @@@ Rules: no prose intro, no conclusion, nonUpdate('warning', { message: 'Stopped by user.' });return { action: 'abort', value };}-- if (this._hasPendingSteering(tabId)) {++ if (this._hasPendingSteering(tabId) || this._hasPendingPageFeedback(tabId)) {this._appendSyntheticToolResults(tabId, toolCalls, toolIndex, messages, onUpdate, step, () => ({success: false, skipped: true, dispatched: false, noDispatch: true,- error: 'Skipped because the user steered the current task. Reconsider the remaining actions using the latest user message.',+ pageFeedbackPending: this._hasPendingPageFeedback(tabId),+ error: 'Skipped because the user steered the current task or the browser changed. Reconsider remaining actions using the latest feedback.',}));return { action: 'continue' };}@@@ -11924,7 -12112,7 +12121,7 @@@this._throwIfAborted(abortSignal);// Permission, checkpoint and preflight waits can receive a correction.// Recheck after all preparation, before marking or invoking dispatch.-- if (this._hasPendingSteering(tabId)) return { steered: true };++ if (this._hasPendingSteering(tabId) || this._hasPendingPageFeedback(tabId)) return { steered: true };if (!pipelineToolbarPreflight.block && !socialDispatchBlock) callState.invoked = true;const pipelineRawToolResult = pipelineToolbarPreflight.block || socialDispatchBlock || await this.executeTool(tabId,@@@ -36360,7 -36637,7 +36703,8 @@@steps++;lastTraceStep = steps;- await this._applyPendingRunFeedback(tabId, messages, onUpdate);++ await this._applyPendingPageFeedback(tabId, messages, onUpdate);+ if (this._hasPendingSteering(tabId)) { steps--; continue; }onUpdate('thinking', { step: steps });if (runId) trace.recordStepStart(runId, steps, {});@@@ -36536,7 -36813,7 +36880,8 @@@break;}- if (steps < this.maxSteps && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {- if (this._applyPendingSteering(tabId, messages, onUpdate)) {++ if ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate)) {onUpdate('text', { content: '', replace: true });continue;}@@@ -36592,8 -36869,8 +36937,9 @@@const batchResult = await this._executeToolBatch(tabId, result.toolCalls, messages, onUpdate, provider, assistantToolContent, allowedToolNames, steps, runOptions, toolSchemas);- if (['continue', 'return'].includes(batchResult.action) && !batchResult.status && steps < this.maxSteps- && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {+ if (['continue', 'return'].includes(batchResult.action) && !batchResult.status- && this._applyPendingSteering(tabId, messages, onUpdate)) {++ && ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate))) {onUpdate('text', { content: '', replace: true });continue;}@@@ -37362,7 -37671,7 +37740,8 @@@steps++;lastTraceStep = steps;- await this._applyPendingRunFeedback(tabId, messages, onUpdate);++ await this._applyPendingPageFeedback(tabId, messages, onUpdate);+ if (this._hasPendingSteering(tabId)) { steps--; continue; }onUpdate('thinking', { step: steps });if (runId) trace.recordStepStart(runId, steps, {});let traceStepClosed = false;@@@ -37507,7 -37816,7 +37886,8 @@@toolCalls: streamedToolCalls,}));- if (steps < this.maxSteps && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {- if (this._applyPendingSteering(tabId, messages, onUpdate)) {++ if ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate)) {onUpdate('text', { content: '', replace: true });continue;}@@@ -37550,8 -37859,8 +37930,9 @@@const batchResult = await this._executeToolBatch(tabId, toolCalls, messages, onUpdate, provider, fullText, allowedToolNames, steps, runOptions, toolSchemas);- if (['continue', 'return'].includes(batchResult.action) && !batchResult.status && steps < this.maxSteps- && await this._applyPendingRunFeedback(tabId, messages, onUpdate)) {- if (['continue', 'return'].includes(batchResult.action) && !batchResult.status- && this._applyPendingSteering(tabId, messages, onUpdate)) {++ if (['continue', 'return'].includes(batchResult.action) && !batchResult.status++ && ((steps < this.maxSteps && await this._applyPendingPageFeedback(tabId, messages, onUpdate))++ || this._applyPendingSteering(tabId, messages, onUpdate))) {onUpdate('text', { content: '', replace: true });continue;}