@enricai/barnacle 1.12.42 → 1.12.44
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/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +18 -0
- package/dist/config.js.map +1 -1
- package/dist/lib/tracking-click.js +2 -2
- package/dist/lib/tracking-click.js.map +1 -1
- package/dist/plugins/config-plugin.d.ts.map +1 -1
- package/dist/plugins/config-plugin.js +1 -0
- package/dist/plugins/config-plugin.js.map +1 -1
- package/dist/scraper/captcha-solver.d.ts +7 -0
- package/dist/scraper/captcha-solver.d.ts.map +1 -1
- package/dist/scraper/captcha-solver.js +11 -2
- package/dist/scraper/captcha-solver.js.map +1 -1
- package/dist/scraper/flow-runner.d.ts +22 -6
- package/dist/scraper/flow-runner.d.ts.map +1 -1
- package/dist/scraper/flow-runner.js +46 -39
- package/dist/scraper/flow-runner.js.map +1 -1
- package/dist/scraper/session-browserbase.d.ts +6 -3
- package/dist/scraper/session-browserbase.d.ts.map +1 -1
- package/dist/scraper/session-browserbase.js +52 -5
- package/dist/scraper/session-browserbase.js.map +1 -1
- package/dist/scraper/session-proxy.d.ts +18 -0
- package/dist/scraper/session-proxy.d.ts.map +1 -0
- package/dist/scraper/session-proxy.js +19 -0
- package/dist/scraper/session-proxy.js.map +1 -0
- package/dist/scraper/session-shared.d.ts +29 -0
- package/dist/scraper/session-shared.d.ts.map +1 -1
- package/dist/scraper/session-shared.js.map +1 -1
- package/dist/scraper/session-steel.d.ts.map +1 -1
- package/dist/scraper/session-steel.js +11 -0
- package/dist/scraper/session-steel.js.map +1 -1
- package/dist/scraper/session-teardown.d.ts +19 -0
- package/dist/scraper/session-teardown.d.ts.map +1 -1
- package/dist/scraper/session-teardown.js +22 -0
- package/dist/scraper/session-teardown.js.map +1 -1
- package/dist/scripts/recon-browser.d.ts.map +1 -1
- package/dist/scripts/recon-browser.js +12 -0
- package/dist/scripts/recon-browser.js.map +1 -1
- package/dist/scripts/recon-generate.d.ts +24 -12
- package/dist/scripts/recon-generate.d.ts.map +1 -1
- package/dist/scripts/recon-generate.js +142 -78
- package/dist/scripts/recon-generate.js.map +1 -1
- package/dist/types/session-proxy.d.ts +11 -0
- package/dist/types/session-proxy.d.ts.map +1 -0
- package/dist/types/session-proxy.js +3 -0
- package/dist/types/session-proxy.js.map +1 -0
- package/package.json +5 -1
|
@@ -4561,18 +4561,42 @@ function findCaptchaCallbackExprSrc() {
|
|
|
4561
4561
|
return null;
|
|
4562
4562
|
}`;
|
|
4563
4563
|
}
|
|
4564
|
+
/**
|
|
4565
|
+
* Shared by both the immediate and late invoke exprs in
|
|
4566
|
+
* `injectCaptchaTokenAndSubmit`: sets `responseField`'s value to `token` via
|
|
4567
|
+
* the descriptor-set path (falling back to a plain assignment when no
|
|
4568
|
+
* setter is found), then invokes the discovered callback `found` with that
|
|
4569
|
+
* same token.
|
|
4570
|
+
*/
|
|
4571
|
+
function setResponseFieldAndInvokeCallbackExprSrc(responseField, token) {
|
|
4572
|
+
return `
|
|
4573
|
+
const responseField = ${JSON.stringify(responseField)};
|
|
4574
|
+
const token = ${JSON.stringify(token)};
|
|
4575
|
+
const field = document.querySelector('[name="' + responseField + '"]');
|
|
4576
|
+
const descriptor = field
|
|
4577
|
+
? Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")
|
|
4578
|
+
: null;
|
|
4579
|
+
if (field && descriptor && descriptor.set) {
|
|
4580
|
+
descriptor.set.call(field, token);
|
|
4581
|
+
} else if (field) {
|
|
4582
|
+
field.value = token;
|
|
4583
|
+
}
|
|
4584
|
+
found.invoke(token);
|
|
4585
|
+
`;
|
|
4586
|
+
}
|
|
4564
4587
|
/**
|
|
4565
4588
|
* Site-agnostic captcha-solve hand-off: given an already-solved token,
|
|
4566
4589
|
* discover the widget's registered callback — a `data-callback` attribute
|
|
4567
4590
|
* naming a `window` global, or (absent that) a callback captured from a
|
|
4568
4591
|
* programmatic `hcaptcha.render({ callback })` call — and deliver the token
|
|
4569
4592
|
* so the site assembles its own submit (its own hidden fields, its own
|
|
4570
|
-
* submit path).
|
|
4571
|
-
*
|
|
4572
|
-
*
|
|
4573
|
-
*
|
|
4574
|
-
*
|
|
4575
|
-
*
|
|
4593
|
+
* submit path). The token is written into the response field first (via the
|
|
4594
|
+
* same property-descriptor `value` setter used by the no-callback fallback
|
|
4595
|
+
* below), then the discovered callback is invoked with that same token so it
|
|
4596
|
+
* drives its own submit off the value that's now present. `hcaptcha.execute`
|
|
4597
|
+
* is never called here: it would discard the already-solved token and
|
|
4598
|
+
* re-run hCaptcha's own challenge from scratch instead of consuming the paid
|
|
4599
|
+
* solve. When no callback is discoverable at precheck
|
|
4576
4600
|
* time, this re-installs the callback-capture script and retries the lookup
|
|
4577
4601
|
* once — catching a widget whose `hcaptcha.render` call happens on demand
|
|
4578
4602
|
* rather than on page load, after this frame missed both session.ts's
|
|
@@ -4632,24 +4656,15 @@ async function injectCaptchaTokenAndSubmit(target, token, responseField = "h-cap
|
|
|
4632
4656
|
const sitekeyEl = document.querySelector("[data-sitekey]");
|
|
4633
4657
|
const found = __findCaptchaCallback(sitekeyEl);
|
|
4634
4658
|
if (!found) return;
|
|
4635
|
-
|
|
4636
|
-
found.kind === "captured" &&
|
|
4637
|
-
found.widgetId !== undefined &&
|
|
4638
|
-
found.widgetId !== null &&
|
|
4639
|
-
window.hcaptcha &&
|
|
4640
|
-
typeof window.hcaptcha.execute === "function";
|
|
4641
|
-
if (canExecute) {
|
|
4642
|
-
window.hcaptcha.execute(found.widgetId);
|
|
4643
|
-
return;
|
|
4644
|
-
}
|
|
4645
|
-
found.invoke(${JSON.stringify(token)});
|
|
4659
|
+
${setResponseFieldAndInvokeCallbackExprSrc(responseField, token)}
|
|
4646
4660
|
})()`;
|
|
4647
|
-
//
|
|
4648
|
-
//
|
|
4649
|
-
//
|
|
4650
|
-
//
|
|
4651
|
-
//
|
|
4652
|
-
//
|
|
4661
|
+
// Deliver the already-solved token into the response field first, then
|
|
4662
|
+
// invoke the widget's own discovered callback with that same token so it
|
|
4663
|
+
// drives its own submit off the value that's now present — never
|
|
4664
|
+
// `hcaptcha.execute`, which would discard the paid solve and re-run
|
|
4665
|
+
// hCaptcha's own challenge from scratch. Invoking the callback can
|
|
4666
|
+
// navigate the frame synchronously from within this call (the callback
|
|
4667
|
+
// is free to build its own fields and submit), tearing down the
|
|
4653
4668
|
// execution context before a return value marshals — that rejection is
|
|
4654
4669
|
// the expected outcome, not a real failure, so it's discarded here rather
|
|
4655
4670
|
// than depended on. Re-resolving the callback here (rather than passing a
|
|
@@ -4683,22 +4698,12 @@ async function injectCaptchaTokenAndSubmit(target, token, responseField = "h-cap
|
|
|
4683
4698
|
const sitekeyEl = document.querySelector("[data-sitekey]");
|
|
4684
4699
|
const found = __findCaptchaCallback(sitekeyEl);
|
|
4685
4700
|
if (!found) return;
|
|
4686
|
-
|
|
4687
|
-
found.kind === "captured" &&
|
|
4688
|
-
found.widgetId !== undefined &&
|
|
4689
|
-
found.widgetId !== null &&
|
|
4690
|
-
window.hcaptcha &&
|
|
4691
|
-
typeof window.hcaptcha.execute === "function";
|
|
4692
|
-
if (canExecute) {
|
|
4693
|
-
window.hcaptcha.execute(found.widgetId);
|
|
4694
|
-
return;
|
|
4695
|
-
}
|
|
4696
|
-
found.invoke(${JSON.stringify(token)});
|
|
4701
|
+
${setResponseFieldAndInvokeCallbackExprSrc(responseField, token)}
|
|
4697
4702
|
})()`;
|
|
4698
|
-
// Same navigate-mid-evaluate tolerance as
|
|
4699
|
-
// the
|
|
4700
|
-
//
|
|
4701
|
-
// return value marshals.
|
|
4703
|
+
// Same token-then-invoke delivery and navigate-mid-evaluate tolerance as
|
|
4704
|
+
// the non-late invoke above: the callback is free to submit the form
|
|
4705
|
+
// synchronously off the field value that's now present, tearing down the
|
|
4706
|
+
// execution context before a return value marshals.
|
|
4702
4707
|
await target.evaluate(invokeLateCallbackExpr).catch(() => undefined);
|
|
4703
4708
|
return { injected, hasForm, callbackDiscovered: true };
|
|
4704
4709
|
}
|
|
@@ -7361,7 +7366,7 @@ function redactIfSensitive(text, sensitiveValue) {
|
|
|
7361
7366
|
return sensitiveValue && text === sensitiveValue ? "[redacted]" : text;
|
|
7362
7367
|
}
|
|
7363
7368
|
async function executeStepWithHealing(params) {
|
|
7364
|
-
const { stagehand, page, optional, upload, submitStep, captchaGated = false, emailStep = false, emailStepConfig, allocatedInbox = null, flowHasSubmitSemantics: flowHasSubmitSemanticsFlag, stepIndex, totalSteps, phase, signalCounter, recentCaptures, recentCaptureMeta, anthropic, rephraseModel, logger, captureFn, uploadFixture, isFinalStep, submitEndpointPattern, submittedStateSelectors, requireSubmitEndpointMatch, advanceTransitionBodyPattern, successUrlFragments, successPageTitleHints, ownBackendHostnames, knownErrorClassPrefixes, wizardExitButtonLabels, getSuppressedAisdkElementIdErrorCount, trajectory, onStepFailure, } = params;
|
|
7369
|
+
const { stagehand, page, optional, upload, submitStep, captchaGated = false, emailStep = false, emailStepConfig, allocatedInbox = null, sessionProxy = null, flowHasSubmitSemantics: flowHasSubmitSemanticsFlag, stepIndex, totalSteps, phase, signalCounter, recentCaptures, recentCaptureMeta, anthropic, rephraseModel, logger, captureFn, uploadFixture, isFinalStep, submitEndpointPattern, submittedStateSelectors, requireSubmitEndpointMatch, advanceTransitionBodyPattern, successUrlFragments, successPageTitleHints, ownBackendHostnames, knownErrorClassPrefixes, wizardExitButtonLabels, getSuppressedAisdkElementIdErrorCount, trajectory, onStepFailure, } = params;
|
|
7365
7370
|
// Mutable: the `emailStep` code-extract path splices the extracted code
|
|
7366
7371
|
// into this instruction (see the emailStep hook block below) so the
|
|
7367
7372
|
// pre-existing fill cascade downstream picks it up as the value to type
|
|
@@ -7729,6 +7734,7 @@ async function executeStepWithHealing(params) {
|
|
|
7729
7734
|
pageUrl,
|
|
7730
7735
|
isInvisible,
|
|
7731
7736
|
userAgent,
|
|
7737
|
+
proxy: sessionProxy ?? undefined,
|
|
7732
7738
|
}).catch((err) => {
|
|
7733
7739
|
logger.error(`${formatStepPrefix(stepIndex, totalSteps)} captchaGated step: solve failed (${(0, errors_1.toErrorMessage)(err)}); failing the step rather than silently proceeding`);
|
|
7734
7740
|
throw err;
|
|
@@ -10022,6 +10028,7 @@ async function runHealingFlow(deps) {
|
|
|
10022
10028
|
emailStep: s.emailStep === true,
|
|
10023
10029
|
emailStepConfig: s.emailStepConfig,
|
|
10024
10030
|
allocatedInbox: deps.allocatedInbox ?? null,
|
|
10031
|
+
sessionProxy: deps.sessionProxy ?? null,
|
|
10025
10032
|
flowHasSubmitSemantics: flowHasSubmitSemanticsFlag,
|
|
10026
10033
|
stepIndex: i,
|
|
10027
10034
|
totalSteps: () => steps.length,
|