@riddledc/riddle-proof 0.7.180 → 0.7.181
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 +2 -0
- package/dist/{chunk-62JD4MJA.js → chunk-T664I6R3.js} +32 -1
- package/dist/cli.cjs +34 -2
- package/dist/cli.js +3 -2
- package/dist/index.cjs +32 -1
- package/dist/index.js +1 -1
- package/dist/profile.cjs +32 -1
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/profile.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -417,6 +417,8 @@ stable enough for Playwright's default click actionability checks. Use `press`
|
|
|
417
417
|
with a Playwright key name, such as `Enter`, `Space`, or `ArrowLeft`,
|
|
418
418
|
when a route's intended browser control is keyboard-driven; omit `selector` for
|
|
419
419
|
a page-level key press, or provide `selector` to press against a focused element.
|
|
420
|
+
For canvas games that read key state rather than keypress events, add `hold_ms`
|
|
421
|
+
or `holdMs` to keep the key down before releasing it.
|
|
420
422
|
Use `click_count` / `clickCount` / `clicks` from 1 to 10 on a single `click`
|
|
421
423
|
action for atomic double-click or double-submit contracts where modeling the
|
|
422
424
|
interaction as repeated setup actions would incorrectly require the target to
|
|
@@ -618,6 +618,7 @@ function profileSetupPressReceipts(results) {
|
|
|
618
618
|
selector: result.selector ?? null,
|
|
619
619
|
frame_selector: result.frame_selector ?? null,
|
|
620
620
|
key: result.key ?? null,
|
|
621
|
+
hold_ms: result.hold_ms ?? null,
|
|
621
622
|
reason: result.reason ?? result.error ?? null
|
|
622
623
|
}));
|
|
623
624
|
}
|
|
@@ -1083,6 +1084,11 @@ function normalizeSetupAction(input, index) {
|
|
|
1083
1084
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
1084
1085
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
1085
1086
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
1087
|
+
const durationMs = numberValue(input.duration_ms) ?? numberValue(input.durationMs);
|
|
1088
|
+
const holdMs = type === "press" ? normalizeSetupActionNonNegativeNumber(input, index, "hold_ms", "hold_ms", "holdMs", "key_down_ms", "keyDownMs", "down_ms", "downMs") ?? durationMs : void 0;
|
|
1089
|
+
if (type === "press" && holdMs !== void 0 && (holdMs < 0 || holdMs > 3e4)) {
|
|
1090
|
+
throw new Error(`target.setup_actions[${index}].hold_ms must be a finite number from 0 to 30000.`);
|
|
1091
|
+
}
|
|
1086
1092
|
if (type === "click") {
|
|
1087
1093
|
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
1088
1094
|
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
@@ -1249,9 +1255,10 @@ function normalizeSetupAction(input, index) {
|
|
|
1249
1255
|
from_y: fromY,
|
|
1250
1256
|
to_x: toX,
|
|
1251
1257
|
to_y: toY,
|
|
1252
|
-
duration_ms:
|
|
1258
|
+
duration_ms: durationMs,
|
|
1253
1259
|
steps,
|
|
1254
1260
|
key,
|
|
1261
|
+
hold_ms: holdMs,
|
|
1255
1262
|
value,
|
|
1256
1263
|
value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
|
|
1257
1264
|
random_queue: randomQueue,
|
|
@@ -4496,6 +4503,7 @@ function profileSetupPressReceipts(results) {
|
|
|
4496
4503
|
selector: result.selector ?? null,
|
|
4497
4504
|
frame_selector: result.frame_selector ?? null,
|
|
4498
4505
|
key: result.key ?? null,
|
|
4506
|
+
hold_ms: result.hold_ms ?? null,
|
|
4499
4507
|
reason: result.reason || result.error || null,
|
|
4500
4508
|
}));
|
|
4501
4509
|
}
|
|
@@ -6432,9 +6440,22 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6432
6440
|
if (type === "press") {
|
|
6433
6441
|
const key = String(action.key || "").trim();
|
|
6434
6442
|
if (!key) return { ...base, reason: "missing_key" };
|
|
6443
|
+
const holdMs = Math.min(30000, Math.max(0, Math.floor(setupNumber(action.hold_ms ?? action.holdMs ?? action.key_down_ms ?? action.keyDownMs ?? action.down_ms ?? action.downMs ?? action.duration_ms ?? action.durationMs, 0) || 0)));
|
|
6435
6444
|
const scope = await setupActionScope(action, timeout);
|
|
6436
6445
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
6437
6446
|
if (!action.selector) {
|
|
6447
|
+
if (holdMs > 0) {
|
|
6448
|
+
if (scope.frame_selector) {
|
|
6449
|
+
await scope.context.locator("body").focus({ timeout }).catch(() => {});
|
|
6450
|
+
}
|
|
6451
|
+
await page.keyboard.down(key);
|
|
6452
|
+
try {
|
|
6453
|
+
await page.waitForTimeout(holdMs);
|
|
6454
|
+
} finally {
|
|
6455
|
+
await page.keyboard.up(key).catch(() => {});
|
|
6456
|
+
}
|
|
6457
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, key, hold_ms: holdMs };
|
|
6458
|
+
}
|
|
6438
6459
|
if (scope.frame_selector) {
|
|
6439
6460
|
await scope.context.locator("body").press(key, { timeout });
|
|
6440
6461
|
} else {
|
|
@@ -6447,6 +6468,16 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6447
6468
|
if (!count) return { ...base, reason: "selector_not_found", count, key };
|
|
6448
6469
|
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
6449
6470
|
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex, key };
|
|
6471
|
+
if (holdMs > 0) {
|
|
6472
|
+
await locator.nth(targetIndex).focus({ timeout });
|
|
6473
|
+
await page.keyboard.down(key);
|
|
6474
|
+
try {
|
|
6475
|
+
await page.waitForTimeout(holdMs);
|
|
6476
|
+
} finally {
|
|
6477
|
+
await page.keyboard.up(key).catch(() => {});
|
|
6478
|
+
}
|
|
6479
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key, hold_ms: holdMs };
|
|
6480
|
+
}
|
|
6450
6481
|
await locator.nth(targetIndex).press(key, { timeout });
|
|
6451
6482
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key };
|
|
6452
6483
|
}
|
package/dist/cli.cjs
CHANGED
|
@@ -7575,6 +7575,7 @@ function profileSetupPressReceipts(results) {
|
|
|
7575
7575
|
selector: result.selector ?? null,
|
|
7576
7576
|
frame_selector: result.frame_selector ?? null,
|
|
7577
7577
|
key: result.key ?? null,
|
|
7578
|
+
hold_ms: result.hold_ms ?? null,
|
|
7578
7579
|
reason: result.reason ?? result.error ?? null
|
|
7579
7580
|
}));
|
|
7580
7581
|
}
|
|
@@ -8040,6 +8041,11 @@ function normalizeSetupAction(input, index) {
|
|
|
8040
8041
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
8041
8042
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
8042
8043
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
8044
|
+
const durationMs = numberValue(input.duration_ms) ?? numberValue(input.durationMs);
|
|
8045
|
+
const holdMs = type === "press" ? normalizeSetupActionNonNegativeNumber(input, index, "hold_ms", "hold_ms", "holdMs", "key_down_ms", "keyDownMs", "down_ms", "downMs") ?? durationMs : void 0;
|
|
8046
|
+
if (type === "press" && holdMs !== void 0 && (holdMs < 0 || holdMs > 3e4)) {
|
|
8047
|
+
throw new Error(`target.setup_actions[${index}].hold_ms must be a finite number from 0 to 30000.`);
|
|
8048
|
+
}
|
|
8043
8049
|
if (type === "click") {
|
|
8044
8050
|
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
8045
8051
|
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
@@ -8206,9 +8212,10 @@ function normalizeSetupAction(input, index) {
|
|
|
8206
8212
|
from_y: fromY,
|
|
8207
8213
|
to_x: toX,
|
|
8208
8214
|
to_y: toY,
|
|
8209
|
-
duration_ms:
|
|
8215
|
+
duration_ms: durationMs,
|
|
8210
8216
|
steps,
|
|
8211
8217
|
key,
|
|
8218
|
+
hold_ms: holdMs,
|
|
8212
8219
|
value,
|
|
8213
8220
|
value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
|
|
8214
8221
|
random_queue: randomQueue,
|
|
@@ -11437,6 +11444,7 @@ function profileSetupPressReceipts(results) {
|
|
|
11437
11444
|
selector: result.selector ?? null,
|
|
11438
11445
|
frame_selector: result.frame_selector ?? null,
|
|
11439
11446
|
key: result.key ?? null,
|
|
11447
|
+
hold_ms: result.hold_ms ?? null,
|
|
11440
11448
|
reason: result.reason || result.error || null,
|
|
11441
11449
|
}));
|
|
11442
11450
|
}
|
|
@@ -13373,9 +13381,22 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13373
13381
|
if (type === "press") {
|
|
13374
13382
|
const key = String(action.key || "").trim();
|
|
13375
13383
|
if (!key) return { ...base, reason: "missing_key" };
|
|
13384
|
+
const holdMs = Math.min(30000, Math.max(0, Math.floor(setupNumber(action.hold_ms ?? action.holdMs ?? action.key_down_ms ?? action.keyDownMs ?? action.down_ms ?? action.downMs ?? action.duration_ms ?? action.durationMs, 0) || 0)));
|
|
13376
13385
|
const scope = await setupActionScope(action, timeout);
|
|
13377
13386
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
13378
13387
|
if (!action.selector) {
|
|
13388
|
+
if (holdMs > 0) {
|
|
13389
|
+
if (scope.frame_selector) {
|
|
13390
|
+
await scope.context.locator("body").focus({ timeout }).catch(() => {});
|
|
13391
|
+
}
|
|
13392
|
+
await page.keyboard.down(key);
|
|
13393
|
+
try {
|
|
13394
|
+
await page.waitForTimeout(holdMs);
|
|
13395
|
+
} finally {
|
|
13396
|
+
await page.keyboard.up(key).catch(() => {});
|
|
13397
|
+
}
|
|
13398
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, key, hold_ms: holdMs };
|
|
13399
|
+
}
|
|
13379
13400
|
if (scope.frame_selector) {
|
|
13380
13401
|
await scope.context.locator("body").press(key, { timeout });
|
|
13381
13402
|
} else {
|
|
@@ -13388,6 +13409,16 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13388
13409
|
if (!count) return { ...base, reason: "selector_not_found", count, key };
|
|
13389
13410
|
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
13390
13411
|
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex, key };
|
|
13412
|
+
if (holdMs > 0) {
|
|
13413
|
+
await locator.nth(targetIndex).focus({ timeout });
|
|
13414
|
+
await page.keyboard.down(key);
|
|
13415
|
+
try {
|
|
13416
|
+
await page.waitForTimeout(holdMs);
|
|
13417
|
+
} finally {
|
|
13418
|
+
await page.keyboard.up(key).catch(() => {});
|
|
13419
|
+
}
|
|
13420
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key, hold_ms: holdMs };
|
|
13421
|
+
}
|
|
13391
13422
|
await locator.nth(targetIndex).press(key, { timeout });
|
|
13392
13423
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key };
|
|
13393
13424
|
}
|
|
@@ -16679,9 +16710,10 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
16679
16710
|
const key = cliString(receipt.key) || "key";
|
|
16680
16711
|
const selector = cliString(receipt.selector);
|
|
16681
16712
|
const frameSelector = cliString(receipt.frame_selector);
|
|
16713
|
+
const holdMs = cliFiniteNumber(receipt.hold_ms);
|
|
16682
16714
|
const ok = receipt.ok === false ? "failed" : "ok";
|
|
16683
16715
|
const reason = cliString(receipt.reason);
|
|
16684
|
-
lines.push(`- ${name} press: ${ok}, ${markdownInlineCode(key)}${selector ? ` on ${markdownInlineCode(selector)}` : ""}${frameSelector ? ` in frame ${markdownInlineCode(frameSelector)}` : ""}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
16716
|
+
lines.push(`- ${name} press: ${ok}, ${markdownInlineCode(key)}${selector ? ` on ${markdownInlineCode(selector)}` : ""}${frameSelector ? ` in frame ${markdownInlineCode(frameSelector)}` : ""}${holdMs === void 0 ? "" : `, held ${holdMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
16685
16717
|
}
|
|
16686
16718
|
if (pressDetails.length > sampledPressDetails.length) lines.push(`- ${pressDetails.length - sampledPressDetails.length} additional press receipt(s) omitted.`);
|
|
16687
16719
|
const canvasSignatureGroups = viewports.map((viewport) => {
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
profileStatusExitCode,
|
|
14
14
|
resolveRiddleProofProfileTargetUrl,
|
|
15
15
|
resolveRiddleProofProfileTimeoutSec
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-T664I6R3.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
isTerminalRiddleJobStatus,
|
|
@@ -962,9 +962,10 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
962
962
|
const key = cliString(receipt.key) || "key";
|
|
963
963
|
const selector = cliString(receipt.selector);
|
|
964
964
|
const frameSelector = cliString(receipt.frame_selector);
|
|
965
|
+
const holdMs = cliFiniteNumber(receipt.hold_ms);
|
|
965
966
|
const ok = receipt.ok === false ? "failed" : "ok";
|
|
966
967
|
const reason = cliString(receipt.reason);
|
|
967
|
-
lines.push(`- ${name} press: ${ok}, ${markdownInlineCode(key)}${selector ? ` on ${markdownInlineCode(selector)}` : ""}${frameSelector ? ` in frame ${markdownInlineCode(frameSelector)}` : ""}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
968
|
+
lines.push(`- ${name} press: ${ok}, ${markdownInlineCode(key)}${selector ? ` on ${markdownInlineCode(selector)}` : ""}${frameSelector ? ` in frame ${markdownInlineCode(frameSelector)}` : ""}${holdMs === void 0 ? "" : `, held ${holdMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
968
969
|
}
|
|
969
970
|
if (pressDetails.length > sampledPressDetails.length) lines.push(`- ${pressDetails.length - sampledPressDetails.length} additional press receipt(s) omitted.`);
|
|
970
971
|
const canvasSignatureGroups = viewports.map((viewport) => {
|
package/dist/index.cjs
CHANGED
|
@@ -9351,6 +9351,7 @@ function profileSetupPressReceipts(results) {
|
|
|
9351
9351
|
selector: result.selector ?? null,
|
|
9352
9352
|
frame_selector: result.frame_selector ?? null,
|
|
9353
9353
|
key: result.key ?? null,
|
|
9354
|
+
hold_ms: result.hold_ms ?? null,
|
|
9354
9355
|
reason: result.reason ?? result.error ?? null
|
|
9355
9356
|
}));
|
|
9356
9357
|
}
|
|
@@ -9816,6 +9817,11 @@ function normalizeSetupAction(input, index) {
|
|
|
9816
9817
|
const toY = numberValue3(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
9817
9818
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
9818
9819
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
9820
|
+
const durationMs = numberValue3(input.duration_ms) ?? numberValue3(input.durationMs);
|
|
9821
|
+
const holdMs = type === "press" ? normalizeSetupActionNonNegativeNumber(input, index, "hold_ms", "hold_ms", "holdMs", "key_down_ms", "keyDownMs", "down_ms", "downMs") ?? durationMs : void 0;
|
|
9822
|
+
if (type === "press" && holdMs !== void 0 && (holdMs < 0 || holdMs > 3e4)) {
|
|
9823
|
+
throw new Error(`target.setup_actions[${index}].hold_ms must be a finite number from 0 to 30000.`);
|
|
9824
|
+
}
|
|
9819
9825
|
if (type === "click") {
|
|
9820
9826
|
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
9821
9827
|
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
@@ -9982,9 +9988,10 @@ function normalizeSetupAction(input, index) {
|
|
|
9982
9988
|
from_y: fromY,
|
|
9983
9989
|
to_x: toX,
|
|
9984
9990
|
to_y: toY,
|
|
9985
|
-
duration_ms:
|
|
9991
|
+
duration_ms: durationMs,
|
|
9986
9992
|
steps,
|
|
9987
9993
|
key,
|
|
9994
|
+
hold_ms: holdMs,
|
|
9988
9995
|
value,
|
|
9989
9996
|
value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
|
|
9990
9997
|
random_queue: randomQueue,
|
|
@@ -13229,6 +13236,7 @@ function profileSetupPressReceipts(results) {
|
|
|
13229
13236
|
selector: result.selector ?? null,
|
|
13230
13237
|
frame_selector: result.frame_selector ?? null,
|
|
13231
13238
|
key: result.key ?? null,
|
|
13239
|
+
hold_ms: result.hold_ms ?? null,
|
|
13232
13240
|
reason: result.reason || result.error || null,
|
|
13233
13241
|
}));
|
|
13234
13242
|
}
|
|
@@ -15165,9 +15173,22 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
15165
15173
|
if (type === "press") {
|
|
15166
15174
|
const key = String(action.key || "").trim();
|
|
15167
15175
|
if (!key) return { ...base, reason: "missing_key" };
|
|
15176
|
+
const holdMs = Math.min(30000, Math.max(0, Math.floor(setupNumber(action.hold_ms ?? action.holdMs ?? action.key_down_ms ?? action.keyDownMs ?? action.down_ms ?? action.downMs ?? action.duration_ms ?? action.durationMs, 0) || 0)));
|
|
15168
15177
|
const scope = await setupActionScope(action, timeout);
|
|
15169
15178
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
15170
15179
|
if (!action.selector) {
|
|
15180
|
+
if (holdMs > 0) {
|
|
15181
|
+
if (scope.frame_selector) {
|
|
15182
|
+
await scope.context.locator("body").focus({ timeout }).catch(() => {});
|
|
15183
|
+
}
|
|
15184
|
+
await page.keyboard.down(key);
|
|
15185
|
+
try {
|
|
15186
|
+
await page.waitForTimeout(holdMs);
|
|
15187
|
+
} finally {
|
|
15188
|
+
await page.keyboard.up(key).catch(() => {});
|
|
15189
|
+
}
|
|
15190
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, key, hold_ms: holdMs };
|
|
15191
|
+
}
|
|
15171
15192
|
if (scope.frame_selector) {
|
|
15172
15193
|
await scope.context.locator("body").press(key, { timeout });
|
|
15173
15194
|
} else {
|
|
@@ -15180,6 +15201,16 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
15180
15201
|
if (!count) return { ...base, reason: "selector_not_found", count, key };
|
|
15181
15202
|
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
15182
15203
|
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex, key };
|
|
15204
|
+
if (holdMs > 0) {
|
|
15205
|
+
await locator.nth(targetIndex).focus({ timeout });
|
|
15206
|
+
await page.keyboard.down(key);
|
|
15207
|
+
try {
|
|
15208
|
+
await page.waitForTimeout(holdMs);
|
|
15209
|
+
} finally {
|
|
15210
|
+
await page.keyboard.up(key).catch(() => {});
|
|
15211
|
+
}
|
|
15212
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key, hold_ms: holdMs };
|
|
15213
|
+
}
|
|
15183
15214
|
await locator.nth(targetIndex).press(key, { timeout });
|
|
15184
15215
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key };
|
|
15185
15216
|
}
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveRiddleProofProfileTimeoutSec,
|
|
63
63
|
slugifyRiddleProofProfileName,
|
|
64
64
|
summarizeRiddleProofProfileResult
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-T664I6R3.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -665,6 +665,7 @@ function profileSetupPressReceipts(results) {
|
|
|
665
665
|
selector: result.selector ?? null,
|
|
666
666
|
frame_selector: result.frame_selector ?? null,
|
|
667
667
|
key: result.key ?? null,
|
|
668
|
+
hold_ms: result.hold_ms ?? null,
|
|
668
669
|
reason: result.reason ?? result.error ?? null
|
|
669
670
|
}));
|
|
670
671
|
}
|
|
@@ -1130,6 +1131,11 @@ function normalizeSetupAction(input, index) {
|
|
|
1130
1131
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
1131
1132
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
1132
1133
|
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
1134
|
+
const durationMs = numberValue(input.duration_ms) ?? numberValue(input.durationMs);
|
|
1135
|
+
const holdMs = type === "press" ? normalizeSetupActionNonNegativeNumber(input, index, "hold_ms", "hold_ms", "holdMs", "key_down_ms", "keyDownMs", "down_ms", "downMs") ?? durationMs : void 0;
|
|
1136
|
+
if (type === "press" && holdMs !== void 0 && (holdMs < 0 || holdMs > 3e4)) {
|
|
1137
|
+
throw new Error(`target.setup_actions[${index}].hold_ms must be a finite number from 0 to 30000.`);
|
|
1138
|
+
}
|
|
1133
1139
|
if (type === "click") {
|
|
1134
1140
|
const hasClickCoordinate = fromX !== void 0 || fromY !== void 0;
|
|
1135
1141
|
if (hasClickCoordinate && (fromX === void 0 || fromY === void 0)) {
|
|
@@ -1296,9 +1302,10 @@ function normalizeSetupAction(input, index) {
|
|
|
1296
1302
|
from_y: fromY,
|
|
1297
1303
|
to_x: toX,
|
|
1298
1304
|
to_y: toY,
|
|
1299
|
-
duration_ms:
|
|
1305
|
+
duration_ms: durationMs,
|
|
1300
1306
|
steps,
|
|
1301
1307
|
key,
|
|
1308
|
+
hold_ms: holdMs,
|
|
1302
1309
|
value,
|
|
1303
1310
|
value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
|
|
1304
1311
|
random_queue: randomQueue,
|
|
@@ -4543,6 +4550,7 @@ function profileSetupPressReceipts(results) {
|
|
|
4543
4550
|
selector: result.selector ?? null,
|
|
4544
4551
|
frame_selector: result.frame_selector ?? null,
|
|
4545
4552
|
key: result.key ?? null,
|
|
4553
|
+
hold_ms: result.hold_ms ?? null,
|
|
4546
4554
|
reason: result.reason || result.error || null,
|
|
4547
4555
|
}));
|
|
4548
4556
|
}
|
|
@@ -6479,9 +6487,22 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6479
6487
|
if (type === "press") {
|
|
6480
6488
|
const key = String(action.key || "").trim();
|
|
6481
6489
|
if (!key) return { ...base, reason: "missing_key" };
|
|
6490
|
+
const holdMs = Math.min(30000, Math.max(0, Math.floor(setupNumber(action.hold_ms ?? action.holdMs ?? action.key_down_ms ?? action.keyDownMs ?? action.down_ms ?? action.downMs ?? action.duration_ms ?? action.durationMs, 0) || 0)));
|
|
6482
6491
|
const scope = await setupActionScope(action, timeout);
|
|
6483
6492
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
6484
6493
|
if (!action.selector) {
|
|
6494
|
+
if (holdMs > 0) {
|
|
6495
|
+
if (scope.frame_selector) {
|
|
6496
|
+
await scope.context.locator("body").focus({ timeout }).catch(() => {});
|
|
6497
|
+
}
|
|
6498
|
+
await page.keyboard.down(key);
|
|
6499
|
+
try {
|
|
6500
|
+
await page.waitForTimeout(holdMs);
|
|
6501
|
+
} finally {
|
|
6502
|
+
await page.keyboard.up(key).catch(() => {});
|
|
6503
|
+
}
|
|
6504
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, key, hold_ms: holdMs };
|
|
6505
|
+
}
|
|
6485
6506
|
if (scope.frame_selector) {
|
|
6486
6507
|
await scope.context.locator("body").press(key, { timeout });
|
|
6487
6508
|
} else {
|
|
@@ -6494,6 +6515,16 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6494
6515
|
if (!count) return { ...base, reason: "selector_not_found", count, key };
|
|
6495
6516
|
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
6496
6517
|
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex, key };
|
|
6518
|
+
if (holdMs > 0) {
|
|
6519
|
+
await locator.nth(targetIndex).focus({ timeout });
|
|
6520
|
+
await page.keyboard.down(key);
|
|
6521
|
+
try {
|
|
6522
|
+
await page.waitForTimeout(holdMs);
|
|
6523
|
+
} finally {
|
|
6524
|
+
await page.keyboard.up(key).catch(() => {});
|
|
6525
|
+
}
|
|
6526
|
+
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key, hold_ms: holdMs };
|
|
6527
|
+
}
|
|
6497
6528
|
await locator.nth(targetIndex).press(key, { timeout });
|
|
6498
6529
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, key };
|
|
6499
6530
|
}
|
package/dist/profile.d.cts
CHANGED
package/dist/profile.d.ts
CHANGED
package/dist/profile.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
resolveRiddleProofProfileTimeoutSec,
|
|
24
24
|
slugifyRiddleProofProfileName,
|
|
25
25
|
summarizeRiddleProofProfileResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-T664I6R3.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|