captchakraken 4.2.0 → 5.0.0-beta.42
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/README.md +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/kinds.d.ts +1 -0
- package/dist/kinds.js +1 -0
- package/dist/playwright-types.d.ts +4 -0
- package/dist/puppeteer-adapter.d.ts +2 -0
- package/dist/puppeteer-adapter.js +34 -2
- package/dist/selectors.d.ts +22 -11
- package/dist/selectors.js +9 -19
- package/dist/solver.d.ts +49 -4
- package/dist/solver.js +177 -47
- package/package.json +2 -2
- package/python/AGENTS.md +5 -4
- package/python/README.md +3 -6
- package/python/pyproject.toml +6 -9
- package/python/src/captchakraken/__init__.py +1 -1
- package/python/src/captchakraken/captchakraken.config.json +43 -9
- package/python/src/captchakraken/cli.py +2 -47
- package/python/src/captchakraken/config.py +0 -4
- package/python/src/captchakraken/kinds.py +1 -0
- package/python/src/captchakraken/models.json +15 -14
- package/python/src/captchakraken/page_solver.py +168 -49
- package/python/src/captchakraken/pointer/__init__.py +7 -9
- package/python/src/captchakraken/pointer/elements.py +1 -1
- package/python/src/captchakraken/pointer/server.py +13 -17
- package/python/src/captchakraken/pointer/service.py +35 -324
- package/python/src/captchakraken/prompts.py +3 -4
- package/python/src/captchakraken/selectors.py +19 -17
- package/python/src/captchakraken/selfhost.py +9 -16
- package/python/src/captchakraken/server_manager.py +0 -4
- package/python/src/captchakraken/solver.py +4 -25
- package/python/src/captchakraken/tool_calls/find_checkbox.py +150 -13
- package/python/src/captchakraken/tool_calls/find_grid.py +6 -132
- package/python/src/captchakraken/updater.py +57 -27
- package/python/src/captchakraken/pointer/detector.py +0 -333
package/README.md
CHANGED
|
@@ -158,7 +158,6 @@ Full details, including writing your own humanizer:
|
|
|
158
158
|
| `CAPTCHA_BASE_MODEL` | Merged v2 weights vLLM loads | `CaptchaKraken/MidnightV2-4B-q4` |
|
|
159
159
|
| `CAPTCHA_LORA_ADAPTER` | Model repository (HF id or path) | `CaptchaKraken/MidnightV2-4B-q4` |
|
|
160
160
|
| `CAPTCHA_LORA_NAME` | Served model name sent as `model` | `captcha-pointer` |
|
|
161
|
-
| `CAPTCHA_POINTER_DETECTOR` | CNN element detector | set by `captchakraken fetch` |
|
|
162
161
|
| `CAPTCHA_KRAKEN_AUTOSTART` | `0` never auto-starts a local server | `1` |
|
|
163
162
|
| `CAPTCHA_KRAKEN_PYTHON` | Interpreter used for the bundled engine | the package's venv, else `python3` |
|
|
164
163
|
| `CAPTCHA_KRAKEN_SKIP_PYTHON_SETUP` | `1` skips the `postinstall` bootstrap | unset |
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { fromPuppeteer } from './puppeteer-adapter';
|
|
|
5
5
|
export type { Page, PlaywrightPage, PlaywrightFrame, PlaywrightElementHandle, PlaywrightLocator, PlaywrightScope } from './playwright-types';
|
|
6
6
|
export type { CaptchaKrakenConfig } from './types';
|
|
7
7
|
export { DEFAULT_CONFIG_PATH, SelectorConfigError, loadConfig } from './selectors';
|
|
8
|
-
export type { CustomSelectors,
|
|
8
|
+
export type { CustomSelectors, SelectorConfig, SelectorConfigFile, VendorSelectors } from './selectors';
|
|
9
9
|
export { HumanizationMode, PromptFamily, Vendor } from './kinds';
|
|
10
10
|
export type { SolveResult, SolveStepEvent, Vector } from './types';
|
|
11
11
|
export type { RoundVerdict } from './verdicts';
|
package/dist/kinds.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const Vendor: {
|
|
|
22
22
|
readonly FUNCAPTCHA: "funcaptcha";
|
|
23
23
|
readonly PROTON: "proton";
|
|
24
24
|
readonly DATADOME: "datadome";
|
|
25
|
+
readonly CYBERSIARA: "cybersiara";
|
|
25
26
|
readonly UNKNOWN: "unknown";
|
|
26
27
|
};
|
|
27
28
|
export type Vendor = (typeof Vendor)[keyof typeof Vendor];
|
package/dist/kinds.js
CHANGED
|
@@ -26,6 +26,7 @@ exports.Vendor = {
|
|
|
26
26
|
FUNCAPTCHA: 'funcaptcha',
|
|
27
27
|
PROTON: 'proton',
|
|
28
28
|
DATADOME: 'datadome',
|
|
29
|
+
CYBERSIARA: 'cybersiara',
|
|
29
30
|
UNKNOWN: 'unknown',
|
|
30
31
|
};
|
|
31
32
|
exports.ActionKind = { CLICK: 'click', DRAG: 'drag', TYPE: 'type', WAIT: 'wait', DONE: 'done', HOLD: 'hold', REFRESH: 'refresh', SLIDE: 'slide' };
|
|
@@ -13,6 +13,7 @@ export interface PlaywrightElementHandle {
|
|
|
13
13
|
path?: string;
|
|
14
14
|
timeout?: number;
|
|
15
15
|
animations?: 'disabled' | 'allow';
|
|
16
|
+
style?: string;
|
|
16
17
|
}): Promise<Buffer>;
|
|
17
18
|
contentFrame(): Promise<PlaywrightFrame | null>;
|
|
18
19
|
boundingBox(): Promise<BoundingBoxRect | null>;
|
|
@@ -44,6 +45,8 @@ export interface PlaywrightScope {
|
|
|
44
45
|
export interface PlaywrightFrame extends PlaywrightScope {
|
|
45
46
|
/** Optional: its HOSTNAME alone is sent as X-CK-Widget-Host, the host the widget was served from. */
|
|
46
47
|
url?(): string;
|
|
48
|
+
/** Optional: the frames nested in this one (Playwright and Puppeteer both have it), searched for a vendor's `board`. */
|
|
49
|
+
childFrames?(): PlaywrightFrame[];
|
|
47
50
|
waitForSelector(selector: string, options?: {
|
|
48
51
|
state?: 'attached' | 'detached' | 'visible' | 'hidden';
|
|
49
52
|
timeout?: number;
|
|
@@ -99,6 +102,7 @@ export interface PlaywrightPage extends PlaywrightScope {
|
|
|
99
102
|
screenshot(options?: {
|
|
100
103
|
timeout?: number;
|
|
101
104
|
animations?: 'disabled' | 'allow';
|
|
105
|
+
style?: string;
|
|
102
106
|
}): Promise<Buffer>;
|
|
103
107
|
/** Optional: the mouse humanizer asks the window for its size when `viewportSize()` is null (camoufox). */
|
|
104
108
|
evaluate?<R>(pageFunction: () => R): Promise<R>;
|
|
@@ -11,6 +11,7 @@ interface PuppeteerElementHandle {
|
|
|
11
11
|
$$(selector: string): Promise<PuppeteerElementHandle[]>;
|
|
12
12
|
}
|
|
13
13
|
interface PuppeteerFrame {
|
|
14
|
+
evaluate(pageFunction: (...args: any[]) => any, ...args: any[]): Promise<any>;
|
|
14
15
|
$$(selector: string): Promise<PuppeteerElementHandle[]>;
|
|
15
16
|
waitForSelector(selector: string, options?: any): Promise<PuppeteerElementHandle | null>;
|
|
16
17
|
waitForFunction(pageFunction: Function | string, options?: any, ...args: any[]): Promise<unknown>;
|
|
@@ -43,6 +44,7 @@ interface PuppeteerPage {
|
|
|
43
44
|
on(event: 'response', listener: (response: PlaywrightResponse) => void): unknown;
|
|
44
45
|
off(event: 'response', listener: (response: PlaywrightResponse) => void): unknown;
|
|
45
46
|
url(): string;
|
|
47
|
+
frames(): PuppeteerFrame[];
|
|
46
48
|
}
|
|
47
49
|
export declare function fromPuppeteer(page: PuppeteerPage): PlaywrightPage;
|
|
48
50
|
export {};
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromPuppeteer = fromPuppeteer;
|
|
4
|
+
// Run in the browser: `at` is an element handle's own node, or null in a frame's evaluate, which passes none.
|
|
5
|
+
function addStyle(at, css) {
|
|
6
|
+
const doc = at?.ownerDocument ?? document;
|
|
7
|
+
const el = doc.createElement('style');
|
|
8
|
+
el.id = 'ck-screenshot-style';
|
|
9
|
+
el.textContent = css;
|
|
10
|
+
(doc.head ?? doc.documentElement).appendChild(el);
|
|
11
|
+
}
|
|
12
|
+
function dropStyle(at) {
|
|
13
|
+
(at?.ownerDocument ?? document).getElementById('ck-screenshot-style')?.remove();
|
|
14
|
+
}
|
|
15
|
+
const inDoc = (d, fn, css = '') => 'handle' in d ? d.handle.evaluate(fn, css) : d.frame.evaluate(fn, null, css);
|
|
16
|
+
/**
|
|
17
|
+
* Playwright's screenshot `style`, which Puppeteer lacks: the sheet goes into each document for the length of the
|
|
18
|
+
* capture. A frame that has gone away in the meantime has nothing left to restore.
|
|
19
|
+
*/
|
|
20
|
+
async function styled(into, css, capture) {
|
|
21
|
+
if (!css)
|
|
22
|
+
return capture();
|
|
23
|
+
const docs = await into();
|
|
24
|
+
await Promise.all(docs.map((d) => inDoc(d, addStyle, css)));
|
|
25
|
+
try {
|
|
26
|
+
return await capture();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
await Promise.all(docs.map((d) => inDoc(d, dropStyle).catch(() => undefined)));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
4
32
|
function toPuppeteerSelectorOptions(options) {
|
|
5
33
|
if (!options)
|
|
6
34
|
return undefined;
|
|
@@ -32,7 +60,11 @@ function wrapHandle(h) {
|
|
|
32
60
|
if (!h)
|
|
33
61
|
return null;
|
|
34
62
|
return {
|
|
35
|
-
|
|
63
|
+
// The handle's own document and, for a frame, the document inside it: where a widget draws its verdicts.
|
|
64
|
+
screenshot: ({ style, ...options } = {}) => styled(async () => {
|
|
65
|
+
const inner = await h.contentFrame();
|
|
66
|
+
return inner ? [{ handle: h }, { frame: inner }] : [{ handle: h }];
|
|
67
|
+
}, style, () => h.screenshot(options)),
|
|
36
68
|
contentFrame: async () => wrapFrame(await h.contentFrame()),
|
|
37
69
|
boundingBox: () => h.boundingBox(),
|
|
38
70
|
scrollIntoViewIfNeeded: () => h.scrollIntoView(),
|
|
@@ -76,7 +108,7 @@ function fromPuppeteer(page) {
|
|
|
76
108
|
waitForSelector: async (selector, options) => wrapHandle(await page.waitForSelector(selector, toPuppeteerSelectorOptions(options))),
|
|
77
109
|
viewportSize: () => page.viewport(),
|
|
78
110
|
// Puppeteer has no `animations` option, and its own timeout; the capture is PNG either way.
|
|
79
|
-
screenshot: async () => Buffer.from(await page.screenshot({ type: 'png' })),
|
|
111
|
+
screenshot: async ({ style } = {}) => styled(async () => page.frames().map((frame) => ({ frame })), style, async () => Buffer.from(await page.screenshot({ type: 'png' }))),
|
|
80
112
|
evaluate: (pageFunction) => page.evaluate(pageFunction),
|
|
81
113
|
locator: (selector) => locatorOver(() => page.$$(selector)),
|
|
82
114
|
// Forwarded explicitly: without it the watcher polls a dead page forever.
|
package/dist/selectors.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export interface VendorSelectors {
|
|
|
25
25
|
readonly fresh?: string;
|
|
26
26
|
/** Inside the challenge frame: the pictures a board is made of; the driver waits for each to have painted. */
|
|
27
27
|
readonly images?: readonly string[];
|
|
28
|
+
/**
|
|
29
|
+
* Inside the challenge frame: the tiles of the board's grid, in reading order. Where each one is placed is read from
|
|
30
|
+
* the DOM, to click it and to watch it reload.
|
|
31
|
+
*/
|
|
32
|
+
readonly tiles?: readonly string[];
|
|
28
33
|
/** Inside the widget: the vendor's own submit control, tried after the generic text probes. */
|
|
29
34
|
readonly submit?: readonly string[];
|
|
30
35
|
/** Inside the challenge frame: verdict banners and what each means. */
|
|
@@ -37,6 +42,16 @@ export interface VendorSelectors {
|
|
|
37
42
|
readonly textInput?: readonly string[];
|
|
38
43
|
/** Inside the widget: the knob a slide must start on; a drag from the piece moves nothing. */
|
|
39
44
|
readonly sliderHandle?: readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* Beside the widget (a sibling of it, or of its parent): a strip the vendor draws outside the widget element that
|
|
47
|
+
* every board carries, such as Yidun's prompt and slider bar. The shot takes it in.
|
|
48
|
+
*/
|
|
49
|
+
readonly bar?: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* Inside the widget's frame or a frame nested in it: the board itself, when the widget frame pads it (Proton's
|
|
52
|
+
* 682x600 frame around its 370x534 `.protonCaptchaContainer`). The shot is this element.
|
|
53
|
+
*/
|
|
54
|
+
readonly board?: readonly string[];
|
|
40
55
|
/** Inside the widget: the piece, measured to steer the slide and dragged directly when there is no track. */
|
|
41
56
|
readonly piece?: readonly string[];
|
|
42
57
|
/** Inside the widget: the control that deals a new puzzle, pressed when the model answers `refresh`. */
|
|
@@ -52,7 +67,8 @@ export interface SelectorConfigFile {
|
|
|
52
67
|
readonly custom?: Record<string, unknown> | null;
|
|
53
68
|
readonly vendors?: Record<string, Record<string, unknown>>;
|
|
54
69
|
readonly generic?: Record<string, readonly string[]>;
|
|
55
|
-
|
|
70
|
+
/** Left from the element detector the client no longer has: still accepted, and ignored. */
|
|
71
|
+
readonly detector?: string;
|
|
56
72
|
readonly [comment: `_${string}`]: unknown;
|
|
57
73
|
}
|
|
58
74
|
/** A selector config the solver cannot use; the message names the file and the key. */
|
|
@@ -64,17 +80,8 @@ export interface SelectorConfig {
|
|
|
64
80
|
readonly custom: CustomSelectors | null;
|
|
65
81
|
readonly vendors: ReadonlyArray<readonly [Vendor, VendorSelectors]>;
|
|
66
82
|
readonly generic: Readonly<Record<GenericKey, readonly string[]>>;
|
|
67
|
-
/** Which element detector the engine runs: see `DETECTOR_MODELS`. */
|
|
68
|
-
readonly detector: DetectorModel;
|
|
69
83
|
}
|
|
70
|
-
|
|
71
|
-
* The element detector's weights: `lite` keeps a board near 100 ms on one vCPU, `standard` is the larger network, and
|
|
72
|
-
* `auto` takes `lite` on a machine of two CPUs or fewer, else times one board and takes `standard` when it fits.
|
|
73
|
-
* `CAPTCHA_KRAKEN_DETECTOR_MODEL` in the environment overrides the config.
|
|
74
|
-
*/
|
|
75
|
-
export declare const DETECTOR_MODELS: readonly ["auto", "standard", "lite"];
|
|
76
|
-
export type DetectorModel = (typeof DETECTOR_MODELS)[number];
|
|
77
|
-
declare const GENERIC: readonly ["submit_text", "text_input", "slider_handle", "piece"];
|
|
84
|
+
declare const GENERIC: readonly ["submit_text", "text_input", "slider_handle", "piece", "feedback"];
|
|
78
85
|
type GenericKey = (typeof GENERIC)[number];
|
|
79
86
|
/**
|
|
80
87
|
* The default config: the repository's own `captchakraken.config.json` when this package runs from a checkout, so an
|
|
@@ -119,6 +126,8 @@ export declare class SelectorTable {
|
|
|
119
126
|
/** A real Verify/Next/Submit/Skip/Confirm first; the vendor-named controls are fallbacks. */
|
|
120
127
|
readonly submit: readonly string[];
|
|
121
128
|
readonly textInputVendor: readonly string[];
|
|
129
|
+
/** The vendor-named submit controls alone: the only ones looked for outside the widget, after a typed answer. */
|
|
130
|
+
readonly submitVendor: readonly string[];
|
|
122
131
|
/**
|
|
123
132
|
* Vendor-named first, generic last: the driver takes the first visible match, and a generic selector reached before
|
|
124
133
|
* the vendor's own is how a captcha's answer ends up in a login form's username box.
|
|
@@ -128,6 +137,8 @@ export declare class SelectorTable {
|
|
|
128
137
|
readonly sliderHandle: readonly string[];
|
|
129
138
|
readonly refresh: readonly string[];
|
|
130
139
|
readonly piece: readonly string[];
|
|
140
|
+
/** The verdict messages a widget shows over its board: every vendor's banners, then the generic ones. */
|
|
141
|
+
readonly feedback: readonly string[];
|
|
131
142
|
constructor(custom?: CustomSelectors, config?: string | SelectorConfigFile | SelectorConfig);
|
|
132
143
|
}
|
|
133
144
|
export declare const DEFAULT_TABLE: SelectorTable;
|
package/dist/selectors.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PIECE_SELECTORS = exports.REFRESH_SELECTORS = exports.SLIDER_HANDLE_SELECTORS = exports.TEXT_INPUT_SELECTORS = exports.TEXT_INPUT_VENDOR_SELECTORS = exports.SUBMIT_SELECTORS = exports.ACCEPTED_SELECTORS = exports.RESPONSE_SELECTORS = exports.ENCLAVE_SELECTORS = exports.WIDGET_PROBES = exports.VENDORS = exports.DEFAULT_TABLE = exports.SelectorTable = exports.submitByText = exports.SELECTORS = exports.DEFAULT_CONFIG = exports.DEFAULT_CONFIG_PATH = exports.
|
|
6
|
+
exports.PIECE_SELECTORS = exports.REFRESH_SELECTORS = exports.SLIDER_HANDLE_SELECTORS = exports.TEXT_INPUT_SELECTORS = exports.TEXT_INPUT_VENDOR_SELECTORS = exports.SUBMIT_SELECTORS = exports.ACCEPTED_SELECTORS = exports.RESPONSE_SELECTORS = exports.ENCLAVE_SELECTORS = exports.WIDGET_PROBES = exports.VENDORS = exports.DEFAULT_TABLE = exports.SelectorTable = exports.submitByText = exports.SELECTORS = exports.DEFAULT_CONFIG = exports.DEFAULT_CONFIG_PATH = exports.SelectorConfigError = void 0;
|
|
7
7
|
exports.loadConfig = loadConfig;
|
|
8
8
|
/**
|
|
9
9
|
* Every selector the driver knows, keyed by vendor, read from `captchakraken.config.json` at the repository root. The
|
|
@@ -22,17 +22,11 @@ class SelectorConfigError extends Error {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
exports.SelectorConfigError = SelectorConfigError;
|
|
25
|
-
|
|
26
|
-
* The element detector's weights: `lite` keeps a board near 100 ms on one vCPU, `standard` is the larger network, and
|
|
27
|
-
* `auto` takes `lite` on a machine of two CPUs or fewer, else times one board and takes `standard` when it fits.
|
|
28
|
-
* `CAPTCHA_KRAKEN_DETECTOR_MODEL` in the environment overrides the config.
|
|
29
|
-
*/
|
|
30
|
-
exports.DETECTOR_MODELS = ['auto', 'standard', 'lite'];
|
|
31
|
-
const GENERIC = ['submit_text', 'text_input', 'slider_handle', 'piece'];
|
|
25
|
+
const GENERIC = ['submit_text', 'text_input', 'slider_handle', 'piece', 'feedback'];
|
|
32
26
|
// The file is spelled as the Python port's fields; these three are camelCase here.
|
|
33
27
|
const CAMEL = { text_input: 'textInput', slider_handle: 'sliderHandle', hold_completes: 'holdCompletes' };
|
|
34
28
|
const FIELDS = ['hosts', 'challenge', 'checkbox', 'enclave', 'widget', 'response', 'checked', 'box', 'accepted', 'fresh',
|
|
35
|
-
'images', 'submit', 'banners', 'blocked', 'passive', 'text_input', 'slider_handle', 'piece', 'refresh', 'hold_completes'];
|
|
29
|
+
'images', 'tiles', 'submit', 'banners', 'blocked', 'passive', 'text_input', 'slider_handle', 'bar', 'board', 'piece', 'refresh', 'hold_completes'];
|
|
36
30
|
const ONE = new Set(['response', 'checked', 'accepted', 'fresh']);
|
|
37
31
|
const BANNERS = new Set(Object.values(kinds_1.RecaptchaBanner));
|
|
38
32
|
const VENDOR_VALUES = new Set(Object.values(kinds_1.Vendor));
|
|
@@ -96,16 +90,10 @@ function parse(name, doc, base) {
|
|
|
96
90
|
if (!isObject(doc))
|
|
97
91
|
throw new SelectorConfigError(`${name}: the top level must be an object`);
|
|
98
92
|
for (const key of Object.keys(doc)) {
|
|
93
|
+
// `detector` chose an element detector the client no longer has; a config written for one still loads.
|
|
99
94
|
if (!key.startsWith('_') && !['detector', 'custom', 'vendors', 'generic'].includes(key)) {
|
|
100
|
-
throw new SelectorConfigError(`${name}: ${key}: not a config key (
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
let detector = base?.detector ?? 'auto';
|
|
104
|
-
if ('detector' in doc) {
|
|
105
|
-
if (!exports.DETECTOR_MODELS.includes(doc.detector)) {
|
|
106
|
-
throw new SelectorConfigError(`${name}: detector: ${JSON.stringify(doc.detector)} is not one of ${exports.DETECTOR_MODELS.join(', ')}`);
|
|
95
|
+
throw new SelectorConfigError(`${name}: ${key}: not a config key (custom, vendors, generic)`);
|
|
107
96
|
}
|
|
108
|
-
detector = doc.detector;
|
|
109
97
|
}
|
|
110
98
|
let custom = base?.custom ?? null;
|
|
111
99
|
if ('custom' in doc)
|
|
@@ -142,7 +130,7 @@ function parse(name, doc, base) {
|
|
|
142
130
|
const absent = GENERIC.filter((k) => !generic[k]);
|
|
143
131
|
if (absent.length)
|
|
144
132
|
throw new SelectorConfigError(`${name}: generic: missing ${JSON.stringify(absent)}`);
|
|
145
|
-
return { custom, vendors: [...vendors], generic: generic
|
|
133
|
+
return { custom, vendors: [...vendors], generic: generic };
|
|
146
134
|
}
|
|
147
135
|
function read(file) {
|
|
148
136
|
let text;
|
|
@@ -211,12 +199,14 @@ class SelectorTable {
|
|
|
211
199
|
this.enclave = every('enclave');
|
|
212
200
|
this.response = this.vendors.flatMap(([, s]) => s.response ?? []);
|
|
213
201
|
this.accepted = this.vendors.flatMap(([, s]) => s.accepted ?? []);
|
|
214
|
-
this.
|
|
202
|
+
this.submitVendor = every('submit');
|
|
203
|
+
this.submit = [...loaded.generic.submit_text.map(exports.submitByText), ...this.submitVendor];
|
|
215
204
|
this.textInputVendor = every('textInput');
|
|
216
205
|
this.textInput = [...this.textInputVendor, ...loaded.generic.text_input];
|
|
217
206
|
this.sliderHandle = [...every('sliderHandle'), ...loaded.generic.slider_handle];
|
|
218
207
|
this.refresh = every('refresh');
|
|
219
208
|
this.piece = [...every('piece'), ...loaded.generic.piece];
|
|
209
|
+
this.feedback = [...this.vendors.flatMap(([, s]) => (s.banners ?? []).map(([sel]) => sel)), ...loaded.generic.feedback];
|
|
220
210
|
}
|
|
221
211
|
}
|
|
222
212
|
exports.SelectorTable = SelectorTable;
|
package/dist/solver.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export declare class CaptchaKrakenSolver {
|
|
|
56
56
|
private videoBudgetGranted;
|
|
57
57
|
private human;
|
|
58
58
|
private sel;
|
|
59
|
+
/** A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown. */
|
|
60
|
+
private get feedbackHidden();
|
|
59
61
|
private stepIndex;
|
|
60
62
|
private solveStartMs;
|
|
61
63
|
private cvWorker;
|
|
@@ -187,13 +189,19 @@ export declare class CaptchaKrakenSolver {
|
|
|
187
189
|
* shows "Verifying…" before its box, so an empty capture is looked at again until `detectionTimeoutMs`.
|
|
188
190
|
*/
|
|
189
191
|
private findCheckboxOnScreen;
|
|
190
|
-
/** One capture and
|
|
192
|
+
/** One capture and plain pixel arithmetic, no model: a point inside the tick box, or null when none is drawn. */
|
|
191
193
|
private checkboxOnScreen;
|
|
192
194
|
/**
|
|
193
195
|
* A clicked checkbox passes or opens a challenge, and both show in the DOM.
|
|
194
196
|
* Without this wait the next round found the same checkbox still up and clicked it again.
|
|
195
197
|
*/
|
|
196
198
|
private awaitWhatTheCheckboxOpened;
|
|
199
|
+
/**
|
|
200
|
+
* The widget's Verify, else, after a typed answer, the vendor-named submit beside its text box. BotDetect's Validate
|
|
201
|
+
* sits in the widget's fieldset, outside the 280x50 `.BDC_CaptchaDiv`, like `#captchaCode` (see `answerBox`):
|
|
202
|
+
* without it the code was typed and never sent (live 0/9, 2026-11-13). Only vendor-named selectors widen, so a
|
|
203
|
+
* login form's own Submit is never pressed.
|
|
204
|
+
*/
|
|
197
205
|
private getVerifyButton;
|
|
198
206
|
/** Any element at `selector` carrying a non-blank value; response fields are hidden, so no visibility filter. */
|
|
199
207
|
private hasValue;
|
|
@@ -261,6 +269,14 @@ export declare class CaptchaKrakenSolver {
|
|
|
261
269
|
* GRID_LOAD_CAP_FACTOR times that, or the solve's deadline.
|
|
262
270
|
*/
|
|
263
271
|
private waitForGridCellsLoaded;
|
|
272
|
+
/**
|
|
273
|
+
* The board's tiles as [x0, y0, x1, y1] pixels of `shotPath`, a screenshot of `captchaElement`, in reading order.
|
|
274
|
+
*
|
|
275
|
+
* Read from the vendor's own markup, not the picture: a tile is where the challenge frame placed it. Tile and
|
|
276
|
+
* iframe boxes are both in page pixels, so a tile less the iframe's corner, scaled, lands on the screenshot.
|
|
277
|
+
* Null when the vendor names no tiles or the frame shows fewer than four.
|
|
278
|
+
*/
|
|
279
|
+
private domGrid;
|
|
264
280
|
private getGridBoxes;
|
|
265
281
|
private bboxToCell;
|
|
266
282
|
private cellCenterPage;
|
|
@@ -325,7 +341,11 @@ export declare class CaptchaKrakenSolver {
|
|
|
325
341
|
* takes a different question (a retry mode, a film) or one of the model's other plans. */
|
|
326
342
|
private anotherMoveLeft;
|
|
327
343
|
private boardStayedSilent;
|
|
328
|
-
/**
|
|
344
|
+
/**
|
|
345
|
+
* The board's identity, from a photograph of its own: a filmed frame of an unchanged board differs in bytes, and so
|
|
346
|
+
* does one wearing the vendor's verdict message, a toast that comes and goes over the same board (see
|
|
347
|
+
* TRIBAL_KNOWLEDGE.md). The message is left out of the picture, not waited out.
|
|
348
|
+
*/
|
|
329
349
|
private boardHash;
|
|
330
350
|
/** A cache hit costs no inference, and means the answer already ran: the board cycles. */
|
|
331
351
|
private answerFor;
|
|
@@ -395,12 +415,37 @@ export declare class CaptchaKrakenSolver {
|
|
|
395
415
|
private executeDrag;
|
|
396
416
|
private findControl;
|
|
397
417
|
/**
|
|
398
|
-
* The
|
|
399
|
-
* element's box.
|
|
418
|
+
* The vendor's own `bar`, else the track of its first slider handle, visible with its centre outside the widget
|
|
419
|
+
* element's box. The bar is what Yidun's click modes need: `.yidun_control` holds the 请依次点击 prompt that names the
|
|
420
|
+
* marks and their order, and on the bare `.yidun_panel` the pointer was shown neither (live 0/6 on 2026-11-13). The
|
|
421
|
+
* handle's track covers vendors that name only a handle. Either is looked for in the widget, then in its parent and grandparent: Yidun's `.yidun_slider` is in
|
|
400
422
|
* `.yidun_control`, a sibling of the `.yidun_panel` the widget resolves to. A match inside the widget is passed over,
|
|
401
423
|
* not taken as the answer: Yidun lists its piece (`.yidun_jigsaw`, in the panel) as a handle too. The track (the
|
|
402
424
|
* handle's parent) is returned rather than the handle, whose box moves as it slides and would resize the frame.
|
|
403
425
|
*/
|
|
426
|
+
/**
|
|
427
|
+
* The element whose screenshot the model is shown for `widget`, and the text box when it is typed. This is the whole
|
|
428
|
+
* of what the client PHOTOGRAPHS, kept in one place so the capture gate can check it without solving: the widget,
|
|
429
|
+
* else the board its frame pads (Proton), widened by a text box beside it (BotDetect) or by the vendor's bar or
|
|
430
|
+
* slider track outside it (Yidun).
|
|
431
|
+
*/
|
|
432
|
+
private framed;
|
|
433
|
+
/**
|
|
434
|
+
* The widget on `page` and the element the solver would photograph for it, without solving anything. For release
|
|
435
|
+
* gates: whether the client finds a vendor's widget, by its selectors and URL markers, and frames the whole board,
|
|
436
|
+
* is checkable on a live page at no inference cost. A checkbox widget is returned with its own element.
|
|
437
|
+
*/
|
|
438
|
+
capture(page: Page): Promise<{
|
|
439
|
+
widget: Widget;
|
|
440
|
+
element: ElementHandle;
|
|
441
|
+
} | null>;
|
|
442
|
+
/**
|
|
443
|
+
* The vendor's own `board`, found in the widget's frame or a frame nested in it, or null. Proton's widget frame is
|
|
444
|
+
* 682x600 with its 370x534 `.protonCaptchaContainer` centred two frames down; the pointer trained on that container,
|
|
445
|
+
* and shown the padded frame it repeated one answer until the solve gave up (live 0/2 on 2026-11-13). The board is
|
|
446
|
+
* drawn a moment after the frame, so it is waited for briefly.
|
|
447
|
+
*/
|
|
448
|
+
private boardInside;
|
|
404
449
|
private trackOutside;
|
|
405
450
|
/**
|
|
406
451
|
* The text box inside the widget, else a vendor-named one in its enclosing fieldset/form, never the page: the generic
|