chore: move state to tab, do not cache snapshot (#730)
This commit is contained in:
parent
cfcca40b90
commit
468c84eb8f
23 changed files with 291 additions and 355 deletions
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
|
||||
import { z } from 'zod';
|
||||
import { defineTool } from './tool.js';
|
||||
import { defineTabTool } from './tool.js';
|
||||
|
||||
import type * as playwright from 'playwright';
|
||||
|
||||
const requests = defineTool({
|
||||
const requests = defineTabTool({
|
||||
capability: 'core',
|
||||
|
||||
schema: {
|
||||
|
|
@ -30,8 +30,8 @@ const requests = defineTool({
|
|||
type: 'readOnly',
|
||||
},
|
||||
|
||||
handle: async context => {
|
||||
const requests = context.currentTabOrDie().requests();
|
||||
handle: async tab => {
|
||||
const requests = tab.requests();
|
||||
const log = [...requests.entries()].map(([request, response]) => renderRequest(request, response)).join('\n');
|
||||
return {
|
||||
code: [`// <internal code to list network requests>`],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue