@riddledc/riddle-proof 0.7.179 → 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 +6 -0
- package/dist/{chunk-62JD4MJA.js → chunk-T664I6R3.js} +32 -1
- package/dist/cli.cjs +51 -5
- package/dist/cli.js +20 -5
- 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
|
@@ -192,6 +192,10 @@ riddle-proof-loop run-profile \
|
|
|
192
192
|
Hosted profile runs emit Riddle poll progress to stderr while waiting. Use
|
|
193
193
|
`--quiet` to suppress progress lines, or `--progress-every-ms` to tune the
|
|
194
194
|
heartbeat cadence for long route-inventory or workflow profiles.
|
|
195
|
+
By default, `run-profile` writes the full JSON result to stdout for automation.
|
|
196
|
+
For agent loops where the saved artifacts are the source of truth, use
|
|
197
|
+
`--result-format summary` to print the same compact Markdown summary that is
|
|
198
|
+
written to `summary.md`, or `--result-format none` to leave stdout empty.
|
|
195
199
|
Hosted `run-profile` submits package-generated profile scripts with
|
|
196
200
|
`strict=false` by default because the generated runner is larger than Riddle's
|
|
197
201
|
generic inline-script warning threshold. Use `--strict=true` when you
|
|
@@ -413,6 +417,8 @@ stable enough for Playwright's default click actionability checks. Use `press`
|
|
|
413
417
|
with a Playwright key name, such as `Enter`, `Space`, or `ArrowLeft`,
|
|
414
418
|
when a route's intended browser control is keyboard-driven; omit `selector` for
|
|
415
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.
|
|
416
422
|
Use `click_count` / `clickCount` / `clicks` from 1 to 10 on a single `click`
|
|
417
423
|
action for atomic double-click or double-submit contracts where modeling the
|
|
418
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
|
}
|
|
@@ -15765,7 +15796,7 @@ function usage() {
|
|
|
15765
15796
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
15766
15797
|
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
15767
15798
|
" riddle-proof-loop status --state-path <path>",
|
|
15768
|
-
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--quiet]",
|
|
15799
|
+
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|summary|none; default json] [--quiet]",
|
|
15769
15800
|
" riddle-proof-loop profile-body-assertions --artifact <file|url|-> --candidates-json <file|json|-> [--required-json <file|json|->] [--format json|body-contains]",
|
|
15770
15801
|
" riddle-proof-loop profile-http-status-preflight --profile <file|json|-> --url <base-url> [--format json|summary]",
|
|
15771
15802
|
" riddle-proof-loop riddle-preview-deploy <build-dir> <label> [--framework spa|static]",
|
|
@@ -15842,6 +15873,21 @@ function optionInteger(options, fallback, ...keys) {
|
|
|
15842
15873
|
function profileOutputDirOption(options) {
|
|
15843
15874
|
return optionString(options, "output") ?? optionString(options, "outputDir");
|
|
15844
15875
|
}
|
|
15876
|
+
function runProfileResultFormatOption(options) {
|
|
15877
|
+
const format = optionString(options, "resultFormat") ?? "json";
|
|
15878
|
+
if (format === "json" || format === "summary" || format === "none") return format;
|
|
15879
|
+
throw new Error("--result-format must be json, summary, or none.");
|
|
15880
|
+
}
|
|
15881
|
+
function writeRunProfileResult(result, options) {
|
|
15882
|
+
const format = runProfileResultFormatOption(options);
|
|
15883
|
+
if (format === "none") return;
|
|
15884
|
+
if (format === "summary") {
|
|
15885
|
+
process.stdout.write(profileResultMarkdown(result));
|
|
15886
|
+
return;
|
|
15887
|
+
}
|
|
15888
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
15889
|
+
`);
|
|
15890
|
+
}
|
|
15845
15891
|
function previewFrameworkOption(options) {
|
|
15846
15892
|
const framework = optionString(options, "framework") ?? "static";
|
|
15847
15893
|
if (framework === "spa" || framework === "static") return framework;
|
|
@@ -16664,9 +16710,10 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
16664
16710
|
const key = cliString(receipt.key) || "key";
|
|
16665
16711
|
const selector = cliString(receipt.selector);
|
|
16666
16712
|
const frameSelector = cliString(receipt.frame_selector);
|
|
16713
|
+
const holdMs = cliFiniteNumber(receipt.hold_ms);
|
|
16667
16714
|
const ok = receipt.ok === false ? "failed" : "ok";
|
|
16668
16715
|
const reason = cliString(receipt.reason);
|
|
16669
|
-
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)}` : ""}`);
|
|
16670
16717
|
}
|
|
16671
16718
|
if (pressDetails.length > sampledPressDetails.length) lines.push(`- ${pressDetails.length - sampledPressDetails.length} additional press receipt(s) omitted.`);
|
|
16672
16719
|
const canvasSignatureGroups = viewports.map((viewport) => {
|
|
@@ -17600,8 +17647,7 @@ async function main() {
|
|
|
17600
17647
|
process.stderr.write(`${diagnosticLine}
|
|
17601
17648
|
`);
|
|
17602
17649
|
}
|
|
17603
|
-
|
|
17604
|
-
`);
|
|
17650
|
+
writeRunProfileResult(result, options);
|
|
17605
17651
|
process.exitCode = profileStatusExitCode(profile, result.status);
|
|
17606
17652
|
return;
|
|
17607
17653
|
}
|
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,
|
|
@@ -48,7 +48,7 @@ function usage() {
|
|
|
48
48
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
49
49
|
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
50
50
|
" riddle-proof-loop status --state-path <path>",
|
|
51
|
-
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--quiet]",
|
|
51
|
+
" riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false; default false] [--split-viewports true|false; default false] [--poll-attempts n] [--output <dir>|--output-dir <dir>] [--result-format json|summary|none; default json] [--quiet]",
|
|
52
52
|
" riddle-proof-loop profile-body-assertions --artifact <file|url|-> --candidates-json <file|json|-> [--required-json <file|json|->] [--format json|body-contains]",
|
|
53
53
|
" riddle-proof-loop profile-http-status-preflight --profile <file|json|-> --url <base-url> [--format json|summary]",
|
|
54
54
|
" riddle-proof-loop riddle-preview-deploy <build-dir> <label> [--framework spa|static]",
|
|
@@ -125,6 +125,21 @@ function optionInteger(options, fallback, ...keys) {
|
|
|
125
125
|
function profileOutputDirOption(options) {
|
|
126
126
|
return optionString(options, "output") ?? optionString(options, "outputDir");
|
|
127
127
|
}
|
|
128
|
+
function runProfileResultFormatOption(options) {
|
|
129
|
+
const format = optionString(options, "resultFormat") ?? "json";
|
|
130
|
+
if (format === "json" || format === "summary" || format === "none") return format;
|
|
131
|
+
throw new Error("--result-format must be json, summary, or none.");
|
|
132
|
+
}
|
|
133
|
+
function writeRunProfileResult(result, options) {
|
|
134
|
+
const format = runProfileResultFormatOption(options);
|
|
135
|
+
if (format === "none") return;
|
|
136
|
+
if (format === "summary") {
|
|
137
|
+
process.stdout.write(profileResultMarkdown(result));
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
141
|
+
`);
|
|
142
|
+
}
|
|
128
143
|
function previewFrameworkOption(options) {
|
|
129
144
|
const framework = optionString(options, "framework") ?? "static";
|
|
130
145
|
if (framework === "spa" || framework === "static") return framework;
|
|
@@ -947,9 +962,10 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
947
962
|
const key = cliString(receipt.key) || "key";
|
|
948
963
|
const selector = cliString(receipt.selector);
|
|
949
964
|
const frameSelector = cliString(receipt.frame_selector);
|
|
965
|
+
const holdMs = cliFiniteNumber(receipt.hold_ms);
|
|
950
966
|
const ok = receipt.ok === false ? "failed" : "ok";
|
|
951
967
|
const reason = cliString(receipt.reason);
|
|
952
|
-
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)}` : ""}`);
|
|
953
969
|
}
|
|
954
970
|
if (pressDetails.length > sampledPressDetails.length) lines.push(`- ${pressDetails.length - sampledPressDetails.length} additional press receipt(s) omitted.`);
|
|
955
971
|
const canvasSignatureGroups = viewports.map((viewport) => {
|
|
@@ -1883,8 +1899,7 @@ async function main() {
|
|
|
1883
1899
|
process.stderr.write(`${diagnosticLine}
|
|
1884
1900
|
`);
|
|
1885
1901
|
}
|
|
1886
|
-
|
|
1887
|
-
`);
|
|
1902
|
+
writeRunProfileResult(result, options);
|
|
1888
1903
|
process.exitCode = profileStatusExitCode(profile, result.status);
|
|
1889
1904
|
return;
|
|
1890
1905
|
}
|
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,
|