chore: follow up on tab snapshot capture (#739)

This commit is contained in:
Pavel Feldman 2025-07-22 17:43:42 -07:00 committed by GitHub
parent 601a74305c
commit 6320b08173
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 80 additions and 101 deletions

View file

@ -48,9 +48,8 @@ const selectTab = defineTool({
},
handle: async (context, params, response) => {
const tab = await context.selectTab(params.index);
await context.selectTab(params.index);
response.setIncludeSnapshot();
response.addSnapshot(await tab.captureSnapshot());
},
});
@ -71,9 +70,7 @@ const newTab = defineTool({
const tab = await context.newTab();
if (params.url)
await tab.navigate(params.url);
response.setIncludeSnapshot();
response.addSnapshot(await tab.captureSnapshot());
},
});
@ -92,10 +89,7 @@ const closeTab = defineTool({
handle: async (context, params, response) => {
await context.closeTab(params.index);
response.setIncludeTabs();
response.addCode(`await myPage.close();`);
if (context.tabs().length)
response.addSnapshot(await context.currentTabOrDie().captureSnapshot());
response.setIncludeSnapshot();
},
});