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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Stabilization
|
|
3
|
+
*
|
|
4
|
+
* Stabilizes the page after actions using tiered waiting (DOM + network).
|
|
5
|
+
*
|
|
6
|
+
* @module tools/action-stabilization
|
|
7
|
+
*/
|
|
8
|
+
import type { Page } from 'puppeteer-core';
|
|
9
|
+
import { type StabilizationResult } from '../delta/dom-stabilizer.js';
|
|
10
|
+
import type { PageHandle } from '../browser/page-registry.js';
|
|
11
|
+
import type { BaseSnapshot } from '../snapshot/snapshot.types.js';
|
|
12
|
+
import type { RuntimeHealth } from '../state/health.types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Stabilize page after an action using tiered waiting strategy.
|
|
15
|
+
*
|
|
16
|
+
* This addresses the core issue: actions may trigger API calls that complete
|
|
17
|
+
* after DOM mutations settle. The tiered approach:
|
|
18
|
+
*
|
|
19
|
+
* 1. Wait for DOM to stabilize (MutationObserver) - catches SPA rendering
|
|
20
|
+
* 2. Wait for network to quiet down (networkidle) - catches pending API calls
|
|
21
|
+
* 3. If DOM stabilization fails (navigation), fall back to network idle wait
|
|
22
|
+
*
|
|
23
|
+
* Timeouts are generous but never throw - we proceed even if network stays busy
|
|
24
|
+
* (common with analytics, long-polling, websockets).
|
|
25
|
+
*
|
|
26
|
+
* @param page - Puppeteer Page instance
|
|
27
|
+
* @param networkTimeoutMs - Optional custom timeout for network idle (default: 3000ms)
|
|
28
|
+
* @returns Stabilization result with status
|
|
29
|
+
*/
|
|
30
|
+
export declare function stabilizeAfterAction(page: Page, networkTimeoutMs?: number): Promise<StabilizationResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Stabilize page after explicit navigation (goto, back, forward, reload).
|
|
33
|
+
*
|
|
34
|
+
* Uses a longer network timeout since navigations typically trigger more
|
|
35
|
+
* requests than in-page actions.
|
|
36
|
+
*
|
|
37
|
+
* @param page - Puppeteer Page instance
|
|
38
|
+
* @returns Stabilization result with status
|
|
39
|
+
*/
|
|
40
|
+
export declare function stabilizeAfterNavigation(page: Page): Promise<StabilizationResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Capture snapshot without recovery (fallback path).
|
|
43
|
+
*/
|
|
44
|
+
export declare function captureSnapshotFallback(handle: PageHandle): Promise<{
|
|
45
|
+
snapshot: BaseSnapshot;
|
|
46
|
+
runtime_health: RuntimeHealth;
|
|
47
|
+
}>;
|
|
48
|
+
//# sourceMappingURL=action-stabilization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-stabilization.d.ts","sourceRoot":"","sources":["../../../src/tools/action-stabilization.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAS9D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,gBAAgB,GAAE,MAAuC,GACxD,OAAO,CAAC,mBAAmB,CAAC,CA0C9B;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAEvF;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,cAAc,EAAE,aAAa,CAAA;CAAE,CAAC,CAGpE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Stabilization
|
|
3
|
+
*
|
|
4
|
+
* Stabilizes the page after actions using tiered waiting (DOM + network).
|
|
5
|
+
*
|
|
6
|
+
* @module tools/action-stabilization
|
|
7
|
+
*/
|
|
8
|
+
import { stabilizeDom } from '../delta/dom-stabilizer.js';
|
|
9
|
+
import { createHealthyRuntime } from '../state/health.types.js';
|
|
10
|
+
import { compileSnapshot } from '../snapshot/index.js';
|
|
11
|
+
import { waitForNetworkQuiet, ACTION_NETWORK_IDLE_TIMEOUT_MS, NAVIGATION_NETWORK_IDLE_TIMEOUT_MS, } from '../browser/page-stabilization.js';
|
|
12
|
+
/**
|
|
13
|
+
* Stabilize page after an action using tiered waiting strategy.
|
|
14
|
+
*
|
|
15
|
+
* This addresses the core issue: actions may trigger API calls that complete
|
|
16
|
+
* after DOM mutations settle. The tiered approach:
|
|
17
|
+
*
|
|
18
|
+
* 1. Wait for DOM to stabilize (MutationObserver) - catches SPA rendering
|
|
19
|
+
* 2. Wait for network to quiet down (networkidle) - catches pending API calls
|
|
20
|
+
* 3. If DOM stabilization fails (navigation), fall back to network idle wait
|
|
21
|
+
*
|
|
22
|
+
* Timeouts are generous but never throw - we proceed even if network stays busy
|
|
23
|
+
* (common with analytics, long-polling, websockets).
|
|
24
|
+
*
|
|
25
|
+
* @param page - Puppeteer Page instance
|
|
26
|
+
* @param networkTimeoutMs - Optional custom timeout for network idle (default: 3000ms)
|
|
27
|
+
* @returns Stabilization result with status
|
|
28
|
+
*/
|
|
29
|
+
export async function stabilizeAfterAction(page, networkTimeoutMs = ACTION_NETWORK_IDLE_TIMEOUT_MS) {
|
|
30
|
+
// Step 1: Try MutationObserver-based DOM stabilization first
|
|
31
|
+
const result = await stabilizeDom(page);
|
|
32
|
+
// Step 2: Handle based on DOM stabilization result
|
|
33
|
+
if (result.status === 'stable' || result.status === 'timeout') {
|
|
34
|
+
// DOM settled (or timed out) - now wait for network to quiet down
|
|
35
|
+
// This catches API calls that haven't rendered to DOM yet
|
|
36
|
+
const networkIdle = await waitForNetworkQuiet(page, networkTimeoutMs);
|
|
37
|
+
if (!networkIdle && result.status === 'stable') {
|
|
38
|
+
// DOM was stable but network didn't idle - add a note
|
|
39
|
+
return {
|
|
40
|
+
...result,
|
|
41
|
+
warning: result.warning ?? 'Network did not reach idle state within timeout',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
// status === 'error' means page.evaluate() failed, likely due to navigation
|
|
47
|
+
// Fall back to waiting for network idle on the new page
|
|
48
|
+
try {
|
|
49
|
+
// Wait for network to settle on the new page
|
|
50
|
+
await waitForNetworkQuiet(page, networkTimeoutMs);
|
|
51
|
+
return {
|
|
52
|
+
status: 'stable',
|
|
53
|
+
waitTimeMs: result.waitTimeMs,
|
|
54
|
+
warning: 'Navigation detected; waited for networkidle',
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (waitError) {
|
|
58
|
+
// If network wait also fails, the page might be in an unusual state
|
|
59
|
+
// Return the original error but with additional context
|
|
60
|
+
const message = waitError instanceof Error ? waitError.message : String(waitError);
|
|
61
|
+
return {
|
|
62
|
+
status: 'error',
|
|
63
|
+
waitTimeMs: result.waitTimeMs,
|
|
64
|
+
warning: `${result.warning}. Fallback network wait also failed: ${message}`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Stabilize page after explicit navigation (goto, back, forward, reload).
|
|
70
|
+
*
|
|
71
|
+
* Uses a longer network timeout since navigations typically trigger more
|
|
72
|
+
* requests than in-page actions.
|
|
73
|
+
*
|
|
74
|
+
* @param page - Puppeteer Page instance
|
|
75
|
+
* @returns Stabilization result with status
|
|
76
|
+
*/
|
|
77
|
+
export async function stabilizeAfterNavigation(page) {
|
|
78
|
+
return stabilizeAfterAction(page, NAVIGATION_NETWORK_IDLE_TIMEOUT_MS);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Capture snapshot without recovery (fallback path).
|
|
82
|
+
*/
|
|
83
|
+
export async function captureSnapshotFallback(handle) {
|
|
84
|
+
const snapshot = await compileSnapshot(handle.cdp, handle.page, handle.page_id);
|
|
85
|
+
return { snapshot, runtime_health: createHealthyRuntime() };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=action-stabilization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-stabilization.js","sourceRoot":"","sources":["../../../src/tools/action-stabilization.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAA4B,MAAM,4BAA4B,CAAC;AAIpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAU,EACV,mBAA2B,8BAA8B;IAEzD,6DAA6D;IAC7D,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAExC,mDAAmD;IACnD,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9D,kEAAkE;QAClE,0DAA0D;QAC1D,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAEtE,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/C,sDAAsD;YACtD,OAAO;gBACL,GAAG,MAAM;gBACT,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,iDAAiD;aAC7E,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,4EAA4E;IAC5E,wDAAwD;IACxD,IAAI,CAAC;QACH,6CAA6C;QAC7C,MAAM,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAElD,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,OAAO,EAAE,6CAA6C;SACvD,CAAC;IACJ,CAAC;IAAC,OAAO,SAAS,EAAE,CAAC;QACnB,oEAAoE;QACpE,wDAAwD;QACxD,MAAM,OAAO,GAAG,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACnF,OAAO;YACL,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,wCAAwC,OAAO,EAAE;SAC5E,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,IAAU;IACvD,OAAO,oBAAoB,CAAC,IAAI,EAAE,kCAAkC,CAAC,CAAC;AACxE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAkB;IAElB,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,oBAAoB,EAAE,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -1,150 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Browser Tools
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @param manager - SessionManager instance
|
|
13
|
-
*/
|
|
14
|
-
export declare function initializeTools(manager: SessionManager): void;
|
|
15
|
-
/**
|
|
16
|
-
* Get the snapshot store.
|
|
17
|
-
*/
|
|
18
|
-
export declare function getSnapshotStore(): SnapshotStore;
|
|
19
|
-
/**
|
|
20
|
-
* List all open browser pages with their metadata.
|
|
21
|
-
*
|
|
22
|
-
* Syncs with browser context to ensure all tabs are registered,
|
|
23
|
-
* including tabs opened externally or after reconnection.
|
|
24
|
-
*
|
|
25
|
-
* @returns XML result with page list
|
|
26
|
-
*/
|
|
27
|
-
export declare function listPages(): Promise<import('./tool-schemas.js').ListPagesOutput>;
|
|
28
|
-
/**
|
|
29
|
-
* Close a specific page.
|
|
30
|
-
*
|
|
31
|
-
* @param rawInput - Close options (will be validated)
|
|
32
|
-
* @returns Close result
|
|
33
|
-
*/
|
|
34
|
-
export declare function closePage(rawInput: unknown): Promise<import('./tool-schemas.js').ClosePageOutput>;
|
|
35
|
-
/**
|
|
36
|
-
* Close the entire browser session.
|
|
37
|
-
*
|
|
38
|
-
* @param rawInput - Close options (will be validated)
|
|
39
|
-
* @returns Close result
|
|
40
|
-
*/
|
|
41
|
-
export declare function closeSession(rawInput: unknown): Promise<import('./tool-schemas.js').CloseSessionOutput>;
|
|
42
|
-
/**
|
|
43
|
-
* Navigate to a URL.
|
|
44
|
-
*
|
|
45
|
-
* @param rawInput - Navigation options (will be validated)
|
|
46
|
-
* @returns Navigation result with snapshot data
|
|
47
|
-
*/
|
|
48
|
-
export declare function navigate(rawInput: unknown): Promise<import('./tool-schemas.js').NavigateOutput>;
|
|
49
|
-
/**
|
|
50
|
-
* Go back in browser history.
|
|
51
|
-
*
|
|
52
|
-
* @param rawInput - Navigation options (will be validated)
|
|
53
|
-
* @returns Navigation result with snapshot data
|
|
54
|
-
*/
|
|
55
|
-
export declare function goBack(rawInput: unknown): Promise<import('./tool-schemas.js').GoBackOutput>;
|
|
56
|
-
/**
|
|
57
|
-
* Go forward in browser history.
|
|
58
|
-
*
|
|
59
|
-
* @param rawInput - Navigation options (will be validated)
|
|
60
|
-
* @returns Navigation result with snapshot data
|
|
61
|
-
*/
|
|
62
|
-
export declare function goForward(rawInput: unknown): Promise<import('./tool-schemas.js').GoForwardOutput>;
|
|
63
|
-
/**
|
|
64
|
-
* Reload the current page.
|
|
65
|
-
*
|
|
66
|
-
* @param rawInput - Navigation options (will be validated)
|
|
67
|
-
* @returns Navigation result with snapshot data
|
|
68
|
-
*/
|
|
69
|
-
export declare function reload(rawInput: unknown): Promise<import('./tool-schemas.js').ReloadOutput>;
|
|
70
|
-
/**
|
|
71
|
-
* Capture a fresh snapshot of the current page.
|
|
72
|
-
*
|
|
73
|
-
* @param rawInput - Capture options (will be validated)
|
|
74
|
-
* @returns Snapshot data for the current page
|
|
75
|
-
*/
|
|
76
|
-
export declare function captureSnapshot(rawInput: unknown): Promise<import('./tool-schemas.js').CaptureSnapshotOutput>;
|
|
77
|
-
/**
|
|
78
|
-
* Find elements by semantic criteria.
|
|
79
|
-
*
|
|
80
|
-
* @param rawInput - Query filters (will be validated)
|
|
81
|
-
* @returns Matched nodes
|
|
82
|
-
*/
|
|
83
|
-
export declare function findElements(rawInput: unknown): import('./tool-schemas.js').FindElementsOutput;
|
|
84
|
-
/**
|
|
85
|
-
* Get full details for a specific node.
|
|
86
|
-
*
|
|
87
|
-
* @param rawInput - Node details request (will be validated)
|
|
88
|
-
* @returns Full node details
|
|
89
|
-
*/
|
|
90
|
-
export declare function getNodeDetails(rawInput: unknown): import('./tool-schemas.js').GetNodeDetailsOutput;
|
|
91
|
-
/**
|
|
92
|
-
* Scroll an element into view.
|
|
93
|
-
*
|
|
94
|
-
* @param rawInput - Scroll options (will be validated)
|
|
95
|
-
* @returns Scroll result with delta
|
|
96
|
-
*/
|
|
97
|
-
export declare function scrollElementIntoView(rawInput: unknown): Promise<import('./tool-schemas.js').ScrollElementIntoViewOutput>;
|
|
98
|
-
/**
|
|
99
|
-
* Scroll the page up or down.
|
|
100
|
-
*
|
|
101
|
-
* @param rawInput - Scroll options (will be validated)
|
|
102
|
-
* @returns Scroll result with delta
|
|
103
|
-
*/
|
|
104
|
-
export declare function scrollPage(rawInput: unknown): Promise<import('./tool-schemas.js').ScrollPageOutput>;
|
|
105
|
-
/**
|
|
106
|
-
* Click an element.
|
|
107
|
-
*
|
|
108
|
-
* @param rawInput - Click options (will be validated)
|
|
109
|
-
* @returns Click result with navigation-aware outcome
|
|
110
|
-
*/
|
|
111
|
-
export declare function click(rawInput: unknown): Promise<import('./tool-schemas.js').ClickOutput>;
|
|
112
|
-
/**
|
|
113
|
-
* Type text into an element.
|
|
114
|
-
*
|
|
115
|
-
* @param rawInput - Type options (will be validated)
|
|
116
|
-
* @returns Type result with delta
|
|
117
|
-
*/
|
|
118
|
-
export declare function type(rawInput: unknown): Promise<import('./tool-schemas.js').TypeOutput>;
|
|
119
|
-
/**
|
|
120
|
-
* Press a keyboard key (no agent_version).
|
|
121
|
-
*
|
|
122
|
-
* @param rawInput - Press options (will be validated)
|
|
123
|
-
* @returns Press result with delta
|
|
124
|
-
*/
|
|
125
|
-
export declare function press(rawInput: unknown): Promise<import('./tool-schemas.js').PressOutput>;
|
|
126
|
-
/**
|
|
127
|
-
* Select a dropdown option.
|
|
128
|
-
*
|
|
129
|
-
* @param rawInput - Select options (will be validated)
|
|
130
|
-
* @returns Select result with delta
|
|
131
|
-
*/
|
|
132
|
-
export declare function select(rawInput: unknown): Promise<import('./tool-schemas.js').SelectOutput>;
|
|
133
|
-
/**
|
|
134
|
-
* Hover over an element.
|
|
135
|
-
*
|
|
136
|
-
* @param rawInput - Hover options (will be validated)
|
|
137
|
-
* @returns Hover result with delta
|
|
138
|
-
*/
|
|
139
|
-
export declare function hover(rawInput: unknown): Promise<import('./tool-schemas.js').HoverOutput>;
|
|
140
|
-
/**
|
|
141
|
-
* Take a screenshot of the page or a specific element.
|
|
142
|
-
*
|
|
143
|
-
* Observation tool - does not mutate page state.
|
|
144
|
-
* Returns inline image (<2MB) or temp file path (>=2MB).
|
|
145
|
-
*
|
|
146
|
-
* @param rawInput - Screenshot options (will be validated)
|
|
147
|
-
* @returns ImageResult or FileResult
|
|
148
|
-
*/
|
|
149
|
-
export declare function takeScreenshot(rawInput: unknown): Promise<import('./tool-schemas.js').TakeScreenshotOutput>;
|
|
4
|
+
* Re-export barrel for all browser automation tool handlers.
|
|
5
|
+
* The actual implementations live in category-specific modules.
|
|
6
|
+
*/
|
|
7
|
+
export { initializeTools, type ActionContext, prepareActionContext, captureSnapshotWithRecovery, createActionCapture, buildRuntimeHealth, } from './action-context.js';
|
|
8
|
+
export { listPages, closePage, closeSession, navigate, goBack, goForward, reload, } from './navigation-tools.js';
|
|
9
|
+
export { captureSnapshot, findElements, getNodeDetails, scrollElementIntoView, scrollPage, mapSchemaKindToNodeKind, } from './observation-tools.js';
|
|
10
|
+
export { click, type, press, select, hover } from './interaction-tools.js';
|
|
11
|
+
export { drag, wheel, takeScreenshot } from './viewport-tools.js';
|
|
150
12
|
//# sourceMappingURL=browser-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/browser-tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/browser-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,GACP,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG3E,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|