Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(browser): share headless fallback and recover native profiles #18217

Closeddavidesala23(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/18217/headopened View on GitHub

Showing 17 changed files with 134 additions and 3 deletions (loading 14).

x
0 of 17 viewed, 17 left
2 additions and 2 deletionsapps/server/src/mcp/toolkits/preview/tools.tsModified
View file
@@ -64,7 +64,7 @@
​
const PreviewStatusTool = Tool.make("preview_status", {
description:
- "Report whether a collaborative browser tab is automation-capable, including its control owner, pending dialog, URL, title, visibility, loading state, viewport mode, and measured CSS-pixel size. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab, or the tab the user is viewing when you have none. Server hosts also list every tab in the thread (tabs) with its owner, including tabs the user opened, and the browser profiles preview_open accepts. You can read any listed tab; act only on your own tabs, or on an unclaimed tab while no human controls it.",
+ "Report whether a collaborative browser tab is automation-capable, including its control owner, pending dialog, URL, title, visibility, loading state, viewport mode, and measured CSS-pixel size. Server hosts report serverPageMode (native or headless) for the current tab and tabs list; absence means the host did not report the backing, not that it is native. Pass tabId to inspect a specific tab; omit it to use this agent session's current tab, or the tab the user is viewing when you have none. Server hosts also list every tab in the thread (tabs) with its owner, including tabs the user opened, and the browser profiles preview_open accepts. You can read any listed tab; act only on your own tabs, or on an unclaimed tab while no human controls it.",
parameters: PreviewAutomationTabTargetInput,
success: PreviewAutomationStatus,
failure: PreviewToolFailure,
@@ -78,7 +78,7 @@
const PreviewOpenTool = browserTool(
Tool.make("preview_open", {
description:
- "Initialize a collaborative browser tab and open its thread-bound inline preview by default. Set open=false for background-only automation. Pass tabId to reuse a specific existing tab, set reuseExistingTab=false to create another tab, or omit both to use this agent session's current tab. Parallel subagents sharing a provider session must each open with reuseExistingTab=false and pass their returned tabId on every call. Pass profileId (an id or name from preview_status profiles) to open under a browser profile and its saved logins; omit it for the user's default profile. Another agent session's tabs can be read but not operated.",
+ "Initialize a collaborative browser tab and open its thread-bound inline preview by default. Set open=false for background-only automation. Pass tabId to reuse a specific existing tab, set reuseExistingTab=false to create another tab, or omit both to use this agent session's current tab. Parallel subagents sharing a provider session must each open with reuseExistingTab=false and pass their returned tabId on every call. Pass profileId (an id or name from preview_status profiles) to open under a browser profile; omit it for the user's default profile. To recover a desktop profile's existing sign-ins after a headless fallback, pass its profileId explicitly with open=true and reuseExistingTab=false. On a desktop server, this new foreground tab visits the requested URL only after connecting to the native page; attachment failure closes the new blank tab and preserves previous tabs. Incognito, background, and standalone server opens retain headless support. Another agent session's tabs can be read but not operated.",
parameters: PreviewAutomationOpenInput,
success: PreviewAutomationStatus,
failure: PreviewToolFailure,
83 additions and 0 deletionsapps/server/src/preview/Manager.test.tsModified
View file
@@ -100,6 +100,89 @@
}),
​
+ it.effect("publishes the server's page mode once and preserves a headless choice", () =>
+ Effect.gen(function* () {
+ const threadId = freshThreadId();