captchakraken 5.0.0-beta.41 → 5.0.0-beta.43

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.
@@ -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>;
@@ -101,6 +102,7 @@ export interface PlaywrightPage extends PlaywrightScope {
101
102
  screenshot(options?: {
102
103
  timeout?: number;
103
104
  animations?: 'disabled' | 'allow';
105
+ style?: string;
104
106
  }): Promise<Buffer>;
105
107
  /** Optional: the mouse humanizer asks the window for its size when `viewportSize()` is null (camoufox). */
106
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
- screenshot: (options) => h.screenshot(options),
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.
@@ -54,6 +54,13 @@ export interface VendorSelectors {
54
54
  readonly board?: readonly string[];
55
55
  /** Inside the widget: the piece, measured to steer the slide and dragged directly when there is no track. */
56
56
  readonly piece?: readonly string[];
57
+ /**
58
+ * Inside the widget: picture strips a slide rolls by their background (DingXiang's restore bands). Which strip rolls,
59
+ * and how far per handle pixel, are dealt per board and cannot be seen in the picture, so each strip's background
60
+ * offset is read while the handle moves and the slide stops when the one that rolls has rolled as far as the
61
+ * answer's two points are apart.
62
+ */
63
+ readonly band?: readonly string[];
57
64
  /** Inside the widget: the control that deals a new puzzle, pressed when the model answers `refresh`. */
58
65
  readonly refresh?: readonly string[];
59
66
  /**
@@ -81,7 +88,7 @@ export interface SelectorConfig {
81
88
  readonly vendors: ReadonlyArray<readonly [Vendor, VendorSelectors]>;
82
89
  readonly generic: Readonly<Record<GenericKey, readonly string[]>>;
83
90
  }
84
- declare const GENERIC: readonly ["submit_text", "text_input", "slider_handle", "piece"];
91
+ declare const GENERIC: readonly ["submit_text", "text_input", "slider_handle", "piece", "feedback"];
85
92
  type GenericKey = (typeof GENERIC)[number];
86
93
  /**
87
94
  * The default config: the repository's own `captchakraken.config.json` when this package runs from a checkout, so an
@@ -137,6 +144,8 @@ export declare class SelectorTable {
137
144
  readonly sliderHandle: readonly string[];
138
145
  readonly refresh: readonly string[];
139
146
  readonly piece: readonly string[];
147
+ /** The verdict messages a widget shows over its board: every vendor's banners, then the generic ones. */
148
+ readonly feedback: readonly string[];
140
149
  constructor(custom?: CustomSelectors, config?: string | SelectorConfigFile | SelectorConfig);
141
150
  }
142
151
  export declare const DEFAULT_TABLE: SelectorTable;
package/dist/selectors.js CHANGED
@@ -22,11 +22,11 @@ class SelectorConfigError extends Error {
22
22
  }
23
23
  }
24
24
  exports.SelectorConfigError = SelectorConfigError;
25
- const GENERIC = ['submit_text', 'text_input', 'slider_handle', 'piece'];
25
+ const GENERIC = ['submit_text', 'text_input', 'slider_handle', 'piece', 'feedback'];
26
26
  // The file is spelled as the Python port's fields; these three are camelCase here.
27
27
  const CAMEL = { text_input: 'textInput', slider_handle: 'sliderHandle', hold_completes: 'holdCompletes' };
28
28
  const FIELDS = ['hosts', 'challenge', 'checkbox', 'enclave', 'widget', 'response', 'checked', 'box', 'accepted', 'fresh',
29
- 'images', 'tiles', 'submit', 'banners', 'blocked', 'passive', 'text_input', 'slider_handle', 'bar', 'board', 'piece', 'refresh', 'hold_completes'];
29
+ 'images', 'tiles', 'submit', 'banners', 'blocked', 'passive', 'text_input', 'slider_handle', 'bar', 'board', 'piece', 'band', 'refresh', 'hold_completes'];
30
30
  const ONE = new Set(['response', 'checked', 'accepted', 'fresh']);
31
31
  const BANNERS = new Set(Object.values(kinds_1.RecaptchaBanner));
32
32
  const VENDOR_VALUES = new Set(Object.values(kinds_1.Vendor));
@@ -206,6 +206,7 @@ class SelectorTable {
206
206
  this.sliderHandle = [...every('sliderHandle'), ...loaded.generic.slider_handle];
207
207
  this.refresh = every('refresh');
208
208
  this.piece = [...every('piece'), ...loaded.generic.piece];
209
+ this.feedback = [...this.vendors.flatMap(([, s]) => (s.banners ?? []).map(([sel]) => sel)), ...loaded.generic.feedback];
209
210
  }
210
211
  }
211
212
  exports.SelectorTable = SelectorTable;
package/dist/solver.d.ts CHANGED
@@ -26,6 +26,23 @@ export interface Widget {
26
26
  * `boundingBox` is the union everywhere the round reads it; everything else is the element's own.
27
27
  */
28
28
  export declare function withAnswerBox(el: ElementHandle, box: ElementHandle, maxGrowth?: number): ElementHandle;
29
+ /** One read of a `band` strip: how far its picture sits right of where it started (background offset plus box), its rows, and the width its picture repeats at. */
30
+ export interface BandRead {
31
+ x: number;
32
+ top: number;
33
+ bottom: number;
34
+ period: number;
35
+ }
36
+ /**
37
+ * How far the band that rolled must roll in all, in CSS px, for the answer's two points to meet; null when no band
38
+ * rolled. The answer names a point on one band and where it belongs on the other. When the point's own band rolls it
39
+ * travels to the target; when the target's band rolls the target travels to the point. A band repeats, so the roll
40
+ * is taken the way the probe showed it going, within one turn of its picture.
41
+ */
42
+ export declare function bandRoll(rest: readonly BandRead[], now: readonly BandRead[], seed: readonly [number, number], goal: readonly [number, number]): {
43
+ band: number;
44
+ roll: number;
45
+ } | null;
29
46
  /** An allow-list of what needs nothing: the other direction raises instead of clicking at the origin. */
30
47
  export declare function answerNeedsElementBox(actions: ReadonlyArray<{
31
48
  action?: string;
@@ -56,6 +73,8 @@ export declare class CaptchaKrakenSolver {
56
73
  private videoBudgetGranted;
57
74
  private human;
58
75
  private sel;
76
+ /** A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown. */
77
+ private get feedbackHidden();
59
78
  private stepIndex;
60
79
  private solveStartMs;
61
80
  private cvWorker;
@@ -339,7 +358,11 @@ export declare class CaptchaKrakenSolver {
339
358
  * takes a different question (a retry mode, a film) or one of the model's other plans. */
340
359
  private anotherMoveLeft;
341
360
  private boardStayedSilent;
342
- /** The board's identity, always from a plain photograph: a filmed frame of an unchanged board differs in bytes. */
361
+ /**
362
+ * The board's identity, from a photograph of its own: a filmed frame of an unchanged board differs in bytes, and so
363
+ * does one wearing the vendor's verdict message, a toast that comes and goes over the same board (see
364
+ * TRIBAL_KNOWLEDGE.md). The message is left out of the picture, not waited out.
365
+ */
343
366
  private boardHash;
344
367
  /** A cache hit costs no inference, and means the answer already ran: the board cycles. */
345
368
  private answerFor;
@@ -450,12 +473,28 @@ export declare class CaptchaKrakenSolver {
450
473
  private executeType;
451
474
  /** One look of the slide loop (`slide_tracker.py` behind the CV worker); null when the part cannot be followed. */
452
475
  private slideStep;
476
+ /** The vendor's `band` strips inside the widget, in table order; none for a vendor that names none. */
477
+ private bandsOf;
478
+ /** Where each band's picture sits now (`BandRead`), in page CSS px. */
479
+ private readBands;
480
+ /** Which band the probe rolled and how far it must roll in all (`bandRoll`); a zero is read again before it is believed. */
481
+ private bandRolling;
482
+ /**
483
+ * One look of the slide loop for a band, in the tracker's terms (shot pixels): how far the rolling band has gone
484
+ * against how far it must, and the travel that closes the gap at the roll per handle pixel seen so far.
485
+ */
486
+ private bandStep;
453
487
  private shotScale;
454
488
  /**
455
489
  * Press the handle, nudge it to see what it moves, then steer that part's point onto its target. Release is the submit.
456
490
  * A generation-3 answer names all three points, so nothing is read from the page but pixels. A generation-2 answer
457
491
  * names only the target: its handle comes from the selector table and the part it moves is whatever moved most.
458
492
  * That path goes when the last generation-2 model does.
493
+ *
494
+ * A vendor that names `band`s (DingXiang's restore) is steered by the DOM instead: the handle rolls one of two
495
+ * picture strips, which one and how far per handle pixel are dealt per board, and the answer's point sits on one
496
+ * strip and its target on the other, so there is no single moving part for pixels to follow. The strips'
497
+ * background offsets say exactly how far the one that rolls has gone.
459
498
  */
460
499
  private executeSlide;
461
500
  }
package/dist/solver.js CHANGED
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.CaptchaKrakenSolver = exports.SOLVE_DEFAULTS = exports.HOLD_MAX_MS = exports.HOLD_SETTLE_MS = exports.GRID_LOAD_CAP_FACTOR = exports.IDLE_DRIFT_PX = exports.IDLE_DRIFT_EVERY_MS = exports.INPUT_SETTLE_MS = void 0;
37
37
  exports.withAnswerBox = withAnswerBox;
38
+ exports.bandRoll = bandRoll;
38
39
  exports.answerNeedsElementBox = answerNeedsElementBox;
39
40
  exports.isStaleHandleError = isStaleHandleError;
40
41
  exports.isClosedTargetError = isClosedTargetError;
@@ -191,6 +192,37 @@ const SLIDE_PROBE_PX = 8;
191
192
  // pushing on only carries the pointer away from the handle. Mirrors page_solver.py SLIDE_STALL_PX.
192
193
  const SLIDE_STALL_PX = 1;
193
194
  const slideOffset = (s) => (Array.isArray(s) ? [s[0], s[1]] : [s, 0]);
195
+ // A band whose background moved less than this (CSS px) did not roll. The first drag after a reload can leave every
196
+ // band where it was, so a zero is read twice before it is believed.
197
+ const BAND_STILL_PX = 0.5;
198
+ /**
199
+ * How far the band that rolled must roll in all, in CSS px, for the answer's two points to meet; null when no band
200
+ * rolled. The answer names a point on one band and where it belongs on the other. When the point's own band rolls it
201
+ * travels to the target; when the target's band rolls the target travels to the point. A band repeats, so the roll
202
+ * is taken the way the probe showed it going, within one turn of its picture.
203
+ */
204
+ function bandRoll(rest, now, seed, goal) {
205
+ let band = -1;
206
+ let moved = 0;
207
+ now.forEach((b, i) => {
208
+ const d = b.x - (rest[i]?.x ?? b.x);
209
+ if (Math.abs(d) > Math.abs(moved)) {
210
+ band = i;
211
+ moved = d;
212
+ }
213
+ });
214
+ if (band < 0 || Math.abs(moved) < BAND_STILL_PX)
215
+ return null;
216
+ const b = now[band];
217
+ const on = (y) => y >= b.top && y < b.bottom;
218
+ let roll = on(goal[1]) && !on(seed[1]) ? seed[0] - goal[0] : goal[0] - seed[0];
219
+ if (b.period > 0) {
220
+ roll = ((roll % b.period) + b.period) % b.period;
221
+ if (moved < 0 && roll > 0)
222
+ roll -= b.period;
223
+ }
224
+ return { band, roll };
225
+ }
194
226
  /** Did the handle travel while the part stayed put? Each side is the travel and the part's point of one look. */
195
227
  const slideStalled = (before, now, k) => {
196
228
  const [ax, ay] = slideOffset(before[0]);
@@ -290,6 +322,10 @@ function hostname(page) {
290
322
  }
291
323
  }
292
324
  class CaptchaKrakenSolver {
325
+ /** A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown. */
326
+ get feedbackHidden() {
327
+ return this.sel.feedback.map((s) => `${s} { display: none !important; }`).join('\n');
328
+ }
293
329
  ph(name, fn) {
294
330
  return this.budget ? this.budget.phase(name, fn) : fn();
295
331
  }
@@ -382,17 +418,17 @@ class CaptchaKrakenSolver {
382
418
  * repaints nothing, and measured twice as fast. `disabled` freezes CSS animation, which once sliced GeeTest svg to
383
419
  * a static clip; callers filming motion pass `allow`.
384
420
  */
385
- async shot(el, p, timeout = 2500, animations = 'disabled') {
421
+ async shot(el, p, timeout = 2500, animations = 'disabled', style) {
386
422
  const page = this.page;
387
423
  const view = await viewportOf(page);
388
424
  const rect = (await layoutIsTheViewport(page, view)) ? await this.rectInView(el, view) : null;
389
425
  if (!rect) {
390
426
  // Bigger than the viewport, or a zoomed-out mobile layout: no viewport capture holds it in its own
391
427
  // coordinates, so the element photographs itself.
392
- await el.screenshot({ path: p, timeout, animations });
428
+ await el.screenshot({ path: p, timeout, animations, style });
393
429
  return;
394
430
  }
395
- fs.writeFileSync(p, (0, png_1.cropPng)(await page.screenshot({ timeout, animations }), rect, view.width));
431
+ fs.writeFileSync(p, (0, png_1.cropPng)(await page.screenshot({ timeout, animations, style }), rect, view.width));
396
432
  }
397
433
  async rectOf(el) {
398
434
  const box = await el.boundingBox();
@@ -881,7 +917,7 @@ class CaptchaKrakenSolver {
881
917
  else {
882
918
  await this.ph(kinds_1.Phase.SCREENSHOT, () => this.shot(captchaElement, screenshotPath, cfg.elementScreenshotTimeoutMs ?? 8000));
883
919
  }
884
- const boardHash = await this.boardHash(captchaElement, screenshotPath, filmed);
920
+ const boardHash = await this.boardHash(captchaElement);
885
921
  // A refresh that brought the same picture back has replaced nothing, and every plan has been spent on it.
886
922
  if (this.refreshedBoards.has(boardHash))
887
923
  throw new Error('No progress: the board came back unchanged after a refresh.');
@@ -1085,7 +1121,7 @@ class CaptchaKrakenSolver {
1085
1121
  await this.emitStep(captchaElement, kinds_1.SolveStage.CLICK, `clicked ${bboxes.length || 1} target(s)`, puzzleSource, frameRole, attempt, { bboxes });
1086
1122
  }
1087
1123
  else if (action.action === kinds_1.ActionKind.SLIDE || (action.action === kinds_1.ActionKind.DRAG && !action.source_bounding_box)) {
1088
- if (await this.executeSlide(page, captchaElement, scope, action, requireBox())) {
1124
+ if (await this.executeSlide(page, captchaElement, scope, action, requireBox(), puzzleSource)) {
1089
1125
  performedAction = slid = true;
1090
1126
  await this.emitStep(captchaElement, kinds_1.SolveStage.DRAG, 'slid the piece into the slot', puzzleSource, frameRole, attempt, { action });
1091
1127
  }
@@ -2462,13 +2498,15 @@ class CaptchaKrakenSolver {
2462
2498
  const log = this.verdicts;
2463
2499
  return !!log?.listening && log.exchanges === this.exchangesAtAnswer;
2464
2500
  }
2465
- /** The board's identity, always from a plain photograph: a filmed frame of an unchanged board differs in bytes. */
2466
- async boardHash(element, shot, filmed) {
2467
- if (!filmed)
2468
- return sha1(shot);
2501
+ /**
2502
+ * The board's identity, from a photograph of its own: a filmed frame of an unchanged board differs in bytes, and so
2503
+ * does one wearing the vendor's verdict message, a toast that comes and goes over the same board (see
2504
+ * TRIBAL_KNOWLEDGE.md). The message is left out of the picture, not waited out.
2505
+ */
2506
+ async boardHash(element) {
2469
2507
  const plain = tmp('board');
2470
2508
  try {
2471
- await this.shot(element, plain, this.config.elementScreenshotTimeoutMs ?? 8000);
2509
+ await this.shot(element, plain, this.config.elementScreenshotTimeoutMs ?? 8000, 'disabled', this.feedbackHidden);
2472
2510
  return sha1(plain);
2473
2511
  }
2474
2512
  finally {
@@ -3118,6 +3156,52 @@ class CaptchaKrakenSolver {
3118
3156
  }
3119
3157
  return res;
3120
3158
  }
3159
+ /** The vendor's `band` strips inside the widget, in table order; none for a vendor that names none. */
3160
+ async bandsOf(scope, vendor) {
3161
+ const own = this.sel.selectors[vendor]?.band;
3162
+ return own?.length ? handles(await visible(scope, own)).catch(() => []) : [];
3163
+ }
3164
+ /** Where each band's picture sits now (`BandRead`), in page CSS px. */
3165
+ async readBands(bands) {
3166
+ return Promise.all(bands.map(async (band) => {
3167
+ const box = await band.boundingBox().catch(() => null);
3168
+ const [x, period] = await band.evaluate((el) => {
3169
+ const cs = getComputedStyle(el);
3170
+ const px = (v) => (/^-?[\d.]+px/.test(v.trim()) ? parseFloat(v) : 0);
3171
+ return [px(cs.backgroundPositionX), px(cs.backgroundSize.split(/[\s,]/)[0] ?? '')];
3172
+ }).catch(() => [0, 0]);
3173
+ return { x: x + (box?.x ?? 0), top: box?.y ?? 0, bottom: (box?.y ?? 0) + (box?.height ?? 0), period: period || (box?.width ?? 0) };
3174
+ }));
3175
+ }
3176
+ /** Which band the probe rolled and how far it must roll in all (`bandRoll`); a zero is read again before it is believed. */
3177
+ async bandRolling(bands, rest, seed, goal) {
3178
+ let rolling = bandRoll(rest, await this.readBands(bands), seed, goal);
3179
+ if (!rolling) {
3180
+ await this.human.pause(kinds_1.PauseKind.PROBE);
3181
+ rolling = bandRoll(rest, await this.readBands(bands), seed, goal);
3182
+ }
3183
+ if (rolling)
3184
+ console.log(`[slide] band ${rolling.band + 1} of ${bands.length} rolls; it must roll ${rolling.roll.toFixed(1)}px`);
3185
+ else
3186
+ console.warn('[slide] no band rolled with the handle; steering by pixels');
3187
+ return rolling;
3188
+ }
3189
+ /**
3190
+ * One look of the slide loop for a band, in the tracker's terms (shot pixels): how far the rolling band has gone
3191
+ * against how far it must, and the travel that closes the gap at the roll per handle pixel seen so far.
3192
+ */
3193
+ async bandStep(bands, rest, rolling, s, rolled, k, ask) {
3194
+ const d = ((await this.readBands(bands))[rolling.band].x - rest[rolling.band].x) * k;
3195
+ rolled.push([s, d]);
3196
+ const ss = rolled.reduce((a, [t]) => a + t * t, 0);
3197
+ const slope = ss > 0 ? rolled.reduce((a, [t, m]) => a + t * m, 0) / ss : 0;
3198
+ const gap = rolling.roll * k - d;
3199
+ const next = slope ? Math.min(Math.max(s + gap / slope, ask.bounds[0]), ask.bounds[1]) : s;
3200
+ return {
3201
+ pos: [ask.seed[0] + d, ask.seed[1]], params: [0, d, 0], error: Math.abs(gap), grabbed: false, kind: 'slide', next,
3202
+ done: Math.abs(gap) <= ask.tol, correlation: 1, observation: { s, params: [0, d, 0] },
3203
+ };
3204
+ }
3121
3205
  shotScale(shot, cssWidth) {
3122
3206
  const dims = readPngDimensions(shot);
3123
3207
  return dims && cssWidth > 0 ? dims.width / cssWidth : 1;
@@ -3127,8 +3211,13 @@ class CaptchaKrakenSolver {
3127
3211
  * A generation-3 answer names all three points, so nothing is read from the page but pixels. A generation-2 answer
3128
3212
  * names only the target: its handle comes from the selector table and the part it moves is whatever moved most.
3129
3213
  * That path goes when the last generation-2 model does.
3214
+ *
3215
+ * A vendor that names `band`s (DingXiang's restore) is steered by the DOM instead: the handle rolls one of two
3216
+ * picture strips, which one and how far per handle pixel are dealt per board, and the answer's point sits on one
3217
+ * strip and its target on the other, so there is no single moving part for pixels to follow. The strips'
3218
+ * background offsets say exactly how far the one that rolls has gone.
3130
3219
  */
3131
- async executeSlide(page, element, scope, action, elementBox) {
3220
+ async executeSlide(page, element, scope, action, elementBox, vendor) {
3132
3221
  this.actedOnBoard = true;
3133
3222
  const { width: w, height: h } = elementBox;
3134
3223
  const at = (b) => [((b[0] + b[2]) / 2) * w, ((b[1] + b[3]) / 2) * h];
@@ -3155,10 +3244,12 @@ class CaptchaKrakenSolver {
3155
3244
  const probe = goal[0] >= (seed ?? handle)[0] ? SLIDE_PROBE_PX : -SLIDE_PROBE_PX;
3156
3245
  const timeout = this.config.elementScreenshotTimeoutMs ?? 8000;
3157
3246
  const [first, probed, current] = [tmp('slide_0'), tmp('slide_1'), tmp('slide_2')];
3247
+ const bands = seed && vendor ? await this.bandsOf(scope, vendor) : [];
3158
3248
  try {
3159
3249
  await this.performSmoothMove(page, ...press);
3160
3250
  await this.human.press(page);
3161
3251
  await this.human.pause(kinds_1.PauseKind.GRAB);
3252
+ const rest = bands.length ? await this.readBands(bands) : null;
3162
3253
  await this.shot(element, first, timeout);
3163
3254
  const k = this.shotScale(first, w);
3164
3255
  await this.performSmoothMove(page, press[0] + probe, press[1]);
@@ -3168,12 +3259,17 @@ class CaptchaKrakenSolver {
3168
3259
  first, probe: probed, probe_s: probe * k, goal: [goal[0] * k, goal[1] * k], seed: seed && [seed[0] * k, seed[1] * k],
3169
3260
  handle: [handle[0] * k, handle[1] * k], bounds: [-handle[0] * k, (w - handle[0]) * k], tol: SLIDE_TOLERANCE_PX * k,
3170
3261
  };
3262
+ const page_ = (p) => [elementBox.x + p[0], elementBox.y + p[1]];
3263
+ const rolling = rest && seed ? await this.bandRolling(bands, rest, page_(seed), page_(goal)) : null;
3171
3264
  let look = probed;
3172
3265
  let s = probe * k;
3173
3266
  const history = [];
3267
+ const rolled = [];
3174
3268
  let last = null;
3175
3269
  for (let moves = 0;; moves++) {
3176
- const reply = await this.slideStep({ ...ask, current: look, s, history });
3270
+ const reply = rolling
3271
+ ? await this.bandStep(bands, rest, rolling, s, rolled, k, { ...ask, seed: ask.seed })
3272
+ : await this.slideStep({ ...ask, current: look, s, history });
3177
3273
  if (!reply)
3178
3274
  break;
3179
3275
  if (look !== probed)
@@ -3195,6 +3291,8 @@ class CaptchaKrakenSolver {
3195
3291
  const [dx, dy] = slideOffset(s);
3196
3292
  await this.performSmoothMove(page, press[0] + dx / k, press[1] + dy / k);
3197
3293
  await this.human.pause(kinds_1.PauseKind.PROBE);
3294
+ if (rolling)
3295
+ continue;
3198
3296
  await this.shot(element, current, timeout);
3199
3297
  look = current;
3200
3298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "captchakraken",
3
- "version": "5.0.0-beta.41",
3
+ "version": "5.0.0-beta.43",
4
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.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "captchakraken"
7
- version = "5.0.0b41"
7
+ version = "5.0.0b43"
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.0b41"
103
+ __version__ = "5.0.0b43"
@@ -22,7 +22,9 @@
22
22
  "`hold_completes` (true or false). `note` is for people, not the solver.",
23
23
  "",
24
24
  "generic: the fallbacks tried after every vendor's own. `submit_text` is the",
25
- "button text probed for a submit control, in order.",
25
+ "button text probed for a submit control, in order. `feedback` (CSS only) names the",
26
+ "verdict messages, such as a \"Please try again\" toast, that the photograph telling",
27
+ "one board from the next leaves out; every vendor's `banners` are left out too.",
26
28
  "",
27
29
  "Keys starting with `_` are comments. Field reference: `_fields`."
28
30
  ],
@@ -48,6 +50,7 @@
48
50
  "board": "Inside the widget's frame or a frame nested in it: the element that is the board itself, when the widget frame pads it. The shot is this element, so the model sees the crop it was trained on.",
49
51
  "bar": "Beside the widget (a sibling of it, or of its parent): a strip the vendor draws outside the widget element that every board carries, such as Yidun's prompt and slider bar. The shot takes it in, so the model sees what it was trained on.",
50
52
  "piece": "Inside the widget: the piece, measured to steer the slide and dragged directly when there is no track.",
53
+ "band": "Inside the widget: picture strips a slide rolls by their background, such as DingXiang's restore bands. Which strip rolls, and how far per handle pixel, are dealt per board and cannot be seen in the picture (see TRIBAL_KNOWLEDGE.md), so each strip's background offset is read while the handle moves, and the slide stops when the strip that rolls has rolled as far as the answer's two points are apart.",
51
54
  "refresh": "Inside the widget: the control that deals a new puzzle, pressed when the model answers `refresh`.",
52
55
  "hold_completes": "A press-and-hold that completes on its own once full, and resets when let go before it has: the fill reaching the answer's `to` is not a release, and the hold lasts until the widget says it is done."
53
56
  },
@@ -361,6 +364,10 @@
361
364
  "slider_handle": [
362
365
  ".dx_captcha_basic_slider",
363
366
  ".dx_captcha_rotate_slider"
367
+ ],
368
+ "band": [
369
+ ".dx_captcha_basic_pic .upper",
370
+ ".dx_captcha_basic_pic .lower"
364
371
  ]
365
372
  },
366
373
  "funcaptcha": {
@@ -456,6 +463,11 @@
456
463
  "piece": [
457
464
  "[class*=\"puzzle\"][class*=\"piece\"]",
458
465
  "[class*=\"jigsaw\"]"
466
+ ],
467
+ "feedback": [
468
+ "[role=\"alert\"]",
469
+ "[class*=\"toast\" i]",
470
+ "[id*=\"toast\" i]"
459
471
  ]
460
472
  }
461
473
  }
@@ -73,6 +73,20 @@ def _unlink(path: Optional[str]) -> None:
73
73
  pass
74
74
 
75
75
 
76
+ def _shot(take: Any, style: Optional[str], **kwargs: Any) -> Any:
77
+ """`take(**kwargs)` with `style` when there is one. Playwright before 1.41 has no `style` and raises TypeError;
78
+ that capture is then taken without it, so an older install keeps solving and only the board hash loses the
79
+ feedback mask."""
80
+ if style is None:
81
+ return take(**kwargs)
82
+ try:
83
+ return take(style=style, **kwargs)
84
+ except TypeError as exc:
85
+ if "style" not in str(exc):
86
+ raise
87
+ return take(**kwargs)
88
+
89
+
76
90
  def _sha1(path: str) -> str:
77
91
  with open(path, "rb") as fh:
78
92
  return hashlib.sha1(fh.read()).hexdigest()
@@ -501,6 +515,46 @@ def _offset(s: Any) -> Tuple[float, float]:
501
515
  return (float(s[0]), float(s[1])) if isinstance(s, (list, tuple)) else (float(s), 0.0)
502
516
 
503
517
 
518
+ # A band whose background moved less than this (CSS px) did not roll. The first drag after a reload can leave every
519
+ # band where it was, so a zero is read twice before it is believed.
520
+ BAND_STILL_PX = 0.5
521
+
522
+ _BAND_READ_JS = """(el) => {
523
+ const cs = getComputedStyle(el);
524
+ const px = (v) => (/^-?[\\d.]+px/.test((v || '').trim()) ? parseFloat(v) : 0);
525
+ return [px(cs.backgroundPositionX), px((cs.backgroundSize || '').split(/[\\s,]/)[0])];
526
+ }"""
527
+
528
+
529
+ def band_roll(rest: Sequence[Dict[str, float]], now: Sequence[Dict[str, float]], seed: Sequence[float],
530
+ goal: Sequence[float]) -> Optional[Tuple[int, float]]:
531
+ """(which band rolled, how far it must roll in all) in CSS px for the answer's two points to meet; None when none did.
532
+
533
+ Each read is a band's `x` (how far its picture sits right of where it started), its rows `top`..`bottom` and the
534
+ `period` its picture repeats at. The answer names a point on one band and where it belongs on the other. When the
535
+ point's own band rolls it travels to the target; when the target's band rolls the target travels to the point. A
536
+ band repeats, so the roll is taken the way the probe showed it going, within one turn of its picture.
537
+ """
538
+ band, moved = -1, 0.0
539
+ for i, b in enumerate(now):
540
+ d = b["x"] - (rest[i]["x"] if i < len(rest) else b["x"])
541
+ if abs(d) > abs(moved):
542
+ band, moved = i, d
543
+ if band < 0 or abs(moved) < BAND_STILL_PX:
544
+ return None
545
+ b = now[band]
546
+
547
+ def on(y: float) -> bool:
548
+ return b["top"] <= y < b["bottom"]
549
+
550
+ roll = seed[0] - goal[0] if on(goal[1]) and not on(seed[1]) else goal[0] - seed[0]
551
+ if b["period"] > 0:
552
+ roll %= b["period"]
553
+ if moved < 0 and roll > 0:
554
+ roll -= b["period"]
555
+ return band, roll
556
+
557
+
504
558
  def _stalled(before: Tuple[Any, Sequence[float]], now: Tuple[Any, Sequence[float]], k: float) -> bool:
505
559
  """Did the handle travel while the part stayed put? Each side is (travel, the part's point) of one look."""
506
560
  (ax, ay), (bx, by) = _offset(before[0]), _offset(now[0])
@@ -521,6 +575,8 @@ class PageSolver:
521
575
  self._solver = solver or CaptchaSolver(**solver_kwargs)
522
576
  self._human: Humanizer = resolve_humanizer(self.config)
523
577
  self._sel = SelectorTable(self.config.custom_selectors, config=self.config.selectors)
578
+ # A stylesheet that takes every verdict message out of a photograph, laid out as if it had never been shown.
579
+ self._feedback_hidden = "\n".join(f"{s} {{ display: none !important; }}" for s in self._sel.feedback)
524
580
  self._last_submit_frame_hash: Optional[str] = None
525
581
  self._deadline_ms: Optional[float] = None
526
582
  self._budget: Optional[PhaseBudget] = None
@@ -713,13 +769,17 @@ class PageSolver:
713
769
  if planner is not None and hasattr(planner, "pointer_history"):
714
770
  planner.pointer_history = self._pointer_history
715
771
 
716
- def _board_hash(self, element: Any, shot: str, filmed: bool) -> str:
717
- """The board's identity, always from a plain photograph: a filmed frame of an unchanged board differs in bytes."""
718
- if not filmed:
719
- return _sha1(shot)
772
+ def _board_hash(self, element: Any) -> str:
773
+ """The board's identity, from a photograph of its own.
774
+
775
+ A filmed frame of an unchanged board differs in bytes, and so does one wearing the vendor's verdict message,
776
+ a toast that comes and goes over the same board (see TRIBAL_KNOWLEDGE.md). The message is left out of the
777
+ picture, not waited out.
778
+ """
720
779
  plain = _tmp_png("board")
721
780
  try:
722
- self._screenshot(element, plain, timeout_ms=self.config.element_screenshot_timeout_ms)
781
+ self._screenshot(element, plain, timeout_ms=self.config.element_screenshot_timeout_ms,
782
+ style=self._feedback_hidden)
723
783
  return _sha1(plain)
724
784
  finally:
725
785
  _unlink(plain)
@@ -1220,13 +1280,71 @@ class PageSolver:
1220
1280
  dims = _read_png_dimensions(shot)
1221
1281
  return dims[0] / css_width if dims and css_width > 0 else 1.0
1222
1282
 
1283
+ def _bands_of(self, scope: Any, vendor: Optional[Vendor]) -> List[Any]:
1284
+ """The vendor's `band` strips inside the widget, in table order; none for a vendor that names none."""
1285
+ own = getattr(self._sel.selectors.get(vendor), "band", ()) if vendor is not None else ()
1286
+ return _handles(_visible(scope, own)) if own else []
1287
+
1288
+ @staticmethod
1289
+ def _read_bands(bands: Sequence[Any]) -> List[Dict[str, float]]:
1290
+ """Where each band's picture sits now (see `band_roll`), in page CSS px."""
1291
+ out = []
1292
+ for band in bands:
1293
+ try:
1294
+ box = band.bounding_box() or {}
1295
+ except Exception:
1296
+ box = {}
1297
+ try:
1298
+ x, period = band.evaluate(_BAND_READ_JS)
1299
+ except Exception:
1300
+ x, period = 0.0, 0.0
1301
+ top = float(box.get("y", 0.0))
1302
+ out.append({"x": float(x) + float(box.get("x", 0.0)), "top": top,
1303
+ "bottom": top + float(box.get("height", 0.0)),
1304
+ "period": float(period) or float(box.get("width", 0.0))})
1305
+ return out
1306
+
1307
+ def _band_rolling(self, bands: Sequence[Any], rest: Sequence[Dict[str, float]], seed: Sequence[float],
1308
+ goal: Sequence[float]) -> Optional[Tuple[int, float]]:
1309
+ """Which band the probe rolled and how far it must roll in all (`band_roll`); a zero is read again first."""
1310
+ rolling = band_roll(rest, self._read_bands(bands), seed, goal)
1311
+ if rolling is None:
1312
+ self._human.pause(PauseKind.PROBE)
1313
+ rolling = band_roll(rest, self._read_bands(bands), seed, goal)
1314
+ if rolling is not None:
1315
+ _log(f"slider: band {rolling[0] + 1} of {len(bands)} rolls; it must roll {rolling[1]:.1f}px")
1316
+ else:
1317
+ _log("slider: no band rolled with the handle; steering by pixels")
1318
+ return rolling
1319
+
1320
+ def _band_step(self, bands: Sequence[Any], rest: Sequence[Dict[str, float]], rolling: Tuple[int, float],
1321
+ s: float, rolled: List[Tuple[float, float]], k: float, seed: Sequence[float],
1322
+ bounds: Sequence[float], tol: float) -> Dict[str, Any]:
1323
+ """One look of the slide loop for a band, in the tracker's terms (shot pixels): how far the rolling band has
1324
+ gone against how far it must, and the travel that closes the gap at the roll per handle pixel seen so far."""
1325
+ i, roll = rolling
1326
+ d = (self._read_bands(bands)[i]["x"] - rest[i]["x"]) * k
1327
+ rolled.append((s, d))
1328
+ ss = sum(t * t for t, _ in rolled)
1329
+ slope = sum(t * m for t, m in rolled) / ss if ss > 0 else 0.0
1330
+ gap = roll * k - d
1331
+ nxt = min(max(s + gap / slope, bounds[0]), bounds[1]) if slope else s
1332
+ return {"pos": (seed[0] + d, seed[1]), "params": (0.0, d, 0.0), "error": abs(gap), "grabbed": False,
1333
+ "kind": "slide", "next": nxt, "done": abs(gap) <= tol, "correlation": 1.0,
1334
+ "observation": {"s": s, "params": [0.0, d, 0.0]}}
1335
+
1223
1336
  def _execute_slide(self, page: Any, element: Any, scope: Any, action: Dict[str, Any],
1224
- element_box: Dict[str, float]) -> bool:
1337
+ element_box: Dict[str, float], vendor: Optional[Vendor] = None) -> bool:
1225
1338
  """Press the handle, nudge it to see what it moves, then steer that part's point onto its target.
1226
1339
 
1227
1340
  A generation-3 answer names all three points, so nothing is read from the page but pixels. A generation-2
1228
1341
  answer names only the target: its handle comes from the selector table and the part it moves is whatever
1229
1342
  moved most. That path goes when the last generation-2 model does.
1343
+
1344
+ A vendor that names `band`s (DingXiang's restore) is steered by the DOM instead: the handle rolls one of two
1345
+ picture strips, which one and how far per handle pixel are dealt per board, and the answer's point sits on one
1346
+ strip and its target on the other, so there is no single moving part for pixels to follow. The strips'
1347
+ background offsets say exactly how far the one that rolls has gone.
1230
1348
  """
1231
1349
  from .tool_calls.slide_tracker import TrackingError, slide_step
1232
1350
 
@@ -1254,10 +1372,12 @@ class PageSolver:
1254
1372
  probe = SLIDE_PROBE_PX if goal[0] >= (seed or handle)[0] else -SLIDE_PROBE_PX
1255
1373
  timeout = self.config.element_screenshot_timeout_ms
1256
1374
  first, probed, current = (_tmp_png("slide") for _ in range(3))
1375
+ bands = self._bands_of(scope, vendor) if seed is not None else []
1257
1376
  try:
1258
1377
  self._smooth_move(page, *press)
1259
1378
  self._human.press(page)
1260
1379
  self._human.pause(PauseKind.GRAB)
1380
+ rest = self._read_bands(bands) if bands else None
1261
1381
  self._screenshot(element, first, timeout_ms=timeout)
1262
1382
  k = self._shot_scale(first, w)
1263
1383
  self._smooth_move(page, press[0] + probe, press[1])
@@ -1266,11 +1386,18 @@ class PageSolver:
1266
1386
  ask = dict(probe_s=probe * k, goal=(goal[0] * k, goal[1] * k), seed=seed and (seed[0] * k, seed[1] * k),
1267
1387
  handle=(handle[0] * k, handle[1] * k), bounds=(-handle[0] * k, (w - handle[0]) * k),
1268
1388
  tol=self.config.slide_tolerance_px * k)
1389
+ rolling = None
1390
+ if rest is not None:
1391
+ origin = (element_box["x"], element_box["y"])
1392
+ rolling = self._band_rolling(bands, rest, (origin[0] + seed[0], origin[1] + seed[1]),
1393
+ (origin[0] + goal[0], origin[1] + goal[1]))
1269
1394
  look, s, history, moves = probed, probe * k, [], 0
1395
+ rolled: List[Tuple[float, float]] = []
1270
1396
  last: Optional[Tuple[Any, Sequence[float]]] = None
1271
1397
  while True:
1272
1398
  try:
1273
- reply = slide_step(first, probed, look, s=s, history=history, **ask)
1399
+ reply = (self._band_step(bands, rest, rolling, s, rolled, k, ask["seed"], ask["bounds"], ask["tol"])
1400
+ if rolling is not None else slide_step(first, probed, look, s=s, history=history, **ask))
1274
1401
  except TrackingError as exc:
1275
1402
  _log(f"slider: {exc}; released where the handle is")
1276
1403
  break
@@ -1292,8 +1419,10 @@ class PageSolver:
1292
1419
  dx, dy = _offset(s)
1293
1420
  self._smooth_move(page, press[0] + dx / k, press[1] + dy / k)
1294
1421
  self._human.pause(PauseKind.PROBE)
1295
- self._screenshot(element, current, timeout_ms=timeout)
1296
- look, moves = current, moves + 1
1422
+ moves += 1
1423
+ if rolling is None:
1424
+ self._screenshot(element, current, timeout_ms=timeout)
1425
+ look = current
1297
1426
  self._human.pause(PauseKind.SETTLE)
1298
1427
  finally:
1299
1428
  try:
@@ -1575,13 +1704,13 @@ class PageSolver:
1575
1704
  # ── frames and polling ───────────────────────────────────────────────
1576
1705
 
1577
1706
  def _screenshot(self, element: Any, path: str, timeout_ms: Optional[int] = None,
1578
- animations: str = "disabled") -> None:
1707
+ animations: str = "disabled", style: Optional[str] = None) -> None:
1579
1708
  """Every capture the driver takes: the whole viewport, cropped here to the element.
1580
1709
 
1581
1710
  Never a clipped capture. An element screenshot, or any `clip`, makes a headed Chromium repaint the page at
1582
1711
  the clip's size for that frame, which the user watches as the page flashing and jumping; a viewport
1583
1712
  capture repaints nothing, and measured twice as fast. Short timeout; `disabled` freezes CSS animation,
1584
- so bursts and the keyframe gate pass `allow`.
1713
+ so bursts and the keyframe gate pass `allow`. `style` is CSS applied for this capture only.
1585
1714
  """
1586
1715
  timeout = 2_500 if timeout_ms is None else timeout_ms
1587
1716
  page = self._page
@@ -1590,9 +1719,9 @@ class PageSolver:
1590
1719
  if rect is None:
1591
1720
  # Bigger than the viewport, or a zoomed-out mobile layout: no viewport capture holds it in its own
1592
1721
  # coordinates, so the element photographs itself.
1593
- element.screenshot(path=path, timeout=timeout, animations=animations)
1722
+ _shot(element.screenshot, style, path=path, timeout=timeout, animations=animations)
1594
1723
  return
1595
- png = crop_png(page.screenshot(timeout=timeout, animations=animations), rect, view["width"])
1724
+ png = crop_png(_shot(page.screenshot, style, timeout=timeout, animations=animations), rect, view["width"])
1596
1725
  with open(path, "wb") as fh:
1597
1726
  fh.write(png)
1598
1727
 
@@ -2439,7 +2568,7 @@ class PageSolver:
2439
2568
  if not have_shot:
2440
2569
  with self._phase(Phase.SCREENSHOT):
2441
2570
  self._screenshot(element, shot, timeout_ms=self.config.element_screenshot_timeout_ms)
2442
- self._guard_fallbacks_to_board(self._board_hash(element, shot, filmed=have_shot))
2571
+ self._guard_fallbacks_to_board(self._board_hash(element))
2443
2572
  if self._should_speculate(puzzle_source, text_mode):
2444
2573
  actions, all_usage, keyframe_dir = self._speculate(element, shot, puzzle_source, retry_mode, text_mode)
2445
2574
  is_animated = keyframe_dir is not None
@@ -2488,7 +2617,7 @@ class PageSolver:
2488
2617
  self._human.pause(PauseKind.BETWEEN)
2489
2618
  performed = answered = True
2490
2619
  elif kind == ActionKind.SLIDE or (kind == ActionKind.DRAG and not action.get("source_bounding_box")):
2491
- if self._execute_slide(page, element, scope, action, element_box):
2620
+ if self._execute_slide(page, element, scope, action, element_box, puzzle_source):
2492
2621
  performed = slid = True
2493
2622
  elif kind == ActionKind.DRAG:
2494
2623
  if await_kf:
@@ -66,6 +66,11 @@ class VendorSelectors:
66
66
  board: Sequence[str] = ()
67
67
  # Inside the widget: the piece, measured to steer the slide and dragged directly when there is no track.
68
68
  piece: Sequence[str] = ()
69
+ # Inside the widget: picture strips a slide rolls by their background (DingXiang's restore bands). Which strip
70
+ # rolls, and how far per handle pixel, are dealt per board and cannot be seen in the picture, so each strip's
71
+ # background offset is read while the handle moves and the slide stops when the one that rolls has rolled as far
72
+ # as the answer's two points are apart.
73
+ band: Sequence[str] = ()
69
74
  # Inside the widget: the control that deals a new puzzle, pressed when the model answers `refresh`.
70
75
  refresh: Sequence[str] = ()
71
76
  # A press-and-hold that completes on its own once full, and resets when let go before it has: the fill reaching
@@ -83,7 +88,7 @@ ConfigSource = Union[str, "os.PathLike[str]", Mapping[str, Any]]
83
88
 
84
89
  _FIELDS = {f.name: f for f in fields(VendorSelectors)}
85
90
  _ONE = {"response", "checked", "accepted", "fresh"}
86
- _GENERIC = ("submit_text", "text_input", "slider_handle", "piece")
91
+ _GENERIC = ("submit_text", "text_input", "slider_handle", "piece", "feedback")
87
92
 
88
93
 
89
94
  class SelectorConfigError(ValueError):
@@ -266,6 +271,9 @@ class SelectorTable:
266
271
  self.slider_handle: Sequence[str] = (*self._of_every_vendor("slider_handle"), *loaded.generic["slider_handle"])
267
272
  self.refresh: Sequence[str] = self._of_every_vendor("refresh")
268
273
  self.piece: Sequence[str] = (*self._of_every_vendor("piece"), *loaded.generic["piece"])
274
+ # The verdict messages a widget shows over its board: every vendor's banners, then the generic ones.
275
+ self.feedback: Sequence[str] = (*(sel for _, v in self.vendors for sel, _kind in v.banners),
276
+ *loaded.generic["feedback"])
269
277
 
270
278
  def _of_every_vendor(self, key: str) -> Sequence[str]:
271
279
  assert key in {f.name for f in fields(VendorSelectors)}