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
Placeholder guard: scope supplied values to the task, bind receipts to fields
Claude21d6efae30d6
diff --git a/docs/security-model.md b/docs/security-model.mdindex db0dc4f9f..bca4f4aa5 100644--- a/docs/security-model.md+++ b/docs/security-model.md@@ -223,7 +223,7 @@ The primary threat: a malicious page crafts content that, when read by the agent| **`done()` verification** | Decision and tool-free LLM checks prefer vision, then AX. Confident pending/failed outcomes require read-only recovery before another submission. Accepted task-bound proof can satisfy generic evidence despite an unrelated comment form, while explicit recipient, payment, download, authorization and workflow contracts remain required. Existing dialog/form checks are the final fallback. || **Grouped search approval** | A same-site GET form with no credential, payment or hidden token field, and no side-effect action address, shares one task-scoped approval for its navigation, typing and submit when the page's structure marks it as a search: a search landmark, a search-typed field or one whose keyboard says search, code names such as `q` or `query`, a search address, or a submit control a model read, in any language, as only searching or filtering. Words in a field's visible label decide nothing. Every other form keeps its fresh confirmation. || **Duplicate-submit guard** | A second text click on the same caption within 45 seconds on the same tab and URL is blocked when a model read the caption, in any language, as committing something (sending, saving, paying, publishing, creating, confirming and so on). A caption read as anything else, or that could not be read, stays repeatable; app-observed popups, links, fields and draft tools are always repeatable. Both builds. |-| **Placeholder-value guard** | A form submission whose edited field still holds that field's own placeholder text, the page's example such as `[email protected]` in an email box, is not sent and gets no card unless the user supplied that value: as a whole answer on a card, or, for a value with a digit or symbol, written as a whole in their message. A plain word the request only names ("sign me up for email updates" beside a placeholder `Email`) does not supply it. A field counts as edited when the submit probe sees it differ from its default or WebBrain's own write put the value there in this run. This holds with confirmations off and in scheduled runs too. The probe checks every field of the form, not only the eight its summary shows, and never reports a password. The model is told to ask the user for the value. A placeholder without a letter or shorter than three characters (a `1` in a quantity box) does not count, and grouped searches keep their approval. Both builds. |+| **Placeholder-value guard** | A form submission whose edited field still holds that field's own placeholder text, the page's example such as `[email protected]` in an email box, is not sent and gets no card unless the user supplied that value for the current task: as a whole answer on one of its cards, or, for a value with a digit or symbol, written as a whole in its messages. An earlier, unrelated turn does not count. A plain word the request only names ("sign me up for email updates" beside a placeholder `Email`) does not supply it. A field counts as edited when the submit probe sees it differ from its default or WebBrain's own write put the value into that same field (by its ref, or its name and id) in this run. This holds with confirmations off and in scheduled runs too. The probe checks every field of the form, not only the eight its summary shows, and never reports a password. The model is told to ask the user for the value. A placeholder without a letter or shorter than three characters (a `1` in a quantity box) does not count, and grouped searches keep their approval. Both builds. || **CLICK occlusion test** | Before clicking, the resolver calls `elementFromPoint()`. If another element is visually on top, the click is refused. || **Modal-scoped click** | When a dialog is open, text clicks are scoped to that subtree so the agent doesn't click a dimmed background element. || **Universal preamble** | Every system prompt includes guidance on cookie banners and paywalls — two common injection vectors that look like benign page content. |diff --git a/package.json b/package.jsonindex d8be35c9f..d6e70d2a2 100644--- a/package.json+++ b/package.json@@ -100,8 +100,8 @@"test:upload-owner": "node --test test/page-monitor-upload-owner.mjs test/page-monitor-upload-release.mjs","test:shard:quick": "npm run test:cms && npm run test:markdown && npm run test:generative-media && npm run test:systemone && npm run test:systemone:fast && node --test test/guard-policy.mjs test/browser-dialogs.mjs test/capsolver-cloud-broker.mjs test/captcha-providers.mjs test/captcha-weighted-fallback.mjs test/captcha-hcaptcha-providers.mjs test/captcha-native-providers.mjs test/captcha-runtime-policy.mjs test/captcha-callback-bridge.mjs test/captcha-bridge-registration.mjs test/captcha-aws-recovery.mjs test/captcha-documented-contracts.mjs test/huggingface-signup-recovery.mjs test/trace-full-export.mjs test/feedback-traces.mjs && npm run test:firefox-bidi && npm run test:billing-notice && npm run test:compass-quota && npm run test:provider-limits && npm run test:provider-catalog && npm run test:provider-instances:ui && npm run test:settings-pages:ui && npm run test:openrouter-capabilities && npm run test:anthropic && npm run test:browser-batch && npm run test:accessibility-tree-benchmark && npm run test:toolbar-guard && npm run test:cloud-bridge-approval && npm run test:discord && npm run test:pdf-read && npm run test:pdf-selection && npm run test:social-contract && npm run test:safesocial && npm run test:build-unpacked && npm run test:attachment-drop && npm run test:workflow-editor && node --test test/profile-sync-stats.mjs && node --test test/memcode-recall.mjs","test:shard:runtime-unit": "node --test test/skill-download-wait.mjs && node --test test/agent-lifecycle.mjs test/runtime-startup.mjs test/run-ui-scheduled-lifecycle.mjs test/transport-deadlines.mjs test/cdp-worker-restart.mjs test/bot-memory.mjs test/bot-memory-click-guard.mjs test/bot-memory-registries.mjs test/bot-memory-cloud-controller.mjs test/cdp-clear-receipt.mjs test/cdp-field-submit-recovery.mjs test/conversation-persistence.mjs test/context-live-tool-group.mjs test/integration-races.mjs test/watch-completion-checkpoint.mjs test/runtime-model-identity.mjs test/provider-message-privacy.mjs test/runtime-task-authority.mjs test/planner-repair-authority.mjs test/runtime-progress-continuation.mjs test/chat-resume-chain.mjs test/chat-resume-completion.mjs test/native-chat-execution-ledger.mjs test/chat-send-dispatch-result.mjs test/chat-reply-dedup-race.mjs test/memcode-lifecycle.mjs test/runtime-peer-review.mjs test/read-continuation-schema.mjs test/completion-submit-acknowledgement.mjs test/completion-live-status.mjs test/completion-iframe-submit.mjs test/form-validation-alert-readings.mjs test/control-effect-readings.mjs test/guard-reading-carry-over.mjs test/trusted-retry-readings.mjs test/completion-semantic-commit.mjs test/completion-diagnostics.mjs test/mastodon-publication.mjs test/calculator.mjs test/chat-recovery-protocol.mjs test/chat-pending-reconciliation.mjs test/semantic-page-retry.mjs test/pdf-detection.mjs test/runtime-lifecycle.mjs test/collection-read-progress.mjs test/network-lifecycle.mjs test/text-write-cancellation.mjs test/guard-advisory-writes.mjs test/trusted-field-preparation.mjs test/draftjs-text.mjs test/codemirror-text.mjs test/rich-text-frameworks.mjs test/cdp-managed-text-selection.mjs test/firefox-rich-text-readback.mjs test/contenteditable-beforeinput.mjs test/trusted-field-preparation-ownership.mjs test/typing-preparation-geometry.mjs test/chat-steering.mjs test/resource-mutation-guards.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/clarify-timeout-policy.mjs test/guard-ask-cards.mjs test/permission-steering-wakeup.mjs test/pure-calculation-reply.mjs test/pure-calculation-tools.mjs test/page-feedback.mjs test/page-feedback-progress.mjs test/page-feedback-unbindable-target.mjs test/guard-advisory-actions.mjs test/rich-text-preflight-page-change.mjs test/keyboard-receiver-frame.mjs test/ask-response-scope.mjs test/auto-mode.mjs test/model-picker-icon.mjs test/ask-completion-churn.mjs test/page-feedback-policy.mjs test/research-escalation-page-feedback.mjs test/page-feedback-transport-races.mjs test/page-feedback-recovery.mjs test/telegram-read-preparation-agent.mjs test/media-download-agent-handler.mjs test/code-scanning-url-recipient.mjs test/apocalypse-comm-parsing.mjs test/apocalypse-scalar-decoding.mjs test/bitgpu-chat-security.mjs test/social-media-url-upgrades.mjs test/downloaded-file-saved-bytes.mjs test/downloaded-file-local-probe.mjs test/formless-verification-recovery.mjs test/file-upload-accept.mjs test/file-upload-accept-agent.mjs test/workflow-route-generic-completion.mjs test/release-publication-completion.mjs test/workflow-implicit-metadata.mjs test/workflow-field-readings.mjs test/workflow-field-anchors.mjs test/user-turn-kind.mjs test/follow-up-task-context.mjs test/completion-current-execution-evidence.mjs test/video-upload-attachment.mjs test/feedback-automatic-churn.mjs test/feedback-navigation-idle.mjs test/feedback-run-boundaries.mjs test/feedback-ask-viewing.mjs test/lifecycle-terminal-done.mjs test/incomplete-completion-recovery.mjs test/guard-advisory-completion.mjs test/lean-mode.mjs test/prompt-unverified-pages.mjs test/prompt-missing-values.mjs test/lifecycle-planner-digest.mjs test/lifecycle-steering-latency.mjs test/lifecycle-steering-restart.mjs test/lifecycle-vision-fallback.mjs test/delivery-click-locks.mjs test/guards-steering-receipts.mjs test/terminal-user-messages.mjs test/improver-providers.mjs test/improver-providers-agent.mjs test/improver-guards-ledger.mjs test/improver-guards-tools.mjs test/improver-clarify.mjs test/improver-clarify-scheduler.mjs test/improver-misc.mjs test/improver-forms.mjs test/improver-forms-strict-secrets.mjs test/improver-content-press-keys-hint.mjs && npm run test:plan-notifications",- "test:shard:browser-a": "node --test test/captcha-draft-content.mjs test/captcha-challenge-surfaces.mjs && node test/bot-memory-dom.mjs && node test/bot-memory-click-dom.mjs && node test/ui-content-lifecycle.mjs && node --test test/native-telegram-chat.mjs test/native-telegram-recipient.mjs test/telegram-native-baseline.mjs test/telegram-native-latest.mjs test/native-chat-pre-enter-draft.mjs test/chat-draft-dispatch-ownership.mjs test/native-telegram-alias-preparation.mjs test/telegram-read-preparation-content.mjs test/queued-composer-ownership.mjs test/onboarding-provider-ready.mjs test/sidepanel-permission-gate-ui.mjs test/workflow-native-targets.mjs test/native-whatsapp-chat.mjs test/native-chat-context-identity.mjs test/native-whatsapp-contact.mjs test/whatsapp-chat-selection.mjs test/whatsapp-native-bootstrap.mjs test/whatsapp-drawer-identity.mjs test/whatsapp-read-latest.mjs test/whatsapp-read-preparation.mjs test/whatsapp-chat-completion.mjs test/whatsapp-chat-restart.mjs test/chat-goal-lifecycle.mjs test/chat-completion.mjs test/chat-generic-dispatch.mjs test/completion-live-status-browser.mjs test/native-confirmation-visibility.mjs test/native-button-preparation.mjs test/read-continuation-browser.mjs test/iframe-preparation-focus.mjs test/contenteditable-literal.mjs test/native-chat-empty-editor.mjs test/native-chat-trusted-clear.mjs test/chat-steering-ui.mjs test/recipient-confirmation-ui.mjs test/assistant-message-visibility-ui.mjs test/page-monitor-ui.mjs test/x-compose-trusted-typing.mjs test/page-monitor-dialog.mjs test/page-monitor-dialog-native.mjs test/page-monitor-inline-post.mjs test/bluesky-composer-context.mjs test/page-monitor-anchored.mjs test/page-monitor-upload-owner.mjs test/page-monitor-upload-release.mjs test/page-monitor-native-controls.mjs test/page-monitor-native-preparation.mjs test/native-preparation-cold.mjs test/page-monitor-navigation.mjs test/page-monitor-main-owner.mjs test/page-monitor-collateral-controls.mjs test/accessibility-tree-scoped-budget.mjs test/ax-reference-origin.mjs test/page-monitor-decorative-hit.mjs test/social-ui-navigation.mjs test/native-resource-deletion-binding.mjs test/native-mastodon-confirmation.mjs test/dropdown-menu-inventory.mjs test/page-monitor-passive-progress.mjs test/page-monitor-feed-items.mjs test/media-download-binding.mjs test/media-download-capture-integration.mjs test/social-media-downloader-reinjection.mjs test/upload-file-local-state-guidance.mjs test/monitor-intervention-contract.mjs test/monitor-owned-geometry.mjs test/monitor-viewport-remainder.mjs test/monitor-scroll-churn.mjs test/monitor-local-attribution.mjs test/monitor-lifecycle-leaks.mjs test/lifecycle-run-ui.mjs test/lifecycle-menu-prompts-held.mjs test/delivery-cdp-input.mjs test/delivery-click-ax-response-loss.mjs test/delivery-native-button-geometry.mjs test/delivery-hover-transition.mjs test/delivery-native-button-route.mjs test/delivery-dispatch-boundary.mjs test/delivery-stop-compound.mjs test/guards-control-classification.mjs test/guards-unbound-deletion.mjs test/submit-probe-readings.mjs test/placeholder-submit-probe.mjs test/improver-content-account-chrome.mjs test/improver-content-recipient.mjs test/improver-content-truncated-replacement.mjs test/improver-forms-probe.mjs test/improver-misc-trace-browser.mjs test/page-feedback-held-time.mjs test/page-monitor-held-observation.mjs",- "test:shard:browser-b1": "node test/message-recipient-upload.mjs && node test/message-recipient-clarify-binding.mjs && node --test test/message-recipient-whatsapp.mjs test/message-control-readings.mjs && node test/quality/integration-mv3.mjs --full-form && node test/quality/integration-mv3.mjs --batch && node test/quality/literal-calculate-midrun-mv3.mjs && node test/quality/ask-completion-churn-mv3.mjs && node test/quality/ask-person-activity-mv3.mjs && node test/quality/telegram-cold-preparation-mv3.mjs && node test/quality/native-chat-mv3.mjs && node test/quality/native-chat-presubmit-mv3.mjs && node test/quality/cloud-bot-memory-mv3.mjs",+ "test:shard:browser-a": "node --test test/captcha-draft-content.mjs test/captcha-challenge-surfaces.mjs && node test/bot-memory-dom.mjs && node test/bot-memory-click-dom.mjs && node test/ui-content-lifecycle.mjs && node --test test/native-telegram-chat.mjs test/native-telegram-recipient.mjs test/telegram-native-baseline.mjs test/telegram-native-latest.mjs test/native-chat-pre-enter-draft.mjs test/chat-draft-dispatch-ownership.mjs test/native-telegram-alias-preparation.mjs test/telegram-read-preparation-content.mjs test/queued-composer-ownership.mjs test/onboarding-provider-ready.mjs test/sidepanel-permission-gate-ui.mjs test/workflow-native-targets.mjs test/native-whatsapp-chat.mjs test/native-chat-context-identity.mjs test/native-whatsapp-contact.mjs test/whatsapp-chat-selection.mjs test/whatsapp-native-bootstrap.mjs test/whatsapp-drawer-identity.mjs test/whatsapp-read-latest.mjs test/whatsapp-read-preparation.mjs test/whatsapp-chat-completion.mjs test/whatsapp-chat-restart.mjs test/chat-goal-lifecycle.mjs test/chat-completion.mjs test/chat-generic-dispatch.mjs test/completion-live-status-browser.mjs test/native-confirmation-visibility.mjs test/native-button-preparation.mjs test/read-continuation-browser.mjs test/iframe-preparation-focus.mjs test/contenteditable-literal.mjs test/native-chat-empty-editor.mjs test/native-chat-trusted-clear.mjs test/chat-steering-ui.mjs test/recipient-confirmation-ui.mjs test/assistant-message-visibility-ui.mjs test/page-monitor-ui.mjs test/x-compose-trusted-typing.mjs test/page-monitor-dialog.mjs test/page-monitor-dialog-native.mjs test/page-monitor-inline-post.mjs test/bluesky-composer-context.mjs test/page-monitor-anchored.mjs test/page-monitor-upload-owner.mjs test/page-monitor-upload-release.mjs test/page-monitor-native-controls.mjs test/page-monitor-native-preparation.mjs test/native-preparation-cold.mjs test/page-monitor-navigation.mjs test/page-monitor-main-owner.mjs test/page-monitor-collateral-controls.mjs test/accessibility-tree-scoped-budget.mjs test/ax-reference-origin.mjs test/page-monitor-decorative-hit.mjs test/social-ui-navigation.mjs test/native-resource-deletion-binding.mjs test/native-mastodon-confirmation.mjs test/dropdown-menu-inventory.mjs test/page-monitor-passive-progress.mjs test/page-monitor-feed-items.mjs test/media-download-binding.mjs test/media-download-capture-integration.mjs test/social-media-downloader-reinjection.mjs test/upload-file-local-state-guidance.mjs test/monitor-intervention-contract.mjs test/monitor-owned-geometry.mjs test/monitor-viewport-remainder.mjs test/monitor-scroll-churn.mjs test/monitor-local-attribution.mjs test/monitor-lifecycle-leaks.mjs test/lifecycle-run-ui.mjs test/lifecycle-menu-prompts-held.mjs test/delivery-cdp-input.mjs test/delivery-click-ax-response-loss.mjs test/delivery-native-button-geometry.mjs test/delivery-hover-transition.mjs test/delivery-native-button-route.mjs test/delivery-dispatch-boundary.mjs test/delivery-stop-compound.mjs test/guards-control-classification.mjs test/guards-unbound-deletion.mjs test/submit-probe-readings.mjs test/improver-content-account-chrome.mjs test/improver-content-recipient.mjs test/improver-content-truncated-replacement.mjs test/improver-forms-probe.mjs test/improver-misc-trace-browser.mjs test/page-feedback-held-time.mjs test/page-monitor-held-observation.mjs",+ "test:shard:browser-b1": "node test/message-recipient-upload.mjs && node test/message-recipient-clarify-binding.mjs && node --test test/message-recipient-whatsapp.mjs test/message-control-readings.mjs && node test/quality/integration-mv3.mjs --full-form && node test/quality/integration-mv3.mjs --batch && node test/quality/literal-calculate-midrun-mv3.mjs && node test/quality/ask-completion-churn-mv3.mjs && node test/quality/ask-person-activity-mv3.mjs && node test/quality/telegram-cold-preparation-mv3.mjs && node test/quality/native-chat-mv3.mjs && node test/quality/native-chat-presubmit-mv3.mjs && node test/quality/cloud-bot-memory-mv3.mjs && node --test test/placeholder-submit-probe.mjs","test:shard:browser-b2": "node test/quality/whatsapp-contact-matrix.mjs && node test/quality/pdf-detection-mv3.mjs && node test/quality/download-upload-mv3.mjs && node test/quality/upload-release-binding-mv3.mjs && node test/quality/upload-release-binding-mv3.mjs --selector-recovery && node test/quality/upload-release-binding-mv3.mjs --sequential-assets && node test/quality/release-review-world-mv3.mjs && node test/quality/downloaded-file-saved-bytes-mv3.mjs && node test/quality/file-upload-accept-mv3.mjs && node test/quality/bulk-resume-mv3.mjs && node test/quality/shared-action-guards-mv3.mjs && node test/quality/video-upload-attachment-mv3.mjs","test:shard:browser-c": "node test/quality/literal-frame-mv3.mjs && node test/quality/mastodon-publication-mv3.mjs && node test/quality/mastodon-reply-route-mv3.mjs && node test/quality/mastodon-deletion-mv3.mjs && node test/quality/mastodon-delete-confirmation-mv3.mjs && node test/quality/mastodon-delete-confirmation-mv3.mjs --menu-read && node test/quality/mastodon-delete-confirmation-mv3.mjs --vague && node test/quality/mastodon-delete-after-correction-mv3.mjs && node test/quality/unbound-deletion-mv3.mjs && node test/quality/recipient-clarify-mv3.mjs && node test/quality/open-chat-recipients-mv3.mjs && node test/quality/correction-cross-site-mv3.mjs && node test/quality/anchored-action-mv3.mjs && node test/quality/inline-social-composer-mv3.mjs && node test/quality/x-compose-dialog-mv3.mjs && node test/quality/bluesky-composer-mv3.mjs && node test/quality/dropdown-menu-matrix.mjs && node test/quality/mastodon-deletion-navigation-mv3.mjs && node test/quality/semantic-navigation-matrix.mjs && node test/quality/workflow-replay-mv3.mjs && node test/quality/generative-media-mv3.mjs && node test/quality/cdp-worker-restart-mv3.mjs && node test/quality/steering-worker-restart-mv3.mjs","test:shard:tail": "node test/run.js && node test/selection-scope-restoration.mjs && node scripts/benchmark-offline-relevance.mjs && npm run test:security",diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex e2688ea9a..64ce752d5 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -32424,92 +32424,6 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dreturn null;}- // A submission whose changed field still holds the page's own placeholder- // text, which no message or card answer from the user gave, is the page's- // example typed in as a value ("[email protected]" in an email box). It is- // refused before any card, whether or not the user asked to confirm- // submissions (a scheduled run included), and the model is told to ask- // the user for the value. Grouped searches keep their approval.- _placeholderSubmitBlock(tabId, toolName, submitInfo) {- if (submitInfo?.isSubmit !== true) return null;- if (classifySubmitRisk(submitInfo, submitInfo.url).risk === SubmitRisk.LOW_RISK_SEARCH- && ['click', 'click_ax', 'press_keys'].includes(toolName)) return null;- const fields = this._placeholderValueFields(tabId, submitInfo);- if (!fields.length) return null;- return {- success: false,- denied: true,- dispatched: false,- noDispatch: true,- placeholderValue: true,- placeholderFieldCount: fields.length,- error: `Nothing was submitted on ${submitInfo.host || 'this site'}: ${fields.length === 1 ? 'a field still holds its' : 'fields still hold their'} `- + 'own placeholder text, an example the page shows, not a value the user gave. Ask the user for the real value with clarify '- + '(require_explicit_answer:true for personal values) and type that instead. Do NOT submit the placeholder.',- };- }-- // The edited fields of a submission that hold their own placeholder text- // when the user did not supply that value: the page's example typed in- // as the user's. A field counts as edited when the probe saw it differ- // from its default or WebBrain's own write put that value there in this- // run (a framework may copy a typed value into defaultValue). The- // probe's complete list is read when it sent one; the summary's changed- // fields stop at eight. A placeholder without a letter, or shorter than- // three characters (a "1" in a quantity box), is not an example of this- // kind.- _placeholderValueFields(tabId, submitInfo) {- const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();- const candidates = Array.isArray(submitInfo?.placeholderFields) ? submitInfo.placeholderFields- : Array.isArray(submitInfo?.changedFields) ? submitInfo.changedFields : [];- const fields = candidates.filter(field => {- const value = normalize(field?.value);- return (field?.changed === true || this._placeholderWritten(tabId, value))- && value.length >= 3 && /\p{L}/u.test(value) && value === normalize(field?.placeholder);- });- if (!fields.length) return [];- const messages = (this.conversations.get(tabId) || [])- .filter(message => message?.role === 'user' && !this._isAgentInjectedUserMessage(message));- const requests = messages.map(message => normalize(this._plannerUserAuthoredText(message)));- const answers = messages.flatMap(message => (Array.isArray(message.webbrainTaskClarifications) ? message.webbrainTaskClarifications : [])- .filter(item => ['user', 'text', 'option'].includes(item?.source)).map(item => normalize(item?.answer)));- const supplied = value => {- const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');- const named = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'u');- // A plain word or phrase ("Email", "Your name") is named in requests- // without being given; it counts only as a whole answer to a card.- // A value with a digit or symbol ("[email protected]") counts where- // the user wrote it as a whole.- const specific = /[^\p{L}\s]/u.test(value);- return answers.includes(value) || (specific && [...requests, ...answers].some(text => named.test(text)));- };- return fields.filter(field => !supplied(normalize(field.value)));- }-- // A value WebBrain typed into a field that equals the field's own- // placeholder, from the write's receipt (its field metadata), kept for- // the current run.- _rememberPlaceholderWrite(tabId, toolName, args, response) {- if (!['set_field', 'type_ax', 'type_text', 'iframe_type'].includes(toolName) || response?.success !== true) return;- const meta = response.fieldMeta;- if (!meta || String(meta.type || '').toLowerCase() === 'password') return;- const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();- const placeholder = normalize(meta.placeholder);- const written = normalize(typeof response.value === 'string' ? response.value : args?.text);- if (!placeholder || written !== placeholder) return;- const runId = this.currentRunId.get(tabId) || null;- this._placeholderWrites ??= new Map();- const entry = this._placeholderWrites.get(tabId);- const values = entry?.runId === runId ? entry.values : new Set();- values.add(written);- this._placeholderWrites.set(tabId, { runId, values });- }-- _placeholderWritten(tabId, value) {- const entry = this._placeholderWrites?.get(tabId);- return !!entry && entry.runId === (this.currentRunId.get(tabId) || null) && entry.values.has(value);- }-_fallbackSubmitConfirmationInfo(host, tool, reason, summary = '') {const normalizedHost = normalizeHost(host || '') || String(host || '').trim() || 'this site';return {@@ -32644,7 +32558,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dfields: Array.isArray(detected.fields) ? detected.fields.slice(0, 12) : [],hiddenFields: Array.isArray(detected.hiddenFields) ? detected.hiddenFields.slice(0, 20) : [],changedFields: Array.isArray(detected.changedFields) ? detected.changedFields.slice(0, 8) : [],- ...(Array.isArray(detected.placeholderFields) ? { placeholderFields: detected.placeholderFields.slice(0, 16) } : {}),+ ...(Array.isArray(detected.placeholderFields) ? { placeholderFields: detected.placeholderFields.slice(0, 500) } : {}),method: String(detected.method || 'GET').slice(0, 20).toUpperCase(),action: String(detected.action || '').slice(0, 300),actionUrl: String(detected.actionUrl || detected.action || '').slice(0, 300),@@ -33074,19 +32988,24 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dconst changedFields = fields.filter(field => field.changed || field.value).slice(0, 8);// Every field that holds its own placeholder text, for the// placeholder guard, and whether it differs from its default: unlike- // the summary above, not capped. Passwords and other fields without a- // typed value are left out.+ // the summary above, it covers the whole form, edited fields first.+ // Passwords and other fields without a typed value are left out.const placeholderFields = (() => {try {- return Array.from(form.querySelectorAll('input, textarea')).slice(0, 500).flatMap(el => {+ const matches = Array.from(form.querySelectorAll('input, textarea')).slice(0, 5000).flatMap(el => {const type = String(el.type || '').toLowerCase();if (['hidden', 'submit', 'button', 'reset', 'image', 'checkbox', 'radio', 'file', 'password'].includes(type)) return [];const placeholder = compact(el.getAttribute?.('placeholder') || '', 200);const value = pendingEl && el === pendingEl ? compact(pendingValue, 200) : compact(el.value || '', 200);const changed = el === pendingEl || (!!value && value !== defaultValue(el));return placeholder && value.toLowerCase() === placeholder.toLowerCase()- ? [{ label: labelFor(el), value, placeholder, changed }] : [];- }).slice(0, 16);+ ? [{ label: labelFor(el), value, placeholder, changed,+ ref: typeof window.__wb_ax_ref === 'function' ? String(window.__wb_ax_ref(el) || '') : '',+ name: compact(el.getAttribute?.('name') || '', 120), id: compact(el.getAttribute?.('id') || '', 120) }] : [];+ });+ // Edited fields first, so no number of untouched matches can push+ // one out of the list.+ return [...matches.filter(field => field.changed), ...matches.filter(field => !field.changed)].slice(0, 500);} catch {return [];}@@ -52501,6 +52420,112 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dif (value) this._rememberCredentialValues(tabId, [value]);}+ // A submission whose changed field still holds the page's own placeholder+ // text, which no message or card answer from the user gave, is the page's+ // example typed in as a value ("[email protected]" in an email box). It is+ // refused before any card, whether or not the user asked to confirm+ // submissions (a scheduled run included), and the model is told to ask+ // the user for the value. Grouped searches keep their approval.+ _placeholderSubmitBlock(tabId, toolName, submitInfo) {+ if (submitInfo?.isSubmit !== true) return null;+ if (classifySubmitRisk(submitInfo, submitInfo.url).risk === SubmitRisk.LOW_RISK_SEARCH+ && ['click', 'click_ax', 'press_keys'].includes(toolName)) return null;+ const fields = this._placeholderValueFields(tabId, submitInfo);+ if (!fields.length) return null;+ return {+ success: false,+ denied: true,+ dispatched: false,+ noDispatch: true,+ placeholderValue: true,+ placeholderFieldCount: fields.length,+ error: `Nothing was submitted on ${submitInfo.host || 'this site'}: ${fields.length === 1 ? 'a field still holds its' : 'fields still hold their'} `+ + 'own placeholder text, an example the page shows, not a value the user gave. Ask the user for the real value with clarify '+ + '(require_explicit_answer:true for personal values) and type that instead. Do NOT submit the placeholder.',+ };+ }++ // The edited fields of a submission that hold their own placeholder text+ // when the user did not supply that value for the current task: the+ // page's example typed in as the user's. A field counts as edited when+ // the probe saw it differ from its default or WebBrain's own write put+ // that value into that same field in this run (a framework may copy a+ // typed value into defaultValue). The probe's complete list is read when+ // it sent one; the summary's changed fields stop at eight. A placeholder+ // without a letter, or shorter than three characters (a "1" in a quantity+ // box), is not an example of this kind.+ _placeholderValueFields(tabId, submitInfo) {+ const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();+ const candidates = Array.isArray(submitInfo?.placeholderFields) ? submitInfo.placeholderFields+ : Array.isArray(submitInfo?.changedFields) ? submitInfo.changedFields : [];+ const fields = candidates.filter(field => {+ const value = normalize(field?.value);+ return value.length >= 3 && /\p{L}/u.test(value) && value === normalize(field?.placeholder)+ && (field?.changed === true || this._placeholderWritten(tabId, field, value));+ });+ if (!fields.length) return [];+ // Only the active task's own words and the user's answers to its cards+ // can supply a value; an earlier, unrelated turn cannot.+ const messages = this.conversations.get(tabId) || [];+ const binding = this._activeTaskBinding(messages);+ const taskMessages = binding.taskIndex < 0 ? []+ : (binding.pinnedIndices || []).map(index => messages[index])+ .filter(message => message?.role === 'user' && !this._isAgentInjectedUserMessage(message));+ const requests = binding.taskIndex < 0 ? [] : [binding.requestText,+ ...(Array.isArray(binding.updates) ? binding.updates.map(update => update?.text) : []),+ ...taskMessages.map(message => this._plannerUserAuthoredText(message))].map(normalize).filter(Boolean);+ const answers = binding.taskIndex < 0 ? [] : [+ ...(Array.isArray(binding.answers) ? binding.answers : []),+ ...messages.slice(binding.taskIndex).flatMap(message => (message?.role === 'user' && Array.isArray(message.webbrainTaskClarifications)+ ? message.webbrainTaskClarifications : [])+ .filter(item => ['user', 'text', 'option'].includes(item?.source)).map(item => item?.answer)),+ ].map(normalize).filter(Boolean);+ const supplied = value => {+ const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ const named = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'u');+ // A plain word or phrase ("Email", "Your name") is named in requests+ // without being given; it counts only as a whole answer to a card.+ // A value with a digit or symbol ("[email protected]") counts where+ // the user wrote it as a whole.+ const specific = /[^\p{L}\s]/u.test(value);+ return answers.includes(value) || (specific && [...requests, ...answers].some(text => named.test(text)));+ };+ return fields.filter(field => !supplied(normalize(field.value)));+ }++ // A value WebBrain typed into a field that equals the field's own+ // placeholder, from the write's receipt, kept for the current run with the+ // field it went into: its accessibility ref, and its name and id.+ _rememberPlaceholderWrite(tabId, toolName, args, response) {+ if (!['set_field', 'type_ax', 'type_text', 'iframe_type'].includes(toolName) || response?.success !== true) return;+ const meta = response.fieldMeta;+ if (!meta || String(meta.type || '').toLowerCase() === 'password') return;+ const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();+ const placeholder = normalize(meta.placeholder);+ const written = normalize(typeof response.value === 'string' ? response.value : args?.text);+ if (!placeholder || written !== placeholder) return;+ const ref = [args?.ref_id, response.ref_id].map(value => String(value || '')).find(value => /^ref_\d+$/.test(value)) || '';+ const write = { value: written, ref, name: String(meta.name || ''), id: String(meta.id || '') };+ if (!write.ref && !write.name && !write.id) return;+ const runId = this.currentRunId.get(tabId) || null;+ this._placeholderWrites ??= new Map();+ const entry = this._placeholderWrites.get(tabId);+ const writes = entry?.runId === runId ? entry.writes : [];+ this._placeholderWrites.set(tabId, { runId, writes: [...writes, write].slice(-64) });+ }++ // Whether WebBrain's own write in this run put `value` into this probed+ // field: the same ref when both have one, otherwise the same name and id.+ _placeholderWritten(tabId, field, value) {+ const entry = this._placeholderWrites?.get(tabId);+ if (!entry || entry.runId !== (this.currentRunId.get(tabId) || null)) return false;+ const ref = String(field?.ref || '');+ const name = String(field?.name || '');+ const id = String(field?.id || '');+ return entry.writes.some(write => write.value === value && (write.ref && ref ? write.ref === ref+ : (write.name || write.id) && write.name === name && write.id === id));+ }+// Adds values to the tab's known credentials, keeping the most recent 64.// A value new to the tab may already sit in notes the model wrote before// the fill, such as a password it generated and then typed: those notes arediff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex f509d5f50..f020802e9 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -29412,92 +29412,6 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dreturn null;}- // A submission whose changed field still holds the page's own placeholder- // text, which no message or card answer from the user gave, is the page's- // example typed in as a value ("[email protected]" in an email box). It is- // refused before any card, whether or not the user asked to confirm- // submissions (a scheduled run included), and the model is told to ask- // the user for the value. Grouped searches keep their approval.- _placeholderSubmitBlock(tabId, toolName, submitInfo) {- if (submitInfo?.isSubmit !== true) return null;- if (classifySubmitRisk(submitInfo, submitInfo.url).risk === SubmitRisk.LOW_RISK_SEARCH- && ['click', 'click_ax', 'press_keys'].includes(toolName)) return null;- const fields = this._placeholderValueFields(tabId, submitInfo);- if (!fields.length) return null;- return {- success: false,- denied: true,- dispatched: false,- noDispatch: true,- placeholderValue: true,- placeholderFieldCount: fields.length,- error: `Nothing was submitted on ${submitInfo.host || 'this site'}: ${fields.length === 1 ? 'a field still holds its' : 'fields still hold their'} `- + 'own placeholder text, an example the page shows, not a value the user gave. Ask the user for the real value with clarify '- + '(require_explicit_answer:true for personal values) and type that instead. Do NOT submit the placeholder.',- };- }-- // The edited fields of a submission that hold their own placeholder text- // when the user did not supply that value: the page's example typed in- // as the user's. A field counts as edited when the probe saw it differ- // from its default or WebBrain's own write put that value there in this- // run (a framework may copy a typed value into defaultValue). The- // probe's complete list is read when it sent one; the summary's changed- // fields stop at eight. A placeholder without a letter, or shorter than- // three characters (a "1" in a quantity box), is not an example of this- // kind.- _placeholderValueFields(tabId, submitInfo) {- const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();- const candidates = Array.isArray(submitInfo?.placeholderFields) ? submitInfo.placeholderFields- : Array.isArray(submitInfo?.changedFields) ? submitInfo.changedFields : [];- const fields = candidates.filter(field => {- const value = normalize(field?.value);- return (field?.changed === true || this._placeholderWritten(tabId, value))- && value.length >= 3 && /\p{L}/u.test(value) && value === normalize(field?.placeholder);- });- if (!fields.length) return [];- const messages = (this.conversations.get(tabId) || [])- .filter(message => message?.role === 'user' && !this._isAgentInjectedUserMessage(message));- const requests = messages.map(message => normalize(this._plannerUserAuthoredText(message)));- const answers = messages.flatMap(message => (Array.isArray(message.webbrainTaskClarifications) ? message.webbrainTaskClarifications : [])- .filter(item => ['user', 'text', 'option'].includes(item?.source)).map(item => normalize(item?.answer)));- const supplied = value => {- const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');- const named = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'u');- // A plain word or phrase ("Email", "Your name") is named in requests- // without being given; it counts only as a whole answer to a card.- // A value with a digit or symbol ("[email protected]") counts where- // the user wrote it as a whole.- const specific = /[^\p{L}\s]/u.test(value);- return answers.includes(value) || (specific && [...requests, ...answers].some(text => named.test(text)));- };- return fields.filter(field => !supplied(normalize(field.value)));- }-- // A value WebBrain typed into a field that equals the field's own- // placeholder, from the write's receipt (its field metadata), kept for- // the current run.- _rememberPlaceholderWrite(tabId, toolName, args, response) {- if (!['set_field', 'type_ax', 'type_text', 'iframe_type'].includes(toolName) || response?.success !== true) return;- const meta = response.fieldMeta;- if (!meta || String(meta.type || '').toLowerCase() === 'password') return;- const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();- const placeholder = normalize(meta.placeholder);- const written = normalize(typeof response.value === 'string' ? response.value : args?.text);- if (!placeholder || written !== placeholder) return;- const runId = this.currentRunId.get(tabId) || null;- this._placeholderWrites ??= new Map();- const entry = this._placeholderWrites.get(tabId);- const values = entry?.runId === runId ? entry.values : new Set();- values.add(written);- this._placeholderWrites.set(tabId, { runId, values });- }-- _placeholderWritten(tabId, value) {- const entry = this._placeholderWrites?.get(tabId);- return !!entry && entry.runId === (this.currentRunId.get(tabId) || null) && entry.values.has(value);- }-_fallbackSubmitConfirmationInfo(host, tool, reason, summary = '') {const normalizedHost = normalizeHost(host || '') || String(host || '').trim() || 'this site';return {@@ -29636,7 +29550,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dfields: Array.isArray(detected.fields) ? detected.fields.slice(0, 12) : [],hiddenFields: Array.isArray(detected.hiddenFields) ? detected.hiddenFields.slice(0, 20) : [],changedFields: Array.isArray(detected.changedFields) ? detected.changedFields.slice(0, 8) : [],- ...(Array.isArray(detected.placeholderFields) ? { placeholderFields: detected.placeholderFields.slice(0, 16) } : {}),+ ...(Array.isArray(detected.placeholderFields) ? { placeholderFields: detected.placeholderFields.slice(0, 500) } : {}),method: String(detected.method || 'GET').slice(0, 20).toUpperCase(),action: String(detected.action || '').slice(0, 300),actionUrl: String(detected.actionUrl || detected.action || '').slice(0, 300),@@ -29978,19 +29892,24 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dconst changedFields = fields.filter(field => field.changed || field.value).slice(0, 8);// Every field that holds its own placeholder text, for the// placeholder guard, and whether it differs from its default: unlike- // the summary above, not capped. Passwords and other fields without a- // typed value are left out.+ // the summary above, it covers the whole form, edited fields first.+ // Passwords and other fields without a typed value are left out.const placeholderFields = (() => {try {- return Array.from(form.querySelectorAll('input, textarea')).slice(0, 500).flatMap(el => {+ const matches = Array.from(form.querySelectorAll('input, textarea')).slice(0, 5000).flatMap(el => {const type = String(el.type || '').toLowerCase();if (['hidden', 'submit', 'button', 'reset', 'image', 'checkbox', 'radio', 'file', 'password'].includes(type)) return [];const placeholder = compact(el.getAttribute?.('placeholder') || '', 200);const value = pendingEl && el === pendingEl ? compact(pendingValue, 200) : compact(el.value || '', 200);const changed = el === pendingEl || (!!value && value !== defaultValue(el));return placeholder && value.toLowerCase() === placeholder.toLowerCase()- ? [{ label: labelFor(el), value, placeholder, changed }] : [];- }).slice(0, 16);+ ? [{ label: labelFor(el), value, placeholder, changed,+ ref: typeof window.__wb_ax_ref === 'function' ? String(window.__wb_ax_ref(el) || '') : '',+ name: compact(el.getAttribute?.('name') || '', 120), id: compact(el.getAttribute?.('id') || '', 120) }] : [];+ });+ // Edited fields first, so no number of untouched matches can push+ // one out of the list.+ return [...matches.filter(field => field.changed), ...matches.filter(field => !field.changed)].slice(0, 500);} catch {return [];}@@ -45771,6 +45690,112 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dif (value) this._rememberCredentialValues(tabId, [value]);}+ // A submission whose changed field still holds the page's own placeholder+ // text, which no message or card answer from the user gave, is the page's+ // example typed in as a value ("[email protected]" in an email box). It is+ // refused before any card, whether or not the user asked to confirm+ // submissions (a scheduled run included), and the model is told to ask+ // the user for the value. Grouped searches keep their approval.+ _placeholderSubmitBlock(tabId, toolName, submitInfo) {+ if (submitInfo?.isSubmit !== true) return null;+ if (classifySubmitRisk(submitInfo, submitInfo.url).risk === SubmitRisk.LOW_RISK_SEARCH+ && ['click', 'click_ax', 'press_keys'].includes(toolName)) return null;+ const fields = this._placeholderValueFields(tabId, submitInfo);+ if (!fields.length) return null;+ return {+ success: false,+ denied: true,+ dispatched: false,+ noDispatch: true,+ placeholderValue: true,+ placeholderFieldCount: fields.length,+ error: `Nothing was submitted on ${submitInfo.host || 'this site'}: ${fields.length === 1 ? 'a field still holds its' : 'fields still hold their'} `+ + 'own placeholder text, an example the page shows, not a value the user gave. Ask the user for the real value with clarify '+ + '(require_explicit_answer:true for personal values) and type that instead. Do NOT submit the placeholder.',+ };+ }++ // The edited fields of a submission that hold their own placeholder text+ // when the user did not supply that value for the current task: the+ // page's example typed in as the user's. A field counts as edited when+ // the probe saw it differ from its default or WebBrain's own write put+ // that value into that same field in this run (a framework may copy a+ // typed value into defaultValue). The probe's complete list is read when+ // it sent one; the summary's changed fields stop at eight. A placeholder+ // without a letter, or shorter than three characters (a "1" in a quantity+ // box), is not an example of this kind.+ _placeholderValueFields(tabId, submitInfo) {+ const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();+ const candidates = Array.isArray(submitInfo?.placeholderFields) ? submitInfo.placeholderFields+ : Array.isArray(submitInfo?.changedFields) ? submitInfo.changedFields : [];+ const fields = candidates.filter(field => {+ const value = normalize(field?.value);+ return value.length >= 3 && /\p{L}/u.test(value) && value === normalize(field?.placeholder)+ && (field?.changed === true || this._placeholderWritten(tabId, field, value));+ });+ if (!fields.length) return [];+ // Only the active task's own words and the user's answers to its cards+ // can supply a value; an earlier, unrelated turn cannot.+ const messages = this.conversations.get(tabId) || [];+ const binding = this._activeTaskBinding(messages);+ const taskMessages = binding.taskIndex < 0 ? []+ : (binding.pinnedIndices || []).map(index => messages[index])+ .filter(message => message?.role === 'user' && !this._isAgentInjectedUserMessage(message));+ const requests = binding.taskIndex < 0 ? [] : [binding.requestText,+ ...(Array.isArray(binding.updates) ? binding.updates.map(update => update?.text) : []),+ ...taskMessages.map(message => this._plannerUserAuthoredText(message))].map(normalize).filter(Boolean);+ const answers = binding.taskIndex < 0 ? [] : [+ ...(Array.isArray(binding.answers) ? binding.answers : []),+ ...messages.slice(binding.taskIndex).flatMap(message => (message?.role === 'user' && Array.isArray(message.webbrainTaskClarifications)+ ? message.webbrainTaskClarifications : [])+ .filter(item => ['user', 'text', 'option'].includes(item?.source)).map(item => item?.answer)),+ ].map(normalize).filter(Boolean);+ const supplied = value => {+ const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ const named = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escaped}(?:$|[^\\p{L}\\p{N}])`, 'u');+ // A plain word or phrase ("Email", "Your name") is named in requests+ // without being given; it counts only as a whole answer to a card.+ // A value with a digit or symbol ("[email protected]") counts where+ // the user wrote it as a whole.+ const specific = /[^\p{L}\s]/u.test(value);+ return answers.includes(value) || (specific && [...requests, ...answers].some(text => named.test(text)));+ };+ return fields.filter(field => !supplied(normalize(field.value)));+ }++ // A value WebBrain typed into a field that equals the field's own+ // placeholder, from the write's receipt, kept for the current run with the+ // field it went into: its accessibility ref, and its name and id.+ _rememberPlaceholderWrite(tabId, toolName, args, response) {+ if (!['set_field', 'type_ax', 'type_text', 'iframe_type'].includes(toolName) || response?.success !== true) return;+ const meta = response.fieldMeta;+ if (!meta || String(meta.type || '').toLowerCase() === 'password') return;+ const normalize = text => String(text ?? '').replace(/\s+/g, ' ').trim().toLowerCase();+ const placeholder = normalize(meta.placeholder);+ const written = normalize(typeof response.value === 'string' ? response.value : args?.text);+ if (!placeholder || written !== placeholder) return;+ const ref = [args?.ref_id, response.ref_id].map(value => String(value || '')).find(value => /^ref_\d+$/.test(value)) || '';+ const write = { value: written, ref, name: String(meta.name || ''), id: String(meta.id || '') };+ if (!write.ref && !write.name && !write.id) return;+ const runId = this.currentRunId.get(tabId) || null;+ this._placeholderWrites ??= new Map();+ const entry = this._placeholderWrites.get(tabId);+ const writes = entry?.runId === runId ? entry.writes : [];+ this._placeholderWrites.set(tabId, { runId, writes: [...writes, write].slice(-64) });+ }++ // Whether WebBrain's own write in this run put `value` into this probed+ // field: the same ref when both have one, otherwise the same name and id.+ _placeholderWritten(tabId, field, value) {+ const entry = this._placeholderWrites?.get(tabId);+ if (!entry || entry.runId !== (this.currentRunId.get(tabId) || null)) return false;+ const ref = String(field?.ref || '');+ const name = String(field?.name || '');+ const id = String(field?.id || '');+ return entry.writes.some(write => write.value === value && (write.ref && ref ? write.ref === ref+ : (write.name || write.id) && write.name === name && write.id === id));+ }+// Adds values to the tab's known credentials, keeping the most recent 64.// A value new to the tab may already sit in notes the model wrote before// the fill, such as a password it generated and then typed: those notes arediff --git a/test/placeholder-submit-probe.mjs b/test/placeholder-submit-probe.mjsindex faef96991..abf428b1a 100644--- a/test/placeholder-submit-probe.mjs+++ b/test/placeholder-submit-probe.mjs@@ -38,10 +38,11 @@ for (const build of ['chrome', 'firefox']) {assert.equal(result?.isSubmit, true);assert.equal(result.changedFields.length, 8, 'the summary stops at eight');assert.ok(!result.changedFields.some(field => field.label === 'Email'), 'the email field is past the summary');- assert.deepEqual(result.placeholderFields, [- { label: 'Email', value: '[email protected]', placeholder: '[email protected]', changed: true },- { label: 'City', value: 'Istanbul', placeholder: 'Istanbul', changed: false },- ], 'the edited email field, and the page default marked unchanged; never the password');+ const shown = result.placeholderFields.map(({ label, value, placeholder, changed, name, id }) => ({ label, value, placeholder, changed, name, id }));+ assert.deepEqual(shown, [+ { label: 'Email', value: '[email protected]', placeholder: '[email protected]', changed: true, name: 'email', id: 'email' },+ { label: 'City', value: 'Istanbul', placeholder: 'Istanbul', changed: false, name: 'city', id: 'city' },+ ], 'the edited email field first, then the page default marked unchanged; never the password');});await t.test('a value set_field is about to type and submit is checked too', async () => {@@ -55,6 +56,17 @@ for (const build of ['chrome', 'firefox']) {const own = await probe('set_field', { ref_id: 'ref_email', text: '[email protected]', submit: true });assert.deepEqual(own.placeholderFields, []);});++ await t.test('untouched matches cannot push an edited field out of the list', async () => {+ await page.setContent('<form method="post" action="/many">'+ + Array.from({ length: 600 }, (_, i) => `<input name="d${i}" placeholder="Example" value="Example">`).join('')+ + '<input id="email" name="email" aria-label="Email" placeholder="[email protected]"><button id="go">Save</button></form>');+ await page.evaluate(() => { document.querySelector('#email').value = '[email protected]'; });+ const result = await probe('click', { selector: '#go' });+ assert.equal(result?.isSubmit, true);+ assert.equal(result.placeholderFields[0]?.name, 'email', 'the edited field comes first');+ assert.equal(result.placeholderFields[0]?.changed, true);+ });} finally {await browser.close();}diff --git a/test/run.js b/test/run.jsindex 1a19021aa..dfdc8de4a 100644--- a/test/run.js+++ b/test/run.js@@ -82577,6 +82577,70 @@ test('agent requires fresh submit confirmation across modes and prompt sources',}});+test('submit confirmation honors scheduled and global gate bypasses', async () => {+ for (const AgentClass of [AgentCh, AgentFx]) {+ for (const scenario of [+ { label: 'global gate disabled', skipGate: true },+ { label: 'scheduled confirmations disabled', scheduledBypass: true },+ ]) {+ const agent = new AgentClass({ getVisionProvider: async () => null });+ const tabId = 5108 + (scenario.skipGate ? 1 : 2);+ let executed = false;+ let submitProbeCalls = 0;+ const messages = [];++ agent._ensureGateSetting = async () => { };+ agent._skipPermissionGate = !!scenario.skipGate;+ agent._currentUrl = async () => 'https://host.com/form';+ agent._recordProgressObservation = async () => null;+ agent._autoRecordProgressAction = () => null;+ agent._progressWarningForAction = () => '';+ agent._persist = () => { };+ if (scenario.scheduledBypass) {+ agent.setScheduledRunPolicy(tabId, {+ requireConsequentialConfirmation: false,+ autoApprovePlanReview: true,+ });+ }+ agent._detectLikelySubmitAction = async () => {+ submitProbeCalls += 1;+ return {+ isSubmit: true,+ host: 'host.com',+ tool: 'click_ax',+ reason: 'submit button/control activation',+ };+ };+ agent._promptSubmitConfirmation = async () => {+ throw new Error(`${AgentClass.name} ${scenario.label}: submit prompt should be bypassed`);+ };+ agent.executeTool = async () => {+ executed = true;+ return { success: true, submitted: true };+ };++ await agent._executeToolBatch(+ tabId,+ [{+ id: `tool_submit_bypass_${scenario.label}`,+ function: { name: 'click_ax', arguments: '{"ref_id":"ref_submit"}' },+ }],+ messages,+ () => { },+ { supportsVision: false },+ '',+ new Set(['click_ax']),+ 1,+ );++ assert.equal(submitProbeCalls, 1, `${AgentClass.name} ${scenario.label}: validation preflight should run even when the submit prompt is bypassed`);+ assert.equal(executed, true, `${AgentClass.name} ${scenario.label}: bypassed submit tool should execute`);+ assert.equal(messages.length, 1, `${AgentClass.name} ${scenario.label}: expected one tool result`);+ assert.equal(JSON.parse(agent._unwrapUntrusted(messages[0].content)).success, true, `${AgentClass.name} ${scenario.label}: tool result should be successful`);+ }+ }+});+test('a field holding its own placeholder text is not submitted', async () => {// The refusal is page-derived tool output, wrapped as untrusted content.const toolJson = content => {@@ -82591,7 +82655,8 @@ test('a field holding its own placeholder text is not submitted', async () => {let field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: true };let completeList = null;const updates = [];- const task = [{ role: 'user', content: 'Sign me up for the newsletter on this page.' }];+ const system = { role: 'system', content: 'You are WebBrain.' };+ const task = [system, { role: 'user', content: 'Sign me up for the newsletter on this page.' }];agent.conversationModes.set(tabId, 'act');agent.conversations.set(tabId, [...task]);@@ -82671,7 +82736,7 @@ test('a field holding its own placeholder text is not submitted', async () => {agent.conversations.set(tabId, [...task, { role: 'user', content: 'Use [email protected] for it.' }]);await submit('user-message');assert.equal(prompts, 2, `${AgentClass.name}: a value from the user's message was refused`);- agent.conversations.set(tabId, [{ ...task[0], webbrainTaskClarifications: [{ question: 'Which email?', answer: '[email protected]', source: 'text' }] }]);+ agent.conversations.set(tabId, [system, { ...task[1], webbrainTaskClarifications: [{ question: 'Which email?', answer: '[email protected]', source: 'text' }] }]);await submit('user-answer');assert.equal(prompts, 3, `${AgentClass.name}: a value from the user's card answer was refused`);@@ -82688,10 +82753,10 @@ test('a field holding its own placeholder text is not submitted', async () => {// Naming a plain word in the request does not supply it as the value; a// whole card answer does.- agent.conversations.set(tabId, [{ role: 'user', content: 'Sign me up for email updates.' }]);+ agent.conversations.set(tabId, [system, { role: 'user', content: 'Sign me up for email updates.' }]);field = { label: 'Email', placeholder: 'Email', value: 'Email', changed: true };assert.equal((await submit('named-word')).placeholderValue, true, `${AgentClass.name}: a word the request only named exempted the field`);- agent.conversations.set(tabId, [{ role: 'user', content: 'Sign me up for email updates.',+ agent.conversations.set(tabId, [system, { role: 'user', content: 'Sign me up for email updates.',webbrainTaskClarifications: [{ question: 'What should the email field say?', answer: 'Email', source: 'text' }] }]);await submit('answered-word');assert.equal(prompts, 7, `${AgentClass.name}: a whole card answer was refused`);@@ -82700,78 +82765,26 @@ test('a field holding its own placeholder text is not submitted', async () => {// probe sees no edit; WebBrain's own write in this run still counts.agent.conversations.set(tabId, [...task]);agent.currentRunId.set(tabId, 'placeholder-run');- field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: false };- agent._rememberPlaceholderWrite(tabId, 'set_field', { text: '[email protected]' },- { success: true, value: '[email protected]', fieldMeta: { type: 'email', placeholder: '[email protected]' } });+ field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: false, ref: 'ref_101', name: 'email', id: '' };+ agent._rememberPlaceholderWrite(tabId, 'set_field', { ref_id: 'ref_101', text: '[email protected]' },+ { success: true, value: '[email protected]', fieldMeta: { type: 'email', name: 'email', id: null, placeholder: '[email protected]' } });assert.equal((await submit('framework-default')).placeholderValue, true, `${AgentClass.name}: WebBrain's own write was missed`);+ // The write belongs to that field: another field with the same+ // placeholder, holding it as its page default, is not one WebBrain wrote.+ field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: false, ref: 'ref_202', name: 'email', id: '' };+ await submit('other-field');+ assert.equal(prompts, 8, `${AgentClass.name}: a write to one field counted for another`);+ field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: false, ref: 'ref_101', name: 'email', id: '' };agent.currentRunId.set(tabId, 'next-run');await submit('next-run');- assert.equal(prompts, 8, `${AgentClass.name}: a write from another run still counted`);- assert.equal(executed, 0, `${AgentClass.name}: a refused or declined submission ran`);- }-});+ assert.equal(prompts, 9, `${AgentClass.name}: a write from another run still counted`);-test('submit confirmation honors scheduled and global gate bypasses', async () => {- for (const AgentClass of [AgentCh, AgentFx]) {- for (const scenario of [- { label: 'global gate disabled', skipGate: true },- { label: 'scheduled confirmations disabled', scheduledBypass: true },- ]) {- const agent = new AgentClass({ getVisionProvider: async () => null });- const tabId = 5108 + (scenario.skipGate ? 1 : 2);- let executed = false;- let submitProbeCalls = 0;- const messages = [];-- agent._ensureGateSetting = async () => { };- agent._skipPermissionGate = !!scenario.skipGate;- agent._currentUrl = async () => 'https://host.com/form';- agent._recordProgressObservation = async () => null;- agent._autoRecordProgressAction = () => null;- agent._progressWarningForAction = () => '';- agent._persist = () => { };- if (scenario.scheduledBypass) {- agent.setScheduledRunPolicy(tabId, {- requireConsequentialConfirmation: false,- autoApprovePlanReview: true,- });- }- agent._detectLikelySubmitAction = async () => {- submitProbeCalls += 1;- return {- isSubmit: true,- host: 'host.com',- tool: 'click_ax',- reason: 'submit button/control activation',- };- };- agent._promptSubmitConfirmation = async () => {- throw new Error(`${AgentClass.name} ${scenario.label}: submit prompt should be bypassed`);- };- agent.executeTool = async () => {- executed = true;- return { success: true, submitted: true };- };-- await agent._executeToolBatch(- tabId,- [{- id: `tool_submit_bypass_${scenario.label}`,- function: { name: 'click_ax', arguments: '{"ref_id":"ref_submit"}' },- }],- messages,- () => { },- { supportsVision: false },- '',- new Set(['click_ax']),- 1,- );-- assert.equal(submitProbeCalls, 1, `${AgentClass.name} ${scenario.label}: validation preflight should run even when the submit prompt is bypassed`);- assert.equal(executed, true, `${AgentClass.name} ${scenario.label}: bypassed submit tool should execute`);- assert.equal(messages.length, 1, `${AgentClass.name} ${scenario.label}: expected one tool result`);- assert.equal(JSON.parse(agent._unwrapUntrusted(messages[0].content)).success, true, `${AgentClass.name} ${scenario.label}: tool result should be successful`);- }+ // An earlier, unrelated turn cannot supply the value for the current task.+ field = { label: 'Email', placeholder: '[email protected]', value: '[email protected]', changed: true };+ agent.conversations.set(tabId, [system, { role: 'user', content: 'Do not use [email protected] anywhere.' },+ { role: 'assistant', content: 'Understood.' }, { role: 'user', content: 'Sign me up for the newsletter on this page.' }]);+ assert.equal((await submit('earlier-turn')).placeholderValue, true, `${AgentClass.name}: an earlier turn supplied the value`);+ assert.equal(executed, 0, `${AgentClass.name}: a refused or declined submission ran`);}});