feat(browser): import sessions and add agent PiP#1993
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
🚧 Files skipped from review as they are similar to previous changes (14)
📝 WalkthroughWalkthroughAgent Browser gains run-aware, renderer-managed PiP preview capture and browser-panel integration. A macOS Chrome/Arc cookie import workflow adds staged preview, transactional apply, verification, rollback, typed routes, and settings UI. Agent registry versions and model catalog metadata are also updated. ChangesAgent Browser PiP
Browser profile import
Catalog updates
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
resources/model-db/providers.json (2)
176998-177022: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winCorrect the model type mismatches.
recraft/recraft-v4.*rows output images but are still markedchat; these should beimageGeneration.- The
meta/muse-spark-1.1andmoonshotai/kimi-k3rows markedimageGenerationstill output text; these should bechat.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@resources/model-db/providers.json` around lines 176998 - 177022, Update the model type fields for all affected provider entries: change every recraft/recraft-v4.* row with image output from chat to imageGeneration, and change meta/muse-spark-1.1 and moonshotai/kimi-k3 from imageGeneration to chat. Preserve all other model metadata unchanged.
254651-254736: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winMark the TTS models as text→audio
tts-1*are text-in/audio-out models, somodalities.inputshould be["text"]andmodalities.outputshould be["audio"].- Drop
costhere until the catalog can represent character-based pricing; the current token-based estimator won’t handle these rates correctly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@resources/model-db/providers.json` around lines 254651 - 254736, Update all four TTS model entries in the shown catalog block so modalities.input is ["text"] and modalities.output is ["audio"], then remove their cost fields. Preserve each model’s existing identifiers, limits, tool_call, and reasoning metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@resources/model-db/providers.json`:
- Around line 129661-129680: Update the pricing data around the cost objects and
the associated sanitizeAggregate()/estimateUsageCostUsd() flow so tiered rates
are supported before retaining tiers and context_over_200k; select the
applicable threshold pricing when estimating usage, including requests above
200,000 context tokens. Alternatively, remove these unsupported tier fields from
both affected cost objects until tier-aware estimation is implemented.
In `@src/main/desktop/browser/BrowserProfileImportService.ts`:
- Around line 174-188: Update the rollback flow in the cookie import block to
preserve each existing cookie’s partition identity before clearing storage.
Extend or bypass cookieToSetDetails() so rollback restoration passes the
original partition metadata to setCookies(), ensuring partitioned cookies are
recreated in their original partitions while retaining current behavior for
unpartitioned cookies.
In `@src/renderer/src/components/browser/AgentBrowserPiP.vue`:
- Around line 433-440: Extend the preview reset logic around the
currentSessionId watcher to also react to active run changes within the same
session. When the run changes, clear hasFrame and hasPosition, reset
latestFrameSequence to -1, and clear the associated run/activity state before
loadStatus; also ensure browser/presenter recreation resets the sequence
watermark so new frames starting at zero are accepted.
In `@src/renderer/src/i18n/id-ID/settings.json`:
- Around line 552-575: Replace the English browser-import workflow values with
accurate translations for all keys in src/renderer/src/i18n/id-ID/settings.json
lines 552-575, src/renderer/src/i18n/it-IT/settings.json lines 552-575,
src/renderer/src/i18n/ja-JP/settings.json lines 224-247,
src/renderer/src/i18n/ko-KR/settings.json lines 224-247,
src/renderer/src/i18n/ms-MY/settings.json lines 552-575,
src/renderer/src/i18n/pl-PL/settings.json lines 552-575,
src/renderer/src/i18n/pt-BR/settings.json lines 224-247, and
src/renderer/src/i18n/ru-RU/settings.json lines 224-247. Preserve every existing
key and placeholder, including {count}, {expired}, and {partitioned}, while
translating titles, descriptions, statuses, actions, and error messages into
each catalog’s language.
In `@src/shared/contracts/events/browser.events.ts`:
- Around line 85-87: Update the frame payload schema’s data validator to require
value instanceof Uint8Array instead of the broader ArrayBuffer.isView check,
while preserving the existing 512 KiB byte-length limit.
In `@test/renderer/components/AgentBrowserPiP.test.ts`:
- Around line 24-123: Update the test teardown around setup() so every mounted
AgentBrowserPiP wrapper is unmounted in afterEach before restoring mocks. Track
each wrapper created by setup(), unmount all tracked wrappers after every test,
and clear the tracking collection to prevent listeners, watchers, and capture
timers from leaking between tests.
---
Outside diff comments:
In `@resources/model-db/providers.json`:
- Around line 176998-177022: Update the model type fields for all affected
provider entries: change every recraft/recraft-v4.* row with image output from
chat to imageGeneration, and change meta/muse-spark-1.1 and moonshotai/kimi-k3
from imageGeneration to chat. Preserve all other model metadata unchanged.
- Around line 254651-254736: Update all four TTS model entries in the shown
catalog block so modalities.input is ["text"] and modalities.output is
["audio"], then remove their cost fields. Preserve each model’s existing
identifiers, limits, tool_call, and reasoning metadata.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ac94d39a-7c2c-450e-aeab-161f5335ce31
⛔ Files ignored due to path filters (2)
src/renderer/src/lib/icons/icon-collections.generated.tsis excluded by!**/*.generated.*src/renderer/src/lib/icons/icon-whitelist.generated.tsis excluded by!**/*.generated.*
📒 Files selected for processing (61)
docs/features/agent-browser-pip/plan.mddocs/features/agent-browser-pip/spec.mddocs/features/agent-browser-pip/tasks.mddocs/features/browser-profile-import/plan.mddocs/features/browser-profile-import/spec.mddocs/features/browser-profile-import/tasks.mdresources/acp-registry/registry.jsonresources/model-db/providers.jsonsrc/main/agent/deepchat/runtime/dispatch.tssrc/main/desktop/browser/BrowserProfileImportService.tssrc/main/desktop/browser/YoBrowserPresenter.tssrc/main/desktop/browser/YoBrowserToolHandler.tssrc/main/desktop/browser/yoBrowserSession.tssrc/main/desktop/routes.tssrc/main/tool/agentTools/agentToolManager.tssrc/main/tool/index.tssrc/main/tool/runtimePorts.tssrc/renderer/api/BrowserClient.tssrc/renderer/settings/components/BrowserDataImportDialog.vuesrc/renderer/settings/components/DataSettings.vuesrc/renderer/src/components/browser/AgentBrowserPiP.vuesrc/renderer/src/components/sidepanel/BrowserPanel.vuesrc/renderer/src/components/sidepanel/ChatSidePanel.vuesrc/renderer/src/i18n/da-DK/settings.jsonsrc/renderer/src/i18n/de-DE/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/es-ES/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/he-IL/settings.jsonsrc/renderer/src/i18n/id-ID/settings.jsonsrc/renderer/src/i18n/it-IT/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/ms-MY/settings.jsonsrc/renderer/src/i18n/pl-PL/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/tr-TR/settings.jsonsrc/renderer/src/i18n/vi-VN/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/stores/ui/sidepanel.tssrc/renderer/src/views/ChatTabView.vuesrc/shared/contracts/domainSchemas.tssrc/shared/contracts/events.tssrc/shared/contracts/events/browser.events.tssrc/shared/contracts/routes.tssrc/shared/contracts/routes/browser.routes.tssrc/shared/types/browser.tssrc/shared/types/desktop.tssrc/shared/types/tool.d.tstest/main/desktop/browser/BrowserProfileImportService.test.tstest/main/desktop/browser/YoBrowserPresenter.test.tstest/main/routes/contracts.test.tstest/renderer/api/clients.test.tstest/renderer/components/AgentBrowserPiP.test.tstest/renderer/components/ChatSidePanel.test.tstest/renderer/components/ChatTabView.test.tstest/setup.ts
| "cost": { | ||
| "input": 2, | ||
| "output": 6, | ||
| "cache_read": 0.5, | ||
| "tiers": [ | ||
| { | ||
| "input": 4, | ||
| "output": 12, | ||
| "cache_read": 1, | ||
| "tier": { | ||
| "type": "context", | ||
| "size": 200000 | ||
| } | ||
| } | ||
| ], | ||
| "context_over_200k": { | ||
| "input": 4, | ||
| "output": 12, | ||
| "cache_read": 1 | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Implement tier-aware pricing before adding these cost objects.
sanitizeAggregate() discards tiers and context_over_200k because it retains only numeric cost values. estimateUsageCostUsd() therefore always applies the base rate, underestimating requests above each threshold.
Either extend the sanitized contract and estimator to select the applicable tier, or remove these unsupported fields until that support exists.
Also applies to: 129722-129741
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@resources/model-db/providers.json` around lines 129661 - 129680, Update the
pricing data around the cost objects and the associated
sanitizeAggregate()/estimateUsageCostUsd() flow so tiered rates are supported
before retaining tiers and context_over_200k; select the applicable threshold
pricing when estimating usage, including requests above 200,000 context tokens.
Alternatively, remove these unsupported tier fields from both affected cost
objects until tier-aware estimation is implemented.
| "button": "Import website data", | ||
| "title": "Import browser session data", | ||
| "description": "Choose a Chrome or Arc profile. macOS may ask you to authorize Keychain access. The source is never modified.", | ||
| "scanning": "Looking for browser profiles...", | ||
| "unsupportedTitle": "Not supported on this platform", | ||
| "unsupportedDescription": "Direct browser data import is currently available only on macOS. Windows remains unsupported because current Chrome data is app-bound.", | ||
| "profileLabel": "Source profile", | ||
| "profilePlaceholder": "Select a profile", | ||
| "noProfiles": "No supported Chrome or Arc profiles with cookie data were found.", | ||
| "cookies": "Cookies and sessions", | ||
| "supported": "Included in this import", | ||
| "otherData": "Passwords and web storage", | ||
| "notIncluded": "Not included in this version", | ||
| "preview": "Authorize and preview", | ||
| "previewTitle": "Ready to replace YoBrowser cookies", | ||
| "previewDescription": "{count} cookies can be imported. Existing YoBrowser cookies will be replaced.", | ||
| "skipped": "Skipped: {expired} expired, {partitioned} partitioned.", | ||
| "confirm": "Replace and import", | ||
| "doneTitle": "Import complete", | ||
| "doneDescription": "Imported {count} cookies. Open browser pages were reloaded.", | ||
| "keyDenied": "Keychain access was denied or the browser key could not be read.", | ||
| "previewExpired": "The source changed or the preview expired. Create a new preview.", | ||
| "encryptionUnsupported": "This profile uses an encryption format that this importer does not support.", | ||
| "failed": "Import failed before completion. Existing YoBrowser cookies were restored when mutation had started." |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Localize the browser-import workflow instead of copying English values.
All eight locale catalogs currently display the complete workflow in English.
src/renderer/src/i18n/id-ID/settings.json#L552-L575: provide Indonesian translations.src/renderer/src/i18n/it-IT/settings.json#L552-L575: provide Italian translations.src/renderer/src/i18n/ja-JP/settings.json#L224-L247: provide Japanese translations.src/renderer/src/i18n/ko-KR/settings.json#L224-L247: provide Korean translations.src/renderer/src/i18n/ms-MY/settings.json#L552-L575: provide Malay translations.src/renderer/src/i18n/pl-PL/settings.json#L552-L575: provide Polish translations.src/renderer/src/i18n/pt-BR/settings.json#L224-L247: provide Brazilian Portuguese translations.src/renderer/src/i18n/ru-RU/settings.json#L224-L247: provide Russian translations.
📍 Affects 8 files
src/renderer/src/i18n/id-ID/settings.json#L552-L575(this comment)src/renderer/src/i18n/it-IT/settings.json#L552-L575src/renderer/src/i18n/ja-JP/settings.json#L224-L247src/renderer/src/i18n/ko-KR/settings.json#L224-L247src/renderer/src/i18n/ms-MY/settings.json#L552-L575src/renderer/src/i18n/pl-PL/settings.json#L552-L575src/renderer/src/i18n/pt-BR/settings.json#L224-L247src/renderer/src/i18n/ru-RU/settings.json#L224-L247
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/renderer/src/i18n/id-ID/settings.json` around lines 552 - 575, Replace
the English browser-import workflow values with accurate translations for all
keys in src/renderer/src/i18n/id-ID/settings.json lines 552-575,
src/renderer/src/i18n/it-IT/settings.json lines 552-575,
src/renderer/src/i18n/ja-JP/settings.json lines 224-247,
src/renderer/src/i18n/ko-KR/settings.json lines 224-247,
src/renderer/src/i18n/ms-MY/settings.json lines 552-575,
src/renderer/src/i18n/pl-PL/settings.json lines 552-575,
src/renderer/src/i18n/pt-BR/settings.json lines 224-247, and
src/renderer/src/i18n/ru-RU/settings.json lines 224-247. Preserve every existing
key and placeholder, including {count}, {expired}, and {partitioned}, while
translating titles, descriptions, statuses, actions, and error messages into
each catalog’s language.
Summary
WebContentsViewat 1280×800 in a focusless offscreen render host, then reparent that exact view into Browser on panel handoffWhy
YoBrowser currently starts with an isolated website session, forcing users to sign in again, and every Agent browser action opens the right-side panel even when the user intentionally closed it. The first PiP implementation also embedded the live native page, which made the preview clickable and created a focus/blur feedback loop. This change improves transferable session continuity and makes Agent activity visible without exposing an interactive mini-browser or taking over the chat layout.
User impact
Users on macOS can explicitly import supported Chrome profile cookies into the global YoBrowser session and repeat the operation to replace local cookie state. Agent browser pages appear as a draggable read-only mirror only while the owning Agent run and foreground chat are active. Opening Browser moves the same live page into the panel without navigation, page recreation, or session loss.
Before
After
V1 boundaries
localStorage,sessionStorage, partitioned cookies, visible multi-tabs, and fit-desktop emulation remain deferredValidation
pnpm run formatpnpm run i18npnpm run lintpnpm run typecheckpnpm testpnpm run buildSummary by CodeRabbit
New Features
Documentation