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
Let Summarize this page read a long page to the end
Emre Sokullu485aed138e60
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4d32542eb..ab3179147 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,7 @@ This changelog was generated from the repository Git history and release tags. V### Fixed- Side panel math: inline formulas written between single dollar signs, such as `$\rightarrow$`, `$W \cdot S \cdot H$` or `$O(n^2)$`, now render with KaTeX instead of showing the raw TeX. A `$...$` span renders only when it reads as TeX (a command, `^`, `_` or braces, or a single letter), so prices such as $5 to $10 stay text, and saved history keeps each formula as its TeX source. Both builds.+- **Summarize this page** on a long page no longer stops after eight `read_page` windows and returns its summary as partial. Each further window of the same page that adds unread text is now progress through the page and does not count toward the eight-observation delivery checkpoint, which had cut off the read of a 43,000-character GitHub README just as it reached the end. The first window of each page, rereads and other observations still count, and a run gets at most 16 uncounted windows. Both builds.- WebBrain Companion: its local Bonsai 2 model no longer fails a request that asks for `high` reasoning effort, which clients such as Cline, Kilo and Open WebUI send. Bonsai 2's chat template accepts only `low`, `medium` and `xhigh`, so Companion now declares just those, and its proxy sends `high` as `medium`, the nearest declared level.## [45.0.1] - 2026-10-29diff --git a/docs/agent-tools.md b/docs/agent-tools.mdindex 305569a27..40613fd58 100644--- a/docs/agent-tools.md+++ b/docs/agent-tools.md@@ -74,6 +74,14 @@ contains unrelated inbox rows and does not count. Expansion is independent:messages and returns a clear limitation; Act/Dev can use **Expand all** and thenre-read the trusted conversation subtree from page 1.+`read_page` returns a page's prose in windows of at most 6,000 characters and+reports `hasMore` and `continuationArgs` for the rest. Reading further into the+same page is progress through it: a window that adds unread text of the page+does not count toward the eight-observation delivery checkpoint, so **Summarize+this page** can read a long article or README to its end. The first window of+each page, rereads and other observations still count, and a run gets at most+16 uncounted windows (`document-read-progress.js`).+## Tool matrixLegend: **Yes** = available · **-** = not available · **C** = Chrome only ·diff --git a/docs/fr/agent-tools.md b/docs/fr/agent-tools.mdindex 29c168d82..be7eae10c 100644--- a/docs/fr/agent-tools.md+++ b/docs/fr/agent-tools.md@@ -32,6 +32,17 @@ suivantes de la racine du document contiennent des lignes de boîte de réceptiosans rapport et ne comptent pas. **Collapse all** doit aussi confirmer séparémentque Gmail a développé la conversation.+## Lecture d'une longue page avec `read_page`++`read_page` renvoie la prose d'une page par fenêtres d'au plus 6 000 caractères+et signale la suite avec `hasMore` et `continuationArgs`. Une fenêtre qui+ajoute du texte non lu de la même page fait avancer la lecture : elle ne compte+pas dans le point de contrôle de livraison, déclenché après huit observations+sans progrès, si bien que **Summarize this page** peut lire un long article ou+README jusqu'au bout. La première fenêtre de chaque page, les relectures et les+autres observations comptent toujours, et une exécution dispose d'au plus 16+fenêtres non comptées (`document-read-progress.js`).+## Matrice des outilsLégende : **Oui** = disponible · **-** = indisponible · **C** = Chromediff --git a/docs/zh-CN/agent-tools.md b/docs/zh-CN/agent-tools.mdindex 3b7221496..9432aa103 100644--- a/docs/zh-CN/agent-tools.md+++ b/docs/zh-CN/agent-tools.md@@ -29,6 +29,15 @@ Gmail 会话的第一个无障碍结果会提供活动会话可信的`hasMore:false`。文档根节点的第 2 页及后续页面会进入无关的收件箱行,不能算作会话覆盖。还必须由 **Collapse all** 单独确认 Gmail 已展开整个会话。+## 用 `read_page` 读取长页面++`read_page` 以每段最多 6,000 个字符的窗口返回页面正文,并用 `hasMore` 和+`continuationArgs` 指出剩余部分。为同一页面补充未读文本的窗口算作读取进展:+它不计入“连续八次观察未取得进展”时触发的交付检查点,因此+**Summarize this page** 可以把长文章或 README 读到结尾。每个页面的第一个窗口、+重复读取和其他观察仍然计数,每次运行最多有 16 个不计数的窗口+(`document-read-progress.js`)。+## 工具矩阵图例:**是** = 可用 · **-** = 不可用 · **C** = 仅 Chrome ·diff --git a/package.json b/package.jsonindex 6a2c9a597..2e0ecc80a 100644--- a/package.json+++ b/package.json@@ -71,7 +71,7 @@"benchmark:relevance": "node scripts/benchmark-offline-relevance.mjs --verbose","test:social-contract": "node --test test/social-publish-contract.mjs test/publication-quote-markup.mjs test/publication-prefetch.mjs","test:social-contract:dom": "node test/social-publish-contract-dom.mjs",-"test:runtime-lifecycle": "node test/bot-memory-dom.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-registries.mjs test/bot-memory-cloud-controller.mjs test/cdp-clear-receipt.mjs test/cdp-field-submit-recovery.mjs test/conversation-persistence.mjs test/history-recovery-state.mjs test/history-recovery-scheduler.mjs test/history-recovery-atomic.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-pre-enter-veto.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/lifecycle-steering-restart.mjs test/resource-mutation-guards.mjs test/action-guard-user-override.mjs test/guard-direct-override.mjs test/guard-override-persistence.mjs test/publication-user-override.mjs test/resource-mutation-clarification.mjs test/publication-override-target.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/run-ui-hidden-panel.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/input-receiving-frame.mjs test/ask-response-scope.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/download-conversation-scope.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/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/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/guard-policy.mjs test/lean-mode.mjs test/prompt-unverified-pages.mjs test/prompt-missing-values.mjs test/lifecycle-planner-digest.mjs test/planner-clarify-loop.mjs test/lifecycle-vision-fallback.mjs test/guards-control-classification.mjs test/guards-unbound-deletion.mjs test/guards-steering-receipts.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/queued-composer-landing.mjs test/onboarding-provider-ready.mjs test/sidepanel-permission-gate-ui.mjs test/permission-skip-dialog-ui.mjs test/permission-skip-session.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/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/slash-command-timeline-ui.mjs test/history-recovery.mjs test/history-recovery-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/upload-file-source-approval.mjs && 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/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/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/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/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:runtime-lifecycle": "node test/bot-memory-dom.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-registries.mjs test/bot-memory-cloud-controller.mjs test/cdp-clear-receipt.mjs test/cdp-field-submit-recovery.mjs test/conversation-persistence.mjs test/history-recovery-state.mjs test/history-recovery-scheduler.mjs test/history-recovery-atomic.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-pre-enter-veto.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/document-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/lifecycle-steering-restart.mjs test/resource-mutation-guards.mjs test/action-guard-user-override.mjs test/guard-direct-override.mjs test/guard-override-persistence.mjs test/publication-user-override.mjs test/resource-mutation-clarification.mjs test/publication-override-target.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/run-ui-hidden-panel.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/input-receiving-frame.mjs test/ask-response-scope.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/download-conversation-scope.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/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/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/guard-policy.mjs test/lean-mode.mjs test/prompt-unverified-pages.mjs test/prompt-missing-values.mjs test/lifecycle-planner-digest.mjs test/planner-clarify-loop.mjs test/lifecycle-vision-fallback.mjs test/guards-control-classification.mjs test/guards-unbound-deletion.mjs test/guards-steering-receipts.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/queued-composer-landing.mjs test/onboarding-provider-ready.mjs test/sidepanel-permission-gate-ui.mjs test/permission-skip-dialog-ui.mjs test/permission-skip-session.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/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/slash-command-timeline-ui.mjs test/history-recovery.mjs test/history-recovery-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/upload-file-source-approval.mjs && 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/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/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/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/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:page-feedback": "node --test test/trusted-field-preparation.mjs test/guard-advisory-writes.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/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/input-receiving-frame.mjs test/ask-response-scope.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/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-passive-progress.mjs test/page-monitor-feed-items.mjs test/media-download-binding.mjs test/media-download-capture-integration.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/feedback-automatic-churn.mjs test/feedback-navigation-idle.mjs test/feedback-run-boundaries.mjs test/feedback-ask-viewing.mjs test/delivery-click-ax-response-loss.mjs test/delivery-stop-compound.mjs test/delivery-cdp-input.mjs test/delivery-click-locks.mjs test/delivery-native-button-geometry.mjs test/delivery-hover-transition.mjs test/delivery-native-button-route.mjs test/delivery-dispatch-boundary.mjs && node test/message-recipient-upload.mjs && node test/message-recipient-clarify-binding.mjs && node --test test/message-recipient-whatsapp.mjs test/page-feedback-held-time.mjs test/page-monitor-held-observation.mjs","test:history-recovery": "node --test test/history-recovery.mjs test/history-recovery-ui.mjs test/history-recovery-state.mjs test/history-recovery-scheduler.mjs test/history-recovery-atomic.mjs test/conversation-persistence.mjs","test:chat-steering": "node --test test/chat-steering.mjs test/chat-steering-ui.mjs test/recipient-confirmation-ui.mjs test/lifecycle-steering-latency.mjs test/lifecycle-steering-restart.mjs test/lifecycle-run-ui.mjs test/lifecycle-menu-prompts-held.mjs",@@ -106,7 +106,7 @@"test:chat-draft-recovery": "node --test test/native-chat-pre-enter-draft.mjs test/chat-draft-dispatch-ownership.mjs && node test/quality/native-chat-presubmit-mv3.mjs","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/cookie-banner-host.mjs test/captcha-aws-recovery.mjs test/captcha-documented-contracts.mjs test/huggingface-signup-recovery.mjs test/trace-full-export.mjs test/slash-command-tab-ownership.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-pre-enter-veto.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/action-guard-user-override.mjs test/guard-direct-override.mjs test/guard-override-persistence.mjs test/publication-user-override.mjs test/resource-mutation-clarification.mjs test/publication-override-target.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/run-ui-hidden-panel.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/input-receiving-frame.mjs test/ask-response-scope.mjs test/auto-mode.mjs test/plan-when-needed.mjs test/planner-prompt-trim.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/download-conversation-scope.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/planner-clarify-loop.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: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-pre-enter-veto.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/document-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/action-guard-user-override.mjs test/guard-direct-override.mjs test/guard-override-persistence.mjs test/publication-user-override.mjs test/resource-mutation-clarification.mjs test/publication-override-target.mjs test/completion-steering-receipt-authority.mjs test/steering-revision-recovery.mjs test/pending-clarification-hydration.mjs test/run-ui-hidden-panel.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/input-receiving-frame.mjs test/ask-response-scope.mjs test/auto-mode.mjs test/plan-when-needed.mjs test/planner-prompt-trim.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/download-conversation-scope.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/planner-clarify-loop.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/queued-composer-landing.mjs test/onboarding-provider-ready.mjs test/sidepanel-permission-gate-ui.mjs test/permission-skip-dialog-ui.mjs test/permission-skip-session.mjs test/model-picker-status-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/activity-brain-ui.mjs test/recipient-confirmation-ui.mjs test/assistant-message-visibility-ui.mjs test/slash-command-timeline-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/upload-file-source-approval.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/declined-submission-identity.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-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 && npm run test:quality:resolved-address && 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 && node --test test/iframe-probe-match-index.mjs",diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex 91c08dc4a..fa647c736 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -43,6 +43,7 @@ import { applyReadPageWindow, fitReadPageWindowResult, isReadPageWindowResult }import { STANDARD_TOOL_RESULT_CHARS, createReadCompletenessState, isCommunicationThreadContext, normalizeReadScope, readCompletenessBlock, readCompletenessLimitation, readCompletenessMadeProgress, readWindowLimits, recordReadCompleteness, requirePlannerReadCompleteness, requiresCompleteThreadRead } from './read-completeness.js';import { LoopDetector } from './loop-detector.js';import { recordCollectionReadProgress } from './collection-read-progress.js';+import { recordDocumentReadProgress } from './document-read-progress.js';import { parseToolCallsFromText } from './tool-call-parser.js';import { IMAGE_BUDGET, estimateImageTokens, fitImageDimensions } from './image-budget.js';import { cropImage } from './vision-encoder.js';@@ -1261,6 +1262,7 @@ export class Agent extends LoopDetector {this.deliveryObservationStreaks = new Map(); // tabId -> countthis.deliveryActionableDiscoveryResets = new Set(); // tabIds that used their one discovery reset since meaningful progressthis.deliveryCollectionReads = new Map(); // tabId -> task-bound finite source coverage+ this.deliveryDocumentReads = new Map(); // tabId -> read_page windows read this runthis.lastAutoScreenshotTs = new Map(); // tabId -> ms — defensive debounce// tabId -> { toolName, streak }. Burst state must not leak across tabs or// be consumed by read-only preflight checks.@@ -10612,6 +10614,7 @@ export class Agent extends LoopDetector {_clearRunLoopState(tabId) {super._clearRunLoopState(tabId);this.deliveryCollectionReads.delete(tabId);+ this.deliveryDocumentReads.delete(tabId);}/**@@ -11478,11 +11481,20 @@ export class Agent extends LoopDetector {return recordCollectionReadProgress(coverage, args, result).madeProgress;}+ _deliveryCheckpointDocumentReadProgress(tabId, name, result) {+ if (name !== 'read_page') return false;+ const recorded = recordDocumentReadProgress(this.deliveryDocumentReads.get(tabId), result);+ this.deliveryDocumentReads.set(tabId, recorded.state);+ return recorded.madeProgress;+ }+_checkDeliveryObservationStreak(tabId, name, args = {}, result = null, options = {}) {const observation = this.constructor.DELIVERY_OBSERVATION_TOOLS.has(name)&& !isNetworkMutation(name, args);const collectionReadProgress = observation&& this._deliveryCheckpointCollectionReadProgress(tabId, name, args, result);+ const documentReadProgress = observation && !collectionReadProgress+ && this._deliveryCheckpointDocumentReadProgress(tabId, name, result);if (observation&& options.discoveredActionableTargets === true&& !this.deliveryActionableDiscoveryResets.has(tabId)) {@@ -11514,6 +11526,11 @@ export class Agent extends LoopDetector {this.deliveryObservationStreaks.delete(tabId);return { kind: 'none' };}+ if (documentReadProgress) {+ // The next window of a long page (document-read-progress.js) is not+ // counted. It does not clear the streak either: it is not task progress.+ return { kind: 'none' };+ }if (!observation) {// Meta calls (scratchpad, load_skill, failed actions, etc.) must not let// the model erase an outstanding delivery obligation. Reset only afterdiff --git a/src/chrome/src/agent/document-read-progress.js b/src/chrome/src/agent/document-read-progress.jsnew file mode 100644index 000000000..669762ca2--- /dev/null+++ b/src/chrome/src/agent/document-read-progress.js@@ -0,0 +1,73 @@+import { isReadPageWindowResult } from './read-page-window.js';++// read_page returns a long page a few thousand characters at a time, so a long+// article or README takes several windows, and the Summarize this page action+// asks for all of them. A window that adds text not read before is progress+// through a fixed page, not observation drift, and the delivery checkpoint does+// not count it. The first window of a page still counts, so does a window that+// rereads earlier text, and a run gets a limited number of uncounted windows:+// moving from page to page, or a page too long to finish, still reaches the+// checkpoint.+const MAX_DOCUMENTS = 8;+const MAX_PROGRESS_WINDOWS = 16;+const MIN_NEW_CHARS = 1000;++function documentUrl(value) {+ try {+ const url = new URL(String(value || ''));+ if (!['http:', 'https:', 'file:'].includes(url.protocol)) return '';+ url.hash = '';+ return url.href;+ } catch {+ return '';+ }+}++function deliveredWindow(result) {+ if (!isReadPageWindowResult(result) || result.success === false || result.error+ || result.accessState === 'blocked_by_page_gate') return null;+ const url = documentUrl(result.url);+ const originalLength = Number(result.originalLength);+ const start = Number(result.textOffset);+ const end = start + result.text.length;+ if (!url || !result.text.trim()+ || !Number.isSafeInteger(originalLength) || originalLength <= 0+ || !Number.isSafeInteger(start) || start < 0 || end > originalLength) return null;+ // Live pages change length as timestamps and counters update, so a page is+ // its address and extraction options; positions are compared as they come.+ return { key: `${url}|${result.includeChrome === true}`, start, end, whole: start === 0 && end === originalLength };+}++export function createDocumentReadProgress() {+ return { documents: new Map(), progressWindows: 0 };+}++export function recordDocumentReadProgress(state, result = null) {+ const current = state || createDocumentReadProgress();+ const window = deliveredWindow(result);+ if (!window) return { state: current, madeProgress: false };+ const ranges = current.documents.get(window.key);+ if (!ranges) {+ // A page read in one window leaves nothing further to read.+ if (!window.whole && current.documents.size < MAX_DOCUMENTS) {+ current.documents.set(window.key, [[window.start, window.end]]);+ }+ return { state: current, madeProgress: false };+ }+ let newChars = window.end - window.start;+ for (const [coveredStart, coveredEnd] of ranges) {+ newChars -= Math.max(0, Math.min(window.end, coveredEnd) - Math.max(window.start, coveredStart));+ }+ const merged = [];+ for (const range of [...ranges, [window.start, window.end]].sort((a, b) => a[0] - b[0])) {+ const last = merged.at(-1);+ if (last && range[0] <= last[1]) last[1] = Math.max(last[1], range[1]);+ else merged.push([...range]);+ }+ current.documents.set(window.key, merged);+ // A short last window counts in full; a window that mostly rereads does not.+ const madeProgress = current.progressWindows < MAX_PROGRESS_WINDOWS+ && newChars >= Math.min(MIN_NEW_CHARS, window.end - window.start);+ if (madeProgress) current.progressWindows += 1;+ return { state: current, madeProgress };+}diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex 82f28f090..bce807da2 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -42,6 +42,7 @@ import { applyReadPageWindow, fitReadPageWindowResult, isReadPageWindowResult }import { STANDARD_TOOL_RESULT_CHARS, createReadCompletenessState, isCommunicationThreadContext, normalizeReadScope, readCompletenessBlock, readCompletenessLimitation, readCompletenessMadeProgress, readWindowLimits, recordReadCompleteness, requirePlannerReadCompleteness, requiresCompleteThreadRead } from './read-completeness.js';import { LoopDetector } from './loop-detector.js';import { recordCollectionReadProgress } from './collection-read-progress.js';+import { recordDocumentReadProgress } from './document-read-progress.js';import { parseToolCallsFromText } from './tool-call-parser.js';import { IMAGE_BUDGET, estimateImageTokens, fitImageDimensions } from './image-budget.js';import { BROWSER_MUTATION_TOOLS, STATE_CHANGE_TOOLS as SHARED_STATE_CHANGE_TOOLS } from './mutation-tools.js';@@ -892,6 +893,7 @@ export class Agent extends LoopDetector {this.deliveryObservationStreaks = new Map();this.deliveryActionableDiscoveryResets = new Set();this.deliveryCollectionReads = new Map(); // tabId -> task-bound finite source coverage+ this.deliveryDocumentReads = new Map(); // tabId -> read_page windows read this run// Local screenshot redaction (issue #312). When true, screenshots sent// to a Vision endpoint are pixelated over DOM-detected PII regions// (form fields + email/phone text) BEFORE leaving the extension. Off by@@ -10326,6 +10328,7 @@ export class Agent extends LoopDetector {_clearRunLoopState(tabId) {super._clearRunLoopState(tabId);this.deliveryCollectionReads.delete(tabId);+ this.deliveryDocumentReads.delete(tabId);}/**@@ -11166,11 +11169,20 @@ export class Agent extends LoopDetector {return recordCollectionReadProgress(coverage, args, result).madeProgress;}+ _deliveryCheckpointDocumentReadProgress(tabId, name, result) {+ if (name !== 'read_page') return false;+ const recorded = recordDocumentReadProgress(this.deliveryDocumentReads.get(tabId), result);+ this.deliveryDocumentReads.set(tabId, recorded.state);+ return recorded.madeProgress;+ }+_checkDeliveryObservationStreak(tabId, name, args = {}, result = null, options = {}) {const observation = this.constructor.DELIVERY_OBSERVATION_TOOLS.has(name)&& !isNetworkMutation(name, args);const collectionReadProgress = observation&& this._deliveryCheckpointCollectionReadProgress(tabId, name, args, result);+ const documentReadProgress = observation && !collectionReadProgress+ && this._deliveryCheckpointDocumentReadProgress(tabId, name, result);if (observation&& options.discoveredActionableTargets === true&& !this.deliveryActionableDiscoveryResets.has(tabId)) {@@ -11202,6 +11214,11 @@ export class Agent extends LoopDetector {this.deliveryObservationStreaks.delete(tabId);return { kind: 'none' };}+ if (documentReadProgress) {+ // The next window of a long page (document-read-progress.js) is not+ // counted. It does not clear the streak either: it is not task progress.+ return { kind: 'none' };+ }if (!observation) {// Meta calls (scratchpad, load_skill, failed actions, etc.) must not let// the model erase an outstanding delivery obligation. Reset only afterdiff --git a/src/firefox/src/agent/document-read-progress.js b/src/firefox/src/agent/document-read-progress.jsnew file mode 100644index 000000000..669762ca2--- /dev/null+++ b/src/firefox/src/agent/document-read-progress.js@@ -0,0 +1,73 @@+import { isReadPageWindowResult } from './read-page-window.js';++// read_page returns a long page a few thousand characters at a time, so a long+// article or README takes several windows, and the Summarize this page action+// asks for all of them. A window that adds text not read before is progress+// through a fixed page, not observation drift, and the delivery checkpoint does+// not count it. The first window of a page still counts, so does a window that+// rereads earlier text, and a run gets a limited number of uncounted windows:+// moving from page to page, or a page too long to finish, still reaches the+// checkpoint.+const MAX_DOCUMENTS = 8;+const MAX_PROGRESS_WINDOWS = 16;+const MIN_NEW_CHARS = 1000;++function documentUrl(value) {+ try {+ const url = new URL(String(value || ''));+ if (!['http:', 'https:', 'file:'].includes(url.protocol)) return '';+ url.hash = '';+ return url.href;+ } catch {+ return '';+ }+}++function deliveredWindow(result) {+ if (!isReadPageWindowResult(result) || result.success === false || result.error+ || result.accessState === 'blocked_by_page_gate') return null;+ const url = documentUrl(result.url);+ const originalLength = Number(result.originalLength);+ const start = Number(result.textOffset);+ const end = start + result.text.length;+ if (!url || !result.text.trim()+ || !Number.isSafeInteger(originalLength) || originalLength <= 0+ || !Number.isSafeInteger(start) || start < 0 || end > originalLength) return null;+ // Live pages change length as timestamps and counters update, so a page is+ // its address and extraction options; positions are compared as they come.+ return { key: `${url}|${result.includeChrome === true}`, start, end, whole: start === 0 && end === originalLength };+}++export function createDocumentReadProgress() {+ return { documents: new Map(), progressWindows: 0 };+}++export function recordDocumentReadProgress(state, result = null) {+ const current = state || createDocumentReadProgress();+ const window = deliveredWindow(result);+ if (!window) return { state: current, madeProgress: false };+ const ranges = current.documents.get(window.key);+ if (!ranges) {+ // A page read in one window leaves nothing further to read.+ if (!window.whole && current.documents.size < MAX_DOCUMENTS) {+ current.documents.set(window.key, [[window.start, window.end]]);+ }+ return { state: current, madeProgress: false };+ }+ let newChars = window.end - window.start;+ for (const [coveredStart, coveredEnd] of ranges) {+ newChars -= Math.max(0, Math.min(window.end, coveredEnd) - Math.max(window.start, coveredStart));+ }+ const merged = [];+ for (const range of [...ranges, [window.start, window.end]].sort((a, b) => a[0] - b[0])) {+ const last = merged.at(-1);+ if (last && range[0] <= last[1]) last[1] = Math.max(last[1], range[1]);+ else merged.push([...range]);+ }+ current.documents.set(window.key, merged);+ // A short last window counts in full; a window that mostly rereads does not.+ const madeProgress = current.progressWindows < MAX_PROGRESS_WINDOWS+ && newChars >= Math.min(MIN_NEW_CHARS, window.end - window.start);+ if (madeProgress) current.progressWindows += 1;+ return { state: current, madeProgress };+}diff --git a/test/document-read-progress.mjs b/test/document-read-progress.mjsnew file mode 100644index 000000000..61d453080--- /dev/null+++ b/test/document-read-progress.mjs@@ -0,0 +1,199 @@+import assert from 'node:assert/strict';+import { test } from 'node:test';+import { withFixedChoiceAnswers } from './semantic-decision-stub.mjs';++const area = { get: async () => ({}), set: async () => {}, remove: async () => {} };+const api = {+ storage: { local: area, session: area },+ runtime: { getURL: value => `extension://test/${value}`, sendMessage: async () => ({}) },+ tabs: { get: async id => ({ id, url: 'https://example.com/', title: 'Example' }), sendMessage: async () => ({}) },+};+globalThis.chrome = api;+globalThis.browser = api;++const PAGE_URL = 'https://github.com/esokullu/openbonsai';+const SUMMARIZE = 'Use read_page first for the current long-form page. While read_page returns hasMore:true, call it again with its exact continuationArgs until hasMore is false. Then summarize the page in 5-8 concise bullet points and include any action items. If you stop reading early, say which part of the page the summary covers.';+const call = (id, name, args) => ({ toolCalls: [{ id, function: { name, arguments: JSON.stringify(args) } }] });++function makeAskAgent(Agent, next) {+ const answered = withFixedChoiceAnswers(next, {});+ const provider = {+ name: 'summarize regression', model: 'test', promptTier: 'mid', contextWindow: 128000,+ supportsTools: true, supportsVision: false,+ chat: (messages, options) => answered(messages, options),+ async *chatStream(messages) {+ const response = await next(messages);+ if (response.content) yield { type: 'text', content: response.content };+ if (response.toolCalls) yield { type: 'tool_call', content: response.toolCalls.map((item, index) => ({ ...item, index })) };+ yield { type: 'done' };+ },+ };+ const agent = new Agent({ getActive: () => provider, getProvider: () => provider, getVisionProvider: async () => null });+ for (const name of ['_hydrate', '_persistSubmittedTurn', '_endTraceRun', '_manageContext', '_maybeEmitAskModeHandoff',+ '_maybeReinjectAdapter']) agent[name] = async () => {};+ agent._persist = () => {};+ agent._persistNow = async () => ({ ok: true });+ agent._startTraceRun = async () => null;+ agent._beginReadCompleteness = async () => null;+ agent._checkCostAllowance = async () => null;+ agent._recordCostUsage = async () => null;+ agent._currentUrl = async () => PAGE_URL;+ agent._getTabUrlTitle = async () => ({ tabUrl: PAGE_URL, tabTitle: 'esokullu/openbonsai' });+ agent._enrichUserMessageWithCurrentPage = async (_tab, _messages, content) => ({ role: 'user', content });+ agent._plannerMode = () => 'off';+ agent._shouldAutoScreenshot = () => false;+ agent._pageFeedbackIdleMs = 0;+ agent._completionDoneBlock = () => null;+ agent.maxSteps = Infinity;+ return agent;+}++// The README from the trace that prompted this: 42,833 characters, read in+// 6,000-character windows by the Summarize this page action.+const README_LENGTH = 42833;++for (const build of ['chrome', 'firefox']) {+ const { Agent } = await import(`../src/${build}/src/agent/agent.js`);+ const { recordDocumentReadProgress } = await import(`../src/${build}/src/agent/document-read-progress.js`);+ const { applyReadPageWindow } = await import(`../src/${build}/src/agent/read-page-window.js`);++ const page = (length = README_LENGTH, { url = PAGE_URL, includeChrome = false } = {}) => ({+ url, title: 'esokullu/openbonsai', text: 'w'.repeat(length), includeChrome,+ links: [{ text: 'Code', href: url }], forms: [], shadowDOM: [],+ });+ const read = (offset, { limit = 6000, length, url, includeChrome } = {}) =>+ applyReadPageWindow(page(length, { url, includeChrome }), { offset, limit, includeChrome });++ test(`${build}: each new read_page window of one page is progress, the first and rereads are not`, () => {+ let state;+ const record = (offset, options) => {+ const recorded = recordDocumentReadProgress(state, read(offset, options));+ state = recorded.state;+ return recorded.madeProgress;+ };+ assert.equal(record(0), false, 'the first window is an ordinary observation');+ for (let offset = 6000; offset < 42000; offset += 6000) {+ assert.equal(record(offset), true, `window at ${offset} adds new text`);+ }+ assert.equal(record(42000), true, 'the short last window adds new text');+ assert.equal(record(42000), false, 'rereading the last window is not progress');+ assert.equal(record(0), false, 'starting over is not progress');+ assert.equal(record(3000), false, 'a window inside text already read is not progress');+ });++ test(`${build}: pages are told apart by address and extraction options`, () => {+ let recorded = recordDocumentReadProgress(undefined, read(0));+ recorded = recordDocumentReadProgress(recorded.state, read(6000, { includeChrome: true }));+ assert.equal(recorded.madeProgress, false, 'a read with page chrome is another document');+ recorded = recordDocumentReadProgress(recorded.state, read(6000, { url: 'https://github.com/esokullu/other' }));+ assert.equal(recorded.madeProgress, false, 'another address is another document');+ recorded = recordDocumentReadProgress(recorded.state, read(6000, { url: `${PAGE_URL}#readme` }));+ assert.equal(recorded.madeProgress, true, 'a fragment is the same page');+ });++ test(`${build}: a page read in one window, a blocked page or a failed read is never progress`, () => {+ let recorded = recordDocumentReadProgress(undefined, read(0, { length: 3000 }));+ recorded = recordDocumentReadProgress(recorded.state, read(0, { length: 3000 }));+ assert.equal(recorded.madeProgress, false, 'a whole page has nothing further to read');+ recorded = recordDocumentReadProgress(undefined, read(0));+ const blocked = { ...read(6000), accessState: 'blocked_by_page_gate' };+ assert.equal(recordDocumentReadProgress(recorded.state, blocked).madeProgress, false);+ assert.equal(recordDocumentReadProgress(recorded.state, { success: false, error: 'No tab' }).madeProgress, false);+ assert.equal(recordDocumentReadProgress(recorded.state, { success: true }).madeProgress, false);+ });++ test(`${build}: a run gets sixteen uncounted windows and eight pages`, () => {+ let state;+ const total = 600000;+ let progress = 0;+ for (let offset = 0; offset < 30 * 6000; offset += 6000) {+ const recorded = recordDocumentReadProgress(state, read(offset, { length: total }));+ state = recorded.state;+ if (recorded.madeProgress) progress += 1;+ }+ assert.equal(progress, 16);++ state = undefined;+ for (let index = 0; index < 9; index++) {+ const url = `https://example.com/article-${index}`;+ state = recordDocumentReadProgress(state, read(0, { url })).state;+ const next = recordDocumentReadProgress(state, read(6000, { url }));+ assert.equal(next.madeProgress, index < 8, `page ${index + 1}`);+ state = next.state;+ }+ });++ test(`${build}: Summarize this page reads a long README to the end without forced delivery`, () => {+ const agent = new Agent({});+ const tab = `${build}-summarize`;+ const enforced = { enforceTerminal: true };+ const checks = [];+ for (let offset = 0; offset < README_LENGTH; offset += 6000) {+ const args = offset ? { continuationArgs: { includeChrome: false, offset, limit: 6000 } } : { offset: 0, limit: 6000, includeChrome: false };+ checks.push(agent._checkDeliveryObservationStreak(tab, 'read_page', args, read(offset), enforced));+ }+ assert.equal(checks.length, 8);+ assert.deepEqual(checks.map(check => check.kind), Array(8).fill('none'));+ assert.equal(agent.deliveryObservationStreaks.get(tab), 1, 'only the first window counts');+ agent._clearRunLoopState(tab);+ assert.equal(agent.deliveryDocumentReads.has(tab), false, 'a new run starts its own page coverage');+ });++ test(`${build}: rereading, other observations and a page past the window budget still reach the checkpoint`, () => {+ const agent = new Agent({});+ const enforced = { enforceTerminal: true };+ const rereadTab = `${build}-reread`;+ let check;+ for (let index = 0; index < 8; index++) check = agent._checkDeliveryObservationStreak(rereadTab, 'read_page', {}, read(0), enforced);+ assert.equal(check.kind, 'deliver', 'the same window read eight times');++ const mixedTab = `${build}-mixed`;+ for (let index = 0; index < 3; index++) agent._checkDeliveryObservationStreak(mixedTab, 'scroll', {}, { success: true }, enforced);+ agent._checkDeliveryObservationStreak(mixedTab, 'read_page', {}, read(0), enforced);+ assert.equal(agent.deliveryObservationStreaks.get(mixedTab), 4);+ assert.equal(agent._checkDeliveryObservationStreak(mixedTab, 'read_page', {}, read(6000), enforced).kind, 'none');+ assert.equal(agent.deliveryObservationStreaks.get(mixedTab), 4, 'a new window neither counts nor clears earlier observations');++ const longTab = `${build}-long`;+ const kinds = [];+ for (let offset = 0; kinds.at(-1) !== 'deliver' && offset < 100 * 6000; offset += 6000) {+ kinds.push(agent._checkDeliveryObservationStreak(longTab, 'read_page', {}, read(offset, { length: 600000 }), enforced).kind);+ }+ assert.equal(kinds.length, 24, 'one counted window, sixteen uncounted, then seven counted');+ assert.equal(kinds.filter(kind => kind === 'nudge').length, 1);+ });++ // The traced run: eight windows, the last one ending the page, then done.+ // Before, the eighth window forced a done-only turn and a partial outcome.+ for (const streaming of [false, true]) test(`${build}: ${streaming ? 'stream' : 'chat'} Ask run summarizes the whole README as done, not partial`, async () => {+ const tab = `${build}-ask-summary-${streaming}`, updates = [], offsets = [];+ const summary = '- OpenBonsai compresses dense models to ternary weights.';+ let requests = 0;+ const next = async () => {+ requests += 1;+ if (requests === 1) return call('read-1', 'read_page', { offset: 0, limit: 6000, includeChrome: false });+ if (requests <= 8) {+ return call(`read-${requests}`, 'read_page', { continuationArgs: { includeChrome: false, offset: (requests - 1) * 6000, limit: 6000 } });+ }+ return call('finished', 'done', { summary });+ };+ const agent = makeAskAgent(Agent, next);+ agent.executeTool = async (_tab, name, args) => {+ if (name === 'done') return { done: true, success: true, summary: args.summary };+ assert.equal(name, 'read_page');+ const offset = Number(args.offset ?? args.continuationArgs?.offset ?? 0);+ offsets.push(offset);+ return read(offset);+ };+ const update = (type, data) => updates.push({ type, data });+ const options = { detachedRequestId: `summary-${build}-${streaming}`, askStreamingEnabled: streaming };+ const result = streaming+ ? await agent.processMessageStream(tab, SUMMARIZE, update, 'ask', options)+ : await agent.processMessage(tab, SUMMARIZE, update, 'ask', [], options);+ const warnings = updates.filter(entry => entry.type === 'warning').map(entry => entry.data?.message);+ assert.deepEqual(offsets, [0, 6000, 12000, 18000, 24000, 30000, 36000, 42000]);+ assert.equal(requests, 9, JSON.stringify(warnings));+ assert.equal(String(result).trim(), summary);+ assert.equal(warnings.some(message => /observation tools are now stopping|DELIVERY/.test(String(message))), false, JSON.stringify(warnings));+ });+}