agent-web-interface 4.2.0 → 4.4.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/src/browser/connection-utils.d.ts +48 -0
- package/dist/src/browser/connection-utils.d.ts.map +1 -0
- package/dist/src/browser/connection-utils.js +129 -0
- package/dist/src/browser/connection-utils.js.map +1 -0
- package/dist/src/browser/index.d.ts +3 -1
- package/dist/src/browser/index.d.ts.map +1 -1
- package/dist/src/browser/index.js +2 -1
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/browser/session-manager.d.ts +1 -89
- package/dist/src/browser/session-manager.d.ts.map +1 -1
- package/dist/src/browser/session-manager.js +1 -116
- package/dist/src/browser/session-manager.js.map +1 -1
- package/dist/src/browser/session-manager.types.d.ts +90 -0
- package/dist/src/browser/session-manager.types.d.ts.map +1 -0
- package/dist/src/browser/session-manager.types.js +7 -0
- package/dist/src/browser/session-manager.types.js.map +1 -0
- package/dist/src/form/constraint-extraction.d.ts +31 -0
- package/dist/src/form/constraint-extraction.d.ts.map +1 -0
- package/dist/src/form/constraint-extraction.js +110 -0
- package/dist/src/form/constraint-extraction.js.map +1 -0
- package/dist/src/form/field-extractor.d.ts.map +1 -1
- package/dist/src/form/field-extractor.js +3 -444
- package/dist/src/form/field-extractor.js.map +1 -1
- package/dist/src/form/field-state-extractor.d.ts +22 -0
- package/dist/src/form/field-state-extractor.d.ts.map +1 -0
- package/dist/src/form/field-state-extractor.js +55 -0
- package/dist/src/form/field-state-extractor.js.map +1 -0
- package/dist/src/form/form-actions.d.ts +45 -0
- package/dist/src/form/form-actions.d.ts.map +1 -0
- package/dist/src/form/form-actions.js +108 -0
- package/dist/src/form/form-actions.js.map +1 -0
- package/dist/src/form/form-detector.d.ts +0 -36
- package/dist/src/form/form-detector.d.ts.map +1 -1
- package/dist/src/form/form-detector.js +11 -376
- package/dist/src/form/form-detector.js.map +1 -1
- package/dist/src/form/input-clustering.d.ts +15 -0
- package/dist/src/form/input-clustering.d.ts.map +1 -0
- package/dist/src/form/input-clustering.js +61 -0
- package/dist/src/form/input-clustering.js.map +1 -0
- package/dist/src/form/intent-inference.d.ts +28 -0
- package/dist/src/form/intent-inference.d.ts.map +1 -0
- package/dist/src/form/intent-inference.js +137 -0
- package/dist/src/form/intent-inference.js.map +1 -0
- package/dist/src/form/purpose-inference.d.ts +50 -0
- package/dist/src/form/purpose-inference.d.ts.map +1 -0
- package/dist/src/form/purpose-inference.js +313 -0
- package/dist/src/form/purpose-inference.js.map +1 -0
- package/dist/src/form/submit-detection.d.ts +36 -0
- package/dist/src/form/submit-detection.d.ts.map +1 -0
- package/dist/src/form/submit-detection.js +101 -0
- package/dist/src/form/submit-detection.js.map +1 -0
- package/dist/src/form/types.d.ts +2 -2
- package/dist/src/index.js +65 -48
- package/dist/src/index.js.map +1 -1
- package/dist/src/observation/observation-accumulator.d.ts +1 -1
- package/dist/src/observation/observation-accumulator.js +1 -1
- package/dist/src/observation/observer-script.d.ts +1 -1
- package/dist/src/observation/observer-script.d.ts.map +1 -1
- package/dist/src/observation/observer-script.js +129 -7
- package/dist/src/observation/observer-script.js.map +1 -1
- package/dist/src/query/disambiguation.d.ts +18 -0
- package/dist/src/query/disambiguation.d.ts.map +1 -0
- package/dist/src/query/disambiguation.js +123 -0
- package/dist/src/query/disambiguation.js.map +1 -0
- package/dist/src/query/fuzzy-match.d.ts +17 -0
- package/dist/src/query/fuzzy-match.d.ts.map +1 -0
- package/dist/src/query/fuzzy-match.js +34 -0
- package/dist/src/query/fuzzy-match.js.map +1 -0
- package/dist/src/query/index.d.ts +3 -0
- package/dist/src/query/index.d.ts.map +1 -1
- package/dist/src/query/index.js +6 -0
- package/dist/src/query/index.js.map +1 -1
- package/dist/src/query/query-engine.d.ts +0 -35
- package/dist/src/query/query-engine.d.ts.map +1 -1
- package/dist/src/query/query-engine.js +9 -309
- package/dist/src/query/query-engine.js.map +1 -1
- package/dist/src/query/scoring.d.ts +52 -0
- package/dist/src/query/scoring.d.ts.map +1 -0
- package/dist/src/query/scoring.js +162 -0
- package/dist/src/query/scoring.js.map +1 -0
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/mcp-server.js +29 -1
- package/dist/src/server/mcp-server.js.map +1 -1
- package/dist/src/snapshot/element-resolver.d.ts +50 -18
- package/dist/src/snapshot/element-resolver.d.ts.map +1 -1
- package/dist/src/snapshot/element-resolver.js +180 -101
- package/dist/src/snapshot/element-resolver.js.map +1 -1
- package/dist/src/snapshot/extractors/ax-extractor.d.ts +1 -1
- package/dist/src/snapshot/extractors/ax-extractor.d.ts.map +1 -1
- package/dist/src/snapshot/extractors/ax-extractor.js +4 -1
- package/dist/src/snapshot/extractors/ax-extractor.js.map +1 -1
- package/dist/src/snapshot/extractors/index.d.ts +1 -1
- package/dist/src/snapshot/extractors/index.d.ts.map +1 -1
- package/dist/src/snapshot/extractors/index.js +1 -1
- package/dist/src/snapshot/extractors/index.js.map +1 -1
- package/dist/src/snapshot/extractors/region-resolver.d.ts.map +1 -1
- package/dist/src/snapshot/extractors/region-resolver.js +8 -0
- package/dist/src/snapshot/extractors/region-resolver.js.map +1 -1
- package/dist/src/snapshot/extractors/types.d.ts +8 -0
- package/dist/src/snapshot/extractors/types.d.ts.map +1 -1
- package/dist/src/snapshot/extractors/types.js +16 -0
- package/dist/src/snapshot/extractors/types.js.map +1 -1
- package/dist/src/snapshot/frame-context.d.ts +68 -0
- package/dist/src/snapshot/frame-context.d.ts.map +1 -0
- package/dist/src/snapshot/frame-context.js +131 -0
- package/dist/src/snapshot/frame-context.js.map +1 -0
- package/dist/src/snapshot/heading-index.d.ts +28 -0
- package/dist/src/snapshot/heading-index.d.ts.map +1 -0
- package/dist/src/snapshot/heading-index.js +108 -0
- package/dist/src/snapshot/heading-index.js.map +1 -0
- package/dist/src/snapshot/index.d.ts +5 -3
- package/dist/src/snapshot/index.d.ts.map +1 -1
- package/dist/src/snapshot/index.js +3 -2
- package/dist/src/snapshot/index.js.map +1 -1
- package/dist/src/snapshot/kind-mapping.d.ts +30 -0
- package/dist/src/snapshot/kind-mapping.d.ts.map +1 -0
- package/dist/src/snapshot/kind-mapping.js +114 -0
- package/dist/src/snapshot/kind-mapping.js.map +1 -0
- package/dist/src/snapshot/node-filter.d.ts +31 -0
- package/dist/src/snapshot/node-filter.d.ts.map +1 -0
- package/dist/src/snapshot/node-filter.js +137 -0
- package/dist/src/snapshot/node-filter.js.map +1 -0
- package/dist/src/snapshot/node-synthesizer.d.ts +62 -0
- package/dist/src/snapshot/node-synthesizer.d.ts.map +1 -0
- package/dist/src/snapshot/node-synthesizer.js +185 -0
- package/dist/src/snapshot/node-synthesizer.js.map +1 -0
- package/dist/src/snapshot/snapshot-compiler.d.ts +2 -36
- package/dist/src/snapshot/snapshot-compiler.d.ts.map +1 -1
- package/dist/src/snapshot/snapshot-compiler.js +28 -520
- package/dist/src/snapshot/snapshot-compiler.js.map +1 -1
- package/dist/src/snapshot/snapshot.types.d.ts +7 -2
- package/dist/src/snapshot/snapshot.types.d.ts.map +1 -1
- package/dist/src/snapshot/snapshot.types.js +9 -0
- package/dist/src/snapshot/snapshot.types.js.map +1 -1
- package/dist/src/state/actionables-filter.d.ts +5 -0
- package/dist/src/state/actionables-filter.d.ts.map +1 -1
- package/dist/src/state/actionables-filter.js +22 -3
- package/dist/src/state/actionables-filter.js.map +1 -1
- package/dist/src/state/diff-engine.js +3 -3
- package/dist/src/state/diff-engine.js.map +1 -1
- package/dist/src/state/element-registry.d.ts.map +1 -1
- package/dist/src/state/element-registry.js +6 -4
- package/dist/src/state/element-registry.js.map +1 -1
- package/dist/src/state/hash-utils.d.ts +24 -0
- package/dist/src/state/hash-utils.d.ts.map +1 -0
- package/dist/src/state/hash-utils.js +41 -0
- package/dist/src/state/hash-utils.js.map +1 -0
- package/dist/src/state/layer-detector.d.ts.map +1 -1
- package/dist/src/state/layer-detector.js +15 -286
- package/dist/src/state/layer-detector.js.map +1 -1
- package/dist/src/state/layer-detectors/drawer-detector.d.ts +32 -0
- package/dist/src/state/layer-detectors/drawer-detector.d.ts.map +1 -0
- package/dist/src/state/layer-detectors/drawer-detector.js +96 -0
- package/dist/src/state/layer-detectors/drawer-detector.js.map +1 -0
- package/dist/src/state/layer-detectors/index.d.ts +10 -0
- package/dist/src/state/layer-detectors/index.d.ts.map +1 -0
- package/dist/src/state/layer-detectors/index.js +10 -0
- package/dist/src/state/layer-detectors/index.js.map +1 -0
- package/dist/src/state/layer-detectors/modal-detector.d.ts +30 -0
- package/dist/src/state/layer-detectors/modal-detector.d.ts.map +1 -0
- package/dist/src/state/layer-detectors/modal-detector.js +127 -0
- package/dist/src/state/layer-detectors/modal-detector.js.map +1 -0
- package/dist/src/state/layer-detectors/popover-detector.d.ts +20 -0
- package/dist/src/state/layer-detectors/popover-detector.d.ts.map +1 -0
- package/dist/src/state/layer-detectors/popover-detector.js +76 -0
- package/dist/src/state/layer-detectors/popover-detector.js.map +1 -0
- package/dist/src/state/layer-detectors/toast-detector.d.ts +24 -0
- package/dist/src/state/layer-detectors/toast-detector.d.ts.map +1 -0
- package/dist/src/state/layer-detectors/toast-detector.js +48 -0
- package/dist/src/state/layer-detectors/toast-detector.js.map +1 -0
- package/dist/src/state/region-mapping.d.ts +13 -0
- package/dist/src/state/region-mapping.d.ts.map +1 -0
- package/dist/src/state/region-mapping.js +25 -0
- package/dist/src/state/region-mapping.js.map +1 -0
- package/dist/src/state/state-manager.d.ts.map +1 -1
- package/dist/src/state/state-manager.js +8 -192
- package/dist/src/state/state-manager.js.map +1 -1
- package/dist/src/state/state-renderer.d.ts.map +1 -1
- package/dist/src/state/state-renderer.js +16 -2
- package/dist/src/state/state-renderer.js.map +1 -1
- package/dist/src/state/types.d.ts +8 -4
- package/dist/src/state/types.d.ts.map +1 -1
- package/dist/src/state/url-sanitization.d.ts +22 -0
- package/dist/src/state/url-sanitization.d.ts.map +1 -0
- package/dist/src/state/url-sanitization.js +60 -0
- package/dist/src/state/url-sanitization.js.map +1 -0
- package/dist/src/state/value-masking.d.ts +36 -0
- package/dist/src/state/value-masking.d.ts.map +1 -0
- package/dist/src/state/value-masking.js +86 -0
- package/dist/src/state/value-masking.js.map +1 -0
- package/dist/src/tools/action-context.d.ts +60 -0
- package/dist/src/tools/action-context.d.ts.map +1 -0
- package/dist/src/tools/action-context.js +78 -0
- package/dist/src/tools/action-context.js.map +1 -0
- package/dist/src/tools/action-stabilization.d.ts +48 -0
- package/dist/src/tools/action-stabilization.d.ts.map +1 -0
- package/dist/src/tools/action-stabilization.js +87 -0
- package/dist/src/tools/action-stabilization.js.map +1 -0
- package/dist/src/tools/browser-tools.d.ts +8 -146
- package/dist/src/tools/browser-tools.d.ts.map +1 -1
- package/dist/src/tools/browser-tools.js +13 -689
- package/dist/src/tools/browser-tools.js.map +1 -1
- package/dist/src/tools/canvas-tools.d.ts +32 -0
- package/dist/src/tools/canvas-tools.d.ts.map +1 -0
- package/dist/src/tools/canvas-tools.js +370 -0
- package/dist/src/tools/canvas-tools.js.map +1 -0
- package/dist/src/tools/effect-tracker.d.ts +25 -0
- package/dist/src/tools/effect-tracker.d.ts.map +1 -0
- package/dist/src/tools/effect-tracker.js +69 -0
- package/dist/src/tools/effect-tracker.js.map +1 -0
- package/dist/src/tools/execute-action.d.ts +1 -31
- package/dist/src/tools/execute-action.d.ts.map +1 -1
- package/dist/src/tools/execute-action.js +7 -276
- package/dist/src/tools/execute-action.js.map +1 -1
- package/dist/src/tools/form-tools.d.ts +4 -6
- package/dist/src/tools/form-tools.d.ts.map +1 -1
- package/dist/src/tools/form-tools.js +10 -42
- package/dist/src/tools/form-tools.js.map +1 -1
- package/dist/src/tools/index.d.ts +6 -4
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +21 -10
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/interaction-tools.d.ts +46 -0
- package/dist/src/tools/interaction-tools.d.ts.map +1 -0
- package/dist/src/tools/interaction-tools.js +138 -0
- package/dist/src/tools/interaction-tools.js.map +1 -0
- package/dist/src/tools/navigation-detection.d.ts +31 -0
- package/dist/src/tools/navigation-detection.d.ts.map +1 -0
- package/dist/src/tools/navigation-detection.js +46 -0
- package/dist/src/tools/navigation-detection.js.map +1 -0
- package/dist/src/tools/navigation-tools.d.ts +57 -0
- package/dist/src/tools/navigation-tools.d.ts.map +1 -0
- package/dist/src/tools/navigation-tools.js +178 -0
- package/dist/src/tools/navigation-tools.js.map +1 -0
- package/dist/src/tools/observation-tools.d.ts +53 -0
- package/dist/src/tools/observation-tools.d.ts.map +1 -0
- package/dist/src/tools/observation-tools.js +247 -0
- package/dist/src/tools/observation-tools.js.map +1 -0
- package/dist/src/tools/response-builder.js +2 -2
- package/dist/src/tools/response-builder.js.map +1 -1
- package/dist/src/tools/stale-element-retry.d.ts +37 -0
- package/dist/src/tools/stale-element-retry.d.ts.map +1 -0
- package/dist/src/tools/stale-element-retry.js +68 -0
- package/dist/src/tools/stale-element-retry.js.map +1 -0
- package/dist/src/tools/state-manager-registry.d.ts +26 -0
- package/dist/src/tools/state-manager-registry.d.ts.map +1 -0
- package/dist/src/tools/state-manager-registry.js +39 -0
- package/dist/src/tools/state-manager-registry.js.map +1 -0
- package/dist/src/tools/tool-context.d.ts +53 -0
- package/dist/src/tools/tool-context.d.ts.map +1 -0
- package/dist/src/tools/tool-context.js +119 -0
- package/dist/src/tools/tool-context.js.map +1 -0
- package/dist/src/tools/tool-result.types.d.ts +16 -1
- package/dist/src/tools/tool-result.types.d.ts.map +1 -1
- package/dist/src/tools/tool-result.types.js +11 -0
- package/dist/src/tools/tool-result.types.js.map +1 -1
- package/dist/src/tools/tool-schemas.d.ts +358 -146
- package/dist/src/tools/tool-schemas.d.ts.map +1 -1
- package/dist/src/tools/tool-schemas.js +142 -19
- package/dist/src/tools/tool-schemas.js.map +1 -1
- package/dist/src/tools/viewport-tools.d.ts +36 -0
- package/dist/src/tools/viewport-tools.d.ts.map +1 -0
- package/dist/src/tools/viewport-tools.js +105 -0
- package/dist/src/tools/viewport-tools.js.map +1 -0
- package/package.json +1 -1
package/dist/src/tools/index.js
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Browser automation tools exposed via MCP protocol.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
// Shared tool context
|
|
7
|
+
export { initializeToolContext, getSnapshotStore } from './tool-context.js';
|
|
8
|
+
// Legacy exports for backward compatibility
|
|
9
|
+
export { initializeTools } from './browser-tools.js';
|
|
7
10
|
// Tool handlers - Simplified API
|
|
8
|
-
export { listPages, closePage, closeSession, navigate, goBack, goForward, reload, captureSnapshot, findElements, getNodeDetails, scrollElementIntoView, scrollPage, click, type, press, select, hover, takeScreenshot, } from './browser-tools.js';
|
|
11
|
+
export { listPages, closePage, closeSession, navigate, goBack, goForward, reload, captureSnapshot, findElements, getNodeDetails, scrollElementIntoView, scrollPage, click, type, press, select, hover, drag, wheel, takeScreenshot, mapSchemaKindToNodeKind, } from './browser-tools.js';
|
|
9
12
|
// Server config - lazy browser initialization
|
|
10
13
|
export { ensureBrowserForTools, getSessionManager } from '../server/server-config.js';
|
|
11
14
|
// Schemas - Simplified API
|
|
@@ -24,15 +27,15 @@ GoBackInputSchema, GoBackOutputSchema,
|
|
|
24
27
|
GoForwardInputSchema, GoForwardOutputSchema,
|
|
25
28
|
// reload
|
|
26
29
|
ReloadInputSchema, ReloadOutputSchema,
|
|
27
|
-
//
|
|
30
|
+
// snapshot
|
|
28
31
|
CaptureSnapshotInputSchema, CaptureSnapshotOutputSchema,
|
|
29
|
-
//
|
|
32
|
+
// find
|
|
30
33
|
FindElementsInputSchema, FindElementsOutputSchema,
|
|
31
|
-
//
|
|
34
|
+
// get_element
|
|
32
35
|
GetNodeDetailsInputSchema, GetNodeDetailsOutputSchema,
|
|
33
|
-
//
|
|
36
|
+
// scroll_to
|
|
34
37
|
ScrollElementIntoViewInputSchema, ScrollElementIntoViewInputSchemaBase, ScrollElementIntoViewOutputSchema,
|
|
35
|
-
//
|
|
38
|
+
// scroll
|
|
36
39
|
ScrollPageInputSchema, ScrollPageOutputSchema,
|
|
37
40
|
// click
|
|
38
41
|
ClickInputSchema, ClickInputSchemaBase, ClickOutputSchema,
|
|
@@ -44,10 +47,18 @@ PressInputSchema, PressOutputSchema,
|
|
|
44
47
|
SelectInputSchema, SelectInputSchemaBase, SelectOutputSchema,
|
|
45
48
|
// hover
|
|
46
49
|
HoverInputSchema, HoverInputSchemaBase, HoverOutputSchema,
|
|
47
|
-
//
|
|
48
|
-
|
|
50
|
+
// drag
|
|
51
|
+
DragInputSchema, DragInputSchemaBase, DragOutputSchema,
|
|
52
|
+
// wheel
|
|
53
|
+
WheelInputSchema, WheelInputSchemaBase, WheelOutputSchema,
|
|
54
|
+
// screenshot
|
|
55
|
+
TakeScreenshotInputSchema, TakeScreenshotInputSchemaBase, TakeScreenshotOutputSchema,
|
|
56
|
+
// inspect_canvas (unchanged)
|
|
57
|
+
InspectCanvasInputSchema, InspectCanvasInputSchemaBase, } from './tool-schemas.js';
|
|
49
58
|
// Tool result types
|
|
50
|
-
export { isImageResult, isFileResult, } from './tool-result.types.js';
|
|
59
|
+
export { isImageResult, isFileResult, isCompositeResult, } from './tool-result.types.js';
|
|
51
60
|
// Form tools
|
|
52
61
|
export { initializeFormTools, getFormUnderstanding, getFieldContext, GetFormUnderstandingInputSchema, GetFieldContextInputSchema, } from './form-tools.js';
|
|
62
|
+
// Canvas tools
|
|
63
|
+
export { inspectCanvas } from './canvas-tools.js';
|
|
53
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sBAAsB;AACtB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,E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gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB;AAGjB,OAAO;AACP,eAAe,EACf,mBAAmB,EACnB,gBAAgB;AAGhB,QAAQ;AACR,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB;AAGjB,aAAa;AACb,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B;AAG1B,6BAA6B;AAC7B,wBAAwB,EACxB,4BAA4B,GAE7B,MAAM,mBAAmB,CAAC;AAE3B,oBAAoB;AACpB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,iBAAiB,GAKlB,MAAM,wBAAwB,CAAC;AAEhC,aAAa;AACb,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,+BAA+B,EAC/B,0BAA0B,GAG3B,MAAM,iBAAiB,CAAC;AAEzB,eAAe;AACf,OAAO,EAAE,aAAa,EAA0C,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interaction Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for element interaction: click, type, press, select, hover.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Click an element or at viewport coordinates.
|
|
8
|
+
*
|
|
9
|
+
* Three modes:
|
|
10
|
+
* 1. eid only -> click element center (existing behavior)
|
|
11
|
+
* 2. eid + x/y -> click at offset relative to element top-left
|
|
12
|
+
* 3. x/y only -> click at absolute viewport coordinates
|
|
13
|
+
*
|
|
14
|
+
* @param rawInput - Click options (will be validated)
|
|
15
|
+
* @returns Click result with navigation-aware outcome
|
|
16
|
+
*/
|
|
17
|
+
export declare function click(rawInput: unknown): Promise<import('./tool-schemas.js').ClickOutput>;
|
|
18
|
+
/**
|
|
19
|
+
* Type text into an element.
|
|
20
|
+
*
|
|
21
|
+
* @param rawInput - Type options (will be validated)
|
|
22
|
+
* @returns Type result with delta
|
|
23
|
+
*/
|
|
24
|
+
export declare function type(rawInput: unknown): Promise<import('./tool-schemas.js').TypeOutput>;
|
|
25
|
+
/**
|
|
26
|
+
* Press a keyboard key (no agent_version).
|
|
27
|
+
*
|
|
28
|
+
* @param rawInput - Press options (will be validated)
|
|
29
|
+
* @returns Press result with delta
|
|
30
|
+
*/
|
|
31
|
+
export declare function press(rawInput: unknown): Promise<import('./tool-schemas.js').PressOutput>;
|
|
32
|
+
/**
|
|
33
|
+
* Select a dropdown option.
|
|
34
|
+
*
|
|
35
|
+
* @param rawInput - Select options (will be validated)
|
|
36
|
+
* @returns Select result with delta
|
|
37
|
+
*/
|
|
38
|
+
export declare function select(rawInput: unknown): Promise<import('./tool-schemas.js').SelectOutput>;
|
|
39
|
+
/**
|
|
40
|
+
* Hover over an element.
|
|
41
|
+
*
|
|
42
|
+
* @param rawInput - Hover options (will be validated)
|
|
43
|
+
* @returns Hover result with delta
|
|
44
|
+
*/
|
|
45
|
+
export declare function hover(rawInput: unknown): Promise<import('./tool-schemas.js').HoverOutput>;
|
|
46
|
+
//# sourceMappingURL=interaction-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/interaction-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8BH;;;;;;;;;;GAUG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,WAAW,CAAC,CAsD/F;AAED;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,UAAU,CAAC,CAyB7F;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,WAAW,CAAC,CAkB/F;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,YAAY,CAAC,CAuBjG;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,WAAW,CAAC,CAuB/F"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interaction Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for element interaction: click, type, press, select, hover.
|
|
5
|
+
*/
|
|
6
|
+
import { clickByBackendNodeId, clickAtCoordinates, clickAtElementOffset, typeByBackendNodeId, pressKey, selectOption, hoverByBackendNodeId, } from '../snapshot/index.js';
|
|
7
|
+
import { ClickInputSchema, TypeInputSchema, PressInputSchema, SelectInputSchema, HoverInputSchema, } from './tool-schemas.js';
|
|
8
|
+
import { executeAction, executeActionWithRetry, executeActionWithOutcome, } from './execute-action.js';
|
|
9
|
+
import { getSnapshotStore, requireSnapshot, resolveElementByEid } from './tool-context.js';
|
|
10
|
+
import { prepareActionContext } from './action-context.js';
|
|
11
|
+
// Convenience alias for module-internal use
|
|
12
|
+
const snapshotStore = getSnapshotStore();
|
|
13
|
+
/**
|
|
14
|
+
* Click an element or at viewport coordinates.
|
|
15
|
+
*
|
|
16
|
+
* Three modes:
|
|
17
|
+
* 1. eid only -> click element center (existing behavior)
|
|
18
|
+
* 2. eid + x/y -> click at offset relative to element top-left
|
|
19
|
+
* 3. x/y only -> click at absolute viewport coordinates
|
|
20
|
+
*
|
|
21
|
+
* @param rawInput - Click options (will be validated)
|
|
22
|
+
* @returns Click result with navigation-aware outcome
|
|
23
|
+
*/
|
|
24
|
+
export async function click(rawInput) {
|
|
25
|
+
const input = ClickInputSchema.parse(rawInput);
|
|
26
|
+
const hasEid = input.eid !== undefined;
|
|
27
|
+
const hasCoords = input.x !== undefined && input.y !== undefined;
|
|
28
|
+
if (!hasEid && !hasCoords) {
|
|
29
|
+
throw new Error('Either eid or both x and y coordinates must be provided.');
|
|
30
|
+
}
|
|
31
|
+
if ((input.x !== undefined) !== (input.y !== undefined)) {
|
|
32
|
+
throw new Error('Both x and y coordinates must be provided together.');
|
|
33
|
+
}
|
|
34
|
+
const { handleRef, pageId, captureSnapshot } = await prepareActionContext(input.page_id);
|
|
35
|
+
let result;
|
|
36
|
+
if (hasEid) {
|
|
37
|
+
// Mode 1 & 2: element-based click (center or offset)
|
|
38
|
+
const snap = requireSnapshot(pageId);
|
|
39
|
+
const node = resolveElementByEid(pageId, input.eid, snap);
|
|
40
|
+
result = await executeActionWithOutcome(handleRef.current, node, async (backendNodeId) => {
|
|
41
|
+
if (hasCoords) {
|
|
42
|
+
await clickAtElementOffset(handleRef.current.cdp, backendNodeId, input.x, input.y, input.modifiers);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await clickByBackendNodeId(handleRef.current.cdp, backendNodeId, input.modifiers);
|
|
46
|
+
}
|
|
47
|
+
}, snapshotStore, captureSnapshot);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Mode 3: x/y only -> absolute viewport click
|
|
51
|
+
result = await executeAction(handleRef.current, async () => {
|
|
52
|
+
await clickAtCoordinates(handleRef.current.cdp, input.x, input.y, input.modifiers);
|
|
53
|
+
}, captureSnapshot);
|
|
54
|
+
}
|
|
55
|
+
snapshotStore.store(pageId, result.snapshot);
|
|
56
|
+
return result.state_response;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Type text into an element.
|
|
60
|
+
*
|
|
61
|
+
* @param rawInput - Type options (will be validated)
|
|
62
|
+
* @returns Type result with delta
|
|
63
|
+
*/
|
|
64
|
+
export async function type(rawInput) {
|
|
65
|
+
const input = TypeInputSchema.parse(rawInput);
|
|
66
|
+
const { handleRef, pageId, captureSnapshot } = await prepareActionContext(input.page_id);
|
|
67
|
+
const snap = requireSnapshot(pageId);
|
|
68
|
+
const node = resolveElementByEid(pageId, input.eid, snap);
|
|
69
|
+
// Execute action with automatic retry on stale elements
|
|
70
|
+
const result = await executeActionWithRetry(handleRef.current, node, async (backendNodeId) => {
|
|
71
|
+
await typeByBackendNodeId(handleRef.current.cdp, backendNodeId, input.text, {
|
|
72
|
+
clear: input.clear,
|
|
73
|
+
});
|
|
74
|
+
}, snapshotStore, captureSnapshot);
|
|
75
|
+
// Store snapshot for future queries
|
|
76
|
+
snapshotStore.store(pageId, result.snapshot);
|
|
77
|
+
// Return XML state response directly
|
|
78
|
+
return result.state_response;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Press a keyboard key (no agent_version).
|
|
82
|
+
*
|
|
83
|
+
* @param rawInput - Press options (will be validated)
|
|
84
|
+
* @returns Press result with delta
|
|
85
|
+
*/
|
|
86
|
+
export async function press(rawInput) {
|
|
87
|
+
const input = PressInputSchema.parse(rawInput);
|
|
88
|
+
const { handleRef, pageId, captureSnapshot } = await prepareActionContext(input.page_id);
|
|
89
|
+
// Execute action with new simplified wrapper
|
|
90
|
+
const result = await executeAction(handleRef.current, async () => {
|
|
91
|
+
await pressKey(handleRef.current.cdp, input.key, input.modifiers);
|
|
92
|
+
}, captureSnapshot);
|
|
93
|
+
// Store snapshot for future queries
|
|
94
|
+
snapshotStore.store(pageId, result.snapshot);
|
|
95
|
+
// Return XML state response directly
|
|
96
|
+
return result.state_response;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Select a dropdown option.
|
|
100
|
+
*
|
|
101
|
+
* @param rawInput - Select options (will be validated)
|
|
102
|
+
* @returns Select result with delta
|
|
103
|
+
*/
|
|
104
|
+
export async function select(rawInput) {
|
|
105
|
+
const input = SelectInputSchema.parse(rawInput);
|
|
106
|
+
const { handleRef, pageId, captureSnapshot } = await prepareActionContext(input.page_id);
|
|
107
|
+
const snap = requireSnapshot(pageId);
|
|
108
|
+
const node = resolveElementByEid(pageId, input.eid, snap);
|
|
109
|
+
// Execute action with automatic retry on stale elements
|
|
110
|
+
const result = await executeActionWithRetry(handleRef.current, node, async (backendNodeId) => {
|
|
111
|
+
await selectOption(handleRef.current.cdp, backendNodeId, input.value);
|
|
112
|
+
}, snapshotStore, captureSnapshot);
|
|
113
|
+
// Store snapshot for future queries
|
|
114
|
+
snapshotStore.store(pageId, result.snapshot);
|
|
115
|
+
// Return XML state response directly
|
|
116
|
+
return result.state_response;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Hover over an element.
|
|
120
|
+
*
|
|
121
|
+
* @param rawInput - Hover options (will be validated)
|
|
122
|
+
* @returns Hover result with delta
|
|
123
|
+
*/
|
|
124
|
+
export async function hover(rawInput) {
|
|
125
|
+
const input = HoverInputSchema.parse(rawInput);
|
|
126
|
+
const { handleRef, pageId, captureSnapshot } = await prepareActionContext(input.page_id);
|
|
127
|
+
const snap = requireSnapshot(pageId);
|
|
128
|
+
const node = resolveElementByEid(pageId, input.eid, snap);
|
|
129
|
+
// Execute action with automatic retry on stale elements
|
|
130
|
+
const result = await executeActionWithRetry(handleRef.current, node, async (backendNodeId) => {
|
|
131
|
+
await hoverByBackendNodeId(handleRef.current.cdp, backendNodeId);
|
|
132
|
+
}, snapshotStore, captureSnapshot);
|
|
133
|
+
// Store snapshot for future queries
|
|
134
|
+
snapshotStore.store(pageId, result.snapshot);
|
|
135
|
+
// Return XML state response directly
|
|
136
|
+
return result.state_response;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=interaction-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction-tools.js","sourceRoot":"","sources":["../../../src/tools/interaction-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,wBAAwB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CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IACnE,CAAC,EACD,aAAa,EACb,eAAe,CAChB,CAAC;IAEF,oCAAoC;IACpC,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE7C,qCAAqC;IACrC,OAAO,MAAM,CAAC,cAAc,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Detection
|
|
3
|
+
*
|
|
4
|
+
* Captures and compares navigation state (URL, loaderId) for click outcome classification.
|
|
5
|
+
*
|
|
6
|
+
* @module tools/navigation-detection
|
|
7
|
+
*/
|
|
8
|
+
import type { PageHandle } from '../browser/page-registry.js';
|
|
9
|
+
/**
|
|
10
|
+
* Navigation state for detecting URL/loaderId changes.
|
|
11
|
+
*/
|
|
12
|
+
export interface NavigationState {
|
|
13
|
+
url: string;
|
|
14
|
+
loaderId?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Capture current navigation state (URL and loaderId).
|
|
18
|
+
*
|
|
19
|
+
* @param handle - Page handle with CDP client
|
|
20
|
+
* @returns Navigation state with URL and optional loaderId
|
|
21
|
+
*/
|
|
22
|
+
export declare function captureNavigationState(handle: PageHandle): Promise<NavigationState>;
|
|
23
|
+
/**
|
|
24
|
+
* Check if navigation occurred between two states.
|
|
25
|
+
*
|
|
26
|
+
* @param before - State before action
|
|
27
|
+
* @param after - State after action
|
|
28
|
+
* @returns True if navigation detected
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkNavigationOccurred(before: NavigationState, after: NavigationState): boolean;
|
|
31
|
+
//# sourceMappingURL=navigation-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-detection.d.ts","sourceRoot":"","sources":["../../../src/tools/navigation-detection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAYzF;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAgBhG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Detection
|
|
3
|
+
*
|
|
4
|
+
* Captures and compares navigation state (URL, loaderId) for click outcome classification.
|
|
5
|
+
*
|
|
6
|
+
* @module tools/navigation-detection
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Capture current navigation state (URL and loaderId).
|
|
10
|
+
*
|
|
11
|
+
* @param handle - Page handle with CDP client
|
|
12
|
+
* @returns Navigation state with URL and optional loaderId
|
|
13
|
+
*/
|
|
14
|
+
export async function captureNavigationState(handle) {
|
|
15
|
+
const url = handle.page.url();
|
|
16
|
+
let loaderId;
|
|
17
|
+
try {
|
|
18
|
+
const frameTree = await handle.cdp.send('Page.getFrameTree', undefined);
|
|
19
|
+
loaderId = frameTree.frameTree.frame.loaderId;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Ignore - we can still detect navigation via URL
|
|
23
|
+
}
|
|
24
|
+
return { url, loaderId };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if navigation occurred between two states.
|
|
28
|
+
*
|
|
29
|
+
* @param before - State before action
|
|
30
|
+
* @param after - State after action
|
|
31
|
+
* @returns True if navigation detected
|
|
32
|
+
*/
|
|
33
|
+
export function checkNavigationOccurred(before, after) {
|
|
34
|
+
// URL changed = navigation
|
|
35
|
+
if (before.url !== after.url) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
// LoaderId changed (and both defined) = navigation
|
|
39
|
+
if (before.loaderId !== undefined &&
|
|
40
|
+
after.loaderId !== undefined &&
|
|
41
|
+
before.loaderId !== after.loaderId) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=navigation-detection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-detection.js","sourceRoot":"","sources":["../../../src/tools/navigation-detection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAkB;IAC7D,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IAC9B,IAAI,QAA4B,CAAC;IAEjC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;QACxE,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,kDAAkD;IACpD,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAuB,EAAE,KAAsB;IACrF,2BAA2B;IAC3B,IAAI,MAAM,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,IACE,MAAM,CAAC,QAAQ,KAAK,SAAS;QAC7B,KAAK,CAAC,QAAQ,KAAK,SAAS;QAC5B,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,EAClC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for browser navigation and session management.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* List all open browser pages with their metadata.
|
|
8
|
+
*
|
|
9
|
+
* Syncs with browser context to ensure all tabs are registered,
|
|
10
|
+
* including tabs opened externally or after reconnection.
|
|
11
|
+
*
|
|
12
|
+
* @returns XML result with page list
|
|
13
|
+
*/
|
|
14
|
+
export declare function listPages(): Promise<import('./tool-schemas.js').ListPagesOutput>;
|
|
15
|
+
/**
|
|
16
|
+
* Close a specific page.
|
|
17
|
+
*
|
|
18
|
+
* @param rawInput - Close options (will be validated)
|
|
19
|
+
* @returns Close result
|
|
20
|
+
*/
|
|
21
|
+
export declare function closePage(rawInput: unknown): Promise<import('./tool-schemas.js').ClosePageOutput>;
|
|
22
|
+
/**
|
|
23
|
+
* Close the entire browser session.
|
|
24
|
+
*
|
|
25
|
+
* @param rawInput - Close options (will be validated)
|
|
26
|
+
* @returns Close result
|
|
27
|
+
*/
|
|
28
|
+
export declare function closeSession(rawInput: unknown): Promise<import('./tool-schemas.js').CloseSessionOutput>;
|
|
29
|
+
/**
|
|
30
|
+
* Navigate to a URL.
|
|
31
|
+
*
|
|
32
|
+
* @param rawInput - Navigation options (will be validated)
|
|
33
|
+
* @returns Navigation result with snapshot data
|
|
34
|
+
*/
|
|
35
|
+
export declare function navigate(rawInput: unknown): Promise<import('./tool-schemas.js').NavigateOutput>;
|
|
36
|
+
/**
|
|
37
|
+
* Go back in browser history.
|
|
38
|
+
*
|
|
39
|
+
* @param rawInput - Navigation options (will be validated)
|
|
40
|
+
* @returns Navigation result with snapshot data
|
|
41
|
+
*/
|
|
42
|
+
export declare function goBack(rawInput: unknown): Promise<import('./tool-schemas.js').GoBackOutput>;
|
|
43
|
+
/**
|
|
44
|
+
* Go forward in browser history.
|
|
45
|
+
*
|
|
46
|
+
* @param rawInput - Navigation options (will be validated)
|
|
47
|
+
* @returns Navigation result with snapshot data
|
|
48
|
+
*/
|
|
49
|
+
export declare function goForward(rawInput: unknown): Promise<import('./tool-schemas.js').GoForwardOutput>;
|
|
50
|
+
/**
|
|
51
|
+
* Reload the current page.
|
|
52
|
+
*
|
|
53
|
+
* @param rawInput - Navigation options (will be validated)
|
|
54
|
+
* @returns Navigation result with snapshot data
|
|
55
|
+
*/
|
|
56
|
+
export declare function reload(rawInput: unknown): Promise<import('./tool-schemas.js').ReloadOutput>;
|
|
57
|
+
//# sourceMappingURL=navigation-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/navigation-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyFH;;;;;;;GAOG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAAC,CA4BtF;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAAC,CAUtD;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,mBAAmB,EAAE,kBAAkB,CAAC,CAWzD;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC,CAsBrD;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,YAAY,CAAC,CAGjG;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,OAAO,mBAAmB,EAAE,eAAe,CAAC,CAGtD;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,mBAAmB,EAAE,YAAY,CAAC,CAGjG"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for browser navigation and session management.
|
|
5
|
+
*/
|
|
6
|
+
import { observationAccumulator } from '../observation/index.js';
|
|
7
|
+
import { ClosePageInputSchema, CloseSessionInputSchema, NavigateInputSchema, GoBackInputSchema, GoForwardInputSchema, ReloadInputSchema, } from './tool-schemas.js';
|
|
8
|
+
import { cleanupTempFiles } from '../lib/temp-file.js';
|
|
9
|
+
import { getStateManager, removeStateManager, clearAllStateManagers, } from './state-manager-registry.js';
|
|
10
|
+
import { stabilizeAfterNavigation } from './action-stabilization.js';
|
|
11
|
+
import { buildClosePageResponse, buildCloseSessionResponse, buildListPagesResponse, } from './response-builder.js';
|
|
12
|
+
import { getDependencyTracker } from '../form/index.js';
|
|
13
|
+
import { getSessionManager, getSnapshotStore } from './tool-context.js';
|
|
14
|
+
import { captureSnapshotWithRecovery } from './action-context.js';
|
|
15
|
+
// Convenience alias for module-internal use
|
|
16
|
+
const snapshotStore = getSnapshotStore();
|
|
17
|
+
/**
|
|
18
|
+
* Execute a navigation action with snapshot capture.
|
|
19
|
+
* Consolidates goBack, goForward, and reload handlers.
|
|
20
|
+
*
|
|
21
|
+
* Waits for both DOM stabilization and network idle after navigation
|
|
22
|
+
* to ensure the page is fully loaded before capturing snapshot.
|
|
23
|
+
*
|
|
24
|
+
* @param pageId - Optional page ID
|
|
25
|
+
* @param action - Navigation action to execute
|
|
26
|
+
* @returns State response after navigation
|
|
27
|
+
*/
|
|
28
|
+
async function executeNavigationAction(pageId, action) {
|
|
29
|
+
const session = getSessionManager();
|
|
30
|
+
let handle = await session.resolvePageOrCreate(pageId);
|
|
31
|
+
const page_id = handle.page_id;
|
|
32
|
+
session.touchPage(page_id);
|
|
33
|
+
// Clear dependency tracker before navigation (old dependencies no longer valid)
|
|
34
|
+
getDependencyTracker().clearPage(page_id);
|
|
35
|
+
// Execute navigation
|
|
36
|
+
switch (action) {
|
|
37
|
+
case 'back':
|
|
38
|
+
await handle.page.goBack();
|
|
39
|
+
break;
|
|
40
|
+
case 'forward':
|
|
41
|
+
await handle.page.goForward();
|
|
42
|
+
break;
|
|
43
|
+
case 'reload':
|
|
44
|
+
await handle.page.reload();
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
// Wait for page to stabilize (DOM + network idle)
|
|
48
|
+
await stabilizeAfterNavigation(handle.page);
|
|
49
|
+
// Re-inject observation accumulator (new document context after navigation)
|
|
50
|
+
await observationAccumulator.inject(handle.page);
|
|
51
|
+
// Auto-capture snapshot after navigation
|
|
52
|
+
const captureResult = await captureSnapshotWithRecovery(session, handle, page_id);
|
|
53
|
+
handle = captureResult.handle;
|
|
54
|
+
const snapshot = captureResult.snapshot;
|
|
55
|
+
snapshotStore.store(page_id, snapshot);
|
|
56
|
+
// Return XML state response (trimmed for navigation snapshots)
|
|
57
|
+
const stateManager = getStateManager(page_id);
|
|
58
|
+
return stateManager.generateResponse(snapshot, { trimRegions: true });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* List all open browser pages with their metadata.
|
|
62
|
+
*
|
|
63
|
+
* Syncs with browser context to ensure all tabs are registered,
|
|
64
|
+
* including tabs opened externally or after reconnection.
|
|
65
|
+
*
|
|
66
|
+
* @returns XML result with page list
|
|
67
|
+
*/
|
|
68
|
+
export async function listPages() {
|
|
69
|
+
const session = getSessionManager();
|
|
70
|
+
// Sync to pick up any unregistered browser tabs
|
|
71
|
+
const pages = await session.syncPages();
|
|
72
|
+
const pageInfos = await Promise.all(pages.map(async (h) => {
|
|
73
|
+
const liveUrl = h.page.url?.() ?? h.url ?? '';
|
|
74
|
+
let liveTitle = h.title ?? '';
|
|
75
|
+
if (typeof h.page.title === 'function') {
|
|
76
|
+
try {
|
|
77
|
+
liveTitle = await h.page.title();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Ignore pages that cannot expose title in the current state.
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
h.url = liveUrl;
|
|
84
|
+
h.title = liveTitle;
|
|
85
|
+
return {
|
|
86
|
+
page_id: h.page_id,
|
|
87
|
+
url: liveUrl,
|
|
88
|
+
title: liveTitle,
|
|
89
|
+
};
|
|
90
|
+
}));
|
|
91
|
+
return buildListPagesResponse(pageInfos);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Close a specific page.
|
|
95
|
+
*
|
|
96
|
+
* @param rawInput - Close options (will be validated)
|
|
97
|
+
* @returns Close result
|
|
98
|
+
*/
|
|
99
|
+
export async function closePage(rawInput) {
|
|
100
|
+
const input = ClosePageInputSchema.parse(rawInput);
|
|
101
|
+
const session = getSessionManager();
|
|
102
|
+
await session.closePage(input.page_id);
|
|
103
|
+
snapshotStore.removeByPageId(input.page_id);
|
|
104
|
+
removeStateManager(input.page_id); // Clean up state manager
|
|
105
|
+
getDependencyTracker().clearPage(input.page_id); // Clean up dependencies
|
|
106
|
+
return buildClosePageResponse(input.page_id);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Close the entire browser session.
|
|
110
|
+
*
|
|
111
|
+
* @param rawInput - Close options (will be validated)
|
|
112
|
+
* @returns Close result
|
|
113
|
+
*/
|
|
114
|
+
export async function closeSession(rawInput) {
|
|
115
|
+
CloseSessionInputSchema.parse(rawInput);
|
|
116
|
+
const session = getSessionManager();
|
|
117
|
+
await session.shutdown();
|
|
118
|
+
snapshotStore.clear();
|
|
119
|
+
clearAllStateManagers(); // Clean up all state managers
|
|
120
|
+
getDependencyTracker().clearAll(); // Clean up all dependencies
|
|
121
|
+
await cleanupTempFiles(); // Clean up screenshot temp files
|
|
122
|
+
return buildCloseSessionResponse();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Navigate to a URL.
|
|
126
|
+
*
|
|
127
|
+
* @param rawInput - Navigation options (will be validated)
|
|
128
|
+
* @returns Navigation result with snapshot data
|
|
129
|
+
*/
|
|
130
|
+
export async function navigate(rawInput) {
|
|
131
|
+
const input = NavigateInputSchema.parse(rawInput);
|
|
132
|
+
const session = getSessionManager();
|
|
133
|
+
let handle = await session.resolvePageOrCreate(input.page_id);
|
|
134
|
+
const page_id = handle.page_id;
|
|
135
|
+
session.touchPage(page_id);
|
|
136
|
+
// Clear dependency tracker before navigation (old dependencies no longer valid)
|
|
137
|
+
getDependencyTracker().clearPage(page_id);
|
|
138
|
+
await session.navigateTo(page_id, input.url);
|
|
139
|
+
// Auto-capture snapshot after navigation
|
|
140
|
+
const captureResult = await captureSnapshotWithRecovery(session, handle, page_id);
|
|
141
|
+
handle = captureResult.handle;
|
|
142
|
+
const snapshot = captureResult.snapshot;
|
|
143
|
+
snapshotStore.store(page_id, snapshot);
|
|
144
|
+
// Return XML state response directly (trimmed for navigation snapshots)
|
|
145
|
+
const stateManager = getStateManager(page_id);
|
|
146
|
+
return stateManager.generateResponse(snapshot, { trimRegions: true });
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Go back in browser history.
|
|
150
|
+
*
|
|
151
|
+
* @param rawInput - Navigation options (will be validated)
|
|
152
|
+
* @returns Navigation result with snapshot data
|
|
153
|
+
*/
|
|
154
|
+
export async function goBack(rawInput) {
|
|
155
|
+
const input = GoBackInputSchema.parse(rawInput);
|
|
156
|
+
return executeNavigationAction(input.page_id, 'back');
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Go forward in browser history.
|
|
160
|
+
*
|
|
161
|
+
* @param rawInput - Navigation options (will be validated)
|
|
162
|
+
* @returns Navigation result with snapshot data
|
|
163
|
+
*/
|
|
164
|
+
export async function goForward(rawInput) {
|
|
165
|
+
const input = GoForwardInputSchema.parse(rawInput);
|
|
166
|
+
return executeNavigationAction(input.page_id, 'forward');
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Reload the current page.
|
|
170
|
+
*
|
|
171
|
+
* @param rawInput - Navigation options (will be validated)
|
|
172
|
+
* @returns Navigation result with snapshot data
|
|
173
|
+
*/
|
|
174
|
+
export async function reload(rawInput) {
|
|
175
|
+
const input = ReloadInputSchema.parse(rawInput);
|
|
176
|
+
return executeNavigationAction(input.page_id, 'reload');
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=navigation-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-tools.js","sourceRoot":"","sources":["../../../src/tools/navigation-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAElE,4CAA4C;AAC5C,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAOzC;;;;;;;;;;GAUG;AACH,KAAK,UAAU,uBAAuB,CACpC,MAA0B,EAC1B,MAAwB;IAExB,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IAEpC,IAAI,MAAM,GA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AAM,CAAC;IAC9B,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;IACxC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEvC,wEAAwE;IACxE,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,QAAiB;IAC5C,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,OAAO,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,QAAiB;IAEjB,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,QAAiB;IAC5C,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,OAAO,uBAAuB,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation Tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tool handlers for page observation: snapshots, find, get_element, scroll.
|
|
5
|
+
*/
|
|
6
|
+
import type { NodeKind } from '../snapshot/snapshot.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Capture a fresh snapshot of the current page.
|
|
9
|
+
*
|
|
10
|
+
* @param rawInput - Capture options (will be validated)
|
|
11
|
+
* @returns Snapshot data for the current page
|
|
12
|
+
*/
|
|
13
|
+
export declare function captureSnapshot(rawInput: unknown): Promise<import('./tool-schemas.js').CaptureSnapshotOutput>;
|
|
14
|
+
/**
|
|
15
|
+
* Map schema kind values to internal NodeKind values.
|
|
16
|
+
*
|
|
17
|
+
* The find schema uses user-friendly names that don't always match
|
|
18
|
+
* internal NodeKind values. For example, 'textbox' in the schema maps to
|
|
19
|
+
* both 'input' and 'textarea' internally.
|
|
20
|
+
*
|
|
21
|
+
* @param schemaKind - Kind value from the find schema
|
|
22
|
+
* @returns Matching NodeKind value(s)
|
|
23
|
+
*/
|
|
24
|
+
export declare function mapSchemaKindToNodeKind(schemaKind: string): NodeKind | NodeKind[];
|
|
25
|
+
/**
|
|
26
|
+
* Find elements by semantic criteria.
|
|
27
|
+
*
|
|
28
|
+
* @param rawInput - Query filters (will be validated)
|
|
29
|
+
* @returns Matched nodes
|
|
30
|
+
*/
|
|
31
|
+
export declare function findElements(rawInput: unknown): import('./tool-schemas.js').FindElementsOutput;
|
|
32
|
+
/**
|
|
33
|
+
* Get full details for a specific node.
|
|
34
|
+
*
|
|
35
|
+
* @param rawInput - Node details request (will be validated)
|
|
36
|
+
* @returns Full node details
|
|
37
|
+
*/
|
|
38
|
+
export declare function getNodeDetails(rawInput: unknown): import('./tool-schemas.js').GetNodeDetailsOutput;
|
|
39
|
+
/**
|
|
40
|
+
* Scroll an element into view.
|
|
41
|
+
*
|
|
42
|
+
* @param rawInput - Scroll options (will be validated)
|
|
43
|
+
* @returns Scroll result with delta
|
|
44
|
+
*/
|
|
45
|
+
export declare function scrollElementIntoView(rawInput: unknown): Promise<import('./tool-schemas.js').ScrollElementIntoViewOutput>;
|
|
46
|
+
/**
|
|
47
|
+
* Scroll the page up or down.
|
|
48
|
+
*
|
|
49
|
+
* @param rawInput - Scroll options (will be validated)
|
|
50
|
+
* @returns Scroll result with delta
|
|
51
|
+
*/
|
|
52
|
+
export declare function scrollPage(rawInput: unknown): Promise<import('./tool-schemas.js').ScrollPageOutput>;
|
|
53
|
+
//# sourceMappingURL=observation-tools.d.ts.map
|