Commit 1a82a17
authored
feat(desktop): browser pages as resource tabs, agent works in a background tab (#7745)
* feat(desktop): browser pages as resource tabs, agent works in the background
Each live desktop browser page is now its own resource tab in the Chat
panel, derived from the desktop app's tab list instead of a persisted
singleton "Browser" resource with a second tab strip inside it. The inner
browser tab strip, tab pinning, duplicate, reorder, the native tab context
menu, and the auto-replacement of a closed last tab are removed.
The agent drives its own tab (the desktop's automation cursor) without
moving the user's visible page: the renderer no longer force-activates the
browser on every tool call nor auto-switches the panel to the agent's tab.
The agent's tab is announced as resource activity, so the existing view
policy shows it or badges it depending on whether the user has taken over
selection. Mentions and attachments point at exact tabs; the chat row never
stores browser resources, and legacy rows are dropped on read.
* fix(desktop): settle browser tab sync edge cases and ease the tab width cap
Review and in-app verification of the resource-tab browser model found
five problems, all fixed here with tests:
- The strip's switch and follow effects could trade `switch-tab` calls
forever after a native switch; the switch effect is now keyed on the
selection alone and ignores the switch it requested itself.
- Migrating a pending chat onto its durable id briefly removed and re-added
every browser tab; a missing store bucket is no longer read as closed.
- Chat hydration could replace the resource list underneath a fresh add,
dropping restored tabs on return; a tab stays projected until its
resource is seen. Hydration also falls back to the last server-held
resource instead of whichever tab happened to land first.
- Strip-driven `switch-tab` no longer claims the page for the user
(`claim: false`), so the agent can still close or adopt it; a user
closing the agent's tab leaves the agent cursor unset rather than
announcing the neighbour as agent activity.
- The driver marked every restored scope as material, refusing pending
chat migration after an empty restore; only a restore that yields pages
does now, matching the session layer. The bridge snapshot is regenerated
with the documented `'new-tab'` fallback.
Resource tab titles ellipsize at 200px for one or two tabs, 180px for
three, and 160px from four on, one small step at a time.
* fix(desktop): mirror strip order into native tabs and drag live tab titles
Reordering a browser tab in the resource strip now reorders the desktop's
native tab list too, so restore and the agent's tab list keep the strip's
order (`reorderTab` returns as an optional bridge method). Dragging a tab
into the chat carries the strip's live title rather than the title captured
when the tab was added. The fork route test follows the new policy that
stored browser rows are dropped.
* fix(emcn): drive the loader spin period from a CSS variable instead of an inline style1 parent 8f6ccf7 commit 1a82a17
56 files changed
Lines changed: 1297 additions & 1562 deletions
File tree
- apps
- desktop/src
- main
- browser-agent
- preload
- sim
- app
- (landing)/components/hero/components/hero-platform-loop
- api/mothership/chats/[chatId]/fork
- workspace/[workspaceId]/home
- components
- mothership-view
- components
- add-resource-dropdown
- resource-content
- components/browser-session
- resource-registry
- resource-tabs
- user-input/components
- hooks
- stream
- lib
- browser-agent
- copilot
- chat
- resources
- stores/browser-session
- packages
- browser-protocol/src
- desktop-bridge
- src
- emcn/src/icons
- animate
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
1280 | 1292 | | |
1281 | 1293 | | |
1282 | 1294 | | |
| |||
1395 | 1407 | | |
1396 | 1408 | | |
1397 | 1409 | | |
1398 | | - | |
| 1410 | + | |
1399 | 1411 | | |
1400 | 1412 | | |
1401 | 1413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
797 | | - | |
798 | 797 | | |
799 | 798 | | |
800 | | - | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
801 | 804 | | |
802 | 805 | | |
803 | 806 | | |
| |||
905 | 908 | | |
906 | 909 | | |
907 | 910 | | |
908 | | - | |
| 911 | + | |
909 | 912 | | |
910 | 913 | | |
911 | 914 | | |
| |||
2368 | 2371 | | |
2369 | 2372 | | |
2370 | 2373 | | |
2371 | | - | |
2372 | | - | |
| 2374 | + | |
2373 | 2375 | | |
2374 | 2376 | | |
2375 | 2377 | | |
| |||
4782 | 4784 | | |
4783 | 4785 | | |
4784 | 4786 | | |
4785 | | - | |
4786 | | - | |
4787 | | - | |
4788 | | - | |
4789 | | - | |
4790 | | - | |
4791 | | - | |
4792 | | - | |
4793 | | - | |
4794 | | - | |
4795 | 4787 | | |
4796 | 4788 | | |
4797 | | - | |
| 4789 | + | |
4798 | 4790 | | |
4799 | 4791 | | |
4800 | 4792 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 44 | + | |
| 45 | + | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
| |||
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
58 | | - | |
| 54 | + | |
59 | 55 | | |
60 | 56 | | |
61 | 57 | | |
| |||
834 | 830 | | |
835 | 831 | | |
836 | 832 | | |
837 | | - | |
| 833 | + | |
838 | 834 | | |
839 | 835 | | |
840 | 836 | | |
| |||
0 commit comments