@treegress.com/treegress-browser-mcp 0.0.56-treegress.3
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.
- package/README.md +68 -0
- package/cli.js +25 -0
- package/config.d.ts +223 -0
- package/index.d.ts +23 -0
- package/index.js +19 -0
- package/mcp/browser/browserContextFactory.js +332 -0
- package/mcp/browser/browserServerBackend.js +105 -0
- package/mcp/browser/config.js +489 -0
- package/mcp/browser/configIni.js +194 -0
- package/mcp/browser/context.js +302 -0
- package/mcp/browser/domSnapshot.js +307 -0
- package/mcp/browser/logFile.js +96 -0
- package/mcp/browser/response.js +299 -0
- package/mcp/browser/sessionLog.js +75 -0
- package/mcp/browser/tab.js +1193 -0
- package/mcp/browser/tools/common.js +63 -0
- package/mcp/browser/tools/config.js +41 -0
- package/mcp/browser/tools/console.js +65 -0
- package/mcp/browser/tools/cookies.js +152 -0
- package/mcp/browser/tools/devtools.js +42 -0
- package/mcp/browser/tools/dialogs.js +59 -0
- package/mcp/browser/tools/evaluate.js +61 -0
- package/mcp/browser/tools/files.js +58 -0
- package/mcp/browser/tools/form.js +63 -0
- package/mcp/browser/tools/install.js +73 -0
- package/mcp/browser/tools/keyboard.js +151 -0
- package/mcp/browser/tools/mouse.js +159 -0
- package/mcp/browser/tools/navigate.js +105 -0
- package/mcp/browser/tools/network.js +92 -0
- package/mcp/browser/tools/pdf.js +48 -0
- package/mcp/browser/tools/route.js +140 -0
- package/mcp/browser/tools/runCode.js +76 -0
- package/mcp/browser/tools/screenshot.js +86 -0
- package/mcp/browser/tools/snapshot.js +207 -0
- package/mcp/browser/tools/storage.js +67 -0
- package/mcp/browser/tools/tabs.js +67 -0
- package/mcp/browser/tools/tool.js +47 -0
- package/mcp/browser/tools/tracing.js +75 -0
- package/mcp/browser/tools/utils.js +88 -0
- package/mcp/browser/tools/verify.js +143 -0
- package/mcp/browser/tools/video.js +89 -0
- package/mcp/browser/tools/wait.js +63 -0
- package/mcp/browser/tools/webstorage.js +223 -0
- package/mcp/browser/tools.js +96 -0
- package/mcp/browser/watchdog.js +44 -0
- package/mcp/config.d.js +16 -0
- package/mcp/extension/cdpRelay.js +354 -0
- package/mcp/extension/extensionContextFactory.js +77 -0
- package/mcp/extension/protocol.js +28 -0
- package/mcp/index.js +61 -0
- package/mcp/log.js +35 -0
- package/mcp/program.js +126 -0
- package/mcp/sdk/exports.js +28 -0
- package/mcp/sdk/http.js +172 -0
- package/mcp/sdk/inProcessTransport.js +71 -0
- package/mcp/sdk/server.js +223 -0
- package/mcp/sdk/tool.js +54 -0
- package/mcp/test/browserBackend.js +98 -0
- package/mcp/test/generatorTools.js +122 -0
- package/mcp/test/plannerTools.js +145 -0
- package/mcp/test/seed.js +82 -0
- package/mcp/test/streams.js +44 -0
- package/mcp/test/testBackend.js +99 -0
- package/mcp/test/testContext.js +285 -0
- package/mcp/test/testTool.js +30 -0
- package/mcp/test/testTools.js +108 -0
- package/package.json +46 -0
|
@@ -0,0 +1,1193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var tab_exports = {};
|
|
20
|
+
__export(tab_exports, {
|
|
21
|
+
Tab: () => Tab,
|
|
22
|
+
renderModalStates: () => renderModalStates,
|
|
23
|
+
shouldIncludeMessage: () => shouldIncludeMessage
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(tab_exports);
|
|
26
|
+
var import_events = require("events");
|
|
27
|
+
var import_fs = require("fs");
|
|
28
|
+
var import_path = require("path");
|
|
29
|
+
var import_utils = require("playwright-core/lib/utils");
|
|
30
|
+
var import_toolsExports = require("playwright-core/lib/tools/exports");
|
|
31
|
+
var import_utils2 = require("./tools/utils");
|
|
32
|
+
var import_log = require("../log");
|
|
33
|
+
var import_logFile = require("./logFile");
|
|
34
|
+
var import_dialogs = require("./tools/dialogs");
|
|
35
|
+
var import_files = require("./tools/files");
|
|
36
|
+
// TODO(treegress-release): `initPage` still relies on Playwright's private
|
|
37
|
+
// transform loader for TypeScript/module support. Keep this dependency for the
|
|
38
|
+
// first release, but move or replace it with a treegress-owned loader so the
|
|
39
|
+
// MCP package no longer needs stock `playwright` at runtime.
|
|
40
|
+
var import_transform = require("playwright/lib/transform/transform");
|
|
41
|
+
var import_domSnapshot = require("./domSnapshot");
|
|
42
|
+
const TabEvents = {
|
|
43
|
+
modalState: "modalState"
|
|
44
|
+
};
|
|
45
|
+
const DOM_SNAPSHOT_KINDS = {
|
|
46
|
+
testId: "testId",
|
|
47
|
+
css: "css",
|
|
48
|
+
xpath: "xpath",
|
|
49
|
+
role: "role",
|
|
50
|
+
text: "text",
|
|
51
|
+
label: "label",
|
|
52
|
+
placeholder: "placeholder",
|
|
53
|
+
altText: "altText",
|
|
54
|
+
title: "title",
|
|
55
|
+
id: "id",
|
|
56
|
+
name: "name",
|
|
57
|
+
dataAttr: "dataAttr",
|
|
58
|
+
nth: "nth"
|
|
59
|
+
};
|
|
60
|
+
const DOM_SNAPSHOT_KIND_SET = new Set(Object.values(DOM_SNAPSHOT_KINDS));
|
|
61
|
+
const DEFAULT_DOM_SERIALIZER = "domSerializer.js";
|
|
62
|
+
class Tab extends import_events.EventEmitter {
|
|
63
|
+
constructor(context, page, onPageClose) {
|
|
64
|
+
super();
|
|
65
|
+
this._lastHeader = { title: "about:blank", url: "about:blank", current: false, console: { total: 0, warnings: 0, errors: 0 } };
|
|
66
|
+
this._downloads = [];
|
|
67
|
+
this._requests = [];
|
|
68
|
+
this._modalStates = [];
|
|
69
|
+
this._needsFullSnapshot = false;
|
|
70
|
+
this._recentEventEntries = [];
|
|
71
|
+
this._domMap = /* @__PURE__ */ new Map();
|
|
72
|
+
this._domSnapshotVersion = 0;
|
|
73
|
+
this._lastDomSnapshotAt = 0;
|
|
74
|
+
this._domSnapshotText = "";
|
|
75
|
+
this._customDomAliases = /* @__PURE__ */ new Map();
|
|
76
|
+
this._customDomLocatorPlans = /* @__PURE__ */ new Map();
|
|
77
|
+
// Historical/debug-only local DOM engine state. The active browser tool path
|
|
78
|
+
// uses playwright-core custom-dom snapshots instead of this vendored runtime.
|
|
79
|
+
this._domSerializerPath = void 0;
|
|
80
|
+
this._domSerializer = void 0;
|
|
81
|
+
this._domSerializerInitScriptRegistered = false;
|
|
82
|
+
this.context = context;
|
|
83
|
+
this.page = page;
|
|
84
|
+
this._onPageClose = onPageClose;
|
|
85
|
+
page.on("console", (event) => this._handleConsoleMessage(messageToConsoleMessage(event)));
|
|
86
|
+
page.on("pageerror", (error) => this._handleConsoleMessage(pageErrorToConsoleMessage(error)));
|
|
87
|
+
page.on("request", (request) => this._handleRequest(request));
|
|
88
|
+
page.on("response", (response) => this._handleResponse(response));
|
|
89
|
+
page.on("requestfailed", (request) => this._handleRequestFailed(request));
|
|
90
|
+
page.on("close", () => this._onClose());
|
|
91
|
+
page.on("filechooser", (chooser) => {
|
|
92
|
+
this.setModalState({
|
|
93
|
+
type: "fileChooser",
|
|
94
|
+
description: "File chooser",
|
|
95
|
+
fileChooser: chooser,
|
|
96
|
+
clearedBy: { tool: import_files.uploadFile.schema.name, skill: "upload" }
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
page.on("dialog", (dialog) => this._dialogShown(dialog));
|
|
100
|
+
page.on("download", (download) => {
|
|
101
|
+
void this._downloadStarted(download);
|
|
102
|
+
});
|
|
103
|
+
page.setDefaultNavigationTimeout(this.context.config.timeouts.navigation);
|
|
104
|
+
page.setDefaultTimeout(this.context.config.timeouts.action);
|
|
105
|
+
page[tabSymbol] = this;
|
|
106
|
+
const wallTime = Date.now();
|
|
107
|
+
this._consoleLog = new import_logFile.LogFile(this.context, wallTime, "console", "Console");
|
|
108
|
+
this._initializedPromise = this._initialize();
|
|
109
|
+
}
|
|
110
|
+
static forPage(page) {
|
|
111
|
+
return page[tabSymbol];
|
|
112
|
+
}
|
|
113
|
+
static async collectConsoleMessages(page) {
|
|
114
|
+
const result = [];
|
|
115
|
+
const messages = await page.consoleMessages().catch(() => []);
|
|
116
|
+
for (const message of messages)
|
|
117
|
+
result.push(messageToConsoleMessage(message));
|
|
118
|
+
const errors = await page.pageErrors().catch(() => []);
|
|
119
|
+
for (const error of errors)
|
|
120
|
+
result.push(pageErrorToConsoleMessage(error));
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
async _initialize() {
|
|
124
|
+
for (const message of await Tab.collectConsoleMessages(this.page))
|
|
125
|
+
this._handleConsoleMessage(message);
|
|
126
|
+
const requests = await this.page.requests().catch(() => []);
|
|
127
|
+
for (const request of requests.filter((r) => r.existingResponse() || r.failure()))
|
|
128
|
+
this._requests.push(request);
|
|
129
|
+
for (const initPage of this.context.config.browser.initPage || []) {
|
|
130
|
+
try {
|
|
131
|
+
const { default: func } = await (0, import_transform.requireOrImport)(initPage);
|
|
132
|
+
await func({ page: this.page });
|
|
133
|
+
} catch (e) {
|
|
134
|
+
(0, import_log.logUnhandledError)(e);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
modalStates() {
|
|
139
|
+
return this._modalStates;
|
|
140
|
+
}
|
|
141
|
+
setModalState(modalState) {
|
|
142
|
+
this._modalStates.push(modalState);
|
|
143
|
+
this.emit(TabEvents.modalState, modalState);
|
|
144
|
+
}
|
|
145
|
+
clearModalState(modalState) {
|
|
146
|
+
this._modalStates = this._modalStates.filter((state) => state !== modalState);
|
|
147
|
+
}
|
|
148
|
+
_dialogShown(dialog) {
|
|
149
|
+
this.setModalState({
|
|
150
|
+
type: "dialog",
|
|
151
|
+
description: `"${dialog.type()}" dialog with message "${dialog.message()}"`,
|
|
152
|
+
dialog,
|
|
153
|
+
clearedBy: { tool: import_dialogs.handleDialog.schema.name, skill: "dialog-accept or dialog-dismiss" }
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async _downloadStarted(download) {
|
|
157
|
+
const outputFile = await this.context.outputFile({ suggestedFilename: sanitizeForFilePath(download.suggestedFilename()), prefix: "download", ext: "bin" }, { origin: "code" });
|
|
158
|
+
const entry = {
|
|
159
|
+
download,
|
|
160
|
+
finished: false,
|
|
161
|
+
outputFile
|
|
162
|
+
};
|
|
163
|
+
this._downloads.push(entry);
|
|
164
|
+
this._addLogEntry({ type: "download-start", wallTime: Date.now(), download: entry });
|
|
165
|
+
await download.saveAs(entry.outputFile);
|
|
166
|
+
entry.finished = true;
|
|
167
|
+
this._addLogEntry({ type: "download-finish", wallTime: Date.now(), download: entry });
|
|
168
|
+
}
|
|
169
|
+
_clearCollectedArtifacts() {
|
|
170
|
+
this._downloads.length = 0;
|
|
171
|
+
this._requests.length = 0;
|
|
172
|
+
this._recentEventEntries.length = 0;
|
|
173
|
+
this._resetLogs();
|
|
174
|
+
this._clearCustomDomSnapshotCache();
|
|
175
|
+
}
|
|
176
|
+
_resetLogs() {
|
|
177
|
+
const wallTime = Date.now();
|
|
178
|
+
this._consoleLog.stop();
|
|
179
|
+
this._consoleLog = new import_logFile.LogFile(this.context, wallTime, "console", "Console");
|
|
180
|
+
}
|
|
181
|
+
_handleRequest(request) {
|
|
182
|
+
this._requests.push(request);
|
|
183
|
+
const wallTime = request.timing().startTime || Date.now();
|
|
184
|
+
this._addLogEntry({ type: "request", wallTime, request });
|
|
185
|
+
}
|
|
186
|
+
_handleResponse(response) {
|
|
187
|
+
const timing = response.request().timing();
|
|
188
|
+
const wallTime = timing.responseStart + timing.startTime;
|
|
189
|
+
this._addLogEntry({ type: "request", wallTime, request: response.request() });
|
|
190
|
+
}
|
|
191
|
+
_handleRequestFailed(request) {
|
|
192
|
+
this._requests.push(request);
|
|
193
|
+
const timing = request.timing();
|
|
194
|
+
const wallTime = timing.responseEnd + timing.startTime;
|
|
195
|
+
this._addLogEntry({ type: "request", wallTime, request });
|
|
196
|
+
}
|
|
197
|
+
_handleConsoleMessage(message) {
|
|
198
|
+
const wallTime = message.timestamp;
|
|
199
|
+
this._addLogEntry({ type: "console", wallTime, message });
|
|
200
|
+
const level = consoleLevelForMessageType(message.type);
|
|
201
|
+
if (level === "error" || level === "warning")
|
|
202
|
+
this._consoleLog.appendLine(wallTime, () => message.toString());
|
|
203
|
+
}
|
|
204
|
+
_addLogEntry(entry) {
|
|
205
|
+
this._recentEventEntries.push(entry);
|
|
206
|
+
}
|
|
207
|
+
_onClose() {
|
|
208
|
+
this._clearCollectedArtifacts();
|
|
209
|
+
this._onPageClose(this);
|
|
210
|
+
}
|
|
211
|
+
async headerSnapshot() {
|
|
212
|
+
let title;
|
|
213
|
+
await this._raceAgainstModalStates(async () => {
|
|
214
|
+
title = await (0, import_utils2.callOnPageNoTrace)(this.page, (page) => page.title());
|
|
215
|
+
});
|
|
216
|
+
const newHeader = {
|
|
217
|
+
title: title ?? "",
|
|
218
|
+
url: this.page.url(),
|
|
219
|
+
current: this.isCurrentTab(),
|
|
220
|
+
console: await this.consoleMessageCount()
|
|
221
|
+
};
|
|
222
|
+
if (!tabHeaderEquals(this._lastHeader, newHeader)) {
|
|
223
|
+
this._lastHeader = newHeader;
|
|
224
|
+
return { ...this._lastHeader, changed: true };
|
|
225
|
+
}
|
|
226
|
+
return { ...this._lastHeader, changed: false };
|
|
227
|
+
}
|
|
228
|
+
isCurrentTab() {
|
|
229
|
+
return this === this.context.currentTab();
|
|
230
|
+
}
|
|
231
|
+
async waitForLoadState(state, options) {
|
|
232
|
+
await this._initializedPromise;
|
|
233
|
+
await (0, import_utils2.callOnPageNoTrace)(this.page, (page) => page.waitForLoadState(state, options).catch(import_log.logUnhandledError));
|
|
234
|
+
}
|
|
235
|
+
async navigate(url) {
|
|
236
|
+
await this._initializedPromise;
|
|
237
|
+
await this.clearConsoleMessages();
|
|
238
|
+
this._clearCollectedArtifacts();
|
|
239
|
+
const { promise: downloadEvent, abort: abortDownloadEvent } = (0, import_utils2.eventWaiter)(this.page, "download", 3e3);
|
|
240
|
+
try {
|
|
241
|
+
await this.page.goto(url, { waitUntil: "domcontentloaded" });
|
|
242
|
+
abortDownloadEvent();
|
|
243
|
+
} catch (_e) {
|
|
244
|
+
const e = _e;
|
|
245
|
+
const mightBeDownload = e.message.includes("net::ERR_ABORTED") || e.message.includes("Download is starting");
|
|
246
|
+
if (!mightBeDownload)
|
|
247
|
+
throw e;
|
|
248
|
+
const download = await downloadEvent;
|
|
249
|
+
if (!download)
|
|
250
|
+
throw e;
|
|
251
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
await this.waitForLoadState("load", { timeout: 5e3 });
|
|
255
|
+
}
|
|
256
|
+
async consoleMessageCount() {
|
|
257
|
+
await this._initializedPromise;
|
|
258
|
+
const messages = await this.page.consoleMessages();
|
|
259
|
+
const pageErrors = await this.page.pageErrors();
|
|
260
|
+
let errors = pageErrors.length;
|
|
261
|
+
let warnings = 0;
|
|
262
|
+
for (const message of messages) {
|
|
263
|
+
if (message.type() === "error")
|
|
264
|
+
errors++;
|
|
265
|
+
else if (message.type() === "warning")
|
|
266
|
+
warnings++;
|
|
267
|
+
}
|
|
268
|
+
return { total: messages.length + pageErrors.length, errors, warnings };
|
|
269
|
+
}
|
|
270
|
+
async consoleMessages(level) {
|
|
271
|
+
await this._initializedPromise;
|
|
272
|
+
const result = [];
|
|
273
|
+
const messages = await this.page.consoleMessages();
|
|
274
|
+
for (const message of messages) {
|
|
275
|
+
const cm = messageToConsoleMessage(message);
|
|
276
|
+
if (shouldIncludeMessage(level, cm.type))
|
|
277
|
+
result.push(cm);
|
|
278
|
+
}
|
|
279
|
+
if (shouldIncludeMessage(level, "error")) {
|
|
280
|
+
const errors = await this.page.pageErrors();
|
|
281
|
+
for (const error of errors)
|
|
282
|
+
result.push(pageErrorToConsoleMessage(error));
|
|
283
|
+
}
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
async clearConsoleMessages() {
|
|
287
|
+
await this._initializedPromise;
|
|
288
|
+
if (typeof this.page.clearConsoleMessages !== "function" && typeof this.page.clearPageErrors !== "function") {
|
|
289
|
+
this._resetLogs();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
await Promise.all([
|
|
293
|
+
typeof this.page.clearConsoleMessages === "function" ? this.page.clearConsoleMessages() : Promise.resolve(),
|
|
294
|
+
typeof this.page.clearPageErrors === "function" ? this.page.clearPageErrors() : Promise.resolve()
|
|
295
|
+
]);
|
|
296
|
+
this._resetLogs();
|
|
297
|
+
}
|
|
298
|
+
async requests() {
|
|
299
|
+
await this._initializedPromise;
|
|
300
|
+
return this._requests;
|
|
301
|
+
}
|
|
302
|
+
async clearRequests() {
|
|
303
|
+
await this._initializedPromise;
|
|
304
|
+
this._requests.length = 0;
|
|
305
|
+
}
|
|
306
|
+
async captureSnapshot(relativeTo) {
|
|
307
|
+
await this._initializedPromise;
|
|
308
|
+
|
|
309
|
+
let tabSnapshot;
|
|
310
|
+
const modalStates = await this._raceAgainstModalStates(async () => {
|
|
311
|
+
const snapshot = await this.page._snapshotForAI({ track: "response", backend: "custom-dom" });
|
|
312
|
+
if (snapshot.backend === "custom-dom" && (0, import_toolsExports.isCustomDomSnapshotEnvelope)(snapshot.envelope)) {
|
|
313
|
+
const formatted = (0, import_toolsExports.formatCustomDomSnapshot)(snapshot.envelope);
|
|
314
|
+
this._customDomAliases = formatted.aliasToStableId;
|
|
315
|
+
this._customDomLocatorPlans = formatted.locatorPlans;
|
|
316
|
+
tabSnapshot = {
|
|
317
|
+
ariaSnapshot: formatted.snapshot,
|
|
318
|
+
modalStates: [],
|
|
319
|
+
events: []
|
|
320
|
+
};
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
this._clearCustomDomSnapshotCache();
|
|
324
|
+
tabSnapshot = {
|
|
325
|
+
ariaSnapshot: snapshot.full,
|
|
326
|
+
ariaSnapshotDiff: this._needsFullSnapshot ? void 0 : snapshot.incremental,
|
|
327
|
+
modalStates: [],
|
|
328
|
+
events: []
|
|
329
|
+
};
|
|
330
|
+
});
|
|
331
|
+
if (tabSnapshot) {
|
|
332
|
+
tabSnapshot.consoleLink = await this._consoleLog.take(relativeTo);
|
|
333
|
+
tabSnapshot.events = this._recentEventEntries;
|
|
334
|
+
this._recentEventEntries = [];
|
|
335
|
+
}
|
|
336
|
+
this._needsFullSnapshot = !tabSnapshot;
|
|
337
|
+
return tabSnapshot ?? {
|
|
338
|
+
ariaSnapshot: "",
|
|
339
|
+
ariaSnapshotDiff: "",
|
|
340
|
+
modalStates,
|
|
341
|
+
events: []
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
_javaScriptBlocked() {
|
|
345
|
+
return this._modalStates.some((state) => state.type === "dialog");
|
|
346
|
+
}
|
|
347
|
+
async _raceAgainstModalStates(action) {
|
|
348
|
+
if (this.modalStates().length)
|
|
349
|
+
return this.modalStates();
|
|
350
|
+
const promise = new import_utils.ManualPromise();
|
|
351
|
+
const listener = (modalState) => promise.resolve([modalState]);
|
|
352
|
+
this.once(TabEvents.modalState, listener);
|
|
353
|
+
return await Promise.race([
|
|
354
|
+
action().then(() => {
|
|
355
|
+
this.off(TabEvents.modalState, listener);
|
|
356
|
+
return [];
|
|
357
|
+
}),
|
|
358
|
+
promise
|
|
359
|
+
]);
|
|
360
|
+
}
|
|
361
|
+
async waitForCompletion(callback) {
|
|
362
|
+
await this._initializedPromise;
|
|
363
|
+
await this._raceAgainstModalStates(() => (0, import_utils2.waitForCompletion)(this, callback));
|
|
364
|
+
}
|
|
365
|
+
async refLocator(params) {
|
|
366
|
+
await this._initializedPromise;
|
|
367
|
+
return (await this.refLocators([params]))[0];
|
|
368
|
+
}
|
|
369
|
+
async refLocators(params) {
|
|
370
|
+
await this._initializedPromise;
|
|
371
|
+
return Promise.all(params.map((param) => this.resolveLocatorFromRef(param)));
|
|
372
|
+
}
|
|
373
|
+
async resolveLocatorFromRef(params) {
|
|
374
|
+
const customDomResolved = await this._resolveLocatorFromCustomDomSnapshot(params);
|
|
375
|
+
if (customDomResolved?.locator && customDomResolved?.resolved)
|
|
376
|
+
return { locator: customDomResolved.locator, resolved: customDomResolved.resolved };
|
|
377
|
+
const customDomSnapshotSeen = this._customDomAliases.size > 0;
|
|
378
|
+
try {
|
|
379
|
+
if (customDomSnapshotSeen && customDomResolved?.diagnostics)
|
|
380
|
+
throw new Error((0, import_toolsExports.formatCustomDomResolverDiagnostics)(customDomResolved.diagnostics));
|
|
381
|
+
let locator = this.page.locator(`aria-ref=${params.ref}`);
|
|
382
|
+
if (params.element)
|
|
383
|
+
locator = locator.describe(params.element);
|
|
384
|
+
const { resolvedSelector } = await locator._resolveSelector();
|
|
385
|
+
return { locator, resolved: (0, import_utils.asLocator)("javascript", resolvedSelector) };
|
|
386
|
+
} catch (e) {
|
|
387
|
+
if (customDomResolved?.diagnostics)
|
|
388
|
+
throw new Error((0, import_toolsExports.formatCustomDomResolverDiagnostics)(customDomResolved.diagnostics));
|
|
389
|
+
throw new Error(`Ref ${params.ref} not found in the current page snapshot. Try capturing new snapshot.`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// Historical/debug-only local DOM engine. This is intentionally not part of
|
|
393
|
+
// the active browser_snapshot/ref-resolution flow anymore. Normal MCP tools
|
|
394
|
+
// go through playwright-core custom-dom snapshots + locator plans.
|
|
395
|
+
async _resolveLocatorFromDomSnapshot(params) {
|
|
396
|
+
const entry = await this._getDomSnapshotEntry(params.ref);
|
|
397
|
+
if (!entry)
|
|
398
|
+
throw new Error(`Ref ${params.ref} not found in the historical local DOM snapshot map. Active browser tools use playwright-core custom-dom snapshots.`);
|
|
399
|
+
|
|
400
|
+
const frame = this._resolveFrame(entry.framePath);
|
|
401
|
+
const strict = !this.context.config.snapshot.domNonstrict;
|
|
402
|
+
const attempts = [];
|
|
403
|
+
let lastBaseLocator;
|
|
404
|
+
|
|
405
|
+
for (let index = 0; index < entry.candidates.length; index++) {
|
|
406
|
+
const candidate = normalizeCandidate(entry.candidates[index]);
|
|
407
|
+
if (!candidate)
|
|
408
|
+
continue;
|
|
409
|
+
|
|
410
|
+
let locator;
|
|
411
|
+
if (candidate.kind === DOM_SNAPSHOT_KINDS.nth) {
|
|
412
|
+
const value = candidate.payload ?? {};
|
|
413
|
+
const nthIndex = Number.isFinite(value.index) ? value.index : Number.isFinite(value.value) ? Number(value.value) : Number.isFinite(value.n) ? Number(value.n) : void 0;
|
|
414
|
+
if (lastBaseLocator && Number.isFinite(nthIndex)) {
|
|
415
|
+
locator = lastBaseLocator.nth(nthIndex);
|
|
416
|
+
} else {
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
locator = buildLocatorFromCandidate(frame, candidate);
|
|
421
|
+
if (!locator)
|
|
422
|
+
continue;
|
|
423
|
+
lastBaseLocator = locator;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
let count = -1;
|
|
427
|
+
try {
|
|
428
|
+
count = await locator.count();
|
|
429
|
+
} catch (error) {
|
|
430
|
+
attempts.push({ kind: candidate.kind, payload: candidate.payload, count, error: error.message || String(error) });
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
attempts.push({ kind: candidate.kind, payload: candidate.payload, count });
|
|
434
|
+
|
|
435
|
+
if (count === 1)
|
|
436
|
+
return {
|
|
437
|
+
locator,
|
|
438
|
+
resolved: locatorToCode(frame, entry.candidates, candidate, this.page.mainFrame() === frame, strict),
|
|
439
|
+
attempts,
|
|
440
|
+
meta: entry.meta
|
|
441
|
+
};
|
|
442
|
+
if (!strict && count > 0)
|
|
443
|
+
return {
|
|
444
|
+
locator: locator.first(),
|
|
445
|
+
resolved: locatorToCode(frame, entry.candidates, candidate, this.page.mainFrame() === frame, strict),
|
|
446
|
+
attempts,
|
|
447
|
+
meta: entry.meta
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (!strict) {
|
|
452
|
+
const fallback = await this._resolveLocatorByNonstrict(entry, frame);
|
|
453
|
+
if (fallback)
|
|
454
|
+
return fallback;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (this.context.config.snapshot.domFallbackToAria) {
|
|
458
|
+
const locator = this.page.locator(`aria-ref=${params.ref}`);
|
|
459
|
+
const { resolvedSelector } = await locator._resolveSelector();
|
|
460
|
+
return { locator, resolved: (0, import_utils.asLocator)("javascript", resolvedSelector) };
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const details = attempts.map((attempt) => {
|
|
464
|
+
const extra = attempt.error ? ` error=${attempt.error}` : "";
|
|
465
|
+
return `kind=${attempt.kind} count=${attempt.count}${extra}`;
|
|
466
|
+
}).join(", ");
|
|
467
|
+
const candidates = entry.candidates.map((candidate) => JSON.stringify(candidate)).join(", ");
|
|
468
|
+
throw new Error(`Failed to resolve ref ${params.ref} by DOM candidates. Candidates: [${candidates}]. Attempts: [${details}]`);
|
|
469
|
+
}
|
|
470
|
+
async _resolveLocatorByNonstrict(entry, frame) {
|
|
471
|
+
for (const raw of entry.candidates) {
|
|
472
|
+
const candidate = normalizeCandidate(raw);
|
|
473
|
+
if (!candidate || candidate.kind === DOM_SNAPSHOT_KINDS.nth)
|
|
474
|
+
continue;
|
|
475
|
+
const locator = buildLocatorFromCandidate(frame, candidate);
|
|
476
|
+
if (!locator)
|
|
477
|
+
continue;
|
|
478
|
+
try {
|
|
479
|
+
if (await locator.count() > 0)
|
|
480
|
+
return { locator, resolved: locatorToCode(frame, entry.candidates, candidate, this.page.mainFrame() === frame, false) };
|
|
481
|
+
} catch (e) {
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
return void 0;
|
|
485
|
+
}
|
|
486
|
+
async _getDomSnapshotEntry(ref) {
|
|
487
|
+
let entry = this._domMap.get(ref);
|
|
488
|
+
if (!entry) {
|
|
489
|
+
await this._captureDomSnapshotToMap();
|
|
490
|
+
entry = this._domMap.get(ref);
|
|
491
|
+
}
|
|
492
|
+
return entry;
|
|
493
|
+
}
|
|
494
|
+
async _captureDomSnapshotToMap() {
|
|
495
|
+
const raw = await this._runDomSerializer();
|
|
496
|
+
const normalized = import_domSnapshot.normalizeDomSnapshotResult(raw);
|
|
497
|
+
const domSnapshotText = normalized.domSnapshotText || fallbackDomSnapshotTextFromElements(normalized.elements);
|
|
498
|
+
this._domMap = new Map();
|
|
499
|
+
for (const element of normalized.elements) {
|
|
500
|
+
if (!element.id)
|
|
501
|
+
continue;
|
|
502
|
+
this._domMap.set(element.id, {
|
|
503
|
+
candidates: normalizeCandidates(element.candidates || []),
|
|
504
|
+
framePath: element.framePath,
|
|
505
|
+
meta: element.meta
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
this._domSnapshotVersion++;
|
|
509
|
+
this._lastDomSnapshotAt = Date.now();
|
|
510
|
+
this._domSnapshotText = domSnapshotText;
|
|
511
|
+
return domSnapshotText;
|
|
512
|
+
}
|
|
513
|
+
async _captureDomSnapshot() {
|
|
514
|
+
const snapshotText = await this._captureDomSnapshotToMap();
|
|
515
|
+
return {
|
|
516
|
+
ariaSnapshot: snapshotText,
|
|
517
|
+
ariaSnapshotDiff: this._needsFullSnapshot ? void 0 : snapshotText,
|
|
518
|
+
modalStates: [],
|
|
519
|
+
events: []
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
async _runDomSerializer() {
|
|
523
|
+
const serializer = await this._resolveDomSerializerModule();
|
|
524
|
+
return runDomSerializer(serializer, this.page, this._domSerializerPath);
|
|
525
|
+
}
|
|
526
|
+
async _resolveDomSerializerModule() {
|
|
527
|
+
const serializerPath = resolveDomSerializerPath(this.context.config.snapshot.domSerializerPath);
|
|
528
|
+
if (this._domSerializerPath === serializerPath && this._domSerializer)
|
|
529
|
+
return this._domSerializer;
|
|
530
|
+
|
|
531
|
+
if (!serializerPath || !import_fs.existsSync(serializerPath))
|
|
532
|
+
throw new Error(`DOM snapshot engine is enabled, but domSerializer.js was not found. Searched at ${serializerPath}. Pass --dom-serializer or PLAYWRIGHT_MCP_DOM_SERIALIZER_PATH.`);
|
|
533
|
+
|
|
534
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
535
|
+
const required = require(serializerPath);
|
|
536
|
+
const serializer = pickDomSerializer(required);
|
|
537
|
+
if (!serializer)
|
|
538
|
+
throw new Error(`Could not initialize domSerializer.js from ${serializerPath}. Expected a function or serializable object.`);
|
|
539
|
+
if (!this._domSerializerInitScriptRegistered) {
|
|
540
|
+
await this.page.context().addInitScript({ path: serializerPath });
|
|
541
|
+
this._domSerializerInitScriptRegistered = true;
|
|
542
|
+
}
|
|
543
|
+
this._domSerializerPath = serializerPath;
|
|
544
|
+
this._domSerializer = serializer;
|
|
545
|
+
return serializer;
|
|
546
|
+
}
|
|
547
|
+
_resolveFrame(framePath) {
|
|
548
|
+
const frame = this.page.mainFrame();
|
|
549
|
+
const path = parseFramePath(framePath);
|
|
550
|
+
let current = frame;
|
|
551
|
+
for (const index of path) {
|
|
552
|
+
if (!Number.isFinite(index) || index < 0)
|
|
553
|
+
return frame;
|
|
554
|
+
const child = current.childFrames()[index];
|
|
555
|
+
if (!child)
|
|
556
|
+
return frame;
|
|
557
|
+
current = child;
|
|
558
|
+
}
|
|
559
|
+
return current;
|
|
560
|
+
}
|
|
561
|
+
async waitForTimeout(time) {
|
|
562
|
+
if (this._javaScriptBlocked()) {
|
|
563
|
+
await new Promise((f) => setTimeout(f, time));
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
await (0, import_utils2.callOnPageNoTrace)(this.page, (page) => {
|
|
567
|
+
return page.evaluate(() => new Promise((f) => setTimeout(f, 1e3))).catch(() => {
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
_clearCustomDomSnapshotCache() {
|
|
572
|
+
this._customDomAliases.clear();
|
|
573
|
+
this._customDomLocatorPlans.clear();
|
|
574
|
+
}
|
|
575
|
+
_resolveFrameByPath(framePath) {
|
|
576
|
+
let frame = this.page.mainFrame();
|
|
577
|
+
for (const childIndex of framePath) {
|
|
578
|
+
const childFrames = frame.childFrames();
|
|
579
|
+
frame = childFrames[childIndex];
|
|
580
|
+
if (!frame)
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
return frame;
|
|
584
|
+
}
|
|
585
|
+
async _resolveLocatorFromCustomDomSnapshot(params) {
|
|
586
|
+
const diagnostics = {
|
|
587
|
+
ref: params.ref,
|
|
588
|
+
alias: {
|
|
589
|
+
status: "missing"
|
|
590
|
+
},
|
|
591
|
+
locatorPlan: {
|
|
592
|
+
status: "not-checked"
|
|
593
|
+
},
|
|
594
|
+
frame: {
|
|
595
|
+
status: "not-checked"
|
|
596
|
+
},
|
|
597
|
+
candidates: {
|
|
598
|
+
total: 0,
|
|
599
|
+
attempts: []
|
|
600
|
+
},
|
|
601
|
+
outcome: {
|
|
602
|
+
status: "alias-missing"
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
const alias = this._customDomAliases.get(params.ref);
|
|
606
|
+
if (!alias)
|
|
607
|
+
return { diagnostics };
|
|
608
|
+
diagnostics.alias = {
|
|
609
|
+
status: "found",
|
|
610
|
+
stableId: alias.stableId,
|
|
611
|
+
framePath: [...alias.framePath]
|
|
612
|
+
};
|
|
613
|
+
const planKey = (0, import_toolsExports.customDomStableLocatorKey)(alias.framePath, alias.stableId);
|
|
614
|
+
diagnostics.locatorPlan = {
|
|
615
|
+
status: "missing",
|
|
616
|
+
key: planKey
|
|
617
|
+
};
|
|
618
|
+
const locatorPlan = this._customDomLocatorPlans.get(planKey);
|
|
619
|
+
if (!locatorPlan)
|
|
620
|
+
return {
|
|
621
|
+
diagnostics: {
|
|
622
|
+
...diagnostics,
|
|
623
|
+
outcome: {
|
|
624
|
+
status: "locator-plan-missing"
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
diagnostics.locatorPlan = {
|
|
629
|
+
status: "found",
|
|
630
|
+
key: planKey
|
|
631
|
+
};
|
|
632
|
+
const frame = this._resolveFrameByPath(alias.framePath);
|
|
633
|
+
if (!frame)
|
|
634
|
+
return {
|
|
635
|
+
diagnostics: {
|
|
636
|
+
...diagnostics,
|
|
637
|
+
frame: {
|
|
638
|
+
status: "stale",
|
|
639
|
+
framePath: [...alias.framePath]
|
|
640
|
+
},
|
|
641
|
+
outcome: {
|
|
642
|
+
status: "frame-stale"
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
diagnostics.frame = {
|
|
647
|
+
status: "resolved",
|
|
648
|
+
framePath: [...alias.framePath]
|
|
649
|
+
};
|
|
650
|
+
const candidates = (0, import_toolsExports.compileLocatorCandidatesFromPlan)(frame, locatorPlan);
|
|
651
|
+
diagnostics.candidates.total = candidates.length;
|
|
652
|
+
if (!candidates.length)
|
|
653
|
+
return {
|
|
654
|
+
diagnostics: {
|
|
655
|
+
...diagnostics,
|
|
656
|
+
outcome: {
|
|
657
|
+
status: "no-candidates"
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
const inspection = await (0, import_toolsExports.inspectLocatorCandidates)(candidates);
|
|
662
|
+
diagnostics.candidates.attempts = inspection.attempts;
|
|
663
|
+
const candidate = inspection.selected;
|
|
664
|
+
if (!candidate) {
|
|
665
|
+
return {
|
|
666
|
+
diagnostics: {
|
|
667
|
+
...diagnostics,
|
|
668
|
+
outcome: {
|
|
669
|
+
status: inspection.outcome === "ambiguous" ? "ambiguous" : "no-match"
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
let locator = candidate.locator;
|
|
675
|
+
if (params.element)
|
|
676
|
+
locator = locator.describe(params.element);
|
|
677
|
+
return {
|
|
678
|
+
locator,
|
|
679
|
+
resolved: await locator._resolveForCode(),
|
|
680
|
+
diagnostics: {
|
|
681
|
+
...diagnostics,
|
|
682
|
+
outcome: {
|
|
683
|
+
status: "resolved",
|
|
684
|
+
selectedStrategy: candidate.strategy
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
// Historical/debug-only local DOM engine helpers. Keep only for one-off
|
|
691
|
+
// forensics while the active MCP browser tool path stays delegated to
|
|
692
|
+
// playwright-core custom-dom snapshots.
|
|
693
|
+
function resolveDomSerializerPath(configuredPath) {
|
|
694
|
+
const candidates = [];
|
|
695
|
+
if (configuredPath)
|
|
696
|
+
candidates.push(import_path.resolve(process.cwd(), configuredPath));
|
|
697
|
+
candidates.push(import_path.resolve(process.cwd(), DEFAULT_DOM_SERIALIZER));
|
|
698
|
+
candidates.push(import_path.resolve(__dirname, "../../../..", DEFAULT_DOM_SERIALIZER));
|
|
699
|
+
for (const candidate of candidates) {
|
|
700
|
+
if (import_fs.existsSync(candidate))
|
|
701
|
+
return candidate;
|
|
702
|
+
}
|
|
703
|
+
return candidates[0] ?? null;
|
|
704
|
+
}
|
|
705
|
+
function pickDomSerializer(required) {
|
|
706
|
+
if (typeof required === "function")
|
|
707
|
+
return required;
|
|
708
|
+
if (required?.default && typeof required.default === "function")
|
|
709
|
+
return required.default;
|
|
710
|
+
if (typeof required?.serialize === "function")
|
|
711
|
+
return required.serialize;
|
|
712
|
+
if (typeof required?.serializeDOM === "function")
|
|
713
|
+
return required.serializeDOM;
|
|
714
|
+
if (typeof required?.getFlexibleLocators === "function")
|
|
715
|
+
return required.getFlexibleLocators;
|
|
716
|
+
if (typeof required?.snapshot === "function")
|
|
717
|
+
return required.snapshot;
|
|
718
|
+
if (typeof required?.getSnapshot === "function")
|
|
719
|
+
return required.getSnapshot;
|
|
720
|
+
if (required && typeof required === "object" && (required.dom || required.snapshot || required.elements))
|
|
721
|
+
return () => required;
|
|
722
|
+
return void 0;
|
|
723
|
+
}
|
|
724
|
+
async function runDomSerializer(serializer, page, serializerPath) {
|
|
725
|
+
const candidateArgs = [page, page.mainFrame(), void 0];
|
|
726
|
+
let lastError;
|
|
727
|
+
for (const args of candidateArgs.map((value) => [value])) {
|
|
728
|
+
try {
|
|
729
|
+
const result = await Promise.resolve(serializer(...args));
|
|
730
|
+
if (result !== void 0 && !isEmptyDomSerializerResult(result))
|
|
731
|
+
return result;
|
|
732
|
+
} catch (e) {
|
|
733
|
+
lastError = e;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
try {
|
|
737
|
+
const direct = await Promise.resolve(serializer());
|
|
738
|
+
if (!isEmptyDomSerializerResult(direct))
|
|
739
|
+
return direct;
|
|
740
|
+
} catch (error) {
|
|
741
|
+
lastError = lastError || error;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
const browserResult = await runDomSerializerInPage(page, serializerPath);
|
|
745
|
+
if (!isEmptyDomSerializerResult(browserResult))
|
|
746
|
+
return browserResult;
|
|
747
|
+
|
|
748
|
+
if (lastError)
|
|
749
|
+
throw lastError;
|
|
750
|
+
throw new Error("DOM serializer returned an empty snapshot. Ensure domSerializer.js produces DOM tree data and element ids in the current page.");
|
|
751
|
+
}
|
|
752
|
+
function isEmptyDomSerializerResult(raw) {
|
|
753
|
+
if (raw === void 0 || raw === null)
|
|
754
|
+
return true;
|
|
755
|
+
if (typeof raw === "string")
|
|
756
|
+
return raw.trim().length === 0;
|
|
757
|
+
if (Array.isArray(raw))
|
|
758
|
+
return raw.length === 0;
|
|
759
|
+
if (typeof raw !== "object")
|
|
760
|
+
return false;
|
|
761
|
+
const normalized = import_domSnapshot.normalizeDomSnapshotResult(raw);
|
|
762
|
+
if (normalized.elements.length > 0)
|
|
763
|
+
return false;
|
|
764
|
+
if ((normalized.domSnapshotText || "").trim().length > 0)
|
|
765
|
+
return false;
|
|
766
|
+
if (typeof raw.domSnapshotText === "string" && raw.domSnapshotText.trim())
|
|
767
|
+
return false;
|
|
768
|
+
if (typeof raw.snapshotText === "string" && raw.snapshotText.trim())
|
|
769
|
+
return false;
|
|
770
|
+
return true;
|
|
771
|
+
}
|
|
772
|
+
async function runDomSerializerInPage(page, serializerPath) {
|
|
773
|
+
if (!serializerPath)
|
|
774
|
+
return void 0;
|
|
775
|
+
await ensureDomSerializerLoadedInPage(page, serializerPath);
|
|
776
|
+
const result = await page.evaluate(() => {
|
|
777
|
+
const serializer = typeof globalThis.serializeDOM === "function" ? globalThis.serializeDOM : typeof globalThis.domSerializer === "function" ? globalThis.domSerializer : typeof globalThis.domSerializer?.serializeDOM === "function" ? globalThis.domSerializer.serializeDOM : void 0;
|
|
778
|
+
if (typeof serializer !== "function")
|
|
779
|
+
return { __pwMcpDomSerializerError: "serializeDOM function was not found on window after loading domSerializer.js" };
|
|
780
|
+
try {
|
|
781
|
+
const root = document.documentElement || document.body || document;
|
|
782
|
+
return serializer(root);
|
|
783
|
+
} catch (error) {
|
|
784
|
+
const message = error && typeof error === "object" && "stack" in error ? String(error.stack) : String(error);
|
|
785
|
+
return { __pwMcpDomSerializerError: message };
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
if (result && typeof result === "object" && result.__pwMcpDomSerializerError)
|
|
789
|
+
throw new Error(`Failed to execute domSerializer.js in browser context: ${result.__pwMcpDomSerializerError}`);
|
|
790
|
+
return result;
|
|
791
|
+
}
|
|
792
|
+
async function ensureDomSerializerLoadedInPage(page, serializerPath) {
|
|
793
|
+
const hasSerializer = await page.evaluate(() => {
|
|
794
|
+
return typeof globalThis.serializeDOM === "function" || typeof globalThis.domSerializer === "function" || typeof globalThis.domSerializer?.serializeDOM === "function";
|
|
795
|
+
}).catch(() => false);
|
|
796
|
+
if (hasSerializer)
|
|
797
|
+
return;
|
|
798
|
+
|
|
799
|
+
try {
|
|
800
|
+
await page.addScriptTag({ path: serializerPath });
|
|
801
|
+
return;
|
|
802
|
+
} catch (_error) {
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
const serializerSource = await import_fs.promises.readFile(serializerPath, "utf-8");
|
|
806
|
+
await page.waitForFunction(() => !!document.documentElement, void 0, { timeout: 3e3 }).catch(() => {
|
|
807
|
+
});
|
|
808
|
+
await page.evaluate((source) => {
|
|
809
|
+
const parent = document.head || document.body || document.documentElement;
|
|
810
|
+
if (!parent)
|
|
811
|
+
throw new Error("No document root available for domSerializer.js injection");
|
|
812
|
+
const script = document.createElement("script");
|
|
813
|
+
script.type = "text/javascript";
|
|
814
|
+
script.text = `${source}
|
|
815
|
+
//# sourceURL=domSerializer.js`;
|
|
816
|
+
parent.appendChild(script);
|
|
817
|
+
script.remove();
|
|
818
|
+
}, serializerSource);
|
|
819
|
+
}
|
|
820
|
+
function normalizeCandidates(candidates) {
|
|
821
|
+
if (!Array.isArray(candidates))
|
|
822
|
+
return [];
|
|
823
|
+
const result = [];
|
|
824
|
+
const seen = new Set();
|
|
825
|
+
for (const candidate of candidates) {
|
|
826
|
+
const normalized = normalizeCandidate(candidate);
|
|
827
|
+
if (!normalized)
|
|
828
|
+
continue;
|
|
829
|
+
const key = `${normalized.kind}:${JSON.stringify(normalized.payload)}`;
|
|
830
|
+
if (seen.has(key))
|
|
831
|
+
continue;
|
|
832
|
+
seen.add(key);
|
|
833
|
+
result.push(normalized);
|
|
834
|
+
}
|
|
835
|
+
return result;
|
|
836
|
+
}
|
|
837
|
+
function normalizeCandidate(raw) {
|
|
838
|
+
if (!raw || typeof raw !== "object")
|
|
839
|
+
return void 0;
|
|
840
|
+
const kind = raw.kind || raw.type || raw.strategy || raw.candidateKind;
|
|
841
|
+
if (typeof kind === "string" && DOM_SNAPSHOT_KIND_SET.has(kind))
|
|
842
|
+
return { kind, payload: normalizeCandidatePayload(kind, raw.payload ?? raw)};
|
|
843
|
+
|
|
844
|
+
if (raw.getByTestId && raw.getByTestId.testId)
|
|
845
|
+
return { kind: DOM_SNAPSHOT_KINDS.testId, payload: { testId: raw.getByTestId.testId } };
|
|
846
|
+
if (raw.getByRole && raw.getByRole.role)
|
|
847
|
+
return { kind: DOM_SNAPSHOT_KINDS.role, payload: raw.getByRole };
|
|
848
|
+
if (raw.getByText && raw.getByText.text)
|
|
849
|
+
return { kind: DOM_SNAPSHOT_KINDS.text, payload: raw.getByText };
|
|
850
|
+
if (raw.getByPlaceholder && raw.getByPlaceholder.placeholder)
|
|
851
|
+
return { kind: DOM_SNAPSHOT_KINDS.placeholder, payload: raw.getByPlaceholder };
|
|
852
|
+
if (raw.getByCss && raw.getByCss.css)
|
|
853
|
+
return { kind: DOM_SNAPSHOT_KINDS.css, payload: raw.getByCss };
|
|
854
|
+
if (raw.getByXpath && raw.getByXpath.xpath)
|
|
855
|
+
return { kind: DOM_SNAPSHOT_KINDS.xpath, payload: raw.getByXpath };
|
|
856
|
+
|
|
857
|
+
if (raw.target && raw.target.kind)
|
|
858
|
+
return normalizeCandidate(raw.target);
|
|
859
|
+
|
|
860
|
+
if (typeof raw.role === "string")
|
|
861
|
+
return { kind: DOM_SNAPSHOT_KINDS.role, payload: raw };
|
|
862
|
+
if (typeof raw.testId === "string")
|
|
863
|
+
return { kind: DOM_SNAPSHOT_KINDS.testId, payload: raw };
|
|
864
|
+
if (typeof raw.css === "string")
|
|
865
|
+
return { kind: DOM_SNAPSHOT_KINDS.css, payload: raw };
|
|
866
|
+
if (typeof raw.xpath === "string")
|
|
867
|
+
return { kind: DOM_SNAPSHOT_KINDS.xpath, payload: raw };
|
|
868
|
+
if (typeof raw.text === "string")
|
|
869
|
+
return { kind: DOM_SNAPSHOT_KINDS.text, payload: raw };
|
|
870
|
+
if (typeof raw.value === "string")
|
|
871
|
+
return { kind: DOM_SNAPSHOT_KINDS.text, payload: raw };
|
|
872
|
+
if (typeof raw.id === "string")
|
|
873
|
+
return { kind: DOM_SNAPSHOT_KINDS.id, payload: raw };
|
|
874
|
+
if (typeof raw.nth === "number" || typeof raw.n === "number" || typeof raw.index === "number")
|
|
875
|
+
return { kind: DOM_SNAPSHOT_KINDS.nth, payload: { index: raw.index ?? raw.n ?? raw.nth } };
|
|
876
|
+
|
|
877
|
+
return void 0;
|
|
878
|
+
}
|
|
879
|
+
function normalizeCandidatePayload(kind, raw) {
|
|
880
|
+
if (!raw || typeof raw !== "object")
|
|
881
|
+
return {};
|
|
882
|
+
switch (kind) {
|
|
883
|
+
case DOM_SNAPSHOT_KINDS.testId:
|
|
884
|
+
return { testId: raw.testId || raw.value || raw.id || raw.selector };
|
|
885
|
+
case DOM_SNAPSHOT_KINDS.role:
|
|
886
|
+
return {
|
|
887
|
+
role: raw.role,
|
|
888
|
+
name: raw.name,
|
|
889
|
+
exact: raw.exact
|
|
890
|
+
};
|
|
891
|
+
case DOM_SNAPSHOT_KINDS.text:
|
|
892
|
+
case DOM_SNAPSHOT_KINDS.label:
|
|
893
|
+
case DOM_SNAPSHOT_KINDS.placeholder:
|
|
894
|
+
case DOM_SNAPSHOT_KINDS.altText:
|
|
895
|
+
case DOM_SNAPSHOT_KINDS.title:
|
|
896
|
+
return {
|
|
897
|
+
text: raw.text || raw.value || raw.label || raw.placeholder || raw.altText || raw.title,
|
|
898
|
+
exact: raw.exact
|
|
899
|
+
};
|
|
900
|
+
case DOM_SNAPSHOT_KINDS.css:
|
|
901
|
+
case DOM_SNAPSHOT_KINDS.xpath:
|
|
902
|
+
return {
|
|
903
|
+
value: raw.value || raw.css || raw.xpath
|
|
904
|
+
};
|
|
905
|
+
case DOM_SNAPSHOT_KINDS.id:
|
|
906
|
+
return { id: raw.id || raw.value };
|
|
907
|
+
case DOM_SNAPSHOT_KINDS.name:
|
|
908
|
+
return { name: raw.name || raw.value };
|
|
909
|
+
case DOM_SNAPSHOT_KINDS.dataAttr:
|
|
910
|
+
return { attr: raw.attr, value: raw.value };
|
|
911
|
+
case DOM_SNAPSHOT_KINDS.nth:
|
|
912
|
+
return {
|
|
913
|
+
index: Number.isFinite(raw.index) ? raw.index : Number.isFinite(raw.value) ? raw.value : raw.n
|
|
914
|
+
};
|
|
915
|
+
default:
|
|
916
|
+
return raw;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
function buildLocatorFromCandidate(frame, candidate) {
|
|
920
|
+
const payload = candidate.payload || {};
|
|
921
|
+
switch (candidate.kind) {
|
|
922
|
+
case DOM_SNAPSHOT_KINDS.testId: {
|
|
923
|
+
if (typeof payload.testId !== "string" && typeof payload.value !== "string")
|
|
924
|
+
return void 0;
|
|
925
|
+
return frame.getByTestId(payload.testId || payload.value);
|
|
926
|
+
}
|
|
927
|
+
case DOM_SNAPSHOT_KINDS.css: {
|
|
928
|
+
if (!payload.value)
|
|
929
|
+
return void 0;
|
|
930
|
+
return frame.locator(payload.value);
|
|
931
|
+
}
|
|
932
|
+
case DOM_SNAPSHOT_KINDS.xpath: {
|
|
933
|
+
if (!payload.value)
|
|
934
|
+
return void 0;
|
|
935
|
+
return frame.locator(`xpath=${payload.value}`);
|
|
936
|
+
}
|
|
937
|
+
case DOM_SNAPSHOT_KINDS.role: {
|
|
938
|
+
if (!payload.role)
|
|
939
|
+
return void 0;
|
|
940
|
+
const options = {};
|
|
941
|
+
if (payload.name)
|
|
942
|
+
options.name = payload.name;
|
|
943
|
+
if (payload.exact !== void 0)
|
|
944
|
+
options.exact = payload.exact;
|
|
945
|
+
return frame.getByRole(payload.role, options);
|
|
946
|
+
}
|
|
947
|
+
case DOM_SNAPSHOT_KINDS.text: {
|
|
948
|
+
if (!payload.text)
|
|
949
|
+
return void 0;
|
|
950
|
+
return frame.getByText(payload.text, payload.exact === void 0 ? void 0 : { exact: payload.exact });
|
|
951
|
+
}
|
|
952
|
+
case DOM_SNAPSHOT_KINDS.label: {
|
|
953
|
+
if (!payload.text)
|
|
954
|
+
return void 0;
|
|
955
|
+
return frame.getByLabel(payload.text, payload.exact === void 0 ? void 0 : { exact: payload.exact });
|
|
956
|
+
}
|
|
957
|
+
case DOM_SNAPSHOT_KINDS.placeholder: {
|
|
958
|
+
if (!payload.text)
|
|
959
|
+
return void 0;
|
|
960
|
+
return frame.getByPlaceholder(payload.text, payload.exact === void 0 ? void 0 : { exact: payload.exact });
|
|
961
|
+
}
|
|
962
|
+
case DOM_SNAPSHOT_KINDS.altText: {
|
|
963
|
+
if (!payload.text)
|
|
964
|
+
return void 0;
|
|
965
|
+
return frame.getByAltText(payload.text, payload.exact === void 0 ? void 0 : { exact: payload.exact });
|
|
966
|
+
}
|
|
967
|
+
case DOM_SNAPSHOT_KINDS.title: {
|
|
968
|
+
if (!payload.text)
|
|
969
|
+
return void 0;
|
|
970
|
+
return frame.getByTitle(payload.text, payload.exact === void 0 ? void 0 : { exact: payload.exact });
|
|
971
|
+
}
|
|
972
|
+
case DOM_SNAPSHOT_KINDS.id: {
|
|
973
|
+
if (!payload.id)
|
|
974
|
+
return void 0;
|
|
975
|
+
return frame.locator(`#${cssEscape(payload.id)}`);
|
|
976
|
+
}
|
|
977
|
+
case DOM_SNAPSHOT_KINDS.name: {
|
|
978
|
+
if (!payload.name)
|
|
979
|
+
return void 0;
|
|
980
|
+
return frame.locator(`[name=${quoteAttributeValue(payload.name)}]`);
|
|
981
|
+
}
|
|
982
|
+
case DOM_SNAPSHOT_KINDS.dataAttr: {
|
|
983
|
+
if (!payload.attr || !payload.value)
|
|
984
|
+
return void 0;
|
|
985
|
+
return frame.locator(`[${payload.attr}=${quoteAttributeValue(payload.value)}]`);
|
|
986
|
+
}
|
|
987
|
+
default:
|
|
988
|
+
return void 0;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
function locatorToCode(frame, candidates, selectedCandidate, isMainFrame, strict) {
|
|
992
|
+
const root = isMainFrame ? "" : "mainFrame().";
|
|
993
|
+
const baseCandidates = candidates.map((candidate) => normalizeCandidate(candidate)).filter(Boolean);
|
|
994
|
+
const selected = selectedCandidate ? normalizeCandidate(selectedCandidate) : void 0;
|
|
995
|
+
const candidate = selected?.kind !== DOM_SNAPSHOT_KINDS.nth ? selected : baseCandidates.find((entry) => entry.kind !== DOM_SNAPSHOT_KINDS.nth);
|
|
996
|
+
const nthCandidate = baseCandidates.find((entry) => entry.kind === DOM_SNAPSHOT_KINDS.nth);
|
|
997
|
+
if (!candidate)
|
|
998
|
+
return `${root}locator(':scope')`;
|
|
999
|
+
|
|
1000
|
+
const prefix = root;
|
|
1001
|
+
let result = "";
|
|
1002
|
+
const payload = candidate.payload || {};
|
|
1003
|
+
switch (candidate.kind) {
|
|
1004
|
+
case DOM_SNAPSHOT_KINDS.testId:
|
|
1005
|
+
result = `${prefix}getByTestId(${quoteString(payload.testId || payload.value)})`;
|
|
1006
|
+
break;
|
|
1007
|
+
case DOM_SNAPSHOT_KINDS.css:
|
|
1008
|
+
result = `${prefix}locator(${quoteString(payload.value)})`;
|
|
1009
|
+
break;
|
|
1010
|
+
case DOM_SNAPSHOT_KINDS.xpath:
|
|
1011
|
+
result = `${prefix}locator(${quoteString(`xpath=${payload.value}`)})`;
|
|
1012
|
+
break;
|
|
1013
|
+
case DOM_SNAPSHOT_KINDS.role:
|
|
1014
|
+
result = `${prefix}getByRole(${quoteString(payload.role)}, ${formatGetByOptions(payload)})`;
|
|
1015
|
+
break;
|
|
1016
|
+
case DOM_SNAPSHOT_KINDS.text:
|
|
1017
|
+
result = `${prefix}getByText(${quoteString(payload.text)}, ${formatGetByOptions(payload)})`;
|
|
1018
|
+
break;
|
|
1019
|
+
case DOM_SNAPSHOT_KINDS.label:
|
|
1020
|
+
result = `${prefix}getByLabel(${quoteString(payload.text)}, ${formatGetByOptions(payload)})`;
|
|
1021
|
+
break;
|
|
1022
|
+
case DOM_SNAPSHOT_KINDS.placeholder:
|
|
1023
|
+
result = `${prefix}getByPlaceholder(${quoteString(payload.text)}, ${formatGetByOptions(payload)})`;
|
|
1024
|
+
break;
|
|
1025
|
+
case DOM_SNAPSHOT_KINDS.altText:
|
|
1026
|
+
result = `${prefix}getByAltText(${quoteString(payload.text)}, ${formatGetByOptions(payload)})`;
|
|
1027
|
+
break;
|
|
1028
|
+
case DOM_SNAPSHOT_KINDS.title:
|
|
1029
|
+
result = `${prefix}getByTitle(${quoteString(payload.text)}, ${formatGetByOptions(payload)})`;
|
|
1030
|
+
break;
|
|
1031
|
+
case DOM_SNAPSHOT_KINDS.id:
|
|
1032
|
+
result = `${prefix}locator(${quoteString(`#${payload.id}`)})`;
|
|
1033
|
+
break;
|
|
1034
|
+
case DOM_SNAPSHOT_KINDS.name:
|
|
1035
|
+
result = `${prefix}locator(${quoteString(`[name=${payload.name}]`)})`;
|
|
1036
|
+
break;
|
|
1037
|
+
case DOM_SNAPSHOT_KINDS.dataAttr:
|
|
1038
|
+
result = `${prefix}locator(${quoteString(`[${payload.attr}=${quoteAttributeValue(payload.value)}]`)}`;
|
|
1039
|
+
break;
|
|
1040
|
+
default:
|
|
1041
|
+
result = `${prefix}locator(':scope')`;
|
|
1042
|
+
}
|
|
1043
|
+
if (nthCandidate) {
|
|
1044
|
+
const nthPayload = nthCandidate.payload || {};
|
|
1045
|
+
const idx = Number.isFinite(nthPayload.index) ? nthPayload.index : 0;
|
|
1046
|
+
result += `.nth(${idx})`;
|
|
1047
|
+
}
|
|
1048
|
+
if (!strict)
|
|
1049
|
+
result += ".first()";
|
|
1050
|
+
return result;
|
|
1051
|
+
}
|
|
1052
|
+
function formatGetByOptions(payload) {
|
|
1053
|
+
const options = [];
|
|
1054
|
+
if (payload.name)
|
|
1055
|
+
options.push(`name: ${quoteString(payload.name)}`);
|
|
1056
|
+
if (payload.exact !== void 0)
|
|
1057
|
+
options.push(`exact: ${payload.exact}`);
|
|
1058
|
+
if (!options.length)
|
|
1059
|
+
return "{ }";
|
|
1060
|
+
return `{ ${options.join(", ")} }`;
|
|
1061
|
+
}
|
|
1062
|
+
function quoteString(value) {
|
|
1063
|
+
if (typeof value === "string")
|
|
1064
|
+
return JSON.stringify(value);
|
|
1065
|
+
return JSON.stringify(String(value));
|
|
1066
|
+
}
|
|
1067
|
+
function quoteAttributeValue(value) {
|
|
1068
|
+
const escaped = cssEscape(String(value));
|
|
1069
|
+
return `\"${escaped}\"`;
|
|
1070
|
+
}
|
|
1071
|
+
function cssEscape(value) {
|
|
1072
|
+
return String(value).replace(/[\\"']/g, "\\$&").replace(/[\n\r\t]/g, " ");
|
|
1073
|
+
}
|
|
1074
|
+
function fallbackDomSnapshotTextFromElements(elements) {
|
|
1075
|
+
const lines = [];
|
|
1076
|
+
for (const element of elements) {
|
|
1077
|
+
if (!element?.id)
|
|
1078
|
+
continue;
|
|
1079
|
+
const text = element.meta?.accessibleName || element.meta?.text || element.meta?.tag || "element";
|
|
1080
|
+
lines.push(`- ${element.meta?.tag || "element"} "${text}" [ref=${element.id}]`);
|
|
1081
|
+
}
|
|
1082
|
+
return lines.join("\n");
|
|
1083
|
+
}
|
|
1084
|
+
function parseFramePath(framePath) {
|
|
1085
|
+
if (typeof framePath === "number")
|
|
1086
|
+
return [framePath];
|
|
1087
|
+
if (typeof framePath === "string") {
|
|
1088
|
+
const trimmed = framePath.trim();
|
|
1089
|
+
if (!trimmed)
|
|
1090
|
+
return [];
|
|
1091
|
+
try {
|
|
1092
|
+
const parsed = JSON.parse(trimmed);
|
|
1093
|
+
if (Array.isArray(parsed))
|
|
1094
|
+
return parsed.map((value) => Number(value)).filter((value) => Number.isFinite(value));
|
|
1095
|
+
} catch (e) {
|
|
1096
|
+
}
|
|
1097
|
+
if (/^[0-9,.\/-]+$/.test(trimmed))
|
|
1098
|
+
return trimmed.split(/[.,/]/).map((value) => Number(value)).filter((value) => Number.isFinite(value));
|
|
1099
|
+
return [];
|
|
1100
|
+
}
|
|
1101
|
+
if (Array.isArray(framePath))
|
|
1102
|
+
return framePath.map((value) => Number(value)).filter((value) => Number.isFinite(value));
|
|
1103
|
+
return [];
|
|
1104
|
+
}
|
|
1105
|
+
function messageToConsoleMessage(message) {
|
|
1106
|
+
const type = typeof message.type === "function" ? message.type() : message.type || "log";
|
|
1107
|
+
const text = typeof message.text === "function" ? message.text() : String(message.text ?? "");
|
|
1108
|
+
const timestamp = typeof message.timestamp === "function" ? message.timestamp() : typeof message.timestamp === "number" ? message.timestamp : Date.now();
|
|
1109
|
+
const location = typeof message.location === "function" ? message.location() : message.location || {};
|
|
1110
|
+
const locationUrl = location?.url || "unknown";
|
|
1111
|
+
const locationLine = location?.lineNumber ?? location?.line ?? 0;
|
|
1112
|
+
return {
|
|
1113
|
+
type,
|
|
1114
|
+
timestamp,
|
|
1115
|
+
text,
|
|
1116
|
+
toString: () => `[${type.toUpperCase()}] ${text} @ ${locationUrl}:${locationLine}`
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
function pageErrorToConsoleMessage(errorOrValue) {
|
|
1120
|
+
if (errorOrValue instanceof Error) {
|
|
1121
|
+
return {
|
|
1122
|
+
type: "error",
|
|
1123
|
+
timestamp: Date.now(),
|
|
1124
|
+
text: errorOrValue.message,
|
|
1125
|
+
toString: () => errorOrValue.stack || errorOrValue.message
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
return {
|
|
1129
|
+
type: "error",
|
|
1130
|
+
timestamp: Date.now(),
|
|
1131
|
+
text: String(errorOrValue),
|
|
1132
|
+
toString: () => String(errorOrValue)
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
function renderModalStates(config, modalStates) {
|
|
1136
|
+
const result = [];
|
|
1137
|
+
if (modalStates.length === 0)
|
|
1138
|
+
result.push("- There is no modal state present");
|
|
1139
|
+
for (const state of modalStates)
|
|
1140
|
+
result.push(`- [${state.description}]: can be handled by ${config.skillMode ? state.clearedBy.skill : state.clearedBy.tool}`);
|
|
1141
|
+
return result;
|
|
1142
|
+
}
|
|
1143
|
+
const consoleMessageLevels = ["error", "warning", "info", "debug"];
|
|
1144
|
+
function shouldIncludeMessage(thresholdLevel, type) {
|
|
1145
|
+
const messageLevel = consoleLevelForMessageType(type);
|
|
1146
|
+
return consoleMessageLevels.indexOf(messageLevel) <= consoleMessageLevels.indexOf(thresholdLevel);
|
|
1147
|
+
}
|
|
1148
|
+
function consoleLevelForMessageType(type) {
|
|
1149
|
+
switch (type) {
|
|
1150
|
+
case "assert":
|
|
1151
|
+
case "error":
|
|
1152
|
+
return "error";
|
|
1153
|
+
case "warning":
|
|
1154
|
+
return "warning";
|
|
1155
|
+
case "count":
|
|
1156
|
+
case "dir":
|
|
1157
|
+
case "dirxml":
|
|
1158
|
+
case "info":
|
|
1159
|
+
case "log":
|
|
1160
|
+
case "table":
|
|
1161
|
+
case "time":
|
|
1162
|
+
case "timeEnd":
|
|
1163
|
+
return "info";
|
|
1164
|
+
case "clear":
|
|
1165
|
+
case "debug":
|
|
1166
|
+
case "endGroup":
|
|
1167
|
+
case "profile":
|
|
1168
|
+
case "profileEnd":
|
|
1169
|
+
case "startGroup":
|
|
1170
|
+
case "startGroupCollapsed":
|
|
1171
|
+
case "trace":
|
|
1172
|
+
return "debug";
|
|
1173
|
+
default:
|
|
1174
|
+
return "info";
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
const tabSymbol = Symbol("tabSymbol");
|
|
1178
|
+
function sanitizeForFilePath(s) {
|
|
1179
|
+
const sanitize = (s2) => s2.replace(/[\x00-\x2C\x2E-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+/g, "-");
|
|
1180
|
+
const separator = s.lastIndexOf(".");
|
|
1181
|
+
if (separator === -1)
|
|
1182
|
+
return sanitize(s);
|
|
1183
|
+
return sanitize(s.substring(0, separator)) + "." + sanitize(s.substring(separator + 1));
|
|
1184
|
+
}
|
|
1185
|
+
function tabHeaderEquals(a, b) {
|
|
1186
|
+
return a.title === b.title && a.url === b.url && a.current === b.current && a.console.errors === b.console.errors && a.console.warnings === b.console.warnings && a.console.total === b.console.total;
|
|
1187
|
+
}
|
|
1188
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1189
|
+
0 && (module.exports = {
|
|
1190
|
+
Tab,
|
|
1191
|
+
renderModalStates,
|
|
1192
|
+
shouldIncludeMessage
|
|
1193
|
+
});
|