@riddledc/riddle-proof 0.7.146 → 0.7.148
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 +17 -7
- package/dist/{chunk-7GHBRZHQ.js → chunk-M3ZTY6PQ.js} +14 -3
- package/dist/{chunk-ZC6AK3D3.js → chunk-WAJA6TJV.js} +56 -3
- package/dist/cli.cjs +82 -9
- package/dist/cli.js +14 -5
- package/dist/index.cjs +70 -6
- package/dist/index.js +2 -2
- package/dist/profile.cjs +56 -3
- package/dist/profile.d.cts +3 -1
- package/dist/profile.d.ts +3 -1
- package/dist/profile.js +1 -1
- package/dist/riddle-client.cjs +14 -3
- package/dist/riddle-client.d.cts +1 -0
- package/dist/riddle-client.d.ts +1 -0
- package/dist/riddle-client.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -397,8 +397,8 @@ when body matching overrides sequence order.
|
|
|
397
397
|
`target.setup_actions` is optional. Use it when the meaningful proof surface
|
|
398
398
|
appears only after a picker, tab, login stub, storage seed, form fill,
|
|
399
399
|
transport control, or other bounded interaction. Supported setup actions are
|
|
400
|
-
`click`, `drag`, `press`, `fill`, `set_input_value`, `
|
|
401
|
-
`assert_text_absent`, `assert_selector_count`, `assert_window_value`,
|
|
400
|
+
`click`, `drag`, `press`, `fill`, `set_input_value`, `set_range_value`,
|
|
401
|
+
`assert_text_visible`, `assert_text_absent`, `assert_selector_count`, `assert_window_value`,
|
|
402
402
|
`assert_window_number`, `local_storage`, `session_storage`, `clear_storage`,
|
|
403
403
|
`clear_console`, `screenshot`, `wait`, `wait_for_selector`, `wait_for_text`,
|
|
404
404
|
`window_eval`, `window_call`, and `window_call_until`;
|
|
@@ -415,6 +415,13 @@ Use `click_count` / `clickCount` / `clicks` from 1 to 10 on a single `click`
|
|
|
415
415
|
action for atomic double-click or double-submit contracts where modeling the
|
|
416
416
|
interaction as repeated setup actions would incorrectly require the target to
|
|
417
417
|
remain in the DOM after the first click.
|
|
418
|
+
Use `set_range_value` for HTML range inputs and React-controlled sliders. It
|
|
419
|
+
accepts aliases such as `set-slider-value`, requires `selector` plus `value`,
|
|
420
|
+
uses the native input value setter, dispatches bubbling `input` and `change`
|
|
421
|
+
events, and records the requested value plus the browser's actual normalized
|
|
422
|
+
value, numeric value, `min`, `max`, and `step`. The action is intentionally
|
|
423
|
+
strict: if the target is not an `input[type="range"]`, setup fails with
|
|
424
|
+
`not_range_input` instead of silently treating the control like a text field.
|
|
418
425
|
Use `drag` for pointer-driven controls such as canvas launch areas, sliders, or
|
|
419
426
|
drag-to-aim games. Provide `selector`, `from_x`, `from_y`, `to_x`, and `to_y`;
|
|
420
427
|
coordinates are element-relative pixels by default. Set `coordinate_mode:
|
|
@@ -941,11 +948,14 @@ shape, and errors without rerunning blind.
|
|
|
941
948
|
|
|
942
949
|
`riddle-proof-loop riddle-poll <job-id> --wait` keeps stdout as JSON and writes
|
|
943
950
|
human progress lines to stderr while waiting. The JSON result includes
|
|
944
|
-
`poll.timed_out`, `poll.elapsed_ms`, `poll.queue_elapsed_ms`,
|
|
945
|
-
`poll.running_without_submission` so
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
951
|
+
`poll.timed_out`, `poll.elapsed_ms`, `poll.queue_elapsed_ms`,
|
|
952
|
+
`poll.pre_submission_elapsed_ms`, and `poll.running_without_submission` so
|
|
953
|
+
delayed dispatch is distinguishable from a terminal proof failure.
|
|
954
|
+
`queue_elapsed_ms` reflects Riddle's `created_at` to `submitted_at` timestamps;
|
|
955
|
+
`pre_submission_elapsed_ms` preserves how long the CLI actually observed the
|
|
956
|
+
job before `submitted_at` appeared. If `--wait` exhausts its attempts before a
|
|
957
|
+
terminal job status, the command exits non-zero and the result explains the
|
|
958
|
+
last observed status and `submitted_at` state.
|
|
949
959
|
|
|
950
960
|
## Base vs OpenClaw Wrapper Boundary
|
|
951
961
|
|
|
@@ -279,6 +279,7 @@ function buildPollSnapshot(jobId, job, input) {
|
|
|
279
279
|
submitted_at: submittedAt,
|
|
280
280
|
completed_at: completedAt,
|
|
281
281
|
queue_elapsed_ms: queueElapsedMs,
|
|
282
|
+
pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
|
|
282
283
|
running_without_submission: Boolean(status && !terminal && !submittedAt)
|
|
283
284
|
};
|
|
284
285
|
}
|
|
@@ -286,7 +287,8 @@ function pollMessage(snapshot, timedOut) {
|
|
|
286
287
|
if (!timedOut) return void 0;
|
|
287
288
|
const submitted = snapshot.submitted_at || "not submitted";
|
|
288
289
|
const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
|
|
289
|
-
|
|
290
|
+
const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
|
|
291
|
+
return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
|
|
290
292
|
}
|
|
291
293
|
async function pollRiddleJob(config, jobId, options = {}) {
|
|
292
294
|
if (!jobId?.trim()) throw new Error("jobId is required");
|
|
@@ -298,15 +300,24 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
298
300
|
let lastSnapshot = null;
|
|
299
301
|
let lastProgressAt = 0;
|
|
300
302
|
let lastProgressKey = "";
|
|
303
|
+
let preSubmissionElapsedMs = 0;
|
|
301
304
|
for (let index = 0; index < attempts; index += 1) {
|
|
302
305
|
job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
|
|
303
306
|
const observedAt = Date.now();
|
|
304
|
-
|
|
307
|
+
const nextSnapshot = buildPollSnapshot(jobId, job, {
|
|
305
308
|
attempt: index + 1,
|
|
306
309
|
attempts,
|
|
307
310
|
startedAt,
|
|
308
|
-
observedAt
|
|
311
|
+
observedAt,
|
|
312
|
+
preSubmissionElapsedMs
|
|
309
313
|
});
|
|
314
|
+
if (nextSnapshot.running_without_submission) {
|
|
315
|
+
preSubmissionElapsedMs = Math.max(preSubmissionElapsedMs, nextSnapshot.elapsed_ms);
|
|
316
|
+
}
|
|
317
|
+
lastSnapshot = {
|
|
318
|
+
...nextSnapshot,
|
|
319
|
+
pre_submission_elapsed_ms: preSubmissionElapsedMs
|
|
320
|
+
};
|
|
310
321
|
const progressKey = [
|
|
311
322
|
lastSnapshot.status || "unknown",
|
|
312
323
|
lastSnapshot.terminal ? "terminal" : "nonterminal",
|
|
@@ -47,6 +47,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
47
47
|
"press",
|
|
48
48
|
"fill",
|
|
49
49
|
"set_input_value",
|
|
50
|
+
"set_range_value",
|
|
50
51
|
"assert_text_visible",
|
|
51
52
|
"assert_text_absent",
|
|
52
53
|
"assert_selector_count",
|
|
@@ -638,7 +639,7 @@ function isSupportedCheckType(value) {
|
|
|
638
639
|
}
|
|
639
640
|
function normalizeSetupActionType(value, index) {
|
|
640
641
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
641
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
642
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
642
643
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
643
644
|
return normalized;
|
|
644
645
|
}
|
|
@@ -736,7 +737,7 @@ function normalizeSetupAction(input, index) {
|
|
|
736
737
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
737
738
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
738
739
|
}
|
|
739
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
740
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
740
741
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
741
742
|
}
|
|
742
743
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -768,7 +769,7 @@ function normalizeSetupAction(input, index) {
|
|
|
768
769
|
}
|
|
769
770
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
770
771
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
771
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
772
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
772
773
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
773
774
|
}
|
|
774
775
|
const key = stringValue(input.key);
|
|
@@ -5925,6 +5926,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5925
5926
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
5926
5927
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
5927
5928
|
}
|
|
5929
|
+
if (type === "set_range_value") {
|
|
5930
|
+
const scope = await setupActionScope(action, timeout);
|
|
5931
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
5932
|
+
const locator = scope.context.locator(action.selector);
|
|
5933
|
+
const count = await locator.count();
|
|
5934
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
5935
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
5936
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
5937
|
+
const target = locator.nth(targetIndex);
|
|
5938
|
+
await target.waitFor({ state: "visible", timeout });
|
|
5939
|
+
const requestedValue = setupActionValue(action);
|
|
5940
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
5941
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
5942
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
5943
|
+
if (tag !== "input" || inputType !== "range") {
|
|
5944
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
5945
|
+
}
|
|
5946
|
+
const beforeValue = String(element.value);
|
|
5947
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
5948
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
5949
|
+
else element.value = String(value);
|
|
5950
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
5951
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
5952
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
5953
|
+
return {
|
|
5954
|
+
ok: true,
|
|
5955
|
+
before_value: beforeValue,
|
|
5956
|
+
actual_value: String(element.value),
|
|
5957
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
5958
|
+
min: element.min || null,
|
|
5959
|
+
max: element.max || null,
|
|
5960
|
+
step: element.step || null,
|
|
5961
|
+
};
|
|
5962
|
+
}, requestedValue);
|
|
5963
|
+
return {
|
|
5964
|
+
...base,
|
|
5965
|
+
...setupScopeEvidence(scope),
|
|
5966
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
5967
|
+
count,
|
|
5968
|
+
target_index: targetIndex,
|
|
5969
|
+
requested_value: requestedValue,
|
|
5970
|
+
actual_value: rangeResult?.actual_value,
|
|
5971
|
+
before_value: rangeResult?.before_value,
|
|
5972
|
+
value_as_number: rangeResult?.value_as_number,
|
|
5973
|
+
min: rangeResult?.min,
|
|
5974
|
+
max: rangeResult?.max,
|
|
5975
|
+
step: rangeResult?.step,
|
|
5976
|
+
tag: rangeResult?.tag,
|
|
5977
|
+
input_type: rangeResult?.input_type,
|
|
5978
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
5979
|
+
};
|
|
5980
|
+
}
|
|
5928
5981
|
if (type === "assert_selector_count") {
|
|
5929
5982
|
const scope = await setupActionScope(action, timeout);
|
|
5930
5983
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
package/dist/cli.cjs
CHANGED
|
@@ -6840,6 +6840,7 @@ function buildPollSnapshot(jobId, job, input) {
|
|
|
6840
6840
|
submitted_at: submittedAt,
|
|
6841
6841
|
completed_at: completedAt,
|
|
6842
6842
|
queue_elapsed_ms: queueElapsedMs,
|
|
6843
|
+
pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
|
|
6843
6844
|
running_without_submission: Boolean(status && !terminal && !submittedAt)
|
|
6844
6845
|
};
|
|
6845
6846
|
}
|
|
@@ -6847,7 +6848,8 @@ function pollMessage(snapshot, timedOut) {
|
|
|
6847
6848
|
if (!timedOut) return void 0;
|
|
6848
6849
|
const submitted = snapshot.submitted_at || "not submitted";
|
|
6849
6850
|
const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
|
|
6850
|
-
|
|
6851
|
+
const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
|
|
6852
|
+
return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
|
|
6851
6853
|
}
|
|
6852
6854
|
async function pollRiddleJob(config, jobId, options = {}) {
|
|
6853
6855
|
if (!jobId?.trim()) throw new Error("jobId is required");
|
|
@@ -6859,15 +6861,24 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
6859
6861
|
let lastSnapshot = null;
|
|
6860
6862
|
let lastProgressAt = 0;
|
|
6861
6863
|
let lastProgressKey = "";
|
|
6864
|
+
let preSubmissionElapsedMs = 0;
|
|
6862
6865
|
for (let index = 0; index < attempts; index += 1) {
|
|
6863
6866
|
job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
|
|
6864
6867
|
const observedAt = Date.now();
|
|
6865
|
-
|
|
6868
|
+
const nextSnapshot = buildPollSnapshot(jobId, job, {
|
|
6866
6869
|
attempt: index + 1,
|
|
6867
6870
|
attempts,
|
|
6868
6871
|
startedAt,
|
|
6869
|
-
observedAt
|
|
6872
|
+
observedAt,
|
|
6873
|
+
preSubmissionElapsedMs
|
|
6870
6874
|
});
|
|
6875
|
+
if (nextSnapshot.running_without_submission) {
|
|
6876
|
+
preSubmissionElapsedMs = Math.max(preSubmissionElapsedMs, nextSnapshot.elapsed_ms);
|
|
6877
|
+
}
|
|
6878
|
+
lastSnapshot = {
|
|
6879
|
+
...nextSnapshot,
|
|
6880
|
+
pre_submission_elapsed_ms: preSubmissionElapsedMs
|
|
6881
|
+
};
|
|
6871
6882
|
const progressKey = [
|
|
6872
6883
|
lastSnapshot.status || "unknown",
|
|
6873
6884
|
lastSnapshot.terminal ? "terminal" : "nonterminal",
|
|
@@ -6985,6 +6996,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
6985
6996
|
"press",
|
|
6986
6997
|
"fill",
|
|
6987
6998
|
"set_input_value",
|
|
6999
|
+
"set_range_value",
|
|
6988
7000
|
"assert_text_visible",
|
|
6989
7001
|
"assert_text_absent",
|
|
6990
7002
|
"assert_selector_count",
|
|
@@ -7576,7 +7588,7 @@ function isSupportedCheckType(value) {
|
|
|
7576
7588
|
}
|
|
7577
7589
|
function normalizeSetupActionType(value, index) {
|
|
7578
7590
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
7579
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
7591
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
7580
7592
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
7581
7593
|
return normalized;
|
|
7582
7594
|
}
|
|
@@ -7674,7 +7686,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7674
7686
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
7675
7687
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
7676
7688
|
}
|
|
7677
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
7689
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
7678
7690
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
7679
7691
|
}
|
|
7680
7692
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -7706,7 +7718,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7706
7718
|
}
|
|
7707
7719
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
7708
7720
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
7709
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
7721
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
7710
7722
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
7711
7723
|
}
|
|
7712
7724
|
const key = stringValue2(input.key);
|
|
@@ -12847,6 +12859,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
12847
12859
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
12848
12860
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
12849
12861
|
}
|
|
12862
|
+
if (type === "set_range_value") {
|
|
12863
|
+
const scope = await setupActionScope(action, timeout);
|
|
12864
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
12865
|
+
const locator = scope.context.locator(action.selector);
|
|
12866
|
+
const count = await locator.count();
|
|
12867
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
12868
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
12869
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
12870
|
+
const target = locator.nth(targetIndex);
|
|
12871
|
+
await target.waitFor({ state: "visible", timeout });
|
|
12872
|
+
const requestedValue = setupActionValue(action);
|
|
12873
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
12874
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
12875
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
12876
|
+
if (tag !== "input" || inputType !== "range") {
|
|
12877
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
12878
|
+
}
|
|
12879
|
+
const beforeValue = String(element.value);
|
|
12880
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
12881
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
12882
|
+
else element.value = String(value);
|
|
12883
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
12884
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
12885
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
12886
|
+
return {
|
|
12887
|
+
ok: true,
|
|
12888
|
+
before_value: beforeValue,
|
|
12889
|
+
actual_value: String(element.value),
|
|
12890
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
12891
|
+
min: element.min || null,
|
|
12892
|
+
max: element.max || null,
|
|
12893
|
+
step: element.step || null,
|
|
12894
|
+
};
|
|
12895
|
+
}, requestedValue);
|
|
12896
|
+
return {
|
|
12897
|
+
...base,
|
|
12898
|
+
...setupScopeEvidence(scope),
|
|
12899
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
12900
|
+
count,
|
|
12901
|
+
target_index: targetIndex,
|
|
12902
|
+
requested_value: requestedValue,
|
|
12903
|
+
actual_value: rangeResult?.actual_value,
|
|
12904
|
+
before_value: rangeResult?.before_value,
|
|
12905
|
+
value_as_number: rangeResult?.value_as_number,
|
|
12906
|
+
min: rangeResult?.min,
|
|
12907
|
+
max: rangeResult?.max,
|
|
12908
|
+
step: rangeResult?.step,
|
|
12909
|
+
tag: rangeResult?.tag,
|
|
12910
|
+
input_type: rangeResult?.input_type,
|
|
12911
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
12912
|
+
};
|
|
12913
|
+
}
|
|
12850
12914
|
if (type === "assert_selector_count") {
|
|
12851
12915
|
const scope = await setupActionScope(action, timeout);
|
|
12852
12916
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
@@ -14480,7 +14544,7 @@ function formatPollDuration(ms) {
|
|
|
14480
14544
|
}
|
|
14481
14545
|
function riddlePollProgressLine(snapshot) {
|
|
14482
14546
|
const submittedAt = snapshot.submitted_at || "not-submitted";
|
|
14483
|
-
const queuePart = snapshot.running_without_submission ? ` queued_for=${formatPollDuration(snapshot.queue_elapsed_ms)}` : snapshot.queue_elapsed_ms !== null ? ` queue=${formatPollDuration(snapshot.queue_elapsed_ms)}` : "";
|
|
14547
|
+
const queuePart = snapshot.running_without_submission ? ` waiting_for_submit=${formatPollDuration(snapshot.pre_submission_elapsed_ms)}${snapshot.queue_elapsed_ms !== null ? ` queued_for=${formatPollDuration(snapshot.queue_elapsed_ms)}` : ""}` : snapshot.queue_elapsed_ms !== null ? ` queue=${formatPollDuration(snapshot.queue_elapsed_ms)}` : "";
|
|
14484
14548
|
const terminalPart = snapshot.terminal ? " terminal=true" : "";
|
|
14485
14549
|
return [
|
|
14486
14550
|
"[riddle-poll]",
|
|
@@ -14759,6 +14823,7 @@ function profileRiddleJobMarkdown(result) {
|
|
|
14759
14823
|
const terminal = typeof riddle.terminal === "boolean" ? riddle.terminal : void 0;
|
|
14760
14824
|
const queueElapsedMs = cliFiniteNumber(riddle.queue_elapsed_ms);
|
|
14761
14825
|
const elapsedMs3 = cliFiniteNumber(riddle.elapsed_ms);
|
|
14826
|
+
const preSubmissionElapsedMs = cliFiniteNumber(riddle.pre_submission_elapsed_ms);
|
|
14762
14827
|
const attempt = cliFiniteNumber(riddle.attempt);
|
|
14763
14828
|
const attempts = cliFiniteNumber(riddle.attempts);
|
|
14764
14829
|
const submittedAt = cliString(riddle.submitted_at);
|
|
@@ -14773,7 +14838,7 @@ function profileRiddleJobMarkdown(result) {
|
|
|
14773
14838
|
const lines = parts.length ? [`- ${parts.join(", ")}`] : [];
|
|
14774
14839
|
if (queueElapsedMs !== void 0 || elapsedMs3 !== void 0 || attempt !== void 0 || attempts !== void 0) {
|
|
14775
14840
|
lines.push(
|
|
14776
|
-
`- poll: queue ${formatPollDuration(queueElapsedMs)}, elapsed ${formatPollDuration(elapsedMs3)}${attempt === void 0 ? "" : `, attempt ${attempt}${attempts === void 0 ? "" : `/${attempts}`}`}`
|
|
14841
|
+
`- poll: queue ${formatPollDuration(queueElapsedMs)}, elapsed ${formatPollDuration(elapsedMs3)}${preSubmissionElapsedMs === void 0 || preSubmissionElapsedMs < 1e3 ? "" : `, pre-submit ${formatPollDuration(preSubmissionElapsedMs)}`}${attempt === void 0 ? "" : `, attempt ${attempt}${attempts === void 0 ? "" : `/${attempts}`}`}`
|
|
14777
14842
|
);
|
|
14778
14843
|
}
|
|
14779
14844
|
if (submittedAt || completedAt) {
|
|
@@ -14785,11 +14850,15 @@ function profileRiddleJobMarkdown(result) {
|
|
|
14785
14850
|
const splitJobId = cliString(job.job_id);
|
|
14786
14851
|
const splitStatus = cliString(job.status);
|
|
14787
14852
|
const splitTerminal = typeof job.terminal === "boolean" ? job.terminal : void 0;
|
|
14853
|
+
const splitElapsedMs = cliFiniteNumber(job.elapsed_ms);
|
|
14854
|
+
const splitPreSubmissionElapsedMs = cliFiniteNumber(job.pre_submission_elapsed_ms);
|
|
14788
14855
|
lines.push(
|
|
14789
14856
|
`- ${viewport}: ${[
|
|
14790
14857
|
splitJobId ? `job ${markdownInlineCode(splitJobId)}` : "",
|
|
14791
14858
|
splitStatus ? `status ${markdownInlineCode(splitStatus)}` : "",
|
|
14792
|
-
splitTerminal === void 0 ? "" : `terminal ${splitTerminal ? "true" : "false"}
|
|
14859
|
+
splitTerminal === void 0 ? "" : `terminal ${splitTerminal ? "true" : "false"}`,
|
|
14860
|
+
splitElapsedMs === void 0 ? "" : `elapsed ${formatPollDuration(splitElapsedMs)}`,
|
|
14861
|
+
splitPreSubmissionElapsedMs === void 0 || splitPreSubmissionElapsedMs < 1e3 ? "" : `pre-submit ${formatPollDuration(splitPreSubmissionElapsedMs)}`
|
|
14793
14862
|
].filter(Boolean).join(", ") || "job metadata unavailable"}`
|
|
14794
14863
|
);
|
|
14795
14864
|
}
|
|
@@ -15393,6 +15462,7 @@ function withRiddleMetadata(result, input) {
|
|
|
15393
15462
|
submitted_at: poll?.submitted_at ?? result.riddle?.submitted_at,
|
|
15394
15463
|
completed_at: poll?.completed_at ?? result.riddle?.completed_at,
|
|
15395
15464
|
queue_elapsed_ms: poll?.queue_elapsed_ms ?? result.riddle?.queue_elapsed_ms,
|
|
15465
|
+
pre_submission_elapsed_ms: poll?.pre_submission_elapsed_ms ?? result.riddle?.pre_submission_elapsed_ms,
|
|
15396
15466
|
elapsed_ms: poll?.elapsed_ms ?? result.riddle?.elapsed_ms,
|
|
15397
15467
|
attempt: poll?.attempt ?? result.riddle?.attempt,
|
|
15398
15468
|
attempts: poll?.attempts ?? result.riddle?.attempts,
|
|
@@ -15413,6 +15483,7 @@ function riddleMetadataFromPoll(jobId, poll) {
|
|
|
15413
15483
|
submitted_at: poll.poll?.submitted_at,
|
|
15414
15484
|
completed_at: poll.poll?.completed_at,
|
|
15415
15485
|
queue_elapsed_ms: poll.poll?.queue_elapsed_ms,
|
|
15486
|
+
pre_submission_elapsed_ms: poll.poll?.pre_submission_elapsed_ms,
|
|
15416
15487
|
elapsed_ms: poll.poll?.elapsed_ms,
|
|
15417
15488
|
attempt: poll.poll?.attempt,
|
|
15418
15489
|
attempts: poll.poll?.attempts,
|
|
@@ -15461,6 +15532,7 @@ function splitViewportRiddleMetadata(childRuns) {
|
|
|
15461
15532
|
status: result.riddle?.status,
|
|
15462
15533
|
terminal: result.riddle?.terminal,
|
|
15463
15534
|
queue_elapsed_ms: result.riddle?.queue_elapsed_ms,
|
|
15535
|
+
pre_submission_elapsed_ms: result.riddle?.pre_submission_elapsed_ms,
|
|
15464
15536
|
elapsed_ms: result.riddle?.elapsed_ms,
|
|
15465
15537
|
attempt: result.riddle?.attempt,
|
|
15466
15538
|
attempts: result.riddle?.attempts,
|
|
@@ -15472,6 +15544,7 @@ function splitViewportRiddleMetadata(childRuns) {
|
|
|
15472
15544
|
status: "split-viewports",
|
|
15473
15545
|
terminal: childRuns.every(({ result }) => result.riddle?.terminal !== false),
|
|
15474
15546
|
queue_elapsed_ms: sumDefinedNumbers(splitJobs.map((job) => job.queue_elapsed_ms)),
|
|
15547
|
+
pre_submission_elapsed_ms: sumDefinedNumbers(splitJobs.map((job) => job.pre_submission_elapsed_ms)),
|
|
15475
15548
|
elapsed_ms: sumDefinedNumbers(splitJobs.map((job) => job.elapsed_ms)),
|
|
15476
15549
|
split_jobs: splitJobs
|
|
15477
15550
|
};
|
package/dist/cli.js
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
profileStatusExitCode,
|
|
14
14
|
resolveRiddleProofProfileTargetUrl,
|
|
15
15
|
resolveRiddleProofProfileTimeoutSec
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WAJA6TJV.js";
|
|
17
17
|
import {
|
|
18
18
|
createRiddleApiClient,
|
|
19
19
|
parseRiddleViewport
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-M3ZTY6PQ.js";
|
|
21
21
|
import {
|
|
22
22
|
createDisabledRiddleProofAgentAdapter,
|
|
23
23
|
readRiddleProofRunStatus,
|
|
@@ -146,7 +146,7 @@ function formatPollDuration(ms) {
|
|
|
146
146
|
}
|
|
147
147
|
function riddlePollProgressLine(snapshot) {
|
|
148
148
|
const submittedAt = snapshot.submitted_at || "not-submitted";
|
|
149
|
-
const queuePart = snapshot.running_without_submission ? ` queued_for=${formatPollDuration(snapshot.queue_elapsed_ms)}` : snapshot.queue_elapsed_ms !== null ? ` queue=${formatPollDuration(snapshot.queue_elapsed_ms)}` : "";
|
|
149
|
+
const queuePart = snapshot.running_without_submission ? ` waiting_for_submit=${formatPollDuration(snapshot.pre_submission_elapsed_ms)}${snapshot.queue_elapsed_ms !== null ? ` queued_for=${formatPollDuration(snapshot.queue_elapsed_ms)}` : ""}` : snapshot.queue_elapsed_ms !== null ? ` queue=${formatPollDuration(snapshot.queue_elapsed_ms)}` : "";
|
|
150
150
|
const terminalPart = snapshot.terminal ? " terminal=true" : "";
|
|
151
151
|
return [
|
|
152
152
|
"[riddle-poll]",
|
|
@@ -425,6 +425,7 @@ function profileRiddleJobMarkdown(result) {
|
|
|
425
425
|
const terminal = typeof riddle.terminal === "boolean" ? riddle.terminal : void 0;
|
|
426
426
|
const queueElapsedMs = cliFiniteNumber(riddle.queue_elapsed_ms);
|
|
427
427
|
const elapsedMs = cliFiniteNumber(riddle.elapsed_ms);
|
|
428
|
+
const preSubmissionElapsedMs = cliFiniteNumber(riddle.pre_submission_elapsed_ms);
|
|
428
429
|
const attempt = cliFiniteNumber(riddle.attempt);
|
|
429
430
|
const attempts = cliFiniteNumber(riddle.attempts);
|
|
430
431
|
const submittedAt = cliString(riddle.submitted_at);
|
|
@@ -439,7 +440,7 @@ function profileRiddleJobMarkdown(result) {
|
|
|
439
440
|
const lines = parts.length ? [`- ${parts.join(", ")}`] : [];
|
|
440
441
|
if (queueElapsedMs !== void 0 || elapsedMs !== void 0 || attempt !== void 0 || attempts !== void 0) {
|
|
441
442
|
lines.push(
|
|
442
|
-
`- poll: queue ${formatPollDuration(queueElapsedMs)}, elapsed ${formatPollDuration(elapsedMs)}${attempt === void 0 ? "" : `, attempt ${attempt}${attempts === void 0 ? "" : `/${attempts}`}`}`
|
|
443
|
+
`- poll: queue ${formatPollDuration(queueElapsedMs)}, elapsed ${formatPollDuration(elapsedMs)}${preSubmissionElapsedMs === void 0 || preSubmissionElapsedMs < 1e3 ? "" : `, pre-submit ${formatPollDuration(preSubmissionElapsedMs)}`}${attempt === void 0 ? "" : `, attempt ${attempt}${attempts === void 0 ? "" : `/${attempts}`}`}`
|
|
443
444
|
);
|
|
444
445
|
}
|
|
445
446
|
if (submittedAt || completedAt) {
|
|
@@ -451,11 +452,15 @@ function profileRiddleJobMarkdown(result) {
|
|
|
451
452
|
const splitJobId = cliString(job.job_id);
|
|
452
453
|
const splitStatus = cliString(job.status);
|
|
453
454
|
const splitTerminal = typeof job.terminal === "boolean" ? job.terminal : void 0;
|
|
455
|
+
const splitElapsedMs = cliFiniteNumber(job.elapsed_ms);
|
|
456
|
+
const splitPreSubmissionElapsedMs = cliFiniteNumber(job.pre_submission_elapsed_ms);
|
|
454
457
|
lines.push(
|
|
455
458
|
`- ${viewport}: ${[
|
|
456
459
|
splitJobId ? `job ${markdownInlineCode(splitJobId)}` : "",
|
|
457
460
|
splitStatus ? `status ${markdownInlineCode(splitStatus)}` : "",
|
|
458
|
-
splitTerminal === void 0 ? "" : `terminal ${splitTerminal ? "true" : "false"}
|
|
461
|
+
splitTerminal === void 0 ? "" : `terminal ${splitTerminal ? "true" : "false"}`,
|
|
462
|
+
splitElapsedMs === void 0 ? "" : `elapsed ${formatPollDuration(splitElapsedMs)}`,
|
|
463
|
+
splitPreSubmissionElapsedMs === void 0 || splitPreSubmissionElapsedMs < 1e3 ? "" : `pre-submit ${formatPollDuration(splitPreSubmissionElapsedMs)}`
|
|
459
464
|
].filter(Boolean).join(", ") || "job metadata unavailable"}`
|
|
460
465
|
);
|
|
461
466
|
}
|
|
@@ -1059,6 +1064,7 @@ function withRiddleMetadata(result, input) {
|
|
|
1059
1064
|
submitted_at: poll?.submitted_at ?? result.riddle?.submitted_at,
|
|
1060
1065
|
completed_at: poll?.completed_at ?? result.riddle?.completed_at,
|
|
1061
1066
|
queue_elapsed_ms: poll?.queue_elapsed_ms ?? result.riddle?.queue_elapsed_ms,
|
|
1067
|
+
pre_submission_elapsed_ms: poll?.pre_submission_elapsed_ms ?? result.riddle?.pre_submission_elapsed_ms,
|
|
1062
1068
|
elapsed_ms: poll?.elapsed_ms ?? result.riddle?.elapsed_ms,
|
|
1063
1069
|
attempt: poll?.attempt ?? result.riddle?.attempt,
|
|
1064
1070
|
attempts: poll?.attempts ?? result.riddle?.attempts,
|
|
@@ -1079,6 +1085,7 @@ function riddleMetadataFromPoll(jobId, poll) {
|
|
|
1079
1085
|
submitted_at: poll.poll?.submitted_at,
|
|
1080
1086
|
completed_at: poll.poll?.completed_at,
|
|
1081
1087
|
queue_elapsed_ms: poll.poll?.queue_elapsed_ms,
|
|
1088
|
+
pre_submission_elapsed_ms: poll.poll?.pre_submission_elapsed_ms,
|
|
1082
1089
|
elapsed_ms: poll.poll?.elapsed_ms,
|
|
1083
1090
|
attempt: poll.poll?.attempt,
|
|
1084
1091
|
attempts: poll.poll?.attempts,
|
|
@@ -1127,6 +1134,7 @@ function splitViewportRiddleMetadata(childRuns) {
|
|
|
1127
1134
|
status: result.riddle?.status,
|
|
1128
1135
|
terminal: result.riddle?.terminal,
|
|
1129
1136
|
queue_elapsed_ms: result.riddle?.queue_elapsed_ms,
|
|
1137
|
+
pre_submission_elapsed_ms: result.riddle?.pre_submission_elapsed_ms,
|
|
1130
1138
|
elapsed_ms: result.riddle?.elapsed_ms,
|
|
1131
1139
|
attempt: result.riddle?.attempt,
|
|
1132
1140
|
attempts: result.riddle?.attempts,
|
|
@@ -1138,6 +1146,7 @@ function splitViewportRiddleMetadata(childRuns) {
|
|
|
1138
1146
|
status: "split-viewports",
|
|
1139
1147
|
terminal: childRuns.every(({ result }) => result.riddle?.terminal !== false),
|
|
1140
1148
|
queue_elapsed_ms: sumDefinedNumbers(splitJobs.map((job) => job.queue_elapsed_ms)),
|
|
1149
|
+
pre_submission_elapsed_ms: sumDefinedNumbers(splitJobs.map((job) => job.pre_submission_elapsed_ms)),
|
|
1141
1150
|
elapsed_ms: sumDefinedNumbers(splitJobs.map((job) => job.elapsed_ms)),
|
|
1142
1151
|
split_jobs: splitJobs
|
|
1143
1152
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -8780,6 +8780,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
8780
8780
|
"press",
|
|
8781
8781
|
"fill",
|
|
8782
8782
|
"set_input_value",
|
|
8783
|
+
"set_range_value",
|
|
8783
8784
|
"assert_text_visible",
|
|
8784
8785
|
"assert_text_absent",
|
|
8785
8786
|
"assert_selector_count",
|
|
@@ -9371,7 +9372,7 @@ function isSupportedCheckType(value) {
|
|
|
9371
9372
|
}
|
|
9372
9373
|
function normalizeSetupActionType(value, index) {
|
|
9373
9374
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
9374
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
9375
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
9375
9376
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
9376
9377
|
return normalized;
|
|
9377
9378
|
}
|
|
@@ -9469,7 +9470,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9469
9470
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
9470
9471
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
9471
9472
|
}
|
|
9472
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9473
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9473
9474
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
9474
9475
|
}
|
|
9475
9476
|
const fromX = numberValue3(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -9501,7 +9502,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9501
9502
|
}
|
|
9502
9503
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
9503
9504
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
9504
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
9505
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
9505
9506
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
9506
9507
|
}
|
|
9507
9508
|
const key = stringValue5(input.key);
|
|
@@ -14658,6 +14659,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
14658
14659
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
14659
14660
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
14660
14661
|
}
|
|
14662
|
+
if (type === "set_range_value") {
|
|
14663
|
+
const scope = await setupActionScope(action, timeout);
|
|
14664
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
14665
|
+
const locator = scope.context.locator(action.selector);
|
|
14666
|
+
const count = await locator.count();
|
|
14667
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
14668
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
14669
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
14670
|
+
const target = locator.nth(targetIndex);
|
|
14671
|
+
await target.waitFor({ state: "visible", timeout });
|
|
14672
|
+
const requestedValue = setupActionValue(action);
|
|
14673
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
14674
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
14675
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
14676
|
+
if (tag !== "input" || inputType !== "range") {
|
|
14677
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
14678
|
+
}
|
|
14679
|
+
const beforeValue = String(element.value);
|
|
14680
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
14681
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
14682
|
+
else element.value = String(value);
|
|
14683
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
14684
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
14685
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
14686
|
+
return {
|
|
14687
|
+
ok: true,
|
|
14688
|
+
before_value: beforeValue,
|
|
14689
|
+
actual_value: String(element.value),
|
|
14690
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
14691
|
+
min: element.min || null,
|
|
14692
|
+
max: element.max || null,
|
|
14693
|
+
step: element.step || null,
|
|
14694
|
+
};
|
|
14695
|
+
}, requestedValue);
|
|
14696
|
+
return {
|
|
14697
|
+
...base,
|
|
14698
|
+
...setupScopeEvidence(scope),
|
|
14699
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
14700
|
+
count,
|
|
14701
|
+
target_index: targetIndex,
|
|
14702
|
+
requested_value: requestedValue,
|
|
14703
|
+
actual_value: rangeResult?.actual_value,
|
|
14704
|
+
before_value: rangeResult?.before_value,
|
|
14705
|
+
value_as_number: rangeResult?.value_as_number,
|
|
14706
|
+
min: rangeResult?.min,
|
|
14707
|
+
max: rangeResult?.max,
|
|
14708
|
+
step: rangeResult?.step,
|
|
14709
|
+
tag: rangeResult?.tag,
|
|
14710
|
+
input_type: rangeResult?.input_type,
|
|
14711
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
14712
|
+
};
|
|
14713
|
+
}
|
|
14661
14714
|
if (type === "assert_selector_count") {
|
|
14662
14715
|
const scope = await setupActionScope(action, timeout);
|
|
14663
14716
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
@@ -16464,6 +16517,7 @@ function buildPollSnapshot(jobId, job, input) {
|
|
|
16464
16517
|
submitted_at: submittedAt,
|
|
16465
16518
|
completed_at: completedAt,
|
|
16466
16519
|
queue_elapsed_ms: queueElapsedMs,
|
|
16520
|
+
pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
|
|
16467
16521
|
running_without_submission: Boolean(status && !terminal && !submittedAt)
|
|
16468
16522
|
};
|
|
16469
16523
|
}
|
|
@@ -16471,7 +16525,8 @@ function pollMessage(snapshot, timedOut) {
|
|
|
16471
16525
|
if (!timedOut) return void 0;
|
|
16472
16526
|
const submitted = snapshot.submitted_at || "not submitted";
|
|
16473
16527
|
const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
|
|
16474
|
-
|
|
16528
|
+
const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
|
|
16529
|
+
return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
|
|
16475
16530
|
}
|
|
16476
16531
|
async function pollRiddleJob(config, jobId, options = {}) {
|
|
16477
16532
|
if (!jobId?.trim()) throw new Error("jobId is required");
|
|
@@ -16483,15 +16538,24 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
16483
16538
|
let lastSnapshot = null;
|
|
16484
16539
|
let lastProgressAt = 0;
|
|
16485
16540
|
let lastProgressKey = "";
|
|
16541
|
+
let preSubmissionElapsedMs = 0;
|
|
16486
16542
|
for (let index = 0; index < attempts; index += 1) {
|
|
16487
16543
|
job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
|
|
16488
16544
|
const observedAt = Date.now();
|
|
16489
|
-
|
|
16545
|
+
const nextSnapshot = buildPollSnapshot(jobId, job, {
|
|
16490
16546
|
attempt: index + 1,
|
|
16491
16547
|
attempts,
|
|
16492
16548
|
startedAt,
|
|
16493
|
-
observedAt
|
|
16549
|
+
observedAt,
|
|
16550
|
+
preSubmissionElapsedMs
|
|
16494
16551
|
});
|
|
16552
|
+
if (nextSnapshot.running_without_submission) {
|
|
16553
|
+
preSubmissionElapsedMs = Math.max(preSubmissionElapsedMs, nextSnapshot.elapsed_ms);
|
|
16554
|
+
}
|
|
16555
|
+
lastSnapshot = {
|
|
16556
|
+
...nextSnapshot,
|
|
16557
|
+
pre_submission_elapsed_ms: preSubmissionElapsedMs
|
|
16558
|
+
};
|
|
16495
16559
|
const progressKey = [
|
|
16496
16560
|
lastSnapshot.status || "unknown",
|
|
16497
16561
|
lastSnapshot.terminal ? "terminal" : "nonterminal",
|
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-WAJA6TJV.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
riddleRequestJson,
|
|
78
78
|
runRiddleScript,
|
|
79
79
|
runRiddleServerPreview
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-M3ZTY6PQ.js";
|
|
81
81
|
import {
|
|
82
82
|
DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
|
|
83
83
|
DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
|
package/dist/profile.cjs
CHANGED
|
@@ -94,6 +94,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
94
94
|
"press",
|
|
95
95
|
"fill",
|
|
96
96
|
"set_input_value",
|
|
97
|
+
"set_range_value",
|
|
97
98
|
"assert_text_visible",
|
|
98
99
|
"assert_text_absent",
|
|
99
100
|
"assert_selector_count",
|
|
@@ -685,7 +686,7 @@ function isSupportedCheckType(value) {
|
|
|
685
686
|
}
|
|
686
687
|
function normalizeSetupActionType(value, index) {
|
|
687
688
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
688
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
689
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
689
690
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
690
691
|
return normalized;
|
|
691
692
|
}
|
|
@@ -783,7 +784,7 @@ function normalizeSetupAction(input, index) {
|
|
|
783
784
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
784
785
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
785
786
|
}
|
|
786
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
787
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
787
788
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
788
789
|
}
|
|
789
790
|
const fromX = numberValue(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -815,7 +816,7 @@ function normalizeSetupAction(input, index) {
|
|
|
815
816
|
}
|
|
816
817
|
const value = stringFromOwn(input, "value", "input_value", "inputValue");
|
|
817
818
|
const hasJsonValue = hasOwn(input, "value_json") || hasOwn(input, "valueJson") || hasOwn(input, "json");
|
|
818
|
-
if ((type === "fill" || type === "set_input_value") && value === void 0 && !hasJsonValue) {
|
|
819
|
+
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
819
820
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
820
821
|
}
|
|
821
822
|
const key = stringValue(input.key);
|
|
@@ -5972,6 +5973,58 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
5972
5973
|
await locator.nth(targetIndex).fill(value, { timeout });
|
|
5973
5974
|
return { ...base, ...setupScopeEvidence(scope), ok: true, count, target_index: targetIndex, value_length: value.length };
|
|
5974
5975
|
}
|
|
5976
|
+
if (type === "set_range_value") {
|
|
5977
|
+
const scope = await setupActionScope(action, timeout);
|
|
5978
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
5979
|
+
const locator = scope.context.locator(action.selector);
|
|
5980
|
+
const count = await locator.count();
|
|
5981
|
+
if (!count) return { ...base, reason: "selector_not_found", count };
|
|
5982
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
5983
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, reason: "index_out_of_range", count, target_index: targetIndex };
|
|
5984
|
+
const target = locator.nth(targetIndex);
|
|
5985
|
+
await target.waitFor({ state: "visible", timeout });
|
|
5986
|
+
const requestedValue = setupActionValue(action);
|
|
5987
|
+
const rangeResult = await target.evaluate((element, value) => {
|
|
5988
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
5989
|
+
const inputType = tag === "input" ? String(element.type || "").toLowerCase() : "";
|
|
5990
|
+
if (tag !== "input" || inputType !== "range") {
|
|
5991
|
+
return { ok: false, reason: "not_range_input", tag, input_type: inputType };
|
|
5992
|
+
}
|
|
5993
|
+
const beforeValue = String(element.value);
|
|
5994
|
+
const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
5995
|
+
if (typeof valueSetter === "function") valueSetter.call(element, String(value));
|
|
5996
|
+
else element.value = String(value);
|
|
5997
|
+
element.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
|
|
5998
|
+
element.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
5999
|
+
const valueAsNumber = Number(element.valueAsNumber);
|
|
6000
|
+
return {
|
|
6001
|
+
ok: true,
|
|
6002
|
+
before_value: beforeValue,
|
|
6003
|
+
actual_value: String(element.value),
|
|
6004
|
+
value_as_number: Number.isFinite(valueAsNumber) ? valueAsNumber : null,
|
|
6005
|
+
min: element.min || null,
|
|
6006
|
+
max: element.max || null,
|
|
6007
|
+
step: element.step || null,
|
|
6008
|
+
};
|
|
6009
|
+
}, requestedValue);
|
|
6010
|
+
return {
|
|
6011
|
+
...base,
|
|
6012
|
+
...setupScopeEvidence(scope),
|
|
6013
|
+
ok: rangeResult && rangeResult.ok === true,
|
|
6014
|
+
count,
|
|
6015
|
+
target_index: targetIndex,
|
|
6016
|
+
requested_value: requestedValue,
|
|
6017
|
+
actual_value: rangeResult?.actual_value,
|
|
6018
|
+
before_value: rangeResult?.before_value,
|
|
6019
|
+
value_as_number: rangeResult?.value_as_number,
|
|
6020
|
+
min: rangeResult?.min,
|
|
6021
|
+
max: rangeResult?.max,
|
|
6022
|
+
step: rangeResult?.step,
|
|
6023
|
+
tag: rangeResult?.tag,
|
|
6024
|
+
input_type: rangeResult?.input_type,
|
|
6025
|
+
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
6026
|
+
};
|
|
6027
|
+
}
|
|
5975
6028
|
if (type === "assert_selector_count") {
|
|
5976
6029
|
const scope = await setupActionScope(action, timeout);
|
|
5977
6030
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
package/dist/profile.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evide
|
|
|
5
5
|
declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
|
|
6
6
|
declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
|
|
7
7
|
declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "url_search_param_equals", "url_search_param_absent", "selector_visible", "selector_absent", "selector_count_at_least", "selector_count_equals", "selector_count_equal", "selector_count_eq", "dialog_count_equals", "dialog_accept_count_equals", "dialog_dismiss_count_equals", "selector_text_visible", "selector_text_absent", "selector_text_order", "frame_text_visible", "frame_url_equals", "frame_url_matches", "frame_no_horizontal_overflow", "text_visible", "text_absent", "http_status", "link_status", "artifact_link_status", "route_inventory", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors", "no_console_warnings"];
|
|
8
|
-
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
8
|
+
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "set_range_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
9
9
|
type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
|
|
10
10
|
type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
|
|
11
11
|
type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
|
|
@@ -385,6 +385,7 @@ interface RiddleProofProfileResult {
|
|
|
385
385
|
submitted_at?: string | null;
|
|
386
386
|
completed_at?: string | null;
|
|
387
387
|
queue_elapsed_ms?: number | null;
|
|
388
|
+
pre_submission_elapsed_ms?: number;
|
|
388
389
|
elapsed_ms?: number;
|
|
389
390
|
attempt?: number;
|
|
390
391
|
attempts?: number;
|
|
@@ -395,6 +396,7 @@ interface RiddleProofProfileResult {
|
|
|
395
396
|
status?: string | null;
|
|
396
397
|
terminal?: boolean;
|
|
397
398
|
queue_elapsed_ms?: number | null;
|
|
399
|
+
pre_submission_elapsed_ms?: number;
|
|
398
400
|
elapsed_ms?: number;
|
|
399
401
|
attempt?: number;
|
|
400
402
|
attempts?: number;
|
package/dist/profile.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: "riddle-proof.profile-evide
|
|
|
5
5
|
declare const RIDDLE_PROOF_PROFILE_RESULT_VERSION: "riddle-proof.profile-result.v1";
|
|
6
6
|
declare const RIDDLE_PROOF_PROFILE_STATUSES: readonly ["passed", "product_regression", "proof_insufficient", "environment_blocked", "configuration_error", "needs_human_review"];
|
|
7
7
|
declare const RIDDLE_PROOF_PROFILE_CHECK_TYPES: readonly ["route_loaded", "url_search_param_equals", "url_search_param_absent", "selector_visible", "selector_absent", "selector_count_at_least", "selector_count_equals", "selector_count_equal", "selector_count_eq", "dialog_count_equals", "dialog_accept_count_equals", "dialog_dismiss_count_equals", "selector_text_visible", "selector_text_absent", "selector_text_order", "frame_text_visible", "frame_url_equals", "frame_url_matches", "frame_no_horizontal_overflow", "text_visible", "text_absent", "http_status", "link_status", "artifact_link_status", "route_inventory", "no_horizontal_overflow", "no_mobile_horizontal_overflow", "no_fatal_console_errors", "no_console_warnings"];
|
|
8
|
-
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
8
|
+
declare const RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: readonly ["click", "drag", "press", "fill", "set_input_value", "set_range_value", "assert_text_visible", "assert_text_absent", "assert_selector_count", "assert_window_value", "assert_window_number", "local_storage", "session_storage", "clear_storage", "clear_console", "dialog_response", "screenshot", "wait", "wait_for_selector", "wait_for_text", "window_eval", "window_call", "window_call_until"];
|
|
9
9
|
type RiddleProofProfileStatus = typeof RIDDLE_PROOF_PROFILE_STATUSES[number];
|
|
10
10
|
type RiddleProofProfileCheckType = typeof RIDDLE_PROOF_PROFILE_CHECK_TYPES[number];
|
|
11
11
|
type RiddleProofProfileSetupActionType = typeof RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES[number];
|
|
@@ -385,6 +385,7 @@ interface RiddleProofProfileResult {
|
|
|
385
385
|
submitted_at?: string | null;
|
|
386
386
|
completed_at?: string | null;
|
|
387
387
|
queue_elapsed_ms?: number | null;
|
|
388
|
+
pre_submission_elapsed_ms?: number;
|
|
388
389
|
elapsed_ms?: number;
|
|
389
390
|
attempt?: number;
|
|
390
391
|
attempts?: number;
|
|
@@ -395,6 +396,7 @@ interface RiddleProofProfileResult {
|
|
|
395
396
|
status?: string | null;
|
|
396
397
|
terminal?: boolean;
|
|
397
398
|
queue_elapsed_ms?: number | null;
|
|
399
|
+
pre_submission_elapsed_ms?: number;
|
|
398
400
|
elapsed_ms?: number;
|
|
399
401
|
attempt?: number;
|
|
400
402
|
attempts?: number;
|
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-WAJA6TJV.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
package/dist/riddle-client.cjs
CHANGED
|
@@ -325,6 +325,7 @@ function buildPollSnapshot(jobId, job, input) {
|
|
|
325
325
|
submitted_at: submittedAt,
|
|
326
326
|
completed_at: completedAt,
|
|
327
327
|
queue_elapsed_ms: queueElapsedMs,
|
|
328
|
+
pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
|
|
328
329
|
running_without_submission: Boolean(status && !terminal && !submittedAt)
|
|
329
330
|
};
|
|
330
331
|
}
|
|
@@ -332,7 +333,8 @@ function pollMessage(snapshot, timedOut) {
|
|
|
332
333
|
if (!timedOut) return void 0;
|
|
333
334
|
const submitted = snapshot.submitted_at || "not submitted";
|
|
334
335
|
const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
|
|
335
|
-
|
|
336
|
+
const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
|
|
337
|
+
return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} submitted_at=${submitted}.${queue}${preSubmit}`;
|
|
336
338
|
}
|
|
337
339
|
async function pollRiddleJob(config, jobId, options = {}) {
|
|
338
340
|
if (!jobId?.trim()) throw new Error("jobId is required");
|
|
@@ -344,15 +346,24 @@ async function pollRiddleJob(config, jobId, options = {}) {
|
|
|
344
346
|
let lastSnapshot = null;
|
|
345
347
|
let lastProgressAt = 0;
|
|
346
348
|
let lastProgressKey = "";
|
|
349
|
+
let preSubmissionElapsedMs = 0;
|
|
347
350
|
for (let index = 0; index < attempts; index += 1) {
|
|
348
351
|
job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
|
|
349
352
|
const observedAt = Date.now();
|
|
350
|
-
|
|
353
|
+
const nextSnapshot = buildPollSnapshot(jobId, job, {
|
|
351
354
|
attempt: index + 1,
|
|
352
355
|
attempts,
|
|
353
356
|
startedAt,
|
|
354
|
-
observedAt
|
|
357
|
+
observedAt,
|
|
358
|
+
preSubmissionElapsedMs
|
|
355
359
|
});
|
|
360
|
+
if (nextSnapshot.running_without_submission) {
|
|
361
|
+
preSubmissionElapsedMs = Math.max(preSubmissionElapsedMs, nextSnapshot.elapsed_ms);
|
|
362
|
+
}
|
|
363
|
+
lastSnapshot = {
|
|
364
|
+
...nextSnapshot,
|
|
365
|
+
pre_submission_elapsed_ms: preSubmissionElapsedMs
|
|
366
|
+
};
|
|
356
367
|
const progressKey = [
|
|
357
368
|
lastSnapshot.status || "unknown",
|
|
358
369
|
lastSnapshot.terminal ? "terminal" : "nonterminal",
|
package/dist/riddle-client.d.cts
CHANGED
|
@@ -18,6 +18,7 @@ interface RiddlePollProgressSnapshot {
|
|
|
18
18
|
submitted_at: string | null;
|
|
19
19
|
completed_at: string | null;
|
|
20
20
|
queue_elapsed_ms: number | null;
|
|
21
|
+
pre_submission_elapsed_ms: number;
|
|
21
22
|
running_without_submission: boolean;
|
|
22
23
|
}
|
|
23
24
|
interface RiddlePollSummary extends RiddlePollProgressSnapshot {
|
package/dist/riddle-client.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ interface RiddlePollProgressSnapshot {
|
|
|
18
18
|
submitted_at: string | null;
|
|
19
19
|
completed_at: string | null;
|
|
20
20
|
queue_elapsed_ms: number | null;
|
|
21
|
+
pre_submission_elapsed_ms: number;
|
|
21
22
|
running_without_submission: boolean;
|
|
22
23
|
}
|
|
23
24
|
interface RiddlePollSummary extends RiddlePollProgressSnapshot {
|
package/dist/riddle-client.js
CHANGED