@enricai/barnacle 1.12.70 → 1.12.71
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/scraper/browser-click-expr.d.ts +3 -4
- package/dist/scraper/browser-click-expr.d.ts.map +1 -1
- package/dist/scraper/browser-click-expr.js +3 -4
- package/dist/scraper/browser-click-expr.js.map +1 -1
- package/dist/scraper/flow-runner.d.ts +27 -6
- package/dist/scraper/flow-runner.d.ts.map +1 -1
- package/dist/scraper/flow-runner.js +332 -61
- package/dist/scraper/flow-runner.js.map +1 -1
- package/dist/scraper/frame-target.d.ts +12 -0
- package/dist/scraper/frame-target.d.ts.map +1 -1
- package/dist/scraper/frame-target.js +1 -0
- package/dist/scraper/frame-target.js.map +1 -1
- package/dist/scraper/submit-control.d.ts +30 -2
- package/dist/scraper/submit-control.d.ts.map +1 -1
- package/dist/scraper/submit-control.js +79 -20
- package/dist/scraper/submit-control.js.map +1 -1
- package/dist/scraper/target-resolution-diagnostic.d.ts +53 -0
- package/dist/scraper/target-resolution-diagnostic.d.ts.map +1 -0
- package/dist/scraper/target-resolution-diagnostic.js +153 -0
- package/dist/scraper/target-resolution-diagnostic.js.map +1 -0
- package/dist/scripts/recon-browser.d.ts +32 -2
- package/dist/scripts/recon-browser.d.ts.map +1 -1
- package/dist/scripts/recon-browser.js +2 -0
- package/dist/scripts/recon-browser.js.map +1 -1
- package/dist/scripts/recon-generate.d.ts.map +1 -1
- package/dist/scripts/recon-generate.js +84 -27
- package/dist/scripts/recon-generate.js.map +1 -1
- package/package.json +1 -1
- package/dist/scraper/deep-query.d.ts +0 -44
- package/dist/scraper/deep-query.d.ts.map +0 -1
- package/dist/scraper/deep-query.js +0 -93
- package/dist/scraper/deep-query.js.map +0 -1
|
@@ -64,6 +64,18 @@ export declare function mainFrameTarget(page: Page, opts?: {
|
|
|
64
64
|
declaredFrameSelector?: string | null;
|
|
65
65
|
evaluateTimeoutMs?: number;
|
|
66
66
|
}): FrameTarget;
|
|
67
|
+
/**
|
|
68
|
+
* Builds a child-frame `FrameTarget`: `evaluate`/`locator` delegate to the
|
|
69
|
+
* resolved `Frame` (reaching across the cross-origin boundary via its own
|
|
70
|
+
* CDP session), while `url`/`title` fall back to the frame's own
|
|
71
|
+
* `location.href` and the top document's title respectively — `Frame` has
|
|
72
|
+
* no `title()` of its own. `evaluate`/`url`/`title` are bounded by the same
|
|
73
|
+
* watchdog as `mainFrameTarget` (`locator` stays unwrapped — it's
|
|
74
|
+
* synchronous, building a `Locator` handle rather than making a CDP call).
|
|
75
|
+
*/
|
|
76
|
+
export declare function childFrameTarget(page: Page, frame: StagehandFrame, frameSelector: string, opts?: {
|
|
77
|
+
evaluateTimeoutMs?: number;
|
|
78
|
+
}): FrameTarget;
|
|
67
79
|
/**
|
|
68
80
|
* Single non-polling presence probe for a frame that may have already
|
|
69
81
|
* attached — the seam callers should use instead of hand-rolling
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-target.d.ts","sourceRoot":"","sources":["../../src/scraper/frame-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAQrD,kHAAkH;AAClH,KAAK,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,uIAAuI;IACvI,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,wGAAwG;IACxG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EACjC,wBAAwB,EAA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AE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7E,OAAO,CAAC,WAAW,CAAC,CAqBtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAM1F;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACxC,aAAa,EAAE,MAAM,GACpB,MAAM,CAOR;AAKD,+FAA+F;AAC/F,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7E,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.mainFrameTarget = mainFrameTarget;
|
|
16
|
+
exports.childFrameTarget = childFrameTarget;
|
|
16
17
|
exports.probeAttachedFrameTarget = probeAttachedFrameTarget;
|
|
17
18
|
exports.resolveFrameTarget = resolveFrameTarget;
|
|
18
19
|
exports.readCurrentFrameUrl = readCurrentFrameUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-target.js","sourceRoot":"","sources":["../../src/scraper/frame-target.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG
|
|
1
|
+
{"version":3,"file":"frame-target.js","sourceRoot":"","sources":["../../src/scraper/frame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9E,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO;IAE1B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,eAAM,CAAC,OAAO,CAAC,2BAA2B,CAAC;IAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,mBAAmB,CAAC;IAClD,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,IAAI,eAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC;IAE1F,MAAM,OAAO,GAAG,KAAK,IAAsB,EAAE;QAC3C,MAAM,UAAU,GAAG,MAAM,IAAA,uBAAY,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAS,qBAAqB,CAAC,EAAE;YAC1F,SAAS,EAAE,iBAAiB;YAC5B,KAAK,EAAE,yCAAyC;SACjD,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,UAAU,KAAK,aAAa,IAAI,UAAU,KAAK,UAAU,CAAC;IACnE,CAAC,CAAC;IAEF,IAAI,MAAM,OAAO,EAAE;QAAE,OAAO;IAE5B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACxC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7B,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC;QACpB,IAAI,MAAM,OAAO,EAAE;YAAE,OAAO;IAC9B,CAAC;IACD,MAAM,CAAC,IAAI,CACT,eAAe,MAAM,CAAC,aAAa,IAAI,cAAc,0BAA0B,SAAS,wBAAwB,CACjH,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Submit-control locator: ranks every submit-shaped candidate the deep
|
|
3
|
-
* resolver
|
|
3
|
+
* resolver can reach — piercing open shadow roots — so
|
|
4
4
|
* the cascade can act on the best-ranked candidate and retry the runner-up
|
|
5
5
|
* if the first click phantoms. A false-positive submit click on a real run
|
|
6
6
|
* (e.g. clicking "Save draft") is worse than the current failure, since it
|
|
@@ -8,6 +8,34 @@
|
|
|
8
8
|
* conservative: only tiers with strong, unambiguous submit signal are
|
|
9
9
|
* included, and "Back"/"Cancel"/"Save draft"-shaped controls never appear.
|
|
10
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* Verbs that identify a control as NOT the submit action even when it is
|
|
13
|
+
* button-shaped and reachable. Checked before any positive tier so a
|
|
14
|
+
* button whose text merely contains "submit" as a substring of a longer
|
|
15
|
+
* negative phrase (unlikely in practice, but the exclusion is what makes
|
|
16
|
+
* the ranking conservative) cannot slip through. Exported so other
|
|
17
|
+
* submit-shape consumers (e.g. flow-runner.ts's xpath tail-retarget
|
|
18
|
+
* disambiguation) apply the identical negative-verb vocabulary instead of a
|
|
19
|
+
* second, driftable copy.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NEGATIVE_TEXT_EXPR = "((text) => {\n const negatives = [\"back\", \"cancel\", \"save draft\", \"save for later\", \"previous\", \"close\"];\n return negatives.some((n) => text === n || text.startsWith(n + \" \") || text.endsWith(\" \" + n));\n})";
|
|
22
|
+
/**
|
|
23
|
+
* Tag/role-agnostic tier-0.5 fallback: a generic-action-verb accessible name
|
|
24
|
+
* (create/continue/next/confirm/proceed — the labels a JS-handled action
|
|
25
|
+
* control with an explicit `type="button"`, or a plain `<div>`/`<a>`/custom-
|
|
26
|
+
* element with a click handler, commonly uses instead of the literal word
|
|
27
|
+
* "submit") qualifies regardless of tag/role, or — when the candidate carries
|
|
28
|
+
* no text signal of its own at all — it is the sole non-excluded button/
|
|
29
|
+
* role="button" control inside its nearest form-like (`<form>` /
|
|
30
|
+
* `[role="form"]`) ancestor. Kept as a
|
|
31
|
+
* separate export (rather than folded into {@link RANK_TIERS_EXPR} inline) so
|
|
32
|
+
* `flow-runner.ts`'s independent hand-rolled submit-shape predicates can
|
|
33
|
+
* import and apply the identical widened signal instead of re-diverging.
|
|
34
|
+
* Deliberately does NOT relax the isButtonLike gate itself — that would
|
|
35
|
+
* accept any div/input regardless of text, exactly the "arbitrary structural
|
|
36
|
+
* divs" false-positive this module's docblock warns against.
|
|
37
|
+
*/
|
|
38
|
+
export declare const SUBMIT_SHAPE_FALLBACK_EXPR = "((el, name, isNegative) => {\n if (/\\b(create|continue|next|confirm|proceed)\\b/.test(name)) return true;\n if (name !== \"\") return false;\n const isFormLike = (node) =>\n (node.tagName || \"\").toLowerCase() === \"form\" ||\n (node.getAttribute && (node.getAttribute(\"role\") || \"\").toLowerCase() === \"form\");\n const findFormContainer = (node) => {\n for (let depth = 0; depth < 6 && node; depth++) {\n if (isFormLike(node)) return node;\n node = node.parentElement;\n }\n return null;\n };\n const container = findFormContainer(el.parentElement);\n if (!container) return false;\n const accessibleName = ((el) => {\n const norm = (s) => (s || \"\").replace(/\\s+/g, \" \").trim().toLowerCase();\n return norm(el.getAttribute(\"aria-label\") || el.textContent || \"\");\n});\n const isCandidate = (c) => {\n if (c === el) return true;\n const cTag = (c.tagName || \"\").toLowerCase();\n const cRole = (c.getAttribute(\"role\") || \"\").toLowerCase();\n if (cTag !== \"button\" && cTag !== \"input\" && cRole !== \"button\") return false;\n return !isNegative(accessibleName(c));\n };\n const candidates = Array.from(container.querySelectorAll(\"*\")).filter(isCandidate);\n return candidates.length === 1 && candidates[0] === el;\n})";
|
|
11
39
|
/**
|
|
12
40
|
* Builds a self-contained `page.evaluate` expression string that walks the
|
|
13
41
|
* whole document (light DOM plus every open shadow root, arbitrarily deep)
|
|
@@ -65,7 +93,7 @@ export declare function buildRankSubmitCandidatesExpr(root?: string): string;
|
|
|
65
93
|
*/
|
|
66
94
|
export declare function buildClickByDeepIndexExpr(deepIndex: number, root?: string): string;
|
|
67
95
|
/** Confidence tier for a ranked submit candidate — higher is more confident. See {@link buildRankSubmitCandidatesExpr}. */
|
|
68
|
-
export type SubmitCandidateTier = 1 | 2 | 3;
|
|
96
|
+
export type SubmitCandidateTier = 0.5 | 1 | 2 | 3;
|
|
69
97
|
/** One ranked candidate returned by {@link buildRankSubmitCandidatesExpr}'s `page.evaluate` call. */
|
|
70
98
|
export interface SubmitCandidate {
|
|
71
99
|
/** Position in the deterministic deep-traversal order; pass to {@link buildClickByDeepIndexExpr} to click this exact candidate. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-control.d.ts","sourceRoot":"","sources":["../../src/scraper/submit-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"submit-control.d.ts","sourceRoot":"","sources":["../../src/scraper/submit-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,sOAG5B,CAAC;AAuEJ;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B,sxCAyBpC,CAAC;AA+CJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,SAAa,GAAG,MAAM,CA0BvE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,SAAa,GAAG,MAAM,CAYtF;AAED,2HAA2H;AAC3H,MAAM,MAAM,mBAAmB,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAElD,qGAAqG;AACrG,MAAM,WAAW,eAAe;IAC9B,mIAAmI;IACnI,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,0EAA0E;AAC1E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,oKAAoK;IACpK,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Submit-control locator: ranks every submit-shaped candidate the deep
|
|
4
|
-
* resolver
|
|
4
|
+
* resolver can reach — piercing open shadow roots — so
|
|
5
5
|
* the cascade can act on the best-ranked candidate and retry the runner-up
|
|
6
6
|
* if the first click phantoms. A false-positive submit click on a real run
|
|
7
7
|
* (e.g. clicking "Save draft") is worse than the current failure, since it
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* included, and "Back"/"Cancel"/"Save draft"-shaped controls never appear.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.SUBMIT_SHAPE_FALLBACK_EXPR = exports.NEGATIVE_TEXT_EXPR = void 0;
|
|
13
14
|
exports.buildRankSubmitCandidatesExpr = buildRankSubmitCandidatesExpr;
|
|
14
15
|
exports.buildClickByDeepIndexExpr = buildClickByDeepIndexExpr;
|
|
15
16
|
const browser_click_expr_1 = require("./browser-click-expr");
|
|
@@ -18,17 +19,18 @@ const browser_click_expr_1 = require("./browser-click-expr");
|
|
|
18
19
|
* button-shaped and reachable. Checked before any positive tier so a
|
|
19
20
|
* button whose text merely contains "submit" as a substring of a longer
|
|
20
21
|
* negative phrase (unlikely in practice, but the exclusion is what makes
|
|
21
|
-
* the ranking conservative) cannot slip through.
|
|
22
|
+
* the ranking conservative) cannot slip through. Exported so other
|
|
23
|
+
* submit-shape consumers (e.g. flow-runner.ts's xpath tail-retarget
|
|
24
|
+
* disambiguation) apply the identical negative-verb vocabulary instead of a
|
|
25
|
+
* second, driftable copy.
|
|
22
26
|
*/
|
|
23
|
-
|
|
27
|
+
exports.NEGATIVE_TEXT_EXPR = `((text) => {
|
|
24
28
|
const negatives = ["back", "cancel", "save draft", "save for later", "previous", "close"];
|
|
25
29
|
return negatives.some((n) => text === n || text.startsWith(n + " ") || text.endsWith(" " + n));
|
|
26
30
|
})`;
|
|
27
31
|
/**
|
|
28
32
|
* Normalizes an element's accessible name to lowercase, whitespace-collapsed
|
|
29
|
-
* text, preferring `aria-label` over visible `textContent
|
|
30
|
-
* `SUBMIT_SHAPED_EL_EXPR`'s own normalization in deep-query.ts so both
|
|
31
|
-
* modules treat the same DOM the same way).
|
|
33
|
+
* text, preferring `aria-label` over visible `textContent`.
|
|
32
34
|
*/
|
|
33
35
|
const ACCESSIBLE_NAME_EXPR = `((el) => {
|
|
34
36
|
const norm = (s) => (s || "").replace(/\\s+/g, " ").trim().toLowerCase();
|
|
@@ -75,10 +77,9 @@ const IS_DISABLED_EXPR = `((el) => {
|
|
|
75
77
|
return false;
|
|
76
78
|
})`;
|
|
77
79
|
/**
|
|
78
|
-
* Recursive open-shadow-root walker,
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* not runtime code that can share a module import).
|
|
80
|
+
* Recursive open-shadow-root walker, composed as a browser-context
|
|
81
|
+
* expression string via string interpolation rather than runtime code that
|
|
82
|
+
* could share a module import.
|
|
82
83
|
*/
|
|
83
84
|
const DEEP_ELEMENTS_EXPR = `((root) => {
|
|
84
85
|
const out = [];
|
|
@@ -92,32 +93,90 @@ const DEEP_ELEMENTS_EXPR = `((root) => {
|
|
|
92
93
|
walk(root);
|
|
93
94
|
return out;
|
|
94
95
|
})`;
|
|
96
|
+
/**
|
|
97
|
+
* Tag/role-agnostic tier-0.5 fallback: a generic-action-verb accessible name
|
|
98
|
+
* (create/continue/next/confirm/proceed — the labels a JS-handled action
|
|
99
|
+
* control with an explicit `type="button"`, or a plain `<div>`/`<a>`/custom-
|
|
100
|
+
* element with a click handler, commonly uses instead of the literal word
|
|
101
|
+
* "submit") qualifies regardless of tag/role, or — when the candidate carries
|
|
102
|
+
* no text signal of its own at all — it is the sole non-excluded button/
|
|
103
|
+
* role="button" control inside its nearest form-like (`<form>` /
|
|
104
|
+
* `[role="form"]`) ancestor. Kept as a
|
|
105
|
+
* separate export (rather than folded into {@link RANK_TIERS_EXPR} inline) so
|
|
106
|
+
* `flow-runner.ts`'s independent hand-rolled submit-shape predicates can
|
|
107
|
+
* import and apply the identical widened signal instead of re-diverging.
|
|
108
|
+
* Deliberately does NOT relax the isButtonLike gate itself — that would
|
|
109
|
+
* accept any div/input regardless of text, exactly the "arbitrary structural
|
|
110
|
+
* divs" false-positive this module's docblock warns against.
|
|
111
|
+
*/
|
|
112
|
+
exports.SUBMIT_SHAPE_FALLBACK_EXPR = `((el, name, isNegative) => {
|
|
113
|
+
if (/\\b(create|continue|next|confirm|proceed)\\b/.test(name)) return true;
|
|
114
|
+
if (name !== "") return false;
|
|
115
|
+
const isFormLike = (node) =>
|
|
116
|
+
(node.tagName || "").toLowerCase() === "form" ||
|
|
117
|
+
(node.getAttribute && (node.getAttribute("role") || "").toLowerCase() === "form");
|
|
118
|
+
const findFormContainer = (node) => {
|
|
119
|
+
for (let depth = 0; depth < ${browser_click_expr_1.MAX_SELECTION_ANCESTOR_DEPTH} && node; depth++) {
|
|
120
|
+
if (isFormLike(node)) return node;
|
|
121
|
+
node = node.parentElement;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
};
|
|
125
|
+
const container = findFormContainer(el.parentElement);
|
|
126
|
+
if (!container) return false;
|
|
127
|
+
const accessibleName = ${ACCESSIBLE_NAME_EXPR};
|
|
128
|
+
const isCandidate = (c) => {
|
|
129
|
+
if (c === el) return true;
|
|
130
|
+
const cTag = (c.tagName || "").toLowerCase();
|
|
131
|
+
const cRole = (c.getAttribute("role") || "").toLowerCase();
|
|
132
|
+
if (cTag !== "button" && cTag !== "input" && cRole !== "button") return false;
|
|
133
|
+
return !isNegative(accessibleName(c));
|
|
134
|
+
};
|
|
135
|
+
const candidates = Array.from(container.querySelectorAll("*")).filter(isCandidate);
|
|
136
|
+
return candidates.length === 1 && candidates[0] === el;
|
|
137
|
+
})`;
|
|
95
138
|
/**
|
|
96
139
|
* Ranking tiers, most confident first. Each tier's `test` receives the
|
|
97
140
|
* element plus its precomputed accessible name and reports whether it
|
|
98
141
|
* belongs in that tier — the first matching tier wins, so an element that
|
|
99
142
|
* qualifies for tier 1 is never re-evaluated against tier 2/3.
|
|
100
143
|
*
|
|
101
|
-
* 1. Explicit `type="submit"` — unambiguous native semantics.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
144
|
+
* 1. Explicit `type="submit"` — unambiguous native semantics. `type` is only
|
|
145
|
+
* meaningful on button/input elements, so this tier alone still requires
|
|
146
|
+
* one of those tags.
|
|
147
|
+
* 2. Accessible name is exactly (or is dominated by) "submit" — covers a
|
|
148
|
+
* `<div>`/`<span>`/custom-element control (e.g. a newsletter form's
|
|
149
|
+
* click-handled `<span>Submit</span>`) whose text is "Submit" but carries
|
|
150
|
+
* no native tag, type attribute, or explicit role (Stencil/web-component
|
|
151
|
+
* controls often omit all three).
|
|
152
|
+
* 3. Accessible name contains "submit" as a distinct word alongside other
|
|
153
|
+
* text (e.g. "Submit Application"), with no negative verb present —
|
|
154
|
+
* covers any element matched by text alone rather than by tag/type/role,
|
|
155
|
+
* including a checkout form's non-button submit control.
|
|
156
|
+
* 4. Button/role="button" element with no submit wording at all and no
|
|
157
|
+
* negative verb present (e.g. `<button type="button">Create Account</button>`),
|
|
158
|
+
* OR — regardless of tag/role — an accessible name carrying a generic
|
|
159
|
+
* action verb (e.g. a `<div>`/`<a>`'s "Create Account"), OR a candidate
|
|
160
|
+
* with no text signal at all that is the sole non-excluded actionable
|
|
161
|
+
* control inside its nearest form-like container (see
|
|
162
|
+
* {@link SUBMIT_SHAPE_FALLBACK_EXPR}) — a generic action control the
|
|
163
|
+
* earlier tiers cannot recognize by submit-specific wording, kept weakest
|
|
164
|
+
* and evaluated last so it never outranks a tier with real submit signal
|
|
165
|
+
* and only surfaces when nothing stronger is on the page.
|
|
109
166
|
*/
|
|
110
167
|
const RANK_TIERS_EXPR = `((el, name) => {
|
|
111
|
-
const isNegative = ${NEGATIVE_TEXT_EXPR};
|
|
168
|
+
const isNegative = ${exports.NEGATIVE_TEXT_EXPR};
|
|
112
169
|
if (isNegative(name)) return 0;
|
|
113
170
|
const tag = (el.tagName || "").toLowerCase();
|
|
114
171
|
const type = (el.getAttribute("type") || "").toLowerCase();
|
|
115
172
|
const role = (el.getAttribute("role") || "").toLowerCase();
|
|
116
173
|
const isButtonLike = tag === "button" || tag === "input" || role === "button";
|
|
117
|
-
if (!isButtonLike) return 0;
|
|
118
174
|
if ((tag === "button" || tag === "input") && type === "submit") return 3;
|
|
119
175
|
if (name === "submit") return 2;
|
|
120
176
|
if (/\\bsubmit\\b/.test(name)) return 1;
|
|
177
|
+
if (isButtonLike) return 0.5;
|
|
178
|
+
const isFallbackShaped = ${exports.SUBMIT_SHAPE_FALLBACK_EXPR};
|
|
179
|
+
if (isFallbackShaped(el, name, isNegative)) return 0.5;
|
|
121
180
|
return 0;
|
|
122
181
|
})`;
|
|
123
182
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-control.js","sourceRoot":"","sources":["../../src/scraper/submit-control.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG
|
|
1
|
+
{"version":3,"file":"submit-control.js","sourceRoot":"","sources":["../../src/scraper/submit-control.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;AAEH,qEAAiG;AAEjG;;;;;;;;;GASG;AACU,QAAA,kBAAkB,GAAG;;;GAG/B,CAAC;AAEJ;;;GAGG;AACH,MAAM,oBAAoB,GAAG;;;GAG1B,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,MAAM,eAAe,GAAG;;;;;GAKrB,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,MAAM,gBAAgB,GAAG;gCACO,iDAA4B;;;;;;GAMzD,CAAC;AAEJ;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;;;;;;;;;;;GAWxB,CAAC;AAEJ;;;;;;;;;;;;;;;GAeG;AACU,QAAA,0BAA0B,GAAG;;;;;;;kCAOR,iDAA4B;;;;;;;;2BAQnC,oBAAoB;;;;;;;;;;GAU5C,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,eAAe,GAAG;uBACD,QAAA,kBAAkB;;;;;;;;;;6BAUZ,QAAA,0BAA0B;;;GAGpD,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,uCAA8C,IAAI,GAAG,UAAU;IAC7D,OAAO;6BACoB,oBAAoB;uBAC1B,eAAe;wBACd,eAAe;yBACd,gBAAgB;2BACd,kBAAkB;+BACd,IAAI;;;;;;;;;;;;;;;;;;OAkB5B,CAAC;AACR,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,mCAA0C,SAAiB,EAAE,IAAI,GAAG,UAAU;IAC5E,OAAO;wBACe,eAAe;yBACd,gBAAgB;2BACd,kBAAkB;+BACd,IAAI;qBACd,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;;;MAGxC,IAAA,wCAAmB,EAAC,IAAI,CAAC;;OAExB,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Target-resolution failure diagnostic: when every technique the cascade has
|
|
3
|
+
* (Stagehand act/observe, the deep-locator resolver, the child-iframe
|
|
4
|
+
* fallback) fails to find a step's target, the next person debugging that
|
|
5
|
+
* failure has nothing to go on but a body-HTML dump and a guess. This module
|
|
6
|
+
* captures WHAT the submit-shaped ranking itself saw at the moment of
|
|
7
|
+
* failure — every candidate it ranked, with enough identity (tag, role,
|
|
8
|
+
* accessible name, tier, visibility, disabled state) to tell "the target
|
|
9
|
+
* genuinely wasn't there" apart from "it was there but ranked wrong" or "it
|
|
10
|
+
* was there but disabled/hidden" — so a live failure is diagnosable without
|
|
11
|
+
* another guessing round.
|
|
12
|
+
*/
|
|
13
|
+
import type { Page } from "@browserbasehq/stagehand";
|
|
14
|
+
import type { FrameTarget } from "./frame-target";
|
|
15
|
+
import { type SubmitCandidate, type SubmitCandidateTier } from "./submit-control";
|
|
16
|
+
/** One submit-shaped candidate the ranking cascade saw, annotated with the fields a triager needs to tell it apart from the others. */
|
|
17
|
+
export interface DiagnosticSnapshotCandidate {
|
|
18
|
+
tag: string;
|
|
19
|
+
role: string;
|
|
20
|
+
accessibleName: string;
|
|
21
|
+
tier: SubmitCandidateTier;
|
|
22
|
+
visible: boolean;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Bounded diagnostic snapshot captured at the moment target resolution gave up. */
|
|
26
|
+
export interface TargetResolutionDiagnosticSnapshot {
|
|
27
|
+
/** Every submit-shaped candidate the ranking cascade saw, highest tier first — the top entry is what the cascade would have clicked, the rest are what it passed over. */
|
|
28
|
+
candidates: DiagnosticSnapshotCandidate[];
|
|
29
|
+
/** Short accessibility-tree excerpt of the region the failed step's instruction most plausibly targeted, or `null` when no candidate was found to anchor the excerpt on. */
|
|
30
|
+
accessibilityExcerpt: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Captures a bounded diagnostic snapshot of the current submit-shaped
|
|
34
|
+
* candidate ranking, called from the two `onStepFailure` sites once every
|
|
35
|
+
* resolution technique has already failed. Reuses
|
|
36
|
+
* {@link buildRankSubmitCandidatesExpr} for the ranking half rather than
|
|
37
|
+
* re-implementing candidate scoring, so the snapshot stays honest about
|
|
38
|
+
* exactly what the cascade's own ranking saw — a divergent, re-implemented
|
|
39
|
+
* ranking here would risk telling a triager the cascade saw a candidate it
|
|
40
|
+
* never actually considered. Never throws: an `evaluate` failure on an
|
|
41
|
+
* already-failing page (navigated away, torn down) degrades to `null`,
|
|
42
|
+
* mirroring the existing `bodyOuterHtml.catch(() => null)` convention at
|
|
43
|
+
* both call sites, since this is diagnostic-only code and must never be
|
|
44
|
+
* the reason a failure path itself fails.
|
|
45
|
+
*
|
|
46
|
+
* `precomputedRanked`, when given, is used in place of a fresh
|
|
47
|
+
* `buildRankSubmitCandidatesExpr` round trip — the deep-submit-locator
|
|
48
|
+
* cascade attempt already ranks the same submit-shaped candidates against
|
|
49
|
+
* the same DOM moments earlier, so re-ranking here would just be a second,
|
|
50
|
+
* redundant `page.evaluate` call reporting the same thing.
|
|
51
|
+
*/
|
|
52
|
+
export declare function captureTargetResolutionDiagnosticSnapshot(target: FrameTarget | undefined, page: Page, precomputedRanked?: SubmitCandidate[] | null): Promise<TargetResolutionDiagnosticSnapshot | null>;
|
|
53
|
+
//# sourceMappingURL=target-resolution-diagnostic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-resolution-diagnostic.d.ts","sourceRoot":"","sources":["../../src/scraper/target-resolution-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAoBlC,uIAAuI;AACvI,MAAM,WAAW,2BAA2B;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,oFAAoF;AACpF,MAAM,WAAW,kCAAkC;IACjD,0KAA0K;IAC1K,UAAU,EAAE,2BAA2B,EAAE,CAAC;IAC1C,4KAA4K;IAC5K,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAuED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,yCAAyC,CAC7D,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,IAAI,EAAE,IAAI,EACV,iBAAiB,CAAC,EAAE,eAAe,EAAE,GAAG,IAAI,GAC3C,OAAO,CAAC,kCAAkC,GAAG,IAAI,CAAC,CAyCpD"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Target-resolution failure diagnostic: when every technique the cascade has
|
|
4
|
+
* (Stagehand act/observe, the deep-locator resolver, the child-iframe
|
|
5
|
+
* fallback) fails to find a step's target, the next person debugging that
|
|
6
|
+
* failure has nothing to go on but a body-HTML dump and a guess. This module
|
|
7
|
+
* captures WHAT the submit-shaped ranking itself saw at the moment of
|
|
8
|
+
* failure — every candidate it ranked, with enough identity (tag, role,
|
|
9
|
+
* accessible name, tier, visibility, disabled state) to tell "the target
|
|
10
|
+
* genuinely wasn't there" apart from "it was there but ranked wrong" or "it
|
|
11
|
+
* was there but disabled/hidden" — so a live failure is diagnosable without
|
|
12
|
+
* another guessing round.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.captureTargetResolutionDiagnosticSnapshot = captureTargetResolutionDiagnosticSnapshot;
|
|
16
|
+
const logging_1 = require("../lib/logging");
|
|
17
|
+
const submit_control_1 = require("./submit-control");
|
|
18
|
+
const logger = (0, logging_1.getLogger)({ name: "scraper/target-resolution-diagnostic" });
|
|
19
|
+
/** Cap on the number of ranked candidates kept in a snapshot. */
|
|
20
|
+
const MAX_SNAPSHOT_CANDIDATES = 25;
|
|
21
|
+
/**
|
|
22
|
+
* Byte budget for the whole serialized snapshot. Mirrors flow-runner.ts's
|
|
23
|
+
* `FAILURE_DUMP_MAX_BODY_LENGTH` truncation convention for `bodyOuterHtml`
|
|
24
|
+
* (100KB) but scaled down: this snapshot is a small structured summary, not
|
|
25
|
+
* a raw DOM dump, so a much smaller cap already comfortably bounds a
|
|
26
|
+
* pathological page (thousands of candidates or a huge excerpt) without
|
|
27
|
+
* ever approaching the body-dump's own budget.
|
|
28
|
+
*/
|
|
29
|
+
const MAX_SNAPSHOT_JSON_LENGTH = 20_000;
|
|
30
|
+
/** Cap on the accessibility-tree excerpt before it is folded into the snapshot. */
|
|
31
|
+
const MAX_EXCERPT_LENGTH = 2_000;
|
|
32
|
+
/**
|
|
33
|
+
* Re-walks the light DOM plus every open shadow root (same traversal shape
|
|
34
|
+
* as `submit-control.ts`'s private `DEEP_ELEMENTS_EXPR` — duplicated rather
|
|
35
|
+
* than imported, since both are browser-context expression strings composed
|
|
36
|
+
* by string interpolation, matching that module's own stated convention for
|
|
37
|
+
* why `IS_VISIBLE_EXPR`/`DEEP_ELEMENTS_EXPR` are duplicated instead of
|
|
38
|
+
* shared) to read the role/visible/disabled/excerpt fields the ranking
|
|
39
|
+
* expression itself doesn't return, and to build a short accessible-name
|
|
40
|
+
* excerpt around the top-ranked candidate. Runs as a single `page.evaluate`
|
|
41
|
+
* round trip so the DOM observed here always matches the one
|
|
42
|
+
* `buildRankSubmitCandidatesExpr` just ranked.
|
|
43
|
+
*/
|
|
44
|
+
function buildCandidateDetailExpr(root, deepIndices) {
|
|
45
|
+
return `(() => {
|
|
46
|
+
const deepElements = ((rootEl) => {
|
|
47
|
+
const out = [];
|
|
48
|
+
const walk = (node) => {
|
|
49
|
+
const kids = node.querySelectorAll ? Array.from(node.querySelectorAll("*")) : [];
|
|
50
|
+
for (const el of kids) {
|
|
51
|
+
out.push(el);
|
|
52
|
+
if (el.shadowRoot) walk(el.shadowRoot);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
walk(rootEl);
|
|
56
|
+
return out;
|
|
57
|
+
})(${root});
|
|
58
|
+
const isVisible = (el) => {
|
|
59
|
+
const rect = el.getBoundingClientRect();
|
|
60
|
+
if (rect.width === 0 && rect.height === 0) return false;
|
|
61
|
+
const style = getComputedStyle(el);
|
|
62
|
+
return style.display !== "none" && style.visibility !== "hidden";
|
|
63
|
+
};
|
|
64
|
+
const isDisabled = (el) => {
|
|
65
|
+
for (let depth = 0, node = el; depth < 8 && node; depth++) {
|
|
66
|
+
if (node.disabled === true) return true;
|
|
67
|
+
if (node.getAttribute && node.getAttribute("aria-disabled") === "true") return true;
|
|
68
|
+
node = node.parentElement;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
const roleOf = (el) => {
|
|
73
|
+
const explicit = el.getAttribute("role");
|
|
74
|
+
if (explicit) return explicit;
|
|
75
|
+
const tag = (el.tagName || "").toLowerCase();
|
|
76
|
+
if (tag === "button") return "button";
|
|
77
|
+
if (tag === "input") return "input";
|
|
78
|
+
if (tag === "a") return "link";
|
|
79
|
+
return "";
|
|
80
|
+
};
|
|
81
|
+
const indices = ${JSON.stringify(deepIndices)};
|
|
82
|
+
const details = indices.map((i) => {
|
|
83
|
+
const el = deepElements[i];
|
|
84
|
+
if (!el) return { role: "", visible: false, disabled: true };
|
|
85
|
+
return { role: roleOf(el), visible: isVisible(el), disabled: isDisabled(el) };
|
|
86
|
+
});
|
|
87
|
+
const topEl = indices.length > 0 ? deepElements[indices[0]] : null;
|
|
88
|
+
let excerpt = null;
|
|
89
|
+
if (topEl) {
|
|
90
|
+
const container =
|
|
91
|
+
topEl.closest("form, section, [role=dialog], fieldset") || topEl.parentElement || topEl;
|
|
92
|
+
excerpt = (container.innerText || container.textContent || "")
|
|
93
|
+
.replace(/\\s+/g, " ")
|
|
94
|
+
.trim()
|
|
95
|
+
.slice(0, ${MAX_EXCERPT_LENGTH});
|
|
96
|
+
}
|
|
97
|
+
return { details, excerpt };
|
|
98
|
+
})()`;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Captures a bounded diagnostic snapshot of the current submit-shaped
|
|
102
|
+
* candidate ranking, called from the two `onStepFailure` sites once every
|
|
103
|
+
* resolution technique has already failed. Reuses
|
|
104
|
+
* {@link buildRankSubmitCandidatesExpr} for the ranking half rather than
|
|
105
|
+
* re-implementing candidate scoring, so the snapshot stays honest about
|
|
106
|
+
* exactly what the cascade's own ranking saw — a divergent, re-implemented
|
|
107
|
+
* ranking here would risk telling a triager the cascade saw a candidate it
|
|
108
|
+
* never actually considered. Never throws: an `evaluate` failure on an
|
|
109
|
+
* already-failing page (navigated away, torn down) degrades to `null`,
|
|
110
|
+
* mirroring the existing `bodyOuterHtml.catch(() => null)` convention at
|
|
111
|
+
* both call sites, since this is diagnostic-only code and must never be
|
|
112
|
+
* the reason a failure path itself fails.
|
|
113
|
+
*
|
|
114
|
+
* `precomputedRanked`, when given, is used in place of a fresh
|
|
115
|
+
* `buildRankSubmitCandidatesExpr` round trip — the deep-submit-locator
|
|
116
|
+
* cascade attempt already ranks the same submit-shaped candidates against
|
|
117
|
+
* the same DOM moments earlier, so re-ranking here would just be a second,
|
|
118
|
+
* redundant `page.evaluate` call reporting the same thing.
|
|
119
|
+
*/
|
|
120
|
+
async function captureTargetResolutionDiagnosticSnapshot(target, page, precomputedRanked) {
|
|
121
|
+
try {
|
|
122
|
+
const evaluator = target ?? page;
|
|
123
|
+
const root = "document";
|
|
124
|
+
const ranked = precomputedRanked ??
|
|
125
|
+
(await evaluator.evaluate((0, submit_control_1.buildRankSubmitCandidatesExpr)(root)));
|
|
126
|
+
const bounded = ranked.slice(0, MAX_SNAPSHOT_CANDIDATES);
|
|
127
|
+
const detail = await evaluator.evaluate(buildCandidateDetailExpr(root, bounded.map((c) => c.deepIndex)));
|
|
128
|
+
const candidates = bounded.map((c, i) => ({
|
|
129
|
+
tag: c.tag,
|
|
130
|
+
accessibleName: c.accessibleName,
|
|
131
|
+
tier: c.tier,
|
|
132
|
+
role: detail.details[i]?.role ?? "",
|
|
133
|
+
visible: detail.details[i]?.visible ?? false,
|
|
134
|
+
disabled: detail.details[i]?.disabled ?? true,
|
|
135
|
+
}));
|
|
136
|
+
const snapshot = {
|
|
137
|
+
candidates,
|
|
138
|
+
accessibilityExcerpt: detail.excerpt || null,
|
|
139
|
+
};
|
|
140
|
+
const serialized = JSON.stringify(snapshot);
|
|
141
|
+
if (serialized.length <= MAX_SNAPSHOT_JSON_LENGTH)
|
|
142
|
+
return snapshot;
|
|
143
|
+
return {
|
|
144
|
+
candidates: candidates.slice(0, Math.max(1, Math.floor(candidates.length / 2))),
|
|
145
|
+
accessibilityExcerpt: snapshot.accessibilityExcerpt,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
logger.warn(`target-resolution diagnostic snapshot failed to capture: ${String(error)}`);
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=target-resolution-diagnostic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-resolution-diagnostic.js","sourceRoot":"","sources":["../../src/scraper/target-resolution-diagnostic.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAIH,2CAA0C;AAE1C,6DAIkC;AAElC,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,EAAE,IAAI,EAAE,sCAAsC,EAAE,CAAC,CAAC;AAE3E,iEAAiE;AACjE,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAExC,mFAAmF;AACnF,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAoBjC;;;;;;;;;;;GAWG;AACH,SAAS,wBAAwB,CAAC,IAAY,EAAE,WAA8B;IAC5E,OAAO;;;;;;;;;;;;SAYA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;sBAwBS,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;;;;oBAc7B,kBAAkB;;;OAG/B,CAAC;AACR,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACI,KAAK,oDACV,MAA+B,EAC/B,IAAU,EACV,iBAA4C;IAE5C,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,IAAI,IAAI,CAAC;QACjC,MAAM,IAAI,GAAG,UAAU,CAAC;QACxB,MAAM,MAAM,GACV,iBAAiB;YACjB,CAAC,MAAM,SAAS,CAAC,QAAQ,CAEvB,IAAA,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CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,4DAA4D,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -47,10 +47,11 @@
|
|
|
47
47
|
* per act; healing and replans push the upper bound higher on flaky sites).
|
|
48
48
|
*/
|
|
49
49
|
import type Anthropic from "@anthropic-ai/sdk";
|
|
50
|
-
import type { LoadState, Page, Stagehand } from "@browserbasehq/stagehand";
|
|
50
|
+
import type { Action, LoadState, Page, Stagehand } from "@browserbasehq/stagehand";
|
|
51
51
|
import { z } from "zod/v4";
|
|
52
52
|
import { type AttemptRecord, type CaptureFn, type EmailStepConfig } from "../scraper/flow-runner";
|
|
53
53
|
import { type ProviderName } from "../scraper/session";
|
|
54
|
+
import type { TargetResolutionDiagnosticSnapshot } from "../scraper/target-resolution-diagnostic";
|
|
54
55
|
import type { Logger } from "../types/logging";
|
|
55
56
|
interface ReplanEvent {
|
|
56
57
|
replanIndex: number;
|
|
@@ -660,6 +661,35 @@ declare function replanRemainingFlow(params: {
|
|
|
660
661
|
*/
|
|
661
662
|
priorReplans?: readonly ReplanEvent[];
|
|
662
663
|
}): Promise<NormalizedStep[] | null>;
|
|
664
|
+
declare function dumpStepFailure(params: {
|
|
665
|
+
stepIndex: number;
|
|
666
|
+
phase: string;
|
|
667
|
+
originalStep: string;
|
|
668
|
+
attempts: AttemptRecord[];
|
|
669
|
+
finalObserve: Action[];
|
|
670
|
+
pageUrl: string;
|
|
671
|
+
pageTitle: string;
|
|
672
|
+
recentCaptures: string[];
|
|
673
|
+
/**
|
|
674
|
+
* Ground-truth DOM at failure time, truncated to 100 KB. `finalObserve` is
|
|
675
|
+
* filtered through Stagehand's LLM-aware observer; this is the raw body so a
|
|
676
|
+
* triager can tell "the page is empty / interstitial" from "the page has
|
|
677
|
+
* content but Stagehand can't see it." Null when the page evaluate fails.
|
|
678
|
+
*/
|
|
679
|
+
bodyOuterHtml: string | null;
|
|
680
|
+
/**
|
|
681
|
+
* `stagehand.observe()` with no instruction — what Stagehand sees on the
|
|
682
|
+
* page unprompted. Complements `finalObserve` (which is observe-with-step).
|
|
683
|
+
*/
|
|
684
|
+
unfocusedObserve: Action[];
|
|
685
|
+
/**
|
|
686
|
+
* Bounded snapshot of the submit-shaped candidate ranking at the moment
|
|
687
|
+
* resolution gave up, or `null` when the capture itself failed on the
|
|
688
|
+
* already-failing page. Persisted verbatim so a triager can see exactly
|
|
689
|
+
* which candidates the cascade ranked without another guessing round.
|
|
690
|
+
*/
|
|
691
|
+
targetResolutionDiagnostic: TargetResolutionDiagnosticSnapshot | null;
|
|
692
|
+
}): string;
|
|
663
693
|
declare function parseCli(): {
|
|
664
694
|
url: string;
|
|
665
695
|
flow: NormalizedStep[];
|
|
@@ -691,5 +721,5 @@ declare function main(): Promise<void>;
|
|
|
691
721
|
export type { Html5DateFillResult, InvalidFormControl, LeafInvalidField, RadioGroupCandidate, ValidationRejectionPair, VerifyFillReadbackResult, } from "../scraper/flow-runner";
|
|
692
722
|
export { buildRadioIdXPath, capturesAfterIndex, chooseRequiredSelectOption, describeAttemptEffectSignals, extractGaEventEvidence, extractSubmitFailureEvidence, fillHtml5DateTimeInput, fillTextDatepickerInput, findRecentBackendError, findRecentPageTransition, formatValidationRejectedReason, hasBillingErrorBeenLogged, isAdvanceStalled, isAdvanceStep, isDomOnlyAdvanceVerified, isSubmitRevealedInvalid, isUploadAffordanceLabel, isWizardExitAction, latestCaptureIndex, logBillingErrorIfPresent, narrowInvalidFormControl, normalizeDateValue, pairInvalidWithErrors, parseCaptureIndex, parseRadioStep, parseSelectStep, pollEnumerate, probeLeafInvalidContainers, probeStepBeforeAttempts, renderLeafInvalidFields, renderUnfocusedObserve, rephraseWithLLM, resetBillingErrorFlagForTests, selectBodyExcerpt, selectRadioGroupOption, shouldSkipTechnique, shouldVetoFallbackAdvance, shouldWarnMissingAdvancePattern, verifyFillReadback, waitForTransitionBody, windowHasAdvanceTransition, windowHasTransitionBody, writeFixtureToTempFile, } from "../scraper/flow-runner";
|
|
693
723
|
export type { NormalizedStep, ReplanEvent };
|
|
694
|
-
export { denormalizeStep, main, normalizeFlow, parseCli, persistReplannedFlow, readFailureDumpEvidence, replanRemainingFlow, snapshotAndPersistCookieJar, writeSubmitManifest, };
|
|
724
|
+
export { denormalizeStep, dumpStepFailure, main, normalizeFlow, parseCli, persistReplannedFlow, readFailureDumpEvidence, replanRemainingFlow, snapshotAndPersistCookieJar, writeSubmitManifest, };
|
|
695
725
|
//# sourceMappingURL=recon-browser.d.ts.map
|