@ai-support-agent/cli 0.1.31 → 0.1.32-beta.0
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/dist/mcp/tools/browser/browser-session.d.ts +8 -34
- package/dist/mcp/tools/browser/browser-session.d.ts.map +1 -1
- package/dist/mcp/tools/browser/browser-session.js +35 -177
- package/dist/mcp/tools/browser/browser-session.js.map +1 -1
- package/dist/mcp/tools/browser/element-info.d.ts.map +1 -1
- package/dist/mcp/tools/browser/element-info.js +12 -179
- package/dist/mcp/tools/browser/element-info.js.map +1 -1
- package/dist/mcp/tools/browser/page-scripts.d.ts +87 -0
- package/dist/mcp/tools/browser/page-scripts.d.ts.map +1 -0
- package/dist/mcp/tools/browser/page-scripts.js +385 -0
- package/dist/mcp/tools/browser/page-scripts.js.map +1 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { Page } from 'playwright';
|
|
7
7
|
import { BrowserActionLog } from './browser-action-log';
|
|
8
8
|
import { DeviceEmulation } from './device-presets';
|
|
9
|
+
export { FOCUS_REPORTING_SCRIPT, SET_FOCUSED_INPUT_VALUE_SCRIPT } from './page-scripts';
|
|
9
10
|
/**
|
|
10
11
|
* Payload passed to Playwright's `FileChooser.setFiles`.
|
|
11
12
|
* - `string[]`: absolute paths on the agent FS (workspace files chosen by the user).
|
|
@@ -58,40 +59,6 @@ export interface FocusChangePayload {
|
|
|
58
59
|
/** Computed padding-left in px. */
|
|
59
60
|
paddingLeft?: number;
|
|
60
61
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Browser-context script installed (idempotently) into the page to report
|
|
63
|
-
* focus/value/selection changes of simple input/textarea elements back to the
|
|
64
|
-
* agent via the `window.__onBrowserFocus` binding exposed by Playwright.
|
|
65
|
-
*
|
|
66
|
-
* Runs in the browser, so it is a string passed to addInitScript / evaluate to
|
|
67
|
-
* avoid Node resolving DOM types (same convention as element-info scripts).
|
|
68
|
-
*
|
|
69
|
-
* Listens in the capture phase for focusin/focusout/input/selectionchange and,
|
|
70
|
-
* for reporting targets (textarea, or input whose type is one of the simple
|
|
71
|
-
* text-like types), builds and sends the focus payload. focusout / non-target
|
|
72
|
-
* elements send `{ focused: false }`.
|
|
73
|
-
*
|
|
74
|
-
* Listener registration is guarded by `window.__browserFocusReportingInstalled`
|
|
75
|
-
* so re-evaluating the script (e.g. after a navigation, or via reportFocusNow)
|
|
76
|
-
* does not double-register handlers. The INITIAL report, however, runs on EVERY
|
|
77
|
-
* evaluation (outside the guard): `focusin` only fires on focus CHANGES after
|
|
78
|
-
* registration, so an element that is already focused at injection time (e.g. an
|
|
79
|
-
* autofocused login field) would otherwise never be reported and its overlay
|
|
80
|
-
* caret would never appear. Reporting the current activeElement at the end of
|
|
81
|
-
* each evaluation surfaces such elements for both addInitScript (new document)
|
|
82
|
-
* and evaluate (existing/re-evaluated document) injection paths.
|
|
83
|
-
*/
|
|
84
|
-
export declare const FOCUS_REPORTING_SCRIPT = "() => {\n // The per-document focus reporting state (listeners + lastReportedFocused) is\n // installed once. Hang the report() helper off window so a re-evaluation that\n // skips re-registration can still invoke the initial report below.\n if (!window.__browserFocusReportingInstalled) {\n window.__browserFocusReportingInstalled = true;\n\n // Last focused state reported to the agent. Used to suppress repeated\n // { focused: false } notifications: selectionchange fires for the whole\n // document (including unrelated page text selections), so without this guard\n // every such selection would emit a redundant focused:false. We only forward\n // a false when transitioning from a previously-focused (true) state.\n var lastReportedFocused = false;\n\n // Forward a payload through the exposed binding, recording the new focused\n // state and logging the first failure once (high-frequency events would\n // otherwise flood the browser console).\n function emit(payload) {\n lastReportedFocused = payload.focused;\n try {\n window.__onBrowserFocus(payload);\n } catch (e) {\n if (!window.__focusReportErrorLogged) {\n window.__focusReportErrorLogged = true;\n try { console.warn('[focus-reporting] report failed', e && e.message ? e.message : e); } catch (_) {}\n }\n }\n }\n\n function isReportingTarget(el) {\n if (!el) return false;\n const tag = el.tagName;\n if (tag === 'TEXTAREA') return true;\n if (tag !== 'INPUT') return false;\n const type = (el.getAttribute('type') || '').toLowerCase();\n return type === '' || type === 'text' || type === 'search' || type === 'email' ||\n type === 'url' || type === 'tel' || type === 'password' || type === 'number';\n }\n\n function buildPayload(el) {\n const rect = el.getBoundingClientRect();\n const cs = getComputedStyle(el);\n const fontSize = parseFloat(cs.fontSize);\n const lineHeight = parseFloat(cs.lineHeight);\n const paddingTop = parseFloat(cs.paddingTop);\n const paddingLeft = parseFloat(cs.paddingLeft);\n const multiline = el.tagName === 'TEXTAREA';\n const payload = {\n focused: true,\n rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },\n value: el.value,\n selectionStart: el.selectionStart == null ? undefined : el.selectionStart,\n selectionEnd: el.selectionEnd == null ? undefined : el.selectionEnd,\n multiline: multiline,\n inputType: multiline ? 'textarea' : ((el.getAttribute('type') || 'text').toLowerCase()),\n textAlign: cs.textAlign,\n };\n if (typeof el.maxLength === 'number' && el.maxLength >= 0) payload.maxLength = el.maxLength;\n if (!Number.isNaN(fontSize)) payload.fontSize = fontSize;\n if (!Number.isNaN(lineHeight)) payload.lineHeight = lineHeight;\n if (!Number.isNaN(paddingTop)) payload.paddingTop = paddingTop;\n if (!Number.isNaN(paddingLeft)) payload.paddingLeft = paddingLeft;\n return payload;\n }\n\n // Report focused:true (with current value/selection) whenever a reporting\n // target is active; report focused:false only on the true->false transition.\n // Exposed on window so a guarded re-evaluation can still trigger the initial\n // report without re-registering listeners.\n window.__browserFocusReport = function () {\n const el = document.activeElement;\n if (isReportingTarget(el)) {\n emit(buildPayload(el));\n } else if (lastReportedFocused) {\n emit({ focused: false });\n }\n };\n\n document.addEventListener('focusin', window.__browserFocusReport, true);\n document.addEventListener('focusout', function () {\n if (lastReportedFocused) emit({ focused: false });\n }, true);\n document.addEventListener('input', window.__browserFocusReport, true);\n document.addEventListener('selectionchange', window.__browserFocusReport, true);\n }\n\n // Initial report on EVERY evaluation: surfaces an element that is already\n // focused at injection time (autofocus) for which focusin will never fire.\n if (typeof window.__browserFocusReport === 'function') window.__browserFocusReport();\n}";
|
|
85
|
-
/**
|
|
86
|
-
* Browser-context script that reflects a value into the currently-focused
|
|
87
|
-
* reporting-target input/textarea using the native value setter +
|
|
88
|
-
* InputEvent('input') dispatch, so React-style controlled components do not
|
|
89
|
-
* roll the value back. Optionally applies a selection range.
|
|
90
|
-
*
|
|
91
|
-
* No-op when the active element is not a reporting target. String script for
|
|
92
|
-
* the same reason as the others (DOM types resolved in the browser).
|
|
93
|
-
*/
|
|
94
|
-
export declare const SET_FOCUSED_INPUT_VALUE_SCRIPT = "(args) => {\n const el = document.activeElement;\n if (!el) return;\n const tag = el.tagName;\n let proto;\n if (tag === 'TEXTAREA') {\n proto = window.HTMLTextAreaElement.prototype;\n } else if (tag === 'INPUT') {\n const type = (el.getAttribute('type') || '').toLowerCase();\n const ok = type === '' || type === 'text' || type === 'search' || type === 'email' ||\n type === 'url' || type === 'tel' || type === 'password' || type === 'number';\n if (!ok) return;\n proto = window.HTMLInputElement.prototype;\n } else {\n return;\n }\n // The native value setter may be absent on exotic/polyfilled prototypes;\n // treat that as a no-op (same as a non-reporting target) rather than letting\n // a TypeError escape from reading .set of undefined.\n const desc = Object.getOwnPropertyDescriptor(proto, 'value');\n const setter = desc && desc.set;\n if (!setter) return;\n setter.call(el, args.value);\n el.dispatchEvent(new InputEvent('input', { bubbles: true }));\n if (args.selectionStart != null && args.selectionEnd != null) {\n try { el.setSelectionRange(args.selectionStart, args.selectionEnd); } catch (e) {}\n }\n}";
|
|
95
62
|
export declare class BrowserSession {
|
|
96
63
|
private browser;
|
|
97
64
|
private context;
|
|
@@ -123,6 +90,13 @@ export declare class BrowserSession {
|
|
|
123
90
|
* 同じ名前の binding を二重登録すると Playwright が例外を投げるため。
|
|
124
91
|
*/
|
|
125
92
|
private focusReportingExposed;
|
|
93
|
+
/**
|
|
94
|
+
* One-shot guard so a failing `__onBrowserFocus` binding callback is logged to
|
|
95
|
+
* the Node logger at most once. The browser-side script already rate-limits
|
|
96
|
+
* its own console.warn, but nothing subscribes to page console, so without
|
|
97
|
+
* this the caret overlay could die with zero server-side trace.
|
|
98
|
+
*/
|
|
99
|
+
private focusBindingErrorLogged;
|
|
126
100
|
/**
|
|
127
101
|
* Get the currently active device emulation ID, or null if none.
|
|
128
102
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-session.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/browser-session.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAwC,IAAI,EAAE,MAAM,YAAY,CAAA;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAkB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"browser-session.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/browser-session.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAwC,IAAI,EAAE,MAAM,YAAY,CAAA;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAkB,MAAM,kBAAkB,CAAA;AAYlE,OAAO,EAAE,sBAAsB,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAA;AAEvF;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B,MAAM,EAAE,GACR,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE7D;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,OAAO,EAAE,OAAO,CAAA;IAChB,gFAAgF;IAChF,IAAI,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM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,CAAC,MAAM,CAAC;IAUxC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAO7B;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAOhC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAO7B;;OAEG;IACH,aAAa,IAAI,MAAM;IAKvB;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAKrC,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,gBAAgB;CAIzB"}
|
|
@@ -11,176 +11,14 @@ const browser_action_log_1 = require("./browser-action-log");
|
|
|
11
11
|
const browser_types_1 = require("./browser-types");
|
|
12
12
|
const device_presets_1 = require("./device-presets");
|
|
13
13
|
const element_info_1 = require("./element-info");
|
|
14
|
+
const page_scripts_1 = require("./page-scripts");
|
|
14
15
|
const playwright_loader_1 = require("./playwright-loader");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const active = document.activeElement;
|
|
22
|
-
if (
|
|
23
|
-
active &&
|
|
24
|
-
(active.tagName === 'INPUT' || active.tagName === 'TEXTAREA') &&
|
|
25
|
-
active.selectionStart != null &&
|
|
26
|
-
active.selectionEnd != null &&
|
|
27
|
-
active.selectionStart !== active.selectionEnd
|
|
28
|
-
) {
|
|
29
|
-
return active.value.substring(active.selectionStart, active.selectionEnd);
|
|
30
|
-
}
|
|
31
|
-
const sel = window.getSelection();
|
|
32
|
-
return sel ? sel.toString() : '';
|
|
33
|
-
}`;
|
|
34
|
-
/**
|
|
35
|
-
* Browser-context script installed (idempotently) into the page to report
|
|
36
|
-
* focus/value/selection changes of simple input/textarea elements back to the
|
|
37
|
-
* agent via the `window.__onBrowserFocus` binding exposed by Playwright.
|
|
38
|
-
*
|
|
39
|
-
* Runs in the browser, so it is a string passed to addInitScript / evaluate to
|
|
40
|
-
* avoid Node resolving DOM types (same convention as element-info scripts).
|
|
41
|
-
*
|
|
42
|
-
* Listens in the capture phase for focusin/focusout/input/selectionchange and,
|
|
43
|
-
* for reporting targets (textarea, or input whose type is one of the simple
|
|
44
|
-
* text-like types), builds and sends the focus payload. focusout / non-target
|
|
45
|
-
* elements send `{ focused: false }`.
|
|
46
|
-
*
|
|
47
|
-
* Listener registration is guarded by `window.__browserFocusReportingInstalled`
|
|
48
|
-
* so re-evaluating the script (e.g. after a navigation, or via reportFocusNow)
|
|
49
|
-
* does not double-register handlers. The INITIAL report, however, runs on EVERY
|
|
50
|
-
* evaluation (outside the guard): `focusin` only fires on focus CHANGES after
|
|
51
|
-
* registration, so an element that is already focused at injection time (e.g. an
|
|
52
|
-
* autofocused login field) would otherwise never be reported and its overlay
|
|
53
|
-
* caret would never appear. Reporting the current activeElement at the end of
|
|
54
|
-
* each evaluation surfaces such elements for both addInitScript (new document)
|
|
55
|
-
* and evaluate (existing/re-evaluated document) injection paths.
|
|
56
|
-
*/
|
|
57
|
-
exports.FOCUS_REPORTING_SCRIPT = `() => {
|
|
58
|
-
// The per-document focus reporting state (listeners + lastReportedFocused) is
|
|
59
|
-
// installed once. Hang the report() helper off window so a re-evaluation that
|
|
60
|
-
// skips re-registration can still invoke the initial report below.
|
|
61
|
-
if (!window.__browserFocusReportingInstalled) {
|
|
62
|
-
window.__browserFocusReportingInstalled = true;
|
|
63
|
-
|
|
64
|
-
// Last focused state reported to the agent. Used to suppress repeated
|
|
65
|
-
// { focused: false } notifications: selectionchange fires for the whole
|
|
66
|
-
// document (including unrelated page text selections), so without this guard
|
|
67
|
-
// every such selection would emit a redundant focused:false. We only forward
|
|
68
|
-
// a false when transitioning from a previously-focused (true) state.
|
|
69
|
-
var lastReportedFocused = false;
|
|
70
|
-
|
|
71
|
-
// Forward a payload through the exposed binding, recording the new focused
|
|
72
|
-
// state and logging the first failure once (high-frequency events would
|
|
73
|
-
// otherwise flood the browser console).
|
|
74
|
-
function emit(payload) {
|
|
75
|
-
lastReportedFocused = payload.focused;
|
|
76
|
-
try {
|
|
77
|
-
window.__onBrowserFocus(payload);
|
|
78
|
-
} catch (e) {
|
|
79
|
-
if (!window.__focusReportErrorLogged) {
|
|
80
|
-
window.__focusReportErrorLogged = true;
|
|
81
|
-
try { console.warn('[focus-reporting] report failed', e && e.message ? e.message : e); } catch (_) {}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function isReportingTarget(el) {
|
|
87
|
-
if (!el) return false;
|
|
88
|
-
const tag = el.tagName;
|
|
89
|
-
if (tag === 'TEXTAREA') return true;
|
|
90
|
-
if (tag !== 'INPUT') return false;
|
|
91
|
-
const type = (el.getAttribute('type') || '').toLowerCase();
|
|
92
|
-
return type === '' || type === 'text' || type === 'search' || type === 'email' ||
|
|
93
|
-
type === 'url' || type === 'tel' || type === 'password' || type === 'number';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function buildPayload(el) {
|
|
97
|
-
const rect = el.getBoundingClientRect();
|
|
98
|
-
const cs = getComputedStyle(el);
|
|
99
|
-
const fontSize = parseFloat(cs.fontSize);
|
|
100
|
-
const lineHeight = parseFloat(cs.lineHeight);
|
|
101
|
-
const paddingTop = parseFloat(cs.paddingTop);
|
|
102
|
-
const paddingLeft = parseFloat(cs.paddingLeft);
|
|
103
|
-
const multiline = el.tagName === 'TEXTAREA';
|
|
104
|
-
const payload = {
|
|
105
|
-
focused: true,
|
|
106
|
-
rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
|
|
107
|
-
value: el.value,
|
|
108
|
-
selectionStart: el.selectionStart == null ? undefined : el.selectionStart,
|
|
109
|
-
selectionEnd: el.selectionEnd == null ? undefined : el.selectionEnd,
|
|
110
|
-
multiline: multiline,
|
|
111
|
-
inputType: multiline ? 'textarea' : ((el.getAttribute('type') || 'text').toLowerCase()),
|
|
112
|
-
textAlign: cs.textAlign,
|
|
113
|
-
};
|
|
114
|
-
if (typeof el.maxLength === 'number' && el.maxLength >= 0) payload.maxLength = el.maxLength;
|
|
115
|
-
if (!Number.isNaN(fontSize)) payload.fontSize = fontSize;
|
|
116
|
-
if (!Number.isNaN(lineHeight)) payload.lineHeight = lineHeight;
|
|
117
|
-
if (!Number.isNaN(paddingTop)) payload.paddingTop = paddingTop;
|
|
118
|
-
if (!Number.isNaN(paddingLeft)) payload.paddingLeft = paddingLeft;
|
|
119
|
-
return payload;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Report focused:true (with current value/selection) whenever a reporting
|
|
123
|
-
// target is active; report focused:false only on the true->false transition.
|
|
124
|
-
// Exposed on window so a guarded re-evaluation can still trigger the initial
|
|
125
|
-
// report without re-registering listeners.
|
|
126
|
-
window.__browserFocusReport = function () {
|
|
127
|
-
const el = document.activeElement;
|
|
128
|
-
if (isReportingTarget(el)) {
|
|
129
|
-
emit(buildPayload(el));
|
|
130
|
-
} else if (lastReportedFocused) {
|
|
131
|
-
emit({ focused: false });
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
document.addEventListener('focusin', window.__browserFocusReport, true);
|
|
136
|
-
document.addEventListener('focusout', function () {
|
|
137
|
-
if (lastReportedFocused) emit({ focused: false });
|
|
138
|
-
}, true);
|
|
139
|
-
document.addEventListener('input', window.__browserFocusReport, true);
|
|
140
|
-
document.addEventListener('selectionchange', window.__browserFocusReport, true);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Initial report on EVERY evaluation: surfaces an element that is already
|
|
144
|
-
// focused at injection time (autofocus) for which focusin will never fire.
|
|
145
|
-
if (typeof window.__browserFocusReport === 'function') window.__browserFocusReport();
|
|
146
|
-
}`;
|
|
147
|
-
/**
|
|
148
|
-
* Browser-context script that reflects a value into the currently-focused
|
|
149
|
-
* reporting-target input/textarea using the native value setter +
|
|
150
|
-
* InputEvent('input') dispatch, so React-style controlled components do not
|
|
151
|
-
* roll the value back. Optionally applies a selection range.
|
|
152
|
-
*
|
|
153
|
-
* No-op when the active element is not a reporting target. String script for
|
|
154
|
-
* the same reason as the others (DOM types resolved in the browser).
|
|
155
|
-
*/
|
|
156
|
-
exports.SET_FOCUSED_INPUT_VALUE_SCRIPT = `(args) => {
|
|
157
|
-
const el = document.activeElement;
|
|
158
|
-
if (!el) return;
|
|
159
|
-
const tag = el.tagName;
|
|
160
|
-
let proto;
|
|
161
|
-
if (tag === 'TEXTAREA') {
|
|
162
|
-
proto = window.HTMLTextAreaElement.prototype;
|
|
163
|
-
} else if (tag === 'INPUT') {
|
|
164
|
-
const type = (el.getAttribute('type') || '').toLowerCase();
|
|
165
|
-
const ok = type === '' || type === 'text' || type === 'search' || type === 'email' ||
|
|
166
|
-
type === 'url' || type === 'tel' || type === 'password' || type === 'number';
|
|
167
|
-
if (!ok) return;
|
|
168
|
-
proto = window.HTMLInputElement.prototype;
|
|
169
|
-
} else {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
// The native value setter may be absent on exotic/polyfilled prototypes;
|
|
173
|
-
// treat that as a no-op (same as a non-reporting target) rather than letting
|
|
174
|
-
// a TypeError escape from reading .set of undefined.
|
|
175
|
-
const desc = Object.getOwnPropertyDescriptor(proto, 'value');
|
|
176
|
-
const setter = desc && desc.set;
|
|
177
|
-
if (!setter) return;
|
|
178
|
-
setter.call(el, args.value);
|
|
179
|
-
el.dispatchEvent(new InputEvent('input', { bubbles: true }));
|
|
180
|
-
if (args.selectionStart != null && args.selectionEnd != null) {
|
|
181
|
-
try { el.setSelectionRange(args.selectionStart, args.selectionEnd); } catch (e) {}
|
|
182
|
-
}
|
|
183
|
-
}`;
|
|
16
|
+
// Re-exported so existing importers (and tests) continue to resolve these
|
|
17
|
+
// browser-context scripts from browser-session. The scripts themselves live in
|
|
18
|
+
// page-scripts.ts (DOM-typed, passed as real functions to Playwright).
|
|
19
|
+
var page_scripts_2 = require("./page-scripts");
|
|
20
|
+
Object.defineProperty(exports, "FOCUS_REPORTING_SCRIPT", { enumerable: true, get: function () { return page_scripts_2.FOCUS_REPORTING_SCRIPT; } });
|
|
21
|
+
Object.defineProperty(exports, "SET_FOCUSED_INPUT_VALUE_SCRIPT", { enumerable: true, get: function () { return page_scripts_2.SET_FOCUSED_INPUT_VALUE_SCRIPT; } });
|
|
184
22
|
class BrowserSession {
|
|
185
23
|
browser = null;
|
|
186
24
|
context = null;
|
|
@@ -212,6 +50,13 @@ class BrowserSession {
|
|
|
212
50
|
* 同じ名前の binding を二重登録すると Playwright が例外を投げるため。
|
|
213
51
|
*/
|
|
214
52
|
focusReportingExposed = false;
|
|
53
|
+
/**
|
|
54
|
+
* One-shot guard so a failing `__onBrowserFocus` binding callback is logged to
|
|
55
|
+
* the Node logger at most once. The browser-side script already rate-limits
|
|
56
|
+
* its own console.warn, but nothing subscribes to page console, so without
|
|
57
|
+
* this the caret overlay could die with zero server-side trace.
|
|
58
|
+
*/
|
|
59
|
+
focusBindingErrorLogged = false;
|
|
215
60
|
/**
|
|
216
61
|
* Get the currently active device emulation ID, or null if none.
|
|
217
62
|
*/
|
|
@@ -289,7 +134,20 @@ class BrowserSession {
|
|
|
289
134
|
async enableFocusReporting(page) {
|
|
290
135
|
if (!this.focusReportingExposed) {
|
|
291
136
|
try {
|
|
292
|
-
await page.exposeBinding('__onBrowserFocus', (_src, payload) =>
|
|
137
|
+
await page.exposeBinding('__onBrowserFocus', (_src, payload) => {
|
|
138
|
+
// Surface binding callback failures to the Node logger (once) so a
|
|
139
|
+
// permanently-broken focus channel is observable server-side; the
|
|
140
|
+
// browser-side console.warn alone never reaches the agent.
|
|
141
|
+
try {
|
|
142
|
+
this.onFocusChange?.(payload);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (!this.focusBindingErrorLogged) {
|
|
146
|
+
this.focusBindingErrorLogged = true;
|
|
147
|
+
logger_1.logger.warn(`[browser] Focus reporting binding callback failed: ${String(error)}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
293
151
|
this.focusReportingExposed = true;
|
|
294
152
|
}
|
|
295
153
|
catch (error) {
|
|
@@ -297,8 +155,8 @@ class BrowserSession {
|
|
|
297
155
|
}
|
|
298
156
|
}
|
|
299
157
|
try {
|
|
300
|
-
await page.addInitScript(
|
|
301
|
-
await page.evaluate(
|
|
158
|
+
await page.addInitScript(page_scripts_1.FOCUS_REPORTING_SCRIPT);
|
|
159
|
+
await page.evaluate(page_scripts_1.FOCUS_REPORTING_SCRIPT);
|
|
302
160
|
}
|
|
303
161
|
catch (error) {
|
|
304
162
|
logger_1.logger.warn(`[browser] Focus reporting script not injected: ${String(error)}`);
|
|
@@ -322,7 +180,7 @@ class BrowserSession {
|
|
|
322
180
|
if (!this.page)
|
|
323
181
|
return;
|
|
324
182
|
try {
|
|
325
|
-
await this.page.evaluate(
|
|
183
|
+
await this.page.evaluate(page_scripts_1.FOCUS_REPORTING_SCRIPT);
|
|
326
184
|
}
|
|
327
185
|
catch (error) {
|
|
328
186
|
logger_1.logger.warn(`[browser] Focus re-report failed: ${String(error)}`);
|
|
@@ -339,7 +197,7 @@ class BrowserSession {
|
|
|
339
197
|
async setFocusedInputValue(value, selectionStart, selectionEnd) {
|
|
340
198
|
const page = this.assertPageActive();
|
|
341
199
|
this.resetIdleTimer();
|
|
342
|
-
await page.evaluate(
|
|
200
|
+
await page.evaluate(page_scripts_1.SET_FOCUSED_INPUT_VALUE_SCRIPT, { value, selectionStart, selectionEnd });
|
|
343
201
|
}
|
|
344
202
|
/**
|
|
345
203
|
* Check if a browser session is currently active.
|
|
@@ -696,9 +554,9 @@ class BrowserSession {
|
|
|
696
554
|
async getSelectedText() {
|
|
697
555
|
const page = this.assertPageActive();
|
|
698
556
|
this.resetIdleTimer();
|
|
699
|
-
// page.evaluate
|
|
700
|
-
//
|
|
701
|
-
const result = await page.evaluate(GET_SELECTED_TEXT_SCRIPT);
|
|
557
|
+
// page.evaluate のコールバックはブラウザコンテキストで実行される。実関数として
|
|
558
|
+
// 渡し、DOM 型は page-scripts.ts 内で解決する(element-info と同じ方針)。
|
|
559
|
+
const result = await page.evaluate(page_scripts_1.GET_SELECTED_TEXT_SCRIPT);
|
|
702
560
|
return typeof result === 'string' ? result : '';
|
|
703
561
|
}
|
|
704
562
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-session.js","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/browser-session.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,4CAAwC;AACxC,6DAAuD;AACvD,mDAAyD;AACzD,qDAAkE;AAClE,iDAAsF;AACtF,2DAAoD;AAEpD;;;;GAIG;AACH,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;EAa/B,CAAA;AAiDF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyFpC,CAAA;AAEF;;;;;;;;GAQG;AACU,QAAA,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B5C,CAAA;AAEF,MAAa,cAAc;IACjB,OAAO,GAAmB,IAAI,CAAA;IAC9B,OAAO,GAA0B,IAAI,CAAA;IACrC,IAAI,GAAgB,IAAI,CAAA;IACxB,SAAS,GAAyC,IAAI,CAAA;IAC7C,aAAa,CAAQ;IAC9B,gBAAgB,GAA0C,IAAI,CAAA;IAC9D,iBAAiB,GAAwB,IAAI,CAAA;IAC7C,cAAc,GAAyC,IAAI,CAAA;IAC3D,gBAAgB,GAAsC,IAAI,CAAA;IAC1D,cAAc,GAAkB,IAAI,CAAA;IACpC,gBAAgB,GAAkB,IAAI,CAAA;IACtC,MAAM,GAAG,KAAK,CAAA;IACL,QAAQ,CAAa;IAC9B,kBAAkB,GAAuB,IAAI,CAAA;IACrD;;;;OAIG;IACH,a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AA;IAC9D,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAA;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAY,CAAA;IAClC,CAAC;IAED;;;;OAIG;IACH,IAAI,OAAO;QACT,OAAO,CAAC,IAAI,CAAC,MAAM,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAA;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAqB,CAAA;IAC7C,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,wCAAwC;QACxC,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAM;QACjC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,eAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;YAC/D,KAAK,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;IACxB,CAAC;IAEO,cAAc;QACpB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QACvB,CAAC;IACH,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QACzD,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;CACF;AA1nBD,wCA0nBC"}
|
|
1
|
+
{"version":3,"file":"browser-session.js","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/browser-session.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,4CAAwC;AACxC,6DAAuD;AACvD,mDAAyD;AACzD,q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AAC,IAAI,CAAC,MAAM,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAA;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAqB,CAAA;IAC7C,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,wCAAwC;QACxC,IAAI,IAAI,CAAC,gBAAgB;YAAE,OAAM;QACjC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,eAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;YAC/D,KAAK,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;IACxB,CAAC;IAEO,cAAc;QACpB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;QACvB,CAAC;IACH,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QACzD,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;CACF;AA9oBD,wCA8oBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-info.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/element-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"element-info.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/element-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAStC,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,QAAQ,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAUrG;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAOnF;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAiB3D"}
|
|
@@ -10,189 +10,21 @@ exports.getElementAtPoint = getElementAtPoint;
|
|
|
10
10
|
exports.getFocusedElementInfo = getFocusedElementInfo;
|
|
11
11
|
exports.getCursorAt = getCursorAt;
|
|
12
12
|
exports.formatElementInfo = formatElementInfo;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* Returns ElementInfo-compatible object or null.
|
|
16
|
-
*/
|
|
17
|
-
const ELEMENT_AT_POINT_SCRIPT = `(point) => {
|
|
18
|
-
const el = document.elementFromPoint(point.x, point.y);
|
|
19
|
-
if (!el) return null;
|
|
20
|
-
return extractInfo(el);
|
|
21
|
-
|
|
22
|
-
function extractInfo(el) {
|
|
23
|
-
const tag = el.tagName.toLowerCase();
|
|
24
|
-
const id = el.id;
|
|
25
|
-
const name = el.getAttribute('name');
|
|
26
|
-
const type = el.getAttribute('type');
|
|
27
|
-
const role = el.getAttribute('role') || implicitRole(tag, type);
|
|
28
|
-
const ariaLabel = el.getAttribute('aria-label');
|
|
29
|
-
const placeholder = el.getAttribute('placeholder');
|
|
30
|
-
const title = el.getAttribute('title');
|
|
31
|
-
const href = el.getAttribute('href');
|
|
32
|
-
const text = getVisibleText(el);
|
|
33
|
-
const testId = el.getAttribute('data-testid') || el.getAttribute('data-test-id');
|
|
34
|
-
|
|
35
|
-
const selector = buildSelector(el, tag, id, name, testId, text, role, ariaLabel, placeholder, type);
|
|
36
|
-
const label = ariaLabel || placeholder || name || title || undefined;
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
selector,
|
|
40
|
-
tagName: tag,
|
|
41
|
-
type: type || undefined,
|
|
42
|
-
text: text || undefined,
|
|
43
|
-
role: role || undefined,
|
|
44
|
-
label: label || undefined,
|
|
45
|
-
href: href || undefined,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function buildSelector(el, tag, id, name, testId, text, role, ariaLabel, placeholder, type) {
|
|
50
|
-
// Priority 1: data-testid (most stable)
|
|
51
|
-
if (testId) return '[data-testid="' + testId + '"]';
|
|
52
|
-
|
|
53
|
-
// Priority 2: id (unique)
|
|
54
|
-
if (id) return '#' + CSS.escape(id);
|
|
55
|
-
|
|
56
|
-
// Priority 3: role + name (accessible selectors)
|
|
57
|
-
if (role && ariaLabel) return tag + '[role="' + role + '"][aria-label="' + ariaLabel + '"]';
|
|
58
|
-
|
|
59
|
-
// Priority 4: name attribute (forms)
|
|
60
|
-
if (name && (tag === 'input' || tag === 'select' || tag === 'textarea')) {
|
|
61
|
-
return tag + '[name="' + name + '"]';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Priority 5: Playwright text selector for buttons/links
|
|
65
|
-
if (text && text.length <= 50 && (tag === 'button' || tag === 'a' || role === 'button' || role === 'link')) {
|
|
66
|
-
return tag + ':has-text("' + text.replace(/"/g, '\\\\"') + '")';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Priority 6: placeholder for inputs
|
|
70
|
-
if (placeholder && tag === 'input') {
|
|
71
|
-
return 'input[placeholder="' + placeholder + '"]';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Priority 7: type for inputs
|
|
75
|
-
if (type && tag === 'input') {
|
|
76
|
-
// Check if unique enough by adding parent context
|
|
77
|
-
const parent = el.parentElement;
|
|
78
|
-
if (parent && parent.id) {
|
|
79
|
-
return '#' + CSS.escape(parent.id) + ' > input[type="' + type + '"]';
|
|
80
|
-
}
|
|
81
|
-
return 'input[type="' + type + '"]';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Priority 8: nth-of-type with class
|
|
85
|
-
const classes = Array.from(el.classList).filter(c => !c.match(/^(js-|is-|has-)/)).slice(0, 2);
|
|
86
|
-
if (classes.length > 0) {
|
|
87
|
-
const classSelector = tag + '.' + classes.map(c => CSS.escape(c)).join('.');
|
|
88
|
-
const siblings = document.querySelectorAll(classSelector);
|
|
89
|
-
if (siblings.length === 1) return classSelector;
|
|
90
|
-
const index = Array.from(siblings).indexOf(el);
|
|
91
|
-
if (index >= 0) return classSelector + ':nth-of-type(' + (index + 1) + ')';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Fallback: tag with index
|
|
95
|
-
return tag;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function getVisibleText(el) {
|
|
99
|
-
const text = (el.textContent || '').trim();
|
|
100
|
-
return text.length > 80 ? text.substring(0, 77) + '...' : text;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function implicitRole(tag, type) {
|
|
104
|
-
if (tag === 'button') return 'button';
|
|
105
|
-
if (tag === 'a') return 'link';
|
|
106
|
-
if (tag === 'input') {
|
|
107
|
-
if (type === 'checkbox') return 'checkbox';
|
|
108
|
-
if (type === 'radio') return 'radio';
|
|
109
|
-
if (type === 'submit') return 'button';
|
|
110
|
-
if (!type || type === 'text' || type === 'email' || type === 'password' || type === 'search' || type === 'tel' || type === 'url' || type === 'number') return 'textbox';
|
|
111
|
-
}
|
|
112
|
-
if (tag === 'textarea') return 'textbox';
|
|
113
|
-
if (tag === 'select') return 'combobox';
|
|
114
|
-
if (tag === 'img') return 'img';
|
|
115
|
-
return '';
|
|
116
|
-
}
|
|
117
|
-
}`;
|
|
118
|
-
/**
|
|
119
|
-
* JavaScript to read the CSS `cursor` value of the element at a point.
|
|
120
|
-
* Mirrors ELEMENT_AT_POINT_SCRIPT's string-script convention so the browser
|
|
121
|
-
* context (not Node) resolves DOM types. Returns 'default' when no element is
|
|
122
|
-
* found or the computed cursor is empty.
|
|
123
|
-
*/
|
|
124
|
-
const CURSOR_AT_POINT_SCRIPT = `(point) => {
|
|
125
|
-
const el = document.elementFromPoint(point.x, point.y);
|
|
126
|
-
if (!el) return 'default';
|
|
127
|
-
return getComputedStyle(el).cursor || 'default';
|
|
128
|
-
}`;
|
|
129
|
-
/**
|
|
130
|
-
* JavaScript to extract info about the currently focused element.
|
|
131
|
-
*/
|
|
132
|
-
const FOCUSED_ELEMENT_SCRIPT = `() => {
|
|
133
|
-
const el = document.activeElement;
|
|
134
|
-
if (!el || el === document.body) return null;
|
|
135
|
-
|
|
136
|
-
const tag = el.tagName.toLowerCase();
|
|
137
|
-
const id = el.id;
|
|
138
|
-
const name = el.getAttribute('name');
|
|
139
|
-
const type = el.getAttribute('type');
|
|
140
|
-
const role = el.getAttribute('role') || implicitRole(tag, type);
|
|
141
|
-
const ariaLabel = el.getAttribute('aria-label');
|
|
142
|
-
const placeholder = el.getAttribute('placeholder');
|
|
143
|
-
const title = el.getAttribute('title');
|
|
144
|
-
const testId = el.getAttribute('data-testid') || el.getAttribute('data-test-id');
|
|
145
|
-
|
|
146
|
-
const selector = buildSelector(el, tag, id, name, testId, '', role, ariaLabel, placeholder, type);
|
|
147
|
-
const label = ariaLabel || placeholder || name || title || undefined;
|
|
148
|
-
|
|
149
|
-
return {
|
|
150
|
-
selector,
|
|
151
|
-
tagName: tag,
|
|
152
|
-
type: type || undefined,
|
|
153
|
-
role: role || undefined,
|
|
154
|
-
label: label || undefined,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
function buildSelector(el, tag, id, name, testId, text, role, ariaLabel, placeholder, type) {
|
|
158
|
-
if (testId) return '[data-testid="' + testId + '"]';
|
|
159
|
-
if (id) return '#' + CSS.escape(id);
|
|
160
|
-
if (role && ariaLabel) return tag + '[role="' + role + '"][aria-label="' + ariaLabel + '"]';
|
|
161
|
-
if (name && (tag === 'input' || tag === 'select' || tag === 'textarea')) {
|
|
162
|
-
return tag + '[name="' + name + '"]';
|
|
163
|
-
}
|
|
164
|
-
if (placeholder && tag === 'input') {
|
|
165
|
-
return 'input[placeholder="' + placeholder + '"]';
|
|
166
|
-
}
|
|
167
|
-
if (type && tag === 'input') return 'input[type="' + type + '"]';
|
|
168
|
-
const classes = Array.from(el.classList).filter(c => !c.match(/^(js-|is-|has-)/)).slice(0, 2);
|
|
169
|
-
if (classes.length > 0) return tag + '.' + classes.map(c => CSS.escape(c)).join('.');
|
|
170
|
-
return tag;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function implicitRole(tag, type) {
|
|
174
|
-
if (tag === 'button') return 'button';
|
|
175
|
-
if (tag === 'a') return 'link';
|
|
176
|
-
if (tag === 'input') {
|
|
177
|
-
if (type === 'checkbox') return 'checkbox';
|
|
178
|
-
if (type === 'radio') return 'radio';
|
|
179
|
-
if (type === 'submit') return 'button';
|
|
180
|
-
if (!type || type === 'text' || type === 'email' || type === 'password' || type === 'search' || type === 'tel' || type === 'url' || type === 'number') return 'textbox';
|
|
181
|
-
}
|
|
182
|
-
if (tag === 'textarea') return 'textbox';
|
|
183
|
-
if (tag === 'select') return 'combobox';
|
|
184
|
-
return '';
|
|
185
|
-
}
|
|
186
|
-
}`;
|
|
13
|
+
const logger_1 = require("../../../logger");
|
|
14
|
+
const page_scripts_1 = require("./page-scripts");
|
|
187
15
|
/**
|
|
188
16
|
* Get element info at the given coordinates via page.evaluate().
|
|
189
17
|
* Returns null if no element found or on error.
|
|
190
18
|
*/
|
|
191
19
|
async function getElementAtPoint(page, x, y) {
|
|
192
20
|
try {
|
|
193
|
-
return await page.evaluate(ELEMENT_AT_POINT_SCRIPT, { x, y });
|
|
21
|
+
return await page.evaluate(page_scripts_1.ELEMENT_AT_POINT_SCRIPT, { x, y });
|
|
194
22
|
}
|
|
195
|
-
catch {
|
|
23
|
+
catch (error) {
|
|
24
|
+
// The script now actually executes in the page, so real eval errors reach
|
|
25
|
+
// here; log them (debug — this is best-effort enrichment) instead of
|
|
26
|
+
// silently dropping them.
|
|
27
|
+
logger_1.logger.debug(`[browser] getElementAtPoint evaluate failed: ${String(error)}`);
|
|
196
28
|
return null;
|
|
197
29
|
}
|
|
198
30
|
}
|
|
@@ -202,9 +34,10 @@ async function getElementAtPoint(page, x, y) {
|
|
|
202
34
|
*/
|
|
203
35
|
async function getFocusedElementInfo(page) {
|
|
204
36
|
try {
|
|
205
|
-
return await page.evaluate(FOCUSED_ELEMENT_SCRIPT);
|
|
37
|
+
return await page.evaluate(page_scripts_1.FOCUSED_ELEMENT_SCRIPT);
|
|
206
38
|
}
|
|
207
|
-
catch {
|
|
39
|
+
catch (error) {
|
|
40
|
+
logger_1.logger.debug(`[browser] getFocusedElementInfo evaluate failed: ${String(error)}`);
|
|
208
41
|
return null;
|
|
209
42
|
}
|
|
210
43
|
}
|
|
@@ -217,7 +50,7 @@ async function getFocusedElementInfo(page) {
|
|
|
217
50
|
* cursor update for that frame instead of reporting a misleading 'default'.
|
|
218
51
|
*/
|
|
219
52
|
async function getCursorAt(page, x, y) {
|
|
220
|
-
const result = await page.evaluate(CURSOR_AT_POINT_SCRIPT, { x, y });
|
|
53
|
+
const result = await page.evaluate(page_scripts_1.CURSOR_AT_POINT_SCRIPT, { x, y });
|
|
221
54
|
return typeof result === 'string' ? result : 'default';
|
|
222
55
|
}
|
|
223
56
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-info.js","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/element-info.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;
|
|
1
|
+
{"version":3,"file":"element-info.js","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/element-info.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiCH,8CAUC;AAMD,sDAOC;AAUD,kCAGC;AAKD,8CAiBC;AAvFD,4CAAwC;AACxC,iDAIuB;AAoBvB;;;GAGG;AACI,KAAK,UAAU,iBAAiB,CAAC,IAAU,EAAE,CAAS,EAAE,CAAS;IACtE,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,sCAAuB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAuB,CAAA;IACrF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0EAA0E;QAC1E,qEAAqE;QACrE,0BAA0B;QAC1B,eAAM,CAAC,KAAK,CAAC,gDAAgD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC7E,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,qBAAqB,CAAC,IAAU;IACpD,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,qCAAsB,CAAuB,CAAA;IAC1E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,oDAAoD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACjF,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAAC,IAAU,EAAE,CAAS,EAAE,CAAS;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|
+
* page.evaluate() / page.addInitScript().
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: every function in this module is serialized by Playwright and
|
|
6
|
+
* executed INSIDE the browser page, NOT in Node. They must therefore be
|
|
7
|
+
* self-contained (no references to Node/module-scope variables) and may only
|
|
8
|
+
* use browser globals (document, window, getComputedStyle, CSS, …).
|
|
9
|
+
*
|
|
10
|
+
* They are REAL functions (not strings): Playwright treats a string
|
|
11
|
+
* pageFunction as a JS expression and never calls it, so a string arrow
|
|
12
|
+
* function would silently do nothing and ignore its argument. Passing the
|
|
13
|
+
* function directly lets Playwright serialize and invoke it with the arg.
|
|
14
|
+
*
|
|
15
|
+
* DOM typing is provided by the MODULE-SCOPED ambient declarations below. They
|
|
16
|
+
* intentionally avoid `/// <reference lib="dom" />` and `declare global`, both
|
|
17
|
+
* of which leak DOM types into the rest of the (Node) codebase; module-scoped
|
|
18
|
+
* `declare const` bindings are visible only within this file, so the global
|
|
19
|
+
* tsconfig `lib: ["ES2022"]` (no "DOM") still catches stray DOM usage elsewhere.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Extract Playwright-friendly element info for the element at a point.
|
|
23
|
+
* Returns an ElementInfo-compatible object or null.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ELEMENT_AT_POINT_SCRIPT: (point: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}) => {
|
|
29
|
+
selector: string;
|
|
30
|
+
tagName: string;
|
|
31
|
+
type: string | undefined;
|
|
32
|
+
text: string | undefined;
|
|
33
|
+
role: string | undefined;
|
|
34
|
+
label: string | undefined;
|
|
35
|
+
href: string | undefined;
|
|
36
|
+
} | null;
|
|
37
|
+
/**
|
|
38
|
+
* Read the CSS `cursor` value of the element at a point. Returns 'default' when
|
|
39
|
+
* no element is found or the computed cursor is empty.
|
|
40
|
+
*/
|
|
41
|
+
export declare const CURSOR_AT_POINT_SCRIPT: (point: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
}) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Extract info about the currently focused element.
|
|
47
|
+
*/
|
|
48
|
+
export declare const FOCUSED_ELEMENT_SCRIPT: () => {
|
|
49
|
+
selector: string;
|
|
50
|
+
tagName: string;
|
|
51
|
+
type: string | undefined;
|
|
52
|
+
role: string | undefined;
|
|
53
|
+
label: string | undefined;
|
|
54
|
+
} | null;
|
|
55
|
+
/**
|
|
56
|
+
* Read the current selection. Prefers the selection range of a focused
|
|
57
|
+
* input/textarea, falling back to the document selection. Returns an empty
|
|
58
|
+
* string when nothing is selected.
|
|
59
|
+
*/
|
|
60
|
+
export declare const GET_SELECTED_TEXT_SCRIPT: () => string;
|
|
61
|
+
/**
|
|
62
|
+
* Install (idempotently) focus/value/selection reporting for simple
|
|
63
|
+
* input/textarea elements. Reports through the `window.__onBrowserFocus`
|
|
64
|
+
* binding exposed by Playwright.
|
|
65
|
+
*
|
|
66
|
+
* Listener registration is guarded by `window.__browserFocusReportingInstalled`
|
|
67
|
+
* so re-evaluating the script does not double-register handlers. The INITIAL
|
|
68
|
+
* report runs on EVERY evaluation (outside the guard) so an element already
|
|
69
|
+
* focused at injection time (e.g. an autofocused login field) is surfaced.
|
|
70
|
+
*
|
|
71
|
+
* Browser-side failures of the exposed binding are warned at most once here;
|
|
72
|
+
* the Node side (browser-session.ts exposeBinding wrapper) adds server-log
|
|
73
|
+
* observability for binding callback failures.
|
|
74
|
+
*/
|
|
75
|
+
export declare const FOCUS_REPORTING_SCRIPT: () => void;
|
|
76
|
+
/**
|
|
77
|
+
* Reflect a value into the currently-focused reporting-target input/textarea
|
|
78
|
+
* using the native value setter + InputEvent('input') dispatch, so React-style
|
|
79
|
+
* controlled components do not roll the value back. Optionally applies a
|
|
80
|
+
* selection range. No-op when the active element is not a reporting target.
|
|
81
|
+
*/
|
|
82
|
+
export declare const SET_FOCUSED_INPUT_VALUE_SCRIPT: (args: {
|
|
83
|
+
value: string;
|
|
84
|
+
selectionStart?: number;
|
|
85
|
+
selectionEnd?: number;
|
|
86
|
+
}) => void;
|
|
87
|
+
//# sourceMappingURL=page-scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-scripts.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/page-scripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA4EH;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;QA+GtE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,MAIxE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;QAiElC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAO,MAa3C,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,YAyFlC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,GAAI,MAAM;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,SA4BA,CAAA"}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* page-scripts.ts — Browser-context functions passed to Playwright's
|
|
4
|
+
* page.evaluate() / page.addInitScript().
|
|
5
|
+
*
|
|
6
|
+
* IMPORTANT: every function in this module is serialized by Playwright and
|
|
7
|
+
* executed INSIDE the browser page, NOT in Node. They must therefore be
|
|
8
|
+
* self-contained (no references to Node/module-scope variables) and may only
|
|
9
|
+
* use browser globals (document, window, getComputedStyle, CSS, …).
|
|
10
|
+
*
|
|
11
|
+
* They are REAL functions (not strings): Playwright treats a string
|
|
12
|
+
* pageFunction as a JS expression and never calls it, so a string arrow
|
|
13
|
+
* function would silently do nothing and ignore its argument. Passing the
|
|
14
|
+
* function directly lets Playwright serialize and invoke it with the arg.
|
|
15
|
+
*
|
|
16
|
+
* DOM typing is provided by the MODULE-SCOPED ambient declarations below. They
|
|
17
|
+
* intentionally avoid `/// <reference lib="dom" />` and `declare global`, both
|
|
18
|
+
* of which leak DOM types into the rest of the (Node) codebase; module-scoped
|
|
19
|
+
* `declare const` bindings are visible only within this file, so the global
|
|
20
|
+
* tsconfig `lib: ["ES2022"]` (no "DOM") still catches stray DOM usage elsewhere.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.SET_FOCUSED_INPUT_VALUE_SCRIPT = exports.FOCUS_REPORTING_SCRIPT = exports.GET_SELECTED_TEXT_SCRIPT = exports.FOCUSED_ELEMENT_SCRIPT = exports.CURSOR_AT_POINT_SCRIPT = exports.ELEMENT_AT_POINT_SCRIPT = void 0;
|
|
24
|
+
/**
|
|
25
|
+
* Extract Playwright-friendly element info for the element at a point.
|
|
26
|
+
* Returns an ElementInfo-compatible object or null.
|
|
27
|
+
*/
|
|
28
|
+
const ELEMENT_AT_POINT_SCRIPT = (point) => {
|
|
29
|
+
const el = document.elementFromPoint(point.x, point.y);
|
|
30
|
+
if (!el)
|
|
31
|
+
return null;
|
|
32
|
+
return extractInfo(el);
|
|
33
|
+
function extractInfo(el) {
|
|
34
|
+
const tag = el.tagName.toLowerCase();
|
|
35
|
+
const id = el.id;
|
|
36
|
+
const name = el.getAttribute('name');
|
|
37
|
+
const type = el.getAttribute('type');
|
|
38
|
+
const role = el.getAttribute('role') || implicitRole(tag, type);
|
|
39
|
+
const ariaLabel = el.getAttribute('aria-label');
|
|
40
|
+
const placeholder = el.getAttribute('placeholder');
|
|
41
|
+
const title = el.getAttribute('title');
|
|
42
|
+
const href = el.getAttribute('href');
|
|
43
|
+
const text = getVisibleText(el);
|
|
44
|
+
const testId = el.getAttribute('data-testid') || el.getAttribute('data-test-id');
|
|
45
|
+
const selector = buildSelector(el, tag, id, name, testId, text, role, ariaLabel, placeholder, type);
|
|
46
|
+
const label = ariaLabel || placeholder || name || title || undefined;
|
|
47
|
+
return {
|
|
48
|
+
selector,
|
|
49
|
+
tagName: tag,
|
|
50
|
+
type: type || undefined,
|
|
51
|
+
text: text || undefined,
|
|
52
|
+
role: role || undefined,
|
|
53
|
+
label: label || undefined,
|
|
54
|
+
href: href || undefined,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function buildSelector(el, tag, id, name, testId, text, role, ariaLabel, placeholder, type) {
|
|
58
|
+
// Priority 1: data-testid (most stable)
|
|
59
|
+
if (testId)
|
|
60
|
+
return '[data-testid="' + testId + '"]';
|
|
61
|
+
// Priority 2: id (unique)
|
|
62
|
+
if (id)
|
|
63
|
+
return '#' + CSS.escape(id);
|
|
64
|
+
// Priority 3: role + name (accessible selectors)
|
|
65
|
+
if (role && ariaLabel)
|
|
66
|
+
return tag + '[role="' + role + '"][aria-label="' + ariaLabel + '"]';
|
|
67
|
+
// Priority 4: name attribute (forms)
|
|
68
|
+
if (name && (tag === 'input' || tag === 'select' || tag === 'textarea')) {
|
|
69
|
+
return tag + '[name="' + name + '"]';
|
|
70
|
+
}
|
|
71
|
+
// Priority 5: Playwright text selector for buttons/links
|
|
72
|
+
if (text && text.length <= 50 && (tag === 'button' || tag === 'a' || role === 'button' || role === 'link')) {
|
|
73
|
+
return tag + ':has-text("' + text.replace(/"/g, '\\"') + '")';
|
|
74
|
+
}
|
|
75
|
+
// Priority 6: placeholder for inputs
|
|
76
|
+
if (placeholder && tag === 'input') {
|
|
77
|
+
return 'input[placeholder="' + placeholder + '"]';
|
|
78
|
+
}
|
|
79
|
+
// Priority 7: type for inputs
|
|
80
|
+
if (type && tag === 'input') {
|
|
81
|
+
// Check if unique enough by adding parent context
|
|
82
|
+
const parent = el.parentElement;
|
|
83
|
+
if (parent && parent.id) {
|
|
84
|
+
return '#' + CSS.escape(parent.id) + ' > input[type="' + type + '"]';
|
|
85
|
+
}
|
|
86
|
+
return 'input[type="' + type + '"]';
|
|
87
|
+
}
|
|
88
|
+
// Priority 8: nth-of-type with class
|
|
89
|
+
const classes = Array.from(el.classList).filter((c) => !c.match(/^(js-|is-|has-)/)).slice(0, 2);
|
|
90
|
+
if (classes.length > 0) {
|
|
91
|
+
const classSelector = tag + '.' + classes.map((c) => CSS.escape(c)).join('.');
|
|
92
|
+
const siblings = document.querySelectorAll(classSelector);
|
|
93
|
+
if (siblings.length === 1)
|
|
94
|
+
return classSelector;
|
|
95
|
+
const index = Array.from(siblings).indexOf(el);
|
|
96
|
+
if (index >= 0)
|
|
97
|
+
return classSelector + ':nth-of-type(' + (index + 1) + ')';
|
|
98
|
+
}
|
|
99
|
+
// Fallback: tag with index
|
|
100
|
+
return tag;
|
|
101
|
+
}
|
|
102
|
+
function getVisibleText(el) {
|
|
103
|
+
const text = (el.textContent || '').trim();
|
|
104
|
+
return text.length > 80 ? text.substring(0, 77) + '...' : text;
|
|
105
|
+
}
|
|
106
|
+
function implicitRole(tag, type) {
|
|
107
|
+
if (tag === 'button')
|
|
108
|
+
return 'button';
|
|
109
|
+
if (tag === 'a')
|
|
110
|
+
return 'link';
|
|
111
|
+
if (tag === 'input') {
|
|
112
|
+
if (type === 'checkbox')
|
|
113
|
+
return 'checkbox';
|
|
114
|
+
if (type === 'radio')
|
|
115
|
+
return 'radio';
|
|
116
|
+
if (type === 'submit')
|
|
117
|
+
return 'button';
|
|
118
|
+
if (!type || type === 'text' || type === 'email' || type === 'password' || type === 'search' || type === 'tel' || type === 'url' || type === 'number')
|
|
119
|
+
return 'textbox';
|
|
120
|
+
}
|
|
121
|
+
if (tag === 'textarea')
|
|
122
|
+
return 'textbox';
|
|
123
|
+
if (tag === 'select')
|
|
124
|
+
return 'combobox';
|
|
125
|
+
if (tag === 'img')
|
|
126
|
+
return 'img';
|
|
127
|
+
return '';
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
exports.ELEMENT_AT_POINT_SCRIPT = ELEMENT_AT_POINT_SCRIPT;
|
|
131
|
+
/**
|
|
132
|
+
* Read the CSS `cursor` value of the element at a point. Returns 'default' when
|
|
133
|
+
* no element is found or the computed cursor is empty.
|
|
134
|
+
*/
|
|
135
|
+
const CURSOR_AT_POINT_SCRIPT = (point) => {
|
|
136
|
+
const el = document.elementFromPoint(point.x, point.y);
|
|
137
|
+
if (!el)
|
|
138
|
+
return 'default';
|
|
139
|
+
return getComputedStyle(el).cursor || 'default';
|
|
140
|
+
};
|
|
141
|
+
exports.CURSOR_AT_POINT_SCRIPT = CURSOR_AT_POINT_SCRIPT;
|
|
142
|
+
/**
|
|
143
|
+
* Extract info about the currently focused element.
|
|
144
|
+
*/
|
|
145
|
+
const FOCUSED_ELEMENT_SCRIPT = () => {
|
|
146
|
+
const el = document.activeElement;
|
|
147
|
+
if (!el || el === document.body)
|
|
148
|
+
return null;
|
|
149
|
+
const tag = el.tagName.toLowerCase();
|
|
150
|
+
const id = el.id;
|
|
151
|
+
const name = el.getAttribute('name');
|
|
152
|
+
const type = el.getAttribute('type');
|
|
153
|
+
const role = el.getAttribute('role') || implicitRole(tag, type);
|
|
154
|
+
const ariaLabel = el.getAttribute('aria-label');
|
|
155
|
+
const placeholder = el.getAttribute('placeholder');
|
|
156
|
+
const title = el.getAttribute('title');
|
|
157
|
+
const testId = el.getAttribute('data-testid') || el.getAttribute('data-test-id');
|
|
158
|
+
const selector = buildSelector(el, tag, id, name, testId, '', role, ariaLabel, placeholder, type);
|
|
159
|
+
const label = ariaLabel || placeholder || name || title || undefined;
|
|
160
|
+
return {
|
|
161
|
+
selector,
|
|
162
|
+
tagName: tag,
|
|
163
|
+
type: type || undefined,
|
|
164
|
+
role: role || undefined,
|
|
165
|
+
label: label || undefined,
|
|
166
|
+
};
|
|
167
|
+
function buildSelector(el, tag, id, name, testId, _text, role, ariaLabel, placeholder, type) {
|
|
168
|
+
if (testId)
|
|
169
|
+
return '[data-testid="' + testId + '"]';
|
|
170
|
+
if (id)
|
|
171
|
+
return '#' + CSS.escape(id);
|
|
172
|
+
if (role && ariaLabel)
|
|
173
|
+
return tag + '[role="' + role + '"][aria-label="' + ariaLabel + '"]';
|
|
174
|
+
if (name && (tag === 'input' || tag === 'select' || tag === 'textarea')) {
|
|
175
|
+
return tag + '[name="' + name + '"]';
|
|
176
|
+
}
|
|
177
|
+
if (placeholder && tag === 'input') {
|
|
178
|
+
return 'input[placeholder="' + placeholder + '"]';
|
|
179
|
+
}
|
|
180
|
+
if (type && tag === 'input')
|
|
181
|
+
return 'input[type="' + type + '"]';
|
|
182
|
+
const classes = Array.from(el.classList).filter((c) => !c.match(/^(js-|is-|has-)/)).slice(0, 2);
|
|
183
|
+
if (classes.length > 0)
|
|
184
|
+
return tag + '.' + classes.map((c) => CSS.escape(c)).join('.');
|
|
185
|
+
return tag;
|
|
186
|
+
}
|
|
187
|
+
function implicitRole(tag, type) {
|
|
188
|
+
if (tag === 'button')
|
|
189
|
+
return 'button';
|
|
190
|
+
if (tag === 'a')
|
|
191
|
+
return 'link';
|
|
192
|
+
if (tag === 'input') {
|
|
193
|
+
if (type === 'checkbox')
|
|
194
|
+
return 'checkbox';
|
|
195
|
+
if (type === 'radio')
|
|
196
|
+
return 'radio';
|
|
197
|
+
if (type === 'submit')
|
|
198
|
+
return 'button';
|
|
199
|
+
if (!type || type === 'text' || type === 'email' || type === 'password' || type === 'search' || type === 'tel' || type === 'url' || type === 'number')
|
|
200
|
+
return 'textbox';
|
|
201
|
+
}
|
|
202
|
+
if (tag === 'textarea')
|
|
203
|
+
return 'textbox';
|
|
204
|
+
if (tag === 'select')
|
|
205
|
+
return 'combobox';
|
|
206
|
+
return '';
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
exports.FOCUSED_ELEMENT_SCRIPT = FOCUSED_ELEMENT_SCRIPT;
|
|
210
|
+
/**
|
|
211
|
+
* Read the current selection. Prefers the selection range of a focused
|
|
212
|
+
* input/textarea, falling back to the document selection. Returns an empty
|
|
213
|
+
* string when nothing is selected.
|
|
214
|
+
*/
|
|
215
|
+
const GET_SELECTED_TEXT_SCRIPT = () => {
|
|
216
|
+
const active = document.activeElement;
|
|
217
|
+
if (active &&
|
|
218
|
+
(active.tagName === 'INPUT' || active.tagName === 'TEXTAREA') &&
|
|
219
|
+
active.selectionStart != null &&
|
|
220
|
+
active.selectionEnd != null &&
|
|
221
|
+
active.selectionStart !== active.selectionEnd) {
|
|
222
|
+
return active.value.substring(active.selectionStart, active.selectionEnd);
|
|
223
|
+
}
|
|
224
|
+
const sel = window.getSelection();
|
|
225
|
+
return sel ? sel.toString() : '';
|
|
226
|
+
};
|
|
227
|
+
exports.GET_SELECTED_TEXT_SCRIPT = GET_SELECTED_TEXT_SCRIPT;
|
|
228
|
+
/**
|
|
229
|
+
* Install (idempotently) focus/value/selection reporting for simple
|
|
230
|
+
* input/textarea elements. Reports through the `window.__onBrowserFocus`
|
|
231
|
+
* binding exposed by Playwright.
|
|
232
|
+
*
|
|
233
|
+
* Listener registration is guarded by `window.__browserFocusReportingInstalled`
|
|
234
|
+
* so re-evaluating the script does not double-register handlers. The INITIAL
|
|
235
|
+
* report runs on EVERY evaluation (outside the guard) so an element already
|
|
236
|
+
* focused at injection time (e.g. an autofocused login field) is surfaced.
|
|
237
|
+
*
|
|
238
|
+
* Browser-side failures of the exposed binding are warned at most once here;
|
|
239
|
+
* the Node side (browser-session.ts exposeBinding wrapper) adds server-log
|
|
240
|
+
* observability for binding callback failures.
|
|
241
|
+
*/
|
|
242
|
+
const FOCUS_REPORTING_SCRIPT = () => {
|
|
243
|
+
// The per-document focus reporting state (listeners + lastReportedFocused) is
|
|
244
|
+
// installed once. Hang the report() helper off window so a re-evaluation that
|
|
245
|
+
// skips re-registration can still invoke the initial report below.
|
|
246
|
+
if (!window.__browserFocusReportingInstalled) {
|
|
247
|
+
window.__browserFocusReportingInstalled = true;
|
|
248
|
+
// Last focused state reported to the agent. Used to suppress repeated
|
|
249
|
+
// { focused: false } notifications: selectionchange fires for the whole
|
|
250
|
+
// document (including unrelated page text selections), so without this guard
|
|
251
|
+
// every such selection would emit a redundant focused:false. We only forward
|
|
252
|
+
// a false when transitioning from a previously-focused (true) state.
|
|
253
|
+
var lastReportedFocused = false;
|
|
254
|
+
// Forward a payload through the exposed binding, recording the new focused
|
|
255
|
+
// state and logging the first failure once (high-frequency events would
|
|
256
|
+
// otherwise flood the browser console).
|
|
257
|
+
function emit(payload) {
|
|
258
|
+
lastReportedFocused = payload.focused;
|
|
259
|
+
try {
|
|
260
|
+
window.__onBrowserFocus(payload);
|
|
261
|
+
}
|
|
262
|
+
catch (e) {
|
|
263
|
+
if (!window.__focusReportErrorLogged) {
|
|
264
|
+
window.__focusReportErrorLogged = true;
|
|
265
|
+
try {
|
|
266
|
+
console.warn('[focus-reporting] report failed', e && e.message ? e.message : e);
|
|
267
|
+
}
|
|
268
|
+
catch (_) { }
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function isReportingTarget(el) {
|
|
273
|
+
if (!el)
|
|
274
|
+
return false;
|
|
275
|
+
const tag = el.tagName;
|
|
276
|
+
if (tag === 'TEXTAREA')
|
|
277
|
+
return true;
|
|
278
|
+
if (tag !== 'INPUT')
|
|
279
|
+
return false;
|
|
280
|
+
const type = (el.getAttribute('type') || '').toLowerCase();
|
|
281
|
+
return type === '' || type === 'text' || type === 'search' || type === 'email' ||
|
|
282
|
+
type === 'url' || type === 'tel' || type === 'password' || type === 'number';
|
|
283
|
+
}
|
|
284
|
+
function buildPayload(el) {
|
|
285
|
+
const rect = el.getBoundingClientRect();
|
|
286
|
+
const cs = getComputedStyle(el);
|
|
287
|
+
const fontSize = parseFloat(cs.fontSize);
|
|
288
|
+
const lineHeight = parseFloat(cs.lineHeight);
|
|
289
|
+
const paddingTop = parseFloat(cs.paddingTop);
|
|
290
|
+
const paddingLeft = parseFloat(cs.paddingLeft);
|
|
291
|
+
const multiline = el.tagName === 'TEXTAREA';
|
|
292
|
+
const payload = {
|
|
293
|
+
focused: true,
|
|
294
|
+
rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
|
|
295
|
+
value: el.value,
|
|
296
|
+
selectionStart: el.selectionStart == null ? undefined : el.selectionStart,
|
|
297
|
+
selectionEnd: el.selectionEnd == null ? undefined : el.selectionEnd,
|
|
298
|
+
multiline: multiline,
|
|
299
|
+
inputType: multiline ? 'textarea' : ((el.getAttribute('type') || 'text').toLowerCase()),
|
|
300
|
+
textAlign: cs.textAlign,
|
|
301
|
+
};
|
|
302
|
+
if (typeof el.maxLength === 'number' && el.maxLength >= 0)
|
|
303
|
+
payload.maxLength = el.maxLength;
|
|
304
|
+
if (!Number.isNaN(fontSize))
|
|
305
|
+
payload.fontSize = fontSize;
|
|
306
|
+
if (!Number.isNaN(lineHeight))
|
|
307
|
+
payload.lineHeight = lineHeight;
|
|
308
|
+
if (!Number.isNaN(paddingTop))
|
|
309
|
+
payload.paddingTop = paddingTop;
|
|
310
|
+
if (!Number.isNaN(paddingLeft))
|
|
311
|
+
payload.paddingLeft = paddingLeft;
|
|
312
|
+
return payload;
|
|
313
|
+
}
|
|
314
|
+
// Report focused:true (with current value/selection) whenever a reporting
|
|
315
|
+
// target is active; report focused:false only on the true->false transition.
|
|
316
|
+
// Exposed on window so a guarded re-evaluation can still trigger the initial
|
|
317
|
+
// report without re-registering listeners.
|
|
318
|
+
window.__browserFocusReport = function () {
|
|
319
|
+
const el = document.activeElement;
|
|
320
|
+
if (isReportingTarget(el)) {
|
|
321
|
+
emit(buildPayload(el));
|
|
322
|
+
}
|
|
323
|
+
else if (lastReportedFocused) {
|
|
324
|
+
emit({ focused: false });
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
document.addEventListener('focusin', window.__browserFocusReport, true);
|
|
328
|
+
document.addEventListener('focusout', function () {
|
|
329
|
+
if (lastReportedFocused)
|
|
330
|
+
emit({ focused: false });
|
|
331
|
+
}, true);
|
|
332
|
+
document.addEventListener('input', window.__browserFocusReport, true);
|
|
333
|
+
document.addEventListener('selectionchange', window.__browserFocusReport, true);
|
|
334
|
+
}
|
|
335
|
+
// Initial report on EVERY evaluation: surfaces an element that is already
|
|
336
|
+
// focused at injection time (autofocus) for which focusin will never fire.
|
|
337
|
+
if (typeof window.__browserFocusReport === 'function')
|
|
338
|
+
window.__browserFocusReport();
|
|
339
|
+
};
|
|
340
|
+
exports.FOCUS_REPORTING_SCRIPT = FOCUS_REPORTING_SCRIPT;
|
|
341
|
+
/**
|
|
342
|
+
* Reflect a value into the currently-focused reporting-target input/textarea
|
|
343
|
+
* using the native value setter + InputEvent('input') dispatch, so React-style
|
|
344
|
+
* controlled components do not roll the value back. Optionally applies a
|
|
345
|
+
* selection range. No-op when the active element is not a reporting target.
|
|
346
|
+
*/
|
|
347
|
+
const SET_FOCUSED_INPUT_VALUE_SCRIPT = (args) => {
|
|
348
|
+
const el = document.activeElement;
|
|
349
|
+
if (!el)
|
|
350
|
+
return;
|
|
351
|
+
const tag = el.tagName;
|
|
352
|
+
let proto;
|
|
353
|
+
if (tag === 'TEXTAREA') {
|
|
354
|
+
proto = window.HTMLTextAreaElement.prototype;
|
|
355
|
+
}
|
|
356
|
+
else if (tag === 'INPUT') {
|
|
357
|
+
const type = (el.getAttribute('type') || '').toLowerCase();
|
|
358
|
+
const ok = type === '' || type === 'text' || type === 'search' || type === 'email' ||
|
|
359
|
+
type === 'url' || type === 'tel' || type === 'password' || type === 'number';
|
|
360
|
+
if (!ok)
|
|
361
|
+
return;
|
|
362
|
+
proto = window.HTMLInputElement.prototype;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
// The native value setter may be absent on exotic/polyfilled prototypes;
|
|
368
|
+
// treat that as a no-op (same as a non-reporting target) rather than letting
|
|
369
|
+
// a TypeError escape from reading .set of undefined.
|
|
370
|
+
const desc = Object.getOwnPropertyDescriptor(proto, 'value');
|
|
371
|
+
const setter = desc && desc.set;
|
|
372
|
+
if (!setter)
|
|
373
|
+
return;
|
|
374
|
+
const input = el;
|
|
375
|
+
setter.call(input, args.value);
|
|
376
|
+
input.dispatchEvent(new InputEvent('input', { bubbles: true }));
|
|
377
|
+
if (args.selectionStart != null && args.selectionEnd != null) {
|
|
378
|
+
try {
|
|
379
|
+
input.setSelectionRange(args.selectionStart, args.selectionEnd);
|
|
380
|
+
}
|
|
381
|
+
catch (e) { }
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
exports.SET_FOCUSED_INPUT_VALUE_SCRIPT = SET_FOCUSED_INPUT_VALUE_SCRIPT;
|
|
385
|
+
//# sourceMappingURL=page-scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-scripts.js","sourceRoot":"","sources":["../../../../src/mcp/tools/browser/page-scripts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AA4EH;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACzE,MAAM,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IACtD,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAA;IACpB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAA;IAEtB,SAAS,WAAW,CAAC,EAAe;QAClC,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAA;QACpC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAA;QAChB,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACpC,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;QACpC,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,I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