@riddledc/riddle-proof 0.7.136 → 0.7.138
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 +4 -1
- package/dist/{chunk-DNSJMFK6.js → chunk-N75EAJNG.js} +83 -2
- package/dist/cli.cjs +109 -3
- package/dist/cli.js +27 -2
- package/dist/index.cjs +83 -2
- package/dist/index.js +1 -1
- package/dist/profile.cjs +83 -2
- 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
|
@@ -455,7 +455,10 @@ met and records `call_count`, final `returned`, and final `until_value`.
|
|
|
455
455
|
Use `screenshot` with an optional `label` to capture durable Riddle screenshots
|
|
456
456
|
at important setup milestones, such as after a route switch, terminal state, or
|
|
457
457
|
reset. These labels are recorded in setup evidence and included in profile
|
|
458
|
-
artifact summaries alongside final viewport screenshots.
|
|
458
|
+
artifact summaries alongside final viewport screenshots. Setup screenshots are
|
|
459
|
+
full-page by default; set `full_page: false`, `fullPage: false`, or
|
|
460
|
+
`mode: "viewport"` when fixed or sticky page chrome would make full-page
|
|
461
|
+
captures harder to review.
|
|
459
462
|
Add `frame_selector` / `frameSelector` to a setup action when the interaction
|
|
460
463
|
target lives inside an embedded iframe, such as a community game player or
|
|
461
464
|
hosted preview surface. Selector-based actions, storage actions, window calls,
|
|
@@ -465,6 +465,21 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
465
465
|
reason: result.reason ?? result.error ?? null
|
|
466
466
|
}));
|
|
467
467
|
}
|
|
468
|
+
function profileSetupWindowCallReceipts(results) {
|
|
469
|
+
return results.filter((result) => profileSetupResultAction(result) === "window_call").map((result) => {
|
|
470
|
+
const receipt = {
|
|
471
|
+
ordinal: result.ordinal ?? null,
|
|
472
|
+
ok: result.ok !== false,
|
|
473
|
+
path: result.path ?? null,
|
|
474
|
+
return_captured: result.return_captured ?? null,
|
|
475
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
476
|
+
reason: result.reason ?? result.error ?? result.store_reason ?? null
|
|
477
|
+
};
|
|
478
|
+
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
479
|
+
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
480
|
+
return receipt;
|
|
481
|
+
});
|
|
482
|
+
}
|
|
468
483
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
469
484
|
if (items.length <= limit) return items;
|
|
470
485
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -493,6 +508,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
493
508
|
const windowCallUntilReceipts = profileSetupWindowCallUntilReceipts(results);
|
|
494
509
|
const windowCallUntilCallCounts = windowCallUntilReceipts.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : void 0).filter((value) => value !== void 0);
|
|
495
510
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
511
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
512
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
513
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
514
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
496
515
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
497
516
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
498
517
|
return {
|
|
@@ -529,6 +548,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
529
548
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
530
549
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
531
550
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
551
|
+
window_call_total: windowCallReceipts.length,
|
|
552
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
553
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
554
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
555
|
+
window_call: sampledWindowCallReceipts,
|
|
532
556
|
clicked,
|
|
533
557
|
text_samples,
|
|
534
558
|
failed: failed.map((result) => ({
|
|
@@ -641,6 +665,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
641
665
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
642
666
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
643
667
|
}
|
|
668
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
669
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
670
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
671
|
+
if (type !== "screenshot") {
|
|
672
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
673
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
674
|
+
}
|
|
675
|
+
return void 0;
|
|
676
|
+
}
|
|
677
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
678
|
+
let modeFullPage;
|
|
679
|
+
if (modeInput) {
|
|
680
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
681
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
682
|
+
modeFullPage = true;
|
|
683
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
684
|
+
modeFullPage = false;
|
|
685
|
+
} else {
|
|
686
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
690
|
+
if (!values.length) return void 0;
|
|
691
|
+
if (values.some((value) => value !== values[0])) {
|
|
692
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
693
|
+
}
|
|
694
|
+
return values[0];
|
|
695
|
+
}
|
|
644
696
|
function normalizeSetupAction(input, index) {
|
|
645
697
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
646
698
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -771,6 +823,7 @@ function normalizeSetupAction(input, index) {
|
|
|
771
823
|
selector,
|
|
772
824
|
frame_selector: frameSelector,
|
|
773
825
|
frame_index: frameIndex,
|
|
826
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
774
827
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
775
828
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
776
829
|
coordinate_mode: coordinateMode,
|
|
@@ -3682,6 +3735,23 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
3682
3735
|
reason: result.reason || result.error || null,
|
|
3683
3736
|
}));
|
|
3684
3737
|
}
|
|
3738
|
+
function profileSetupWindowCallReceipts(results) {
|
|
3739
|
+
return (results || [])
|
|
3740
|
+
.filter((result) => result && profileSetupResultAction(result) === "window_call")
|
|
3741
|
+
.map((result) => {
|
|
3742
|
+
const receipt = {
|
|
3743
|
+
ordinal: result.ordinal ?? null,
|
|
3744
|
+
ok: result.ok !== false,
|
|
3745
|
+
path: result.path ?? null,
|
|
3746
|
+
return_captured: result.return_captured ?? null,
|
|
3747
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
3748
|
+
reason: result.reason || result.error || result.store_reason || null,
|
|
3749
|
+
};
|
|
3750
|
+
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
3751
|
+
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
3752
|
+
return receipt;
|
|
3753
|
+
});
|
|
3754
|
+
}
|
|
3685
3755
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
3686
3756
|
if ((items || []).length <= limit) return items || [];
|
|
3687
3757
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -3716,6 +3786,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
3716
3786
|
.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : undefined)
|
|
3717
3787
|
.filter((value) => value !== undefined);
|
|
3718
3788
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
3789
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
3790
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
3791
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
3792
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
3719
3793
|
const clickedItems = results
|
|
3720
3794
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
3721
3795
|
.map((result) => {
|
|
@@ -3762,6 +3836,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
3762
3836
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
3763
3837
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
3764
3838
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
3839
|
+
window_call_total: windowCallReceipts.length,
|
|
3840
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
3841
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
3842
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
3843
|
+
window_call: sampledWindowCallReceipts,
|
|
3765
3844
|
clicked,
|
|
3766
3845
|
text_samples: textSamples,
|
|
3767
3846
|
failed: failed.map((result) => ({
|
|
@@ -5054,8 +5133,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5054
5133
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
5055
5134
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
5056
5135
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
5057
|
-
|
|
5058
|
-
|
|
5136
|
+
const screenshotOptions = {};
|
|
5137
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
5138
|
+
await saveScreenshot(label, screenshotOptions);
|
|
5139
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
5059
5140
|
}
|
|
5060
5141
|
if (type === "clear_console") {
|
|
5061
5142
|
const cleared_console_event_count = consoleEvents.length;
|
package/dist/cli.cjs
CHANGED
|
@@ -7402,6 +7402,21 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
7402
7402
|
reason: result.reason ?? result.error ?? null
|
|
7403
7403
|
}));
|
|
7404
7404
|
}
|
|
7405
|
+
function profileSetupWindowCallReceipts(results) {
|
|
7406
|
+
return results.filter((result) => profileSetupResultAction(result) === "window_call").map((result) => {
|
|
7407
|
+
const receipt = {
|
|
7408
|
+
ordinal: result.ordinal ?? null,
|
|
7409
|
+
ok: result.ok !== false,
|
|
7410
|
+
path: result.path ?? null,
|
|
7411
|
+
return_captured: result.return_captured ?? null,
|
|
7412
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
7413
|
+
reason: result.reason ?? result.error ?? result.store_reason ?? null
|
|
7414
|
+
};
|
|
7415
|
+
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
7416
|
+
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
7417
|
+
return receipt;
|
|
7418
|
+
});
|
|
7419
|
+
}
|
|
7405
7420
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
7406
7421
|
if (items.length <= limit) return items;
|
|
7407
7422
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -7430,6 +7445,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
7430
7445
|
const windowCallUntilReceipts = profileSetupWindowCallUntilReceipts(results);
|
|
7431
7446
|
const windowCallUntilCallCounts = windowCallUntilReceipts.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : void 0).filter((value) => value !== void 0);
|
|
7432
7447
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
7448
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
7449
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
7450
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
7451
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
7433
7452
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
7434
7453
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
7435
7454
|
return {
|
|
@@ -7466,6 +7485,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
7466
7485
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
7467
7486
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
7468
7487
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
7488
|
+
window_call_total: windowCallReceipts.length,
|
|
7489
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
7490
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
7491
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
7492
|
+
window_call: sampledWindowCallReceipts,
|
|
7469
7493
|
clicked,
|
|
7470
7494
|
text_samples,
|
|
7471
7495
|
failed: failed.map((result) => ({
|
|
@@ -7578,6 +7602,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
7578
7602
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
7579
7603
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
7580
7604
|
}
|
|
7605
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
7606
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
7607
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
7608
|
+
if (type !== "screenshot") {
|
|
7609
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
7610
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
7611
|
+
}
|
|
7612
|
+
return void 0;
|
|
7613
|
+
}
|
|
7614
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
7615
|
+
let modeFullPage;
|
|
7616
|
+
if (modeInput) {
|
|
7617
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
7618
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
7619
|
+
modeFullPage = true;
|
|
7620
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
7621
|
+
modeFullPage = false;
|
|
7622
|
+
} else {
|
|
7623
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
7627
|
+
if (!values.length) return void 0;
|
|
7628
|
+
if (values.some((value) => value !== values[0])) {
|
|
7629
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
7630
|
+
}
|
|
7631
|
+
return values[0];
|
|
7632
|
+
}
|
|
7581
7633
|
function normalizeSetupAction(input, index) {
|
|
7582
7634
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
7583
7635
|
const type = normalizeSetupActionType(stringValue2(input.type), index);
|
|
@@ -7708,6 +7760,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7708
7760
|
selector,
|
|
7709
7761
|
frame_selector: frameSelector,
|
|
7710
7762
|
frame_index: frameIndex,
|
|
7763
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
7711
7764
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
7712
7765
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
7713
7766
|
coordinate_mode: coordinateMode,
|
|
@@ -10603,6 +10656,23 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
10603
10656
|
reason: result.reason || result.error || null,
|
|
10604
10657
|
}));
|
|
10605
10658
|
}
|
|
10659
|
+
function profileSetupWindowCallReceipts(results) {
|
|
10660
|
+
return (results || [])
|
|
10661
|
+
.filter((result) => result && profileSetupResultAction(result) === "window_call")
|
|
10662
|
+
.map((result) => {
|
|
10663
|
+
const receipt = {
|
|
10664
|
+
ordinal: result.ordinal ?? null,
|
|
10665
|
+
ok: result.ok !== false,
|
|
10666
|
+
path: result.path ?? null,
|
|
10667
|
+
return_captured: result.return_captured ?? null,
|
|
10668
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
10669
|
+
reason: result.reason || result.error || result.store_reason || null,
|
|
10670
|
+
};
|
|
10671
|
+
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
10672
|
+
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
10673
|
+
return receipt;
|
|
10674
|
+
});
|
|
10675
|
+
}
|
|
10606
10676
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
10607
10677
|
if ((items || []).length <= limit) return items || [];
|
|
10608
10678
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -10637,6 +10707,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
10637
10707
|
.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : undefined)
|
|
10638
10708
|
.filter((value) => value !== undefined);
|
|
10639
10709
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
10710
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
10711
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
10712
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
10713
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
10640
10714
|
const clickedItems = results
|
|
10641
10715
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
10642
10716
|
.map((result) => {
|
|
@@ -10683,6 +10757,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
10683
10757
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
10684
10758
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
10685
10759
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
10760
|
+
window_call_total: windowCallReceipts.length,
|
|
10761
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
10762
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
10763
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
10764
|
+
window_call: sampledWindowCallReceipts,
|
|
10686
10765
|
clicked,
|
|
10687
10766
|
text_samples: textSamples,
|
|
10688
10767
|
failed: failed.map((result) => ({
|
|
@@ -11975,8 +12054,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
11975
12054
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
11976
12055
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
11977
12056
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
11978
|
-
|
|
11979
|
-
|
|
12057
|
+
const screenshotOptions = {};
|
|
12058
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
12059
|
+
await saveScreenshot(label, screenshotOptions);
|
|
12060
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
11980
12061
|
}
|
|
11981
12062
|
if (type === "clear_console") {
|
|
11982
12063
|
const cleared_console_event_count = consoleEvents.length;
|
|
@@ -14560,6 +14641,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
14560
14641
|
const clickedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0);
|
|
14561
14642
|
const clickCountActionTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_action_total) || 0), 0);
|
|
14562
14643
|
const clickCountValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_value_total) || 0), 0);
|
|
14644
|
+
const windowCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_total) || 0), 0);
|
|
14645
|
+
const windowCallStoredTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_stored_total) || 0), 0);
|
|
14646
|
+
const windowCallCapturedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_captured_total) || 0), 0);
|
|
14563
14647
|
const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
|
|
14564
14648
|
const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
|
|
14565
14649
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
@@ -14571,6 +14655,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
14571
14655
|
if (clickCountActionTotal) {
|
|
14572
14656
|
lines.push(`- click counts: ${clickCountActionTotal} action(s), click_count total ${clickCountValueTotal}`);
|
|
14573
14657
|
}
|
|
14658
|
+
if (windowCallTotal) {
|
|
14659
|
+
lines.push(`- window_call: ${windowCallTotal} action(s), stored returns ${windowCallStoredTotal}, captured returns ${windowCallCapturedTotal}`);
|
|
14660
|
+
}
|
|
14574
14661
|
if (windowCallUntilTotal) {
|
|
14575
14662
|
lines.push(`- window_call_until: ${windowCallUntilTotal} action(s), call_count total ${windowCallUntilCallTotal}`);
|
|
14576
14663
|
}
|
|
@@ -14581,11 +14668,30 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
14581
14668
|
const screenshotCount = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
|
|
14582
14669
|
const clicked = cliFiniteNumber(viewport.clicked_total) || 0;
|
|
14583
14670
|
const clickCountActions = cliFiniteNumber(viewport.click_count_action_total) || 0;
|
|
14671
|
+
const windowCallActions = cliFiniteNumber(viewport.window_call_total) || 0;
|
|
14672
|
+
const windowCallStored = cliFiniteNumber(viewport.window_call_stored_total) || 0;
|
|
14673
|
+
const windowCallCaptured = cliFiniteNumber(viewport.window_call_captured_total) || 0;
|
|
14584
14674
|
const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
|
|
14585
14675
|
const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
|
|
14586
14676
|
const observedPath = cliString(viewport.observed_path);
|
|
14587
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
14677
|
+
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
14678
|
+
}
|
|
14679
|
+
const windowCallDetails = viewports.flatMap((viewport) => {
|
|
14680
|
+
const name = cliString(viewport.name) || "viewport";
|
|
14681
|
+
const receipts = Array.isArray(viewport.window_call) ? viewport.window_call.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
14682
|
+
return receipts.map((receipt) => ({ name, receipt }));
|
|
14683
|
+
});
|
|
14684
|
+
for (const { name, receipt } of windowCallDetails.slice(0, 12)) {
|
|
14685
|
+
const path7 = cliString(receipt.path) || "window_function";
|
|
14686
|
+
const storedTo = cliString(receipt.return_stored_to);
|
|
14687
|
+
const returned = cliValueLabel(receipt.returned);
|
|
14688
|
+
const expected = cliValueLabel(receipt.expected_return);
|
|
14689
|
+
const captured = receipt.return_captured === true ? "captured" : receipt.return_captured === false ? "not captured" : "capture unknown";
|
|
14690
|
+
const ok = receipt.ok === false ? "failed" : "ok";
|
|
14691
|
+
const reason = cliString(receipt.reason);
|
|
14692
|
+
lines.push(`- ${name} window_call: ${ok}, ${markdownInlineCode(path7)}${storedTo ? `, stored ${markdownInlineCode(storedTo)}` : ""}, return ${captured}${expected === void 0 ? "" : `, expected ${markdownInlineCode(expected, 80)}`}${returned === void 0 ? "" : `, returned ${markdownInlineCode(returned, 80)}`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
14588
14693
|
}
|
|
14694
|
+
if (windowCallDetails.length > 12) lines.push(`- ${windowCallDetails.length - 12} additional window_call receipt(s) omitted.`);
|
|
14589
14695
|
const windowCallUntilDetails = viewports.flatMap((viewport) => {
|
|
14590
14696
|
const name = cliString(viewport.name) || "viewport";
|
|
14591
14697
|
const receipts = Array.isArray(viewport.window_call_until) ? viewport.window_call_until.map(cliRecord).filter((item) => Boolean(item)) : [];
|
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
profileStatusExitCode,
|
|
13
13
|
resolveRiddleProofProfileTargetUrl,
|
|
14
14
|
resolveRiddleProofProfileTimeoutSec
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N75EAJNG.js";
|
|
16
16
|
import {
|
|
17
17
|
createRiddleApiClient,
|
|
18
18
|
parseRiddleViewport
|
|
@@ -596,6 +596,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
596
596
|
const clickedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0);
|
|
597
597
|
const clickCountActionTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_action_total) || 0), 0);
|
|
598
598
|
const clickCountValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.click_count_value_total) || 0), 0);
|
|
599
|
+
const windowCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_total) || 0), 0);
|
|
600
|
+
const windowCallStoredTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_stored_total) || 0), 0);
|
|
601
|
+
const windowCallCapturedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_captured_total) || 0), 0);
|
|
599
602
|
const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
|
|
600
603
|
const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
|
|
601
604
|
const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
|
|
@@ -607,6 +610,9 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
607
610
|
if (clickCountActionTotal) {
|
|
608
611
|
lines.push(`- click counts: ${clickCountActionTotal} action(s), click_count total ${clickCountValueTotal}`);
|
|
609
612
|
}
|
|
613
|
+
if (windowCallTotal) {
|
|
614
|
+
lines.push(`- window_call: ${windowCallTotal} action(s), stored returns ${windowCallStoredTotal}, captured returns ${windowCallCapturedTotal}`);
|
|
615
|
+
}
|
|
610
616
|
if (windowCallUntilTotal) {
|
|
611
617
|
lines.push(`- window_call_until: ${windowCallUntilTotal} action(s), call_count total ${windowCallUntilCallTotal}`);
|
|
612
618
|
}
|
|
@@ -617,11 +623,30 @@ function profileSetupSummaryMarkdown(result) {
|
|
|
617
623
|
const screenshotCount = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
|
|
618
624
|
const clicked = cliFiniteNumber(viewport.clicked_total) || 0;
|
|
619
625
|
const clickCountActions = cliFiniteNumber(viewport.click_count_action_total) || 0;
|
|
626
|
+
const windowCallActions = cliFiniteNumber(viewport.window_call_total) || 0;
|
|
627
|
+
const windowCallStored = cliFiniteNumber(viewport.window_call_stored_total) || 0;
|
|
628
|
+
const windowCallCaptured = cliFiniteNumber(viewport.window_call_captured_total) || 0;
|
|
620
629
|
const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
|
|
621
630
|
const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
|
|
622
631
|
const observedPath = cliString(viewport.observed_path);
|
|
623
|
-
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
632
|
+
lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
|
|
633
|
+
}
|
|
634
|
+
const windowCallDetails = viewports.flatMap((viewport) => {
|
|
635
|
+
const name = cliString(viewport.name) || "viewport";
|
|
636
|
+
const receipts = Array.isArray(viewport.window_call) ? viewport.window_call.map(cliRecord).filter((item) => Boolean(item)) : [];
|
|
637
|
+
return receipts.map((receipt) => ({ name, receipt }));
|
|
638
|
+
});
|
|
639
|
+
for (const { name, receipt } of windowCallDetails.slice(0, 12)) {
|
|
640
|
+
const path2 = cliString(receipt.path) || "window_function";
|
|
641
|
+
const storedTo = cliString(receipt.return_stored_to);
|
|
642
|
+
const returned = cliValueLabel(receipt.returned);
|
|
643
|
+
const expected = cliValueLabel(receipt.expected_return);
|
|
644
|
+
const captured = receipt.return_captured === true ? "captured" : receipt.return_captured === false ? "not captured" : "capture unknown";
|
|
645
|
+
const ok = receipt.ok === false ? "failed" : "ok";
|
|
646
|
+
const reason = cliString(receipt.reason);
|
|
647
|
+
lines.push(`- ${name} window_call: ${ok}, ${markdownInlineCode(path2)}${storedTo ? `, stored ${markdownInlineCode(storedTo)}` : ""}, return ${captured}${expected === void 0 ? "" : `, expected ${markdownInlineCode(expected, 80)}`}${returned === void 0 ? "" : `, returned ${markdownInlineCode(returned, 80)}`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
|
|
624
648
|
}
|
|
649
|
+
if (windowCallDetails.length > 12) lines.push(`- ${windowCallDetails.length - 12} additional window_call receipt(s) omitted.`);
|
|
625
650
|
const windowCallUntilDetails = viewports.flatMap((viewport) => {
|
|
626
651
|
const name = cliString(viewport.name) || "viewport";
|
|
627
652
|
const receipts = Array.isArray(viewport.window_call_until) ? viewport.window_call_until.map(cliRecord).filter((item) => Boolean(item)) : [];
|
package/dist/index.cjs
CHANGED
|
@@ -9198,6 +9198,21 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
9198
9198
|
reason: result.reason ?? result.error ?? null
|
|
9199
9199
|
}));
|
|
9200
9200
|
}
|
|
9201
|
+
function profileSetupWindowCallReceipts(results) {
|
|
9202
|
+
return results.filter((result) => profileSetupResultAction(result) === "window_call").map((result) => {
|
|
9203
|
+
const receipt = {
|
|
9204
|
+
ordinal: result.ordinal ?? null,
|
|
9205
|
+
ok: result.ok !== false,
|
|
9206
|
+
path: result.path ?? null,
|
|
9207
|
+
return_captured: result.return_captured ?? null,
|
|
9208
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
9209
|
+
reason: result.reason ?? result.error ?? result.store_reason ?? null
|
|
9210
|
+
};
|
|
9211
|
+
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
9212
|
+
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
9213
|
+
return receipt;
|
|
9214
|
+
});
|
|
9215
|
+
}
|
|
9201
9216
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
9202
9217
|
if (items.length <= limit) return items;
|
|
9203
9218
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -9226,6 +9241,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9226
9241
|
const windowCallUntilReceipts = profileSetupWindowCallUntilReceipts(results);
|
|
9227
9242
|
const windowCallUntilCallCounts = windowCallUntilReceipts.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : void 0).filter((value) => value !== void 0);
|
|
9228
9243
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
9244
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
9245
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
9246
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
9247
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
9229
9248
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
9230
9249
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
9231
9250
|
return {
|
|
@@ -9262,6 +9281,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9262
9281
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
9263
9282
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
9264
9283
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
9284
|
+
window_call_total: windowCallReceipts.length,
|
|
9285
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
9286
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
9287
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
9288
|
+
window_call: sampledWindowCallReceipts,
|
|
9265
9289
|
clicked,
|
|
9266
9290
|
text_samples,
|
|
9267
9291
|
failed: failed.map((result) => ({
|
|
@@ -9374,6 +9398,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
9374
9398
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
9375
9399
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
9376
9400
|
}
|
|
9401
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
9402
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
9403
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
9404
|
+
if (type !== "screenshot") {
|
|
9405
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
9406
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
9407
|
+
}
|
|
9408
|
+
return void 0;
|
|
9409
|
+
}
|
|
9410
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
9411
|
+
let modeFullPage;
|
|
9412
|
+
if (modeInput) {
|
|
9413
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
9414
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
9415
|
+
modeFullPage = true;
|
|
9416
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
9417
|
+
modeFullPage = false;
|
|
9418
|
+
} else {
|
|
9419
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
9423
|
+
if (!values.length) return void 0;
|
|
9424
|
+
if (values.some((value) => value !== values[0])) {
|
|
9425
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
9426
|
+
}
|
|
9427
|
+
return values[0];
|
|
9428
|
+
}
|
|
9377
9429
|
function normalizeSetupAction(input, index) {
|
|
9378
9430
|
if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
9379
9431
|
const type = normalizeSetupActionType(stringValue5(input.type), index);
|
|
@@ -9504,6 +9556,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9504
9556
|
selector,
|
|
9505
9557
|
frame_selector: frameSelector,
|
|
9506
9558
|
frame_index: frameIndex,
|
|
9559
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
9507
9560
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
9508
9561
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
9509
9562
|
coordinate_mode: coordinateMode,
|
|
@@ -12415,6 +12468,23 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
12415
12468
|
reason: result.reason || result.error || null,
|
|
12416
12469
|
}));
|
|
12417
12470
|
}
|
|
12471
|
+
function profileSetupWindowCallReceipts(results) {
|
|
12472
|
+
return (results || [])
|
|
12473
|
+
.filter((result) => result && profileSetupResultAction(result) === "window_call")
|
|
12474
|
+
.map((result) => {
|
|
12475
|
+
const receipt = {
|
|
12476
|
+
ordinal: result.ordinal ?? null,
|
|
12477
|
+
ok: result.ok !== false,
|
|
12478
|
+
path: result.path ?? null,
|
|
12479
|
+
return_captured: result.return_captured ?? null,
|
|
12480
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
12481
|
+
reason: result.reason || result.error || result.store_reason || null,
|
|
12482
|
+
};
|
|
12483
|
+
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
12484
|
+
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
12485
|
+
return receipt;
|
|
12486
|
+
});
|
|
12487
|
+
}
|
|
12418
12488
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
12419
12489
|
if ((items || []).length <= limit) return items || [];
|
|
12420
12490
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -12449,6 +12519,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
12449
12519
|
.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : undefined)
|
|
12450
12520
|
.filter((value) => value !== undefined);
|
|
12451
12521
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
12522
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
12523
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
12524
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
12525
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
12452
12526
|
const clickedItems = results
|
|
12453
12527
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
12454
12528
|
.map((result) => {
|
|
@@ -12495,6 +12569,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
12495
12569
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
12496
12570
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
12497
12571
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
12572
|
+
window_call_total: windowCallReceipts.length,
|
|
12573
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
12574
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
12575
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
12576
|
+
window_call: sampledWindowCallReceipts,
|
|
12498
12577
|
clicked,
|
|
12499
12578
|
text_samples: textSamples,
|
|
12500
12579
|
failed: failed.map((result) => ({
|
|
@@ -13787,8 +13866,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13787
13866
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
13788
13867
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
13789
13868
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
13790
|
-
|
|
13791
|
-
|
|
13869
|
+
const screenshotOptions = {};
|
|
13870
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
13871
|
+
await saveScreenshot(label, screenshotOptions);
|
|
13872
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
13792
13873
|
}
|
|
13793
13874
|
if (type === "clear_console") {
|
|
13794
13875
|
const cleared_console_event_count = consoleEvents.length;
|
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-N75EAJNG.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -512,6 +512,21 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
512
512
|
reason: result.reason ?? result.error ?? null
|
|
513
513
|
}));
|
|
514
514
|
}
|
|
515
|
+
function profileSetupWindowCallReceipts(results) {
|
|
516
|
+
return results.filter((result) => profileSetupResultAction(result) === "window_call").map((result) => {
|
|
517
|
+
const receipt = {
|
|
518
|
+
ordinal: result.ordinal ?? null,
|
|
519
|
+
ok: result.ok !== false,
|
|
520
|
+
path: result.path ?? null,
|
|
521
|
+
return_captured: result.return_captured ?? null,
|
|
522
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
523
|
+
reason: result.reason ?? result.error ?? result.store_reason ?? null
|
|
524
|
+
};
|
|
525
|
+
if (result.returned !== void 0) receipt.returned = result.returned;
|
|
526
|
+
if (result.expected_return !== void 0) receipt.expected_return = result.expected_return;
|
|
527
|
+
return receipt;
|
|
528
|
+
});
|
|
529
|
+
}
|
|
515
530
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
516
531
|
if (items.length <= limit) return items;
|
|
517
532
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -540,6 +555,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
540
555
|
const windowCallUntilReceipts = profileSetupWindowCallUntilReceipts(results);
|
|
541
556
|
const windowCallUntilCallCounts = windowCallUntilReceipts.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : void 0).filter((value) => value !== void 0);
|
|
542
557
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
558
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
559
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
560
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
561
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
543
562
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
544
563
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
545
564
|
return {
|
|
@@ -576,6 +595,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
576
595
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
577
596
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
578
597
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
598
|
+
window_call_total: windowCallReceipts.length,
|
|
599
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
600
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
601
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
602
|
+
window_call: sampledWindowCallReceipts,
|
|
579
603
|
clicked,
|
|
580
604
|
text_samples,
|
|
581
605
|
failed: failed.map((result) => ({
|
|
@@ -688,6 +712,34 @@ function normalizeSetupActionPointerType(value, type, index) {
|
|
|
688
712
|
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
689
713
|
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
690
714
|
}
|
|
715
|
+
function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
716
|
+
const directFullPage = booleanValue(valueFromOwn(input, "full_page", "fullPage"));
|
|
717
|
+
const viewportOnly = booleanValue(valueFromOwn(input, "viewport_only", "viewportOnly", "viewport_screenshot", "viewportScreenshot"));
|
|
718
|
+
if (type !== "screenshot") {
|
|
719
|
+
if (directFullPage !== void 0 || viewportOnly !== void 0 || valueFromOwn(input, "screenshot_mode", "screenshotMode", "capture_mode", "captureMode") !== void 0) {
|
|
720
|
+
throw new Error(`target.setup_actions[${index}].full_page is only supported for screenshot actions.`);
|
|
721
|
+
}
|
|
722
|
+
return void 0;
|
|
723
|
+
}
|
|
724
|
+
const modeInput = stringFromOwn(input, "mode", "screenshot_mode", "screenshotMode", "capture_mode", "captureMode");
|
|
725
|
+
let modeFullPage;
|
|
726
|
+
if (modeInput) {
|
|
727
|
+
const mode = modeInput.trim().toLowerCase().replace(/[-\s]+/g, "_");
|
|
728
|
+
if (mode === "full_page" || mode === "fullpage" || mode === "page" || mode === "document") {
|
|
729
|
+
modeFullPage = true;
|
|
730
|
+
} else if (mode === "viewport" || mode === "view") {
|
|
731
|
+
modeFullPage = false;
|
|
732
|
+
} else {
|
|
733
|
+
throw new Error(`target.setup_actions[${index}].mode ${modeInput} is not supported for screenshot actions. Supported modes: full_page, viewport.`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
const values = [directFullPage, viewportOnly === void 0 ? void 0 : !viewportOnly, modeFullPage].filter((value) => value !== void 0);
|
|
737
|
+
if (!values.length) return void 0;
|
|
738
|
+
if (values.some((value) => value !== values[0])) {
|
|
739
|
+
throw new Error(`target.setup_actions[${index}] has conflicting screenshot full_page / viewport mode options.`);
|
|
740
|
+
}
|
|
741
|
+
return values[0];
|
|
742
|
+
}
|
|
691
743
|
function normalizeSetupAction(input, index) {
|
|
692
744
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
693
745
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -818,6 +870,7 @@ function normalizeSetupAction(input, index) {
|
|
|
818
870
|
selector,
|
|
819
871
|
frame_selector: frameSelector,
|
|
820
872
|
frame_index: frameIndex,
|
|
873
|
+
full_page: normalizeSetupActionScreenshotFullPage(input, type, index),
|
|
821
874
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
822
875
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
823
876
|
coordinate_mode: coordinateMode,
|
|
@@ -3729,6 +3782,23 @@ function profileSetupWindowCallUntilReceipts(results) {
|
|
|
3729
3782
|
reason: result.reason || result.error || null,
|
|
3730
3783
|
}));
|
|
3731
3784
|
}
|
|
3785
|
+
function profileSetupWindowCallReceipts(results) {
|
|
3786
|
+
return (results || [])
|
|
3787
|
+
.filter((result) => result && profileSetupResultAction(result) === "window_call")
|
|
3788
|
+
.map((result) => {
|
|
3789
|
+
const receipt = {
|
|
3790
|
+
ordinal: result.ordinal ?? null,
|
|
3791
|
+
ok: result.ok !== false,
|
|
3792
|
+
path: result.path ?? null,
|
|
3793
|
+
return_captured: result.return_captured ?? null,
|
|
3794
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
3795
|
+
reason: result.reason || result.error || result.store_reason || null,
|
|
3796
|
+
};
|
|
3797
|
+
if (result.returned !== undefined) receipt.returned = result.returned;
|
|
3798
|
+
if (result.expected_return !== undefined) receipt.expected_return = result.expected_return;
|
|
3799
|
+
return receipt;
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3732
3802
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
3733
3803
|
if ((items || []).length <= limit) return items || [];
|
|
3734
3804
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -3763,6 +3833,10 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
3763
3833
|
.map((result) => typeof result.call_count === "number" && Number.isFinite(result.call_count) ? result.call_count : undefined)
|
|
3764
3834
|
.filter((value) => value !== undefined);
|
|
3765
3835
|
const sampledWindowCallUntilReceipts = sampleProfileSetupSummaryItems(windowCallUntilReceipts, 8);
|
|
3836
|
+
const windowCallReceipts = profileSetupWindowCallReceipts(results);
|
|
3837
|
+
const windowCallStoredTotal = windowCallReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
3838
|
+
const windowCallCapturedTotal = windowCallReceipts.filter((result) => result.return_captured === true).length;
|
|
3839
|
+
const sampledWindowCallReceipts = sampleProfileSetupSummaryItems(windowCallReceipts, 8);
|
|
3766
3840
|
const clickedItems = results
|
|
3767
3841
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
3768
3842
|
.map((result) => {
|
|
@@ -3809,6 +3883,11 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
3809
3883
|
window_call_until_call_total: windowCallUntilCallCounts.reduce((sum, value) => sum + value, 0),
|
|
3810
3884
|
window_call_until_truncated: windowCallUntilReceipts.length > sampledWindowCallUntilReceipts.length,
|
|
3811
3885
|
window_call_until: sampledWindowCallUntilReceipts,
|
|
3886
|
+
window_call_total: windowCallReceipts.length,
|
|
3887
|
+
window_call_stored_total: windowCallStoredTotal,
|
|
3888
|
+
window_call_captured_total: windowCallCapturedTotal,
|
|
3889
|
+
window_call_truncated: windowCallReceipts.length > sampledWindowCallReceipts.length,
|
|
3890
|
+
window_call: sampledWindowCallReceipts,
|
|
3812
3891
|
clicked,
|
|
3813
3892
|
text_samples: textSamples,
|
|
3814
3893
|
failed: failed.map((result) => ({
|
|
@@ -5101,8 +5180,10 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5101
5180
|
const viewportName = viewport && viewport.name ? viewport.name : "viewport";
|
|
5102
5181
|
const label = profileSlug + "-" + viewportName + "-" + labelPart;
|
|
5103
5182
|
if (typeof saveScreenshot !== "function") return { ...base, reason: "save_screenshot_unavailable", label: rawLabel };
|
|
5104
|
-
|
|
5105
|
-
|
|
5183
|
+
const screenshotOptions = {};
|
|
5184
|
+
if (action.full_page !== undefined) screenshotOptions.fullPage = action.full_page !== false;
|
|
5185
|
+
await saveScreenshot(label, screenshotOptions);
|
|
5186
|
+
return { ...base, ok: true, label: rawLabel, screenshot_label: label, full_page: action.full_page === undefined ? null : action.full_page !== false };
|
|
5106
5187
|
}
|
|
5107
5188
|
if (type === "clear_console") {
|
|
5108
5189
|
const cleared_console_event_count = consoleEvents.length;
|
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-N75EAJNG.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|