captchakraken 5.0.0-beta.51 → 5.0.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/solver.d.ts CHANGED
@@ -96,6 +96,8 @@ export declare class CaptchaKrakenSolver {
96
96
  private fallbackBoardHash;
97
97
  /** True only once THIS board refused the plan at the front. Nothing is pressed speculatively. */
98
98
  private fallbackArmed;
99
+ /** The click count this board submitted itself at, once a click plan found no Verify; null until then. */
100
+ private submitsAtClicks;
99
101
  private exchangesAtAnswer;
100
102
  /** Earlier screens of the same paged puzzle (FunCaptcha), oldest first; the CLI sends them as `--history`. */
101
103
  private pointerHistory;
@@ -350,6 +352,13 @@ export declare class CaptchaKrakenSolver {
350
352
  /** A click board with no Verify submits itself at a count, so a plan of any other count leaves its tiles ticked
351
353
  * and never submits, and the next plan's clicks untick them. */
352
354
  private keepPlansOfThisManyClicks;
355
+ /**
356
+ * The count is the board's, not one answer's: every plan queued for the board is held to it, the ones a later
357
+ * answer brings included. Applied once, a re-ask's fresh queue had a one-click plan pressed onto a board that
358
+ * submits at two; its mark stayed, the next plan's first press completed the pair, and its second press was
359
+ * refused (Tier 3, Yidun 点击两下, both ports, 2026-11-15).
360
+ */
361
+ private holdFallbacksToSubmitCount;
353
362
  private resetSolveState;
354
363
  /**
355
364
  * Keyed on the BOARD and the retry mode, not the answer alone. A paged puzzle's next arrow sits at the
package/dist/solver.js CHANGED
@@ -173,6 +173,10 @@ function withAnswerBox(el, box, maxGrowth = ANSWER_BOX_MAX_GROWTH) {
173
173
  }
174
174
  /** Every visible match of `selectors`, in selector order, queried at once. A selector this adapter can't parse is skipped, not fatal. */
175
175
  const visible = async (scope, selectors) => (await Promise.all(selectors.map((s) => scope.locator(s).filter({ visible: true }).all().catch(() => [])))).flat();
176
+ /** The presses in a plan made only of clicks; null for a plan with any other action in it. */
177
+ const clickCount = (actions) => actions.length && actions.every((a) => a?.action === kinds_1.ActionKind.CLICK)
178
+ ? actions.reduce((n, a) => n + (a.target_bounding_boxes?.length ?? 1), 0)
179
+ : null;
176
180
  const handleOf = (at) => at.elementHandle({ timeout: HANDLE_TIMEOUT_MS }).catch(() => null);
177
181
  const handles = async (ats) => (await Promise.all(ats.map(handleOf))).filter((h) => h !== null);
178
182
  const frameOf = async (at) => (await (await handleOf(at))?.contentFrame().catch(() => null)) ?? null;
@@ -374,6 +378,8 @@ class CaptchaKrakenSolver {
374
378
  this.fallbackBoardHash = null;
375
379
  /** True only once THIS board refused the plan at the front. Nothing is pressed speculatively. */
376
380
  this.fallbackArmed = false;
381
+ /** The click count this board submitted itself at, once a click plan found no Verify; null until then. */
382
+ this.submitsAtClicks = null;
377
383
  this.exchangesAtAnswer = 0;
378
384
  /** Earlier screens of the same paged puzzle (FunCaptcha), oldest first; the CLI sends them as `--history`. */
379
385
  this.pointerHistory = [];
@@ -719,6 +725,7 @@ class CaptchaKrakenSolver {
719
725
  this.fallbackPlans = [];
720
726
  this.fallbackBoardHash = null;
721
727
  this.fallbackArmed = false;
728
+ this.submitsAtClicks = null;
722
729
  this.dropPointerHistory();
723
730
  // Its own second look, but only once IT fails: what armed it was evidence about the previous board,
724
731
  // and left set it filmed every still board after a solve's first miss.
@@ -1089,6 +1096,7 @@ class CaptchaKrakenSolver {
1089
1096
  }
1090
1097
  if (!fromFallback) {
1091
1098
  this.fallbackPlans = response.fallbacks ?? [];
1099
+ this.holdFallbacksToSubmitCount();
1092
1100
  this.fallbackBoardHash = this.fallbackPlans.length ? boardHash : null;
1093
1101
  this.fallbackArmed = false;
1094
1102
  }
@@ -2446,19 +2454,30 @@ class CaptchaKrakenSolver {
2446
2454
  /** A click board with no Verify submits itself at a count, so a plan of any other count leaves its tiles ticked
2447
2455
  * and never submits, and the next plan's clicks untick them. */
2448
2456
  keepPlansOfThisManyClicks(plan) {
2449
- const clicks = (actions) => actions.length && actions.every((a) => a?.action === kinds_1.ActionKind.CLICK)
2450
- ? actions.reduce((n, a) => n + (a.target_bounding_boxes?.length ?? 1), 0)
2451
- : null;
2452
- const count = clicks(plan);
2457
+ const count = clickCount(plan);
2453
2458
  if (count === null)
2454
2459
  return;
2455
- this.fallbackPlans = this.fallbackPlans.filter((other) => [null, count].includes(clicks(other)));
2460
+ this.submitsAtClicks = count;
2461
+ this.holdFallbacksToSubmitCount();
2462
+ }
2463
+ /**
2464
+ * The count is the board's, not one answer's: every plan queued for the board is held to it, the ones a later
2465
+ * answer brings included. Applied once, a re-ask's fresh queue had a one-click plan pressed onto a board that
2466
+ * submits at two; its mark stayed, the next plan's first press completed the pair, and its second press was
2467
+ * refused (Tier 3, Yidun 点击两下, both ports, 2026-11-15).
2468
+ */
2469
+ holdFallbacksToSubmitCount() {
2470
+ const count = this.submitsAtClicks;
2471
+ if (count === null)
2472
+ return;
2473
+ this.fallbackPlans = this.fallbackPlans.filter((other) => [null, count].includes(clickCount(other)));
2456
2474
  }
2457
2475
  resetSolveState() {
2458
2476
  this.solutionCache.clear();
2459
2477
  this.fallbackPlans = [];
2460
2478
  this.fallbackBoardHash = null;
2461
2479
  this.fallbackArmed = false;
2480
+ this.submitsAtClicks = null;
2462
2481
  this.dropPointerHistory();
2463
2482
  this.repeatedAnswerSeen = false;
2464
2483
  this.knownAnimated = false;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "captchakraken",
3
- "version": "5.0.0-beta.51",
4
- "description": "Captcha solver for Playwright and Puppeteer. Finds the captcha, reads it with the v2 pointer model, and clicks, drags, slides or types through to a token — reCAPTCHA, GeeTest, NetEase Yidun, Tencent, Lemin, Prosopo, Turnstile and distorted text. Hosted API or self-hosted.",
3
+ "version": "5.0.0",
4
+ "description": "Captcha solver for Playwright and Puppeteer. Finds the captcha, reads it with the v2 pointer model, and clicks, drags, slides or types through to a token \u2014 reCAPTCHA, GeeTest, NetEase Yidun, Tencent, Lemin, Prosopo, Turnstile and distorted text. Hosted API or self-hosted.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "captchakraken"
7
- version = "5.0.0b51"
7
+ version = "5.0.0"
8
8
  description = "Captcha-solving engine and CLI: a v2 pointer model for image grids, click and drag puzzles, sliders, distorted text and animated challenges. Hosted API or self-hosted on vLLM."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -100,4 +100,4 @@ __all__ = [
100
100
  "PauseKind",
101
101
  ]
102
102
 
103
- __version__ = "5.0.0b51"
103
+ __version__ = "5.0.0"
@@ -668,6 +668,8 @@ class PageSolver:
668
668
  self._no_progress_rounds = 0
669
669
  self._refused_rounds = 0
670
670
  self._fallback_board: Optional[str] = None
671
+ # The click count this board submitted itself at, once a click plan found no Verify.
672
+ self._submits_at_clicks: Optional[int] = None
671
673
  self._exchanges_at_answer = 0
672
674
  self._drop_pointer_history()
673
675
  self._apply_refusals()
@@ -839,11 +841,20 @@ class PageSolver:
839
841
  plan = [_as_dict(a) for a in actions]
840
842
  if not plan or any(a.get("action") != ActionKind.CLICK for a in plan):
841
843
  return
842
- clicks = sum(len(a.get("target_bounding_boxes") or [1]) for a in plan)
844
+ self._submits_at_clicks = sum(len(a.get("target_bounding_boxes") or [1]) for a in plan)
845
+ self._hold_fallbacks_to_submit_count()
846
+
847
+ def _hold_fallbacks_to_submit_count(self) -> None:
848
+ """The count is the board's, not one answer's: every plan queued for the board is held to it, the ones a
849
+ later answer brings included. Applied once, a re-ask's fresh queue had a one-click plan pressed onto a board
850
+ that submits at two; its mark stayed, the next plan's first press completed the pair, and its second press
851
+ was refused (Tier 3, Yidun 点击两下, both ports, 2026-11-15)."""
852
+ clicks = self._submits_at_clicks
843
853
  target = getattr(self._solver, "planner", None)
844
- if getattr(target, "pointer_fallbacks", None):
845
- target.pointer_fallbacks = [f for f in target.pointer_fallbacks if f.get("action") != ActionKind.CLICK
846
- or len(f.get("points") or []) == clicks]
854
+ if clicks is None or not getattr(target, "pointer_fallbacks", None):
855
+ return
856
+ target.pointer_fallbacks = [f for f in target.pointer_fallbacks if f.get("action") != ActionKind.CLICK
857
+ or len(f.get("points") or []) == clicks]
847
858
 
848
859
  def _fresh_board(self) -> None:
849
860
  # ONE FILM, ONE BOARD — enforced where the board actually changes. The recorded answer describes the
@@ -856,6 +867,7 @@ class PageSolver:
856
867
  self._animated_probe_armed = False
857
868
  self._animated_probe_done = False
858
869
  self._refused_rounds = 0
870
+ self._submits_at_clicks = None
859
871
  self._acted_on_board = False
860
872
  self._submitted_on_board = False
861
873
  self._drop_pointer_history()
@@ -2688,6 +2700,7 @@ class PageSolver:
2688
2700
  raise CaptchaSolveError("could not get bounding box of captcha element")
2689
2701
 
2690
2702
  _log("[answer] " + json.dumps({"actions": [_as_dict(a) for a in actions]}, default=str))
2703
+ self._hold_fallbacks_to_submit_count()
2691
2704
  # A repeated answer is not re-performed: the widget already refused it, and every extra press is
2692
2705
  # behaviour a vendor scores. Re-asking, or asking a recording, is the round's only move.
2693
2706
  # `_note_answer` drops the refused animated answer on its way through, so the next round re-asks.