Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep browser automation available without a tab #30062

Mergedvoltcrash(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/30062/headmerged by juliusmarminge View on GitHub

Showing 4 changed files with 35 additions and 2 deletions (loading 1).

x
0 of 4 viewed, 4 left
1 addition and 1 deletionapps/server/src/mcp/toolkits/preview/tools.tsModified
View file
@@ -59,7 +59,7 @@
​
const PreviewStatusTool = Tool.make("preview_status", {
description:
- "Report preview tab state: owner, pending dialog, URL, title, loading, viewport, and size. `tabs` lists this thread's tabs. `profiles` lists logins for `preview_open`. Read any listed tab. Act only on your tab, or an unclaimed tab with no human in control.",
+ "Report tab state: owner, dialog, URL, title, loading and viewport. No tab (`tabId:null`): try `preview_open`. `tabs`: thread tabs; `profiles`: logins. Read any tab; act on yours or unclaimed tabs without human control.",
parameters: PreviewAutomationTabTargetInput,
success: PreviewAutomationStatus,
failure: PreviewToolFailure,
33 additions and 0 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -3926,6 +3926,39 @@
).pipe(Effect.provide(layer)),
+it.effect("browser automation stays available without an open tab", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const { broker, tabId } = yield* ready;
+ const emptyScope = {
+ ...scope,
+ thread: { ...scope.thread, threadId: ThreadId.make("empty-browser-thread") },
+ };
+ const empty = yield* broker.invoke<PreviewAutomationStatus>({
+ scope: emptyScope,
+ operation: "status",
+ input: {},
+ });