playwright 1.58.0-alpha-1764708599000 → 1.58.0-alpha-2025-12-04

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/ThirdPartyNotices.txt +408 -2893
  2. package/lib/agents/agent.js +2 -3
  3. package/lib/agents/performTask.js +14 -20
  4. package/lib/index.js +2 -2
  5. package/lib/mcp/browser/browserServerBackend.js +2 -1
  6. package/lib/mcp/browser/response.js +129 -53
  7. package/lib/mcp/browser/tab.js +2 -5
  8. package/lib/mcp/browser/tools/common.js +5 -5
  9. package/lib/mcp/browser/tools/console.js +3 -3
  10. package/lib/mcp/browser/tools/dialogs.js +4 -4
  11. package/lib/mcp/browser/tools/evaluate.js +5 -5
  12. package/lib/mcp/browser/tools/files.js +3 -3
  13. package/lib/mcp/browser/tools/form.js +7 -7
  14. package/lib/mcp/browser/tools/install.js +2 -2
  15. package/lib/mcp/browser/tools/keyboard.js +6 -6
  16. package/lib/mcp/browser/tools/mouse.js +11 -11
  17. package/lib/mcp/browser/tools/navigate.js +4 -4
  18. package/lib/mcp/browser/tools/network.js +2 -2
  19. package/lib/mcp/browser/tools/pdf.js +3 -3
  20. package/lib/mcp/browser/tools/runCode.js +3 -3
  21. package/lib/mcp/browser/tools/screenshot.js +7 -7
  22. package/lib/mcp/browser/tools/snapshot.js +14 -14
  23. package/lib/mcp/browser/tools/tabs.js +4 -4
  24. package/lib/mcp/browser/tools/tool.js +8 -7
  25. package/lib/mcp/browser/tools/tracing.js +3 -3
  26. package/lib/mcp/browser/tools/verify.js +15 -15
  27. package/lib/mcp/browser/tools/wait.js +5 -5
  28. package/lib/mcp/sdk/http.js +1 -1
  29. package/lib/mcp/sdk/proxyBackend.js +1 -1
  30. package/lib/mcp/sdk/server.js +1 -1
  31. package/lib/mcp/sdk/tool.js +2 -2
  32. package/lib/mcp/test/generatorTools.js +9 -9
  33. package/lib/mcp/test/plannerTools.js +16 -16
  34. package/lib/mcp/test/testBackend.js +2 -2
  35. package/lib/mcp/test/testTools.js +9 -9
  36. package/package.json +2 -2
  37. package/types/test.d.ts +1 -3
  38. package/lib/mcp/sdk/bundle.js +0 -84
  39. package/lib/mcpBundleImpl.js +0 -62
@@ -21,10 +21,10 @@ __export(agent_exports, {
21
21
  Agent: () => Agent
22
22
  });
23
23
  module.exports = __toCommonJS(agent_exports);
24
- var import_bundle = require("../mcp/sdk/bundle");
24
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
25
  class Agent {
26
26
  constructor(loopName, spec, clients, resultSchema) {
27
- this.loop = new import_bundle.Loop(loopName);
27
+ this.loop = new import_mcpBundle.Loop(loopName, { model: spec.model });
28
28
  this.spec = spec;
29
29
  this.clients = clients;
30
30
  this.resultSchema = resultSchema;
@@ -41,7 +41,6 @@ ${task}
41
41
  Params:
42
42
  ${JSON.stringify(params, null, 2)}`, {
43
43
  ...options,
44
- // TODO: fix types in tiny-loop
45
44
  tools,
46
45
  callTool,
47
46
  resultSchema: this.resultSchema
@@ -21,40 +21,34 @@ __export(performTask_exports, {
21
21
  performTask: () => performTask
22
22
  });
23
23
  module.exports = __toCommonJS(performTask_exports);
24
- var import_utils = require("playwright-core/lib/utils");
24
+ var import_utilsBundle = require("playwright-core/lib/utilsBundle");
25
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
26
  var import_browserContextFactory = require("../mcp/browser/browserContextFactory");
26
27
  var import_browserServerBackend = require("../mcp/browser/browserServerBackend");
27
28
  var import_config = require("../mcp/browser/config");
28
- var import_bundle = require("../mcp/sdk/bundle");
29
29
  var import_server = require("../mcp/sdk/server");
30
- async function performTask(context, task) {
30
+ async function performTask(context, task, options) {
31
31
  const backend = new import_browserServerBackend.BrowserServerBackend(import_config.defaultConfig, (0, import_browserContextFactory.identityBrowserContextFactory)(context));
32
32
  const client = await (0, import_server.wrapInClient)(backend, { name: "Internal", version: "0.0.0" });
33
- const loop = new import_bundle.Loop("copilot");
34
33
  const callTool = async (params) => {
35
34
  return await client.callTool(params);
36
35
  };
36
+ const loop = new import_mcpBundle.Loop(options.provider ?? "github", {
37
+ model: options.model ?? "claude-sonnet-4.5",
38
+ reasoning: options.reasoning,
39
+ temperature: options.temperature,
40
+ maxTokens: options.maxTokens,
41
+ summarize: true,
42
+ debug: import_utilsBundle.debug,
43
+ callTool,
44
+ tools: await backend.listTools()
45
+ });
37
46
  try {
38
- return await loop.run(task, {
39
- // TODO: fix types in tiny-loop
40
- tools: await backend.listTools(),
41
- callTool,
42
- logger
43
- });
47
+ return await loop.run(task);
44
48
  } finally {
45
49
  await client.close();
46
50
  }
47
51
  }
48
- function logger(category, text, details = "") {
49
- const trimmedText = trim(text, 100);
50
- const trimmedDetails = trim(details, 100 - trimmedText.length - 1);
51
- console.log(import_utils.colors.bold(import_utils.colors.green(category)), trimmedText, import_utils.colors.dim(trimmedDetails));
52
- }
53
- function trim(text, maxLength) {
54
- if (text.length <= maxLength)
55
- return text;
56
- return text.slice(0, maxLength - 3) + "...";
57
- }
58
52
  // Annotate the CommonJS export names for ESM import in node:
59
53
  0 && (module.exports = {
60
54
  performTask
package/lib/index.js CHANGED
@@ -418,8 +418,8 @@ const playwrightFixtures = {
418
418
  }
419
419
  },
420
420
  _perform: async ({ context }, use) => {
421
- await use(async (task) => {
422
- await (0, import_performTask.performTask)(context, task);
421
+ await use(async (task, options) => {
422
+ await (0, import_performTask.performTask)(context, task, options ?? {});
423
423
  });
424
424
  }
425
425
  };
@@ -64,7 +64,8 @@ class BrowserServerBackend {
64
64
  context.setRunningTool(void 0);
65
65
  }
66
66
  response.logEnd();
67
- return response.serialize();
67
+ const _meta = rawArguments?._meta;
68
+ return response.serialize({ _meta });
68
69
  }
69
70
  serverClosed() {
70
71
  void this._context?.dispose().catch(import_log.logUnhandledError);
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var response_exports = {};
20
20
  __export(response_exports, {
21
+ RenderedResponse: () => RenderedResponse,
21
22
  Response: () => Response,
22
23
  parseResponse: () => parseResponse,
23
24
  requestDebug: () => requestDebug
@@ -71,6 +72,9 @@ class Response {
71
72
  setIncludeTabs() {
72
73
  this._includeTabs = true;
73
74
  }
75
+ setIncludeModalStates(modalStates) {
76
+ this._includeModalStates = modalStates;
77
+ }
74
78
  async finish() {
75
79
  if (this._includeSnapshot !== "none" && this._context.currentTab())
76
80
  this._tabSnapshot = await this._context.currentTabOrDie().captureSnapshot();
@@ -89,72 +93,64 @@ class Response {
89
93
  requestDebug(this.serialize({ omitSnapshot: true, omitBlobs: true }));
90
94
  }
91
95
  serialize(options = {}) {
92
- const response = [];
93
- if (this._result.length) {
94
- response.push("### Result");
95
- response.push(this._result.join("\n"));
96
- response.push("");
97
- }
98
- if (this._code.length) {
99
- response.push(`### Ran Playwright code
100
- \`\`\`js
101
- ${this._code.join("\n")}
102
- \`\`\``);
103
- response.push("");
96
+ const renderedResponse = new RenderedResponse();
97
+ if (this._result.length)
98
+ renderedResponse.results.push(...this._result);
99
+ if (this._code.length)
100
+ renderedResponse.code.push(...this._code);
101
+ if (this._includeSnapshot !== "none" || this._includeTabs) {
102
+ const tabsMarkdown = renderTabsMarkdown(this._context.tabs(), this._includeTabs);
103
+ if (tabsMarkdown.length)
104
+ renderedResponse.states.tabs = tabsMarkdown.join("\n");
104
105
  }
105
- if (this._includeSnapshot !== "none" || this._includeTabs)
106
- response.push(...renderTabsMarkdown(this._context.tabs(), this._includeTabs));
107
106
  if (this._tabSnapshot?.modalStates.length) {
108
- response.push(...(0, import_tab.renderModalStates)(this._context, this._tabSnapshot.modalStates));
109
- response.push("");
107
+ const modalStatesMarkdown = (0, import_tab.renderModalStates)(this._tabSnapshot.modalStates);
108
+ renderedResponse.states.modal = modalStatesMarkdown.join("\n");
110
109
  } else if (this._tabSnapshot) {
111
110
  const includeSnapshot = options.omitSnapshot ? "none" : this._includeSnapshot;
112
- response.push(renderTabSnapshot(this._tabSnapshot, includeSnapshot));
113
- response.push("");
111
+ renderTabSnapshot(this._tabSnapshot, includeSnapshot, renderedResponse);
112
+ } else if (this._includeModalStates) {
113
+ const modalStatesMarkdown = (0, import_tab.renderModalStates)(this._includeModalStates);
114
+ renderedResponse.states.modal = modalStatesMarkdown.join("\n");
114
115
  }
116
+ const redactedResponse = this._context.config.secrets ? renderedResponse.redact(this._context.config.secrets) : renderedResponse;
117
+ const includeMeta = options._meta && "dev.lowire/history" in options._meta && "dev.lowire/state" in options._meta;
118
+ const _meta = includeMeta ? redactedResponse.asMeta() : void 0;
115
119
  const content = [
116
- { type: "text", text: response.join("\n") }
120
+ { type: "text", text: redactedResponse.asText() }
117
121
  ];
118
122
  if (this._context.config.imageResponses !== "omit") {
119
123
  for (const image of this._images)
120
124
  content.push({ type: "image", data: options.omitBlobs ? "<blob>" : image.data.toString("base64"), mimeType: image.contentType });
121
125
  }
122
- this._redactSecrets(content);
123
- return { content, isError: this._isError };
124
- }
125
- _redactSecrets(content) {
126
- if (!this._context.config.secrets)
127
- return;
128
- for (const item of content) {
129
- if (item.type !== "text")
130
- continue;
131
- for (const [secretName, secretValue] of Object.entries(this._context.config.secrets))
132
- item.text = item.text.replaceAll(secretValue, `<secret>${secretName}</secret>`);
133
- }
126
+ return {
127
+ _meta,
128
+ content,
129
+ isError: this._isError
130
+ };
134
131
  }
135
132
  }
136
- function renderTabSnapshot(tabSnapshot, includeSnapshot) {
137
- const lines = [];
133
+ function renderTabSnapshot(tabSnapshot, includeSnapshot, response) {
138
134
  if (tabSnapshot.consoleMessages.length) {
139
- lines.push(`### New console messages`);
135
+ const lines2 = [];
140
136
  for (const message of tabSnapshot.consoleMessages)
141
- lines.push(`- ${trim(message.toString(), 100)}`);
142
- lines.push("");
137
+ lines2.push(`- ${trim(message.toString(), 100)}`);
138
+ response.updates.push({ category: "console", content: lines2.join("\n") });
143
139
  }
144
140
  if (tabSnapshot.downloads.length) {
145
- lines.push(`### Downloads`);
141
+ const lines2 = [];
146
142
  for (const entry of tabSnapshot.downloads) {
147
143
  if (entry.finished)
148
- lines.push(`- Downloaded file ${entry.download.suggestedFilename()} to ${entry.outputFile}`);
144
+ lines2.push(`- Downloaded file ${entry.download.suggestedFilename()} to ${entry.outputFile}`);
149
145
  else
150
- lines.push(`- Downloading file ${entry.download.suggestedFilename()} ...`);
146
+ lines2.push(`- Downloading file ${entry.download.suggestedFilename()} ...`);
151
147
  }
152
- lines.push("");
148
+ response.updates.push({ category: "downloads", content: lines2.join("\n") });
153
149
  }
154
150
  if (includeSnapshot === "incremental" && tabSnapshot.ariaSnapshotDiff === "") {
155
- return lines.join("\n");
151
+ return;
156
152
  }
157
- lines.push(`### Page state`);
153
+ const lines = [];
158
154
  lines.push(`- Page URL: ${tabSnapshot.url}`);
159
155
  lines.push(`- Page Title: ${tabSnapshot.title}`);
160
156
  if (includeSnapshot !== "none") {
@@ -166,25 +162,19 @@ function renderTabSnapshot(tabSnapshot, includeSnapshot) {
166
162
  lines.push(tabSnapshot.ariaSnapshot);
167
163
  lines.push("```");
168
164
  }
169
- return lines.join("\n");
165
+ response.states.page = lines.join("\n");
170
166
  }
171
167
  function renderTabsMarkdown(tabs, force = false) {
172
168
  if (tabs.length === 1 && !force)
173
169
  return [];
174
- if (!tabs.length) {
175
- return [
176
- "### Open tabs",
177
- 'No open tabs. Use the "browser_navigate" tool to navigate to a page first.',
178
- ""
179
- ];
180
- }
181
- const lines = ["### Open tabs"];
170
+ if (!tabs.length)
171
+ return ['No open tabs. Use the "browser_navigate" tool to navigate to a page first.'];
172
+ const lines = [];
182
173
  for (let i = 0; i < tabs.length; i++) {
183
174
  const tab = tabs[i];
184
175
  const current = tab.isCurrentTab() ? " (current)" : "";
185
176
  lines.push(`- ${i}:${current} [${tab.lastTitle()}] (${tab.page.url()})`);
186
177
  }
187
- lines.push("");
188
178
  return lines;
189
179
  }
190
180
  function trim(text, maxLength) {
@@ -192,6 +182,90 @@ function trim(text, maxLength) {
192
182
  return text;
193
183
  return text.slice(0, maxLength) + "...";
194
184
  }
185
+ class RenderedResponse {
186
+ constructor(copy) {
187
+ this.states = {};
188
+ this.updates = [];
189
+ this.results = [];
190
+ this.code = [];
191
+ if (copy) {
192
+ this.states = copy.states;
193
+ this.updates = copy.updates;
194
+ this.results = copy.results;
195
+ this.code = copy.code;
196
+ }
197
+ }
198
+ asText() {
199
+ const text = [];
200
+ if (this.results.length)
201
+ text.push(`### Result
202
+ ${this.results.join("\n")}
203
+ `);
204
+ if (this.code.length)
205
+ text.push(`### Ran Playwright code
206
+ ${this.code.join("\n")}
207
+ `);
208
+ for (const { category, content } of this.updates) {
209
+ if (!content.trim())
210
+ continue;
211
+ switch (category) {
212
+ case "console":
213
+ text.push(`### New console messages
214
+ ${content}
215
+ `);
216
+ break;
217
+ case "downloads":
218
+ text.push(`### Downloads
219
+ ${content}
220
+ `);
221
+ break;
222
+ }
223
+ }
224
+ for (const [category, value] of Object.entries(this.states)) {
225
+ if (!value.trim())
226
+ continue;
227
+ switch (category) {
228
+ case "page":
229
+ text.push(`### Page state
230
+ ${value}
231
+ `);
232
+ break;
233
+ case "tabs":
234
+ text.push(`### Open tabs
235
+ ${value}
236
+ `);
237
+ break;
238
+ case "modal":
239
+ text.push(`### Modal state
240
+ ${value}
241
+ `);
242
+ break;
243
+ }
244
+ }
245
+ return text.join("\n");
246
+ }
247
+ asMeta() {
248
+ const codeUpdate = this.code.length ? { category: "code", content: this.code.join("\n") } : void 0;
249
+ const resultUpdate = this.results.length ? { category: "result", content: this.results.join("\n") } : void 0;
250
+ const updates = [resultUpdate, codeUpdate, ...this.updates].filter(Boolean);
251
+ return {
252
+ "dev.lowire/history": updates,
253
+ "dev.lowire/state": { ...this.states }
254
+ };
255
+ }
256
+ redact(secrets) {
257
+ const redactText = (text) => {
258
+ for (const [secretName, secretValue] of Object.entries(secrets))
259
+ text = text.replaceAll(secretValue, `<secret>${secretName}</secret>`);
260
+ return text;
261
+ };
262
+ const updates = this.updates.map((update) => ({ ...update, content: redactText(update.content) }));
263
+ const results = this.results.map((result) => redactText(result));
264
+ const code = this.code.map((code2) => redactText(code2));
265
+ const states = Object.fromEntries(Object.entries(this.states).map(([key, value]) => [key, redactText(value)]));
266
+ return new RenderedResponse({ states, updates, results, code });
267
+ }
268
+ }
195
269
  function parseSections(text) {
196
270
  const sections = /* @__PURE__ */ new Map();
197
271
  const sectionHeaders = text.split(/^### /m).slice(1);
@@ -229,11 +303,13 @@ function parseResponse(response) {
229
303
  modalState,
230
304
  downloads,
231
305
  isError,
232
- attachments
306
+ attachments,
307
+ _meta: response._meta
233
308
  };
234
309
  }
235
310
  // Annotate the CommonJS export names for ESM import in node:
236
311
  0 && (module.exports = {
312
+ RenderedResponse,
237
313
  Response,
238
314
  parseResponse,
239
315
  requestDebug
@@ -105,9 +105,6 @@ class Tab extends import_events.EventEmitter {
105
105
  clearModalState(modalState) {
106
106
  this._modalStates = this._modalStates.filter((state) => state !== modalState);
107
107
  }
108
- modalStatesMarkdown() {
109
- return renderModalStates(this.context, this.modalStates());
110
- }
111
108
  _dialogShown(dialog) {
112
109
  this.setModalState({
113
110
  type: "dialog",
@@ -282,8 +279,8 @@ function pageErrorToConsoleMessage(errorOrValue) {
282
279
  toString: () => String(errorOrValue)
283
280
  };
284
281
  }
285
- function renderModalStates(context, modalStates) {
286
- const result = ["### Modal state"];
282
+ function renderModalStates(modalStates) {
283
+ const result = [];
287
284
  if (modalStates.length === 0)
288
285
  result.push("- There is no modal state present");
289
286
  for (const state of modalStates)
@@ -21,7 +21,7 @@ __export(common_exports, {
21
21
  default: () => common_default
22
22
  });
23
23
  module.exports = __toCommonJS(common_exports);
24
- var import_bundle = require("../../sdk/bundle");
24
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  const close = (0, import_tool.defineTool)({
27
27
  capability: "core",
@@ -29,7 +29,7 @@ const close = (0, import_tool.defineTool)({
29
29
  name: "browser_close",
30
30
  title: "Close browser",
31
31
  description: "Close the page",
32
- inputSchema: import_bundle.z.object({}),
32
+ inputSchema: import_mcpBundle.z.object({}),
33
33
  type: "action"
34
34
  },
35
35
  handle: async (context, params, response) => {
@@ -44,9 +44,9 @@ const resize = (0, import_tool.defineTabTool)({
44
44
  name: "browser_resize",
45
45
  title: "Resize browser window",
46
46
  description: "Resize the browser window",
47
- inputSchema: import_bundle.z.object({
48
- width: import_bundle.z.number().describe("Width of the browser window"),
49
- height: import_bundle.z.number().describe("Height of the browser window")
47
+ inputSchema: import_mcpBundle.z.object({
48
+ width: import_mcpBundle.z.number().describe("Width of the browser window"),
49
+ height: import_mcpBundle.z.number().describe("Height of the browser window")
50
50
  }),
51
51
  type: "action"
52
52
  },
@@ -21,7 +21,7 @@ __export(console_exports, {
21
21
  default: () => console_default
22
22
  });
23
23
  module.exports = __toCommonJS(console_exports);
24
- var import_bundle = require("../../sdk/bundle");
24
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  const console = (0, import_tool.defineTabTool)({
27
27
  capability: "core",
@@ -29,8 +29,8 @@ const console = (0, import_tool.defineTabTool)({
29
29
  name: "browser_console_messages",
30
30
  title: "Get console messages",
31
31
  description: "Returns all console messages",
32
- inputSchema: import_bundle.z.object({
33
- onlyErrors: import_bundle.z.boolean().optional().describe("Only return error messages")
32
+ inputSchema: import_mcpBundle.z.object({
33
+ onlyErrors: import_mcpBundle.z.boolean().optional().describe("Only return error messages")
34
34
  }),
35
35
  type: "readOnly"
36
36
  },
@@ -22,7 +22,7 @@ __export(dialogs_exports, {
22
22
  handleDialog: () => handleDialog
23
23
  });
24
24
  module.exports = __toCommonJS(dialogs_exports);
25
- var import_bundle = require("../../sdk/bundle");
25
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
26
26
  var import_tool = require("./tool");
27
27
  const handleDialog = (0, import_tool.defineTabTool)({
28
28
  capability: "core",
@@ -30,9 +30,9 @@ const handleDialog = (0, import_tool.defineTabTool)({
30
30
  name: "browser_handle_dialog",
31
31
  title: "Handle a dialog",
32
32
  description: "Handle a dialog",
33
- inputSchema: import_bundle.z.object({
34
- accept: import_bundle.z.boolean().describe("Whether to accept the dialog."),
35
- promptText: import_bundle.z.string().optional().describe("The text of the prompt in case of a prompt dialog.")
33
+ inputSchema: import_mcpBundle.z.object({
34
+ accept: import_mcpBundle.z.boolean().describe("Whether to accept the dialog."),
35
+ promptText: import_mcpBundle.z.string().optional().describe("The text of the prompt in case of a prompt dialog.")
36
36
  }),
37
37
  type: "action"
38
38
  },
@@ -31,13 +31,13 @@ __export(evaluate_exports, {
31
31
  default: () => evaluate_default
32
32
  });
33
33
  module.exports = __toCommonJS(evaluate_exports);
34
- var import_bundle = require("../../sdk/bundle");
34
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
35
35
  var import_tool = require("./tool");
36
36
  var javascript = __toESM(require("../codegen"));
37
- const evaluateSchema = import_bundle.z.object({
38
- function: import_bundle.z.string().describe("() => { /* code */ } or (element) => { /* code */ } when element is provided"),
39
- element: import_bundle.z.string().optional().describe("Human-readable element description used to obtain permission to interact with the element"),
40
- ref: import_bundle.z.string().optional().describe("Exact target element reference from the page snapshot")
37
+ const evaluateSchema = import_mcpBundle.z.object({
38
+ function: import_mcpBundle.z.string().describe("() => { /* code */ } or (element) => { /* code */ } when element is provided"),
39
+ element: import_mcpBundle.z.string().optional().describe("Human-readable element description used to obtain permission to interact with the element"),
40
+ ref: import_mcpBundle.z.string().optional().describe("Exact target element reference from the page snapshot")
41
41
  });
42
42
  const evaluate = (0, import_tool.defineTabTool)({
43
43
  capability: "core",
@@ -22,7 +22,7 @@ __export(files_exports, {
22
22
  uploadFile: () => uploadFile
23
23
  });
24
24
  module.exports = __toCommonJS(files_exports);
25
- var import_bundle = require("../../sdk/bundle");
25
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
26
26
  var import_tool = require("./tool");
27
27
  const uploadFile = (0, import_tool.defineTabTool)({
28
28
  capability: "core",
@@ -30,8 +30,8 @@ const uploadFile = (0, import_tool.defineTabTool)({
30
30
  name: "browser_file_upload",
31
31
  title: "Upload files",
32
32
  description: "Upload one or multiple files",
33
- inputSchema: import_bundle.z.object({
34
- paths: import_bundle.z.array(import_bundle.z.string()).optional().describe("The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.")
33
+ inputSchema: import_mcpBundle.z.object({
34
+ paths: import_mcpBundle.z.array(import_mcpBundle.z.string()).optional().describe("The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.")
35
35
  }),
36
36
  type: "action"
37
37
  },
@@ -31,7 +31,7 @@ __export(form_exports, {
31
31
  default: () => form_default
32
32
  });
33
33
  module.exports = __toCommonJS(form_exports);
34
- var import_bundle = require("../../sdk/bundle");
34
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
35
35
  var import_tool = require("./tool");
36
36
  var codegen = __toESM(require("../codegen"));
37
37
  const fillForm = (0, import_tool.defineTabTool)({
@@ -40,12 +40,12 @@ const fillForm = (0, import_tool.defineTabTool)({
40
40
  name: "browser_fill_form",
41
41
  title: "Fill form",
42
42
  description: "Fill multiple form fields",
43
- inputSchema: import_bundle.z.object({
44
- fields: import_bundle.z.array(import_bundle.z.object({
45
- name: import_bundle.z.string().describe("Human-readable field name"),
46
- type: import_bundle.z.enum(["textbox", "checkbox", "radio", "combobox", "slider"]).describe("Type of the field"),
47
- ref: import_bundle.z.string().describe("Exact target field reference from the page snapshot"),
48
- value: import_bundle.z.string().describe("Value to fill in the field. If the field is a checkbox, the value should be `true` or `false`. If the field is a combobox, the value should be the text of the option.")
43
+ inputSchema: import_mcpBundle.z.object({
44
+ fields: import_mcpBundle.z.array(import_mcpBundle.z.object({
45
+ name: import_mcpBundle.z.string().describe("Human-readable field name"),
46
+ type: import_mcpBundle.z.enum(["textbox", "checkbox", "radio", "combobox", "slider"]).describe("Type of the field"),
47
+ ref: import_mcpBundle.z.string().describe("Exact target field reference from the page snapshot"),
48
+ value: import_mcpBundle.z.string().describe("Value to fill in the field. If the field is a checkbox, the value should be `true` or `false`. If the field is a combobox, the value should be the text of the option.")
49
49
  })).describe("Fields to fill in")
50
50
  }),
51
51
  type: "input"
@@ -33,7 +33,7 @@ __export(install_exports, {
33
33
  module.exports = __toCommonJS(install_exports);
34
34
  var import_child_process = require("child_process");
35
35
  var import_path = __toESM(require("path"));
36
- var import_bundle = require("../../sdk/bundle");
36
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
37
37
  var import_tool = require("./tool");
38
38
  const install = (0, import_tool.defineTool)({
39
39
  capability: "core-install",
@@ -41,7 +41,7 @@ const install = (0, import_tool.defineTool)({
41
41
  name: "browser_install",
42
42
  title: "Install the browser specified in the config",
43
43
  description: "Install the browser specified in the config. Call this if you get an error about the browser not being installed.",
44
- inputSchema: import_bundle.z.object({}),
44
+ inputSchema: import_mcpBundle.z.object({}),
45
45
  type: "action"
46
46
  },
47
47
  handle: async (context, params, response) => {
@@ -21,7 +21,7 @@ __export(keyboard_exports, {
21
21
  default: () => keyboard_default
22
22
  });
23
23
  module.exports = __toCommonJS(keyboard_exports);
24
- var import_bundle = require("../../sdk/bundle");
24
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  var import_snapshot = require("./snapshot");
27
27
  const pressKey = (0, import_tool.defineTabTool)({
@@ -30,8 +30,8 @@ const pressKey = (0, import_tool.defineTabTool)({
30
30
  name: "browser_press_key",
31
31
  title: "Press a key",
32
32
  description: "Press a key on the keyboard",
33
- inputSchema: import_bundle.z.object({
34
- key: import_bundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
33
+ inputSchema: import_mcpBundle.z.object({
34
+ key: import_mcpBundle.z.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")
35
35
  }),
36
36
  type: "input"
37
37
  },
@@ -45,9 +45,9 @@ const pressKey = (0, import_tool.defineTabTool)({
45
45
  }
46
46
  });
47
47
  const typeSchema = import_snapshot.elementSchema.extend({
48
- text: import_bundle.z.string().describe("Text to type into the element"),
49
- submit: import_bundle.z.boolean().optional().describe("Whether to submit entered text (press Enter after)"),
50
- slowly: import_bundle.z.boolean().optional().describe("Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.")
48
+ text: import_mcpBundle.z.string().describe("Text to type into the element"),
49
+ submit: import_mcpBundle.z.boolean().optional().describe("Whether to submit entered text (press Enter after)"),
50
+ slowly: import_mcpBundle.z.boolean().optional().describe("Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.")
51
51
  });
52
52
  const type = (0, import_tool.defineTabTool)({
53
53
  capability: "core",
@@ -21,10 +21,10 @@ __export(mouse_exports, {
21
21
  default: () => mouse_default
22
22
  });
23
23
  module.exports = __toCommonJS(mouse_exports);
24
- var import_bundle = require("../../sdk/bundle");
24
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
25
  var import_tool = require("./tool");
26
- const elementSchema = import_bundle.z.object({
27
- element: import_bundle.z.string().describe("Human-readable element description used to obtain permission to interact with the element")
26
+ const elementSchema = import_mcpBundle.z.object({
27
+ element: import_mcpBundle.z.string().describe("Human-readable element description used to obtain permission to interact with the element")
28
28
  });
29
29
  const mouseMove = (0, import_tool.defineTabTool)({
30
30
  capability: "vision",
@@ -33,8 +33,8 @@ const mouseMove = (0, import_tool.defineTabTool)({
33
33
  title: "Move mouse",
34
34
  description: "Move mouse to a given position",
35
35
  inputSchema: elementSchema.extend({
36
- x: import_bundle.z.number().describe("X coordinate"),
37
- y: import_bundle.z.number().describe("Y coordinate")
36
+ x: import_mcpBundle.z.number().describe("X coordinate"),
37
+ y: import_mcpBundle.z.number().describe("Y coordinate")
38
38
  }),
39
39
  type: "input"
40
40
  },
@@ -53,8 +53,8 @@ const mouseClick = (0, import_tool.defineTabTool)({
53
53
  title: "Click",
54
54
  description: "Click left mouse button at a given position",
55
55
  inputSchema: elementSchema.extend({
56
- x: import_bundle.z.number().describe("X coordinate"),
57
- y: import_bundle.z.number().describe("Y coordinate")
56
+ x: import_mcpBundle.z.number().describe("X coordinate"),
57
+ y: import_mcpBundle.z.number().describe("Y coordinate")
58
58
  }),
59
59
  type: "input"
60
60
  },
@@ -78,10 +78,10 @@ const mouseDrag = (0, import_tool.defineTabTool)({
78
78
  title: "Drag mouse",
79
79
  description: "Drag left mouse button to a given position",
80
80
  inputSchema: elementSchema.extend({
81
- startX: import_bundle.z.number().describe("Start X coordinate"),
82
- startY: import_bundle.z.number().describe("Start Y coordinate"),
83
- endX: import_bundle.z.number().describe("End X coordinate"),
84
- endY: import_bundle.z.number().describe("End Y coordinate")
81
+ startX: import_mcpBundle.z.number().describe("Start X coordinate"),
82
+ startY: import_mcpBundle.z.number().describe("Start Y coordinate"),
83
+ endX: import_mcpBundle.z.number().describe("End X coordinate"),
84
+ endY: import_mcpBundle.z.number().describe("End Y coordinate")
85
85
  }),
86
86
  type: "input"
87
87
  },
@@ -21,7 +21,7 @@ __export(navigate_exports, {
21
21
  default: () => navigate_default
22
22
  });
23
23
  module.exports = __toCommonJS(navigate_exports);
24
- var import_bundle = require("../../sdk/bundle");
24
+ var import_mcpBundle = require("playwright-core/lib/mcpBundle");
25
25
  var import_tool = require("./tool");
26
26
  const navigate = (0, import_tool.defineTool)({
27
27
  capability: "core",
@@ -29,8 +29,8 @@ const navigate = (0, import_tool.defineTool)({
29
29
  name: "browser_navigate",
30
30
  title: "Navigate to a URL",
31
31
  description: "Navigate to a URL",
32
- inputSchema: import_bundle.z.object({
33
- url: import_bundle.z.string().describe("The URL to navigate to")
32
+ inputSchema: import_mcpBundle.z.object({
33
+ url: import_mcpBundle.z.string().describe("The URL to navigate to")
34
34
  }),
35
35
  type: "action"
36
36
  },
@@ -47,7 +47,7 @@ const goBack = (0, import_tool.defineTabTool)({
47
47
  name: "browser_navigate_back",
48
48
  title: "Go back",
49
49
  description: "Go back to the previous page",
50
- inputSchema: import_bundle.z.object({}),
50
+ inputSchema: import_mcpBundle.z.object({}),
51
51
  type: "action"
52
52
  },
53
53
  handle: async (tab, params, response) => {