@riddledc/riddle-proof 0.7.170 → 0.7.172
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 +9 -1
- package/dist/{chunk-7ZY6ONH4.js → chunk-5ELOMJ7U.js} +219 -7
- package/dist/cli.cjs +250 -8
- package/dist/cli.js +32 -2
- package/dist/index.cjs +219 -7
- package/dist/index.js +1 -1
- package/dist/profile.cjs +219 -7
- package/dist/profile.d.cts +6 -1
- package/dist/profile.d.ts +6 -1
- package/dist/profile.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
package/dist/profile.cjs
CHANGED
|
@@ -96,6 +96,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
96
96
|
"fill",
|
|
97
97
|
"set_input_value",
|
|
98
98
|
"set_range_value",
|
|
99
|
+
"deterministic_runtime",
|
|
99
100
|
"canvas_signature",
|
|
100
101
|
"assert_text_visible",
|
|
101
102
|
"assert_text_absent",
|
|
@@ -404,11 +405,19 @@ function resolveJsonPath(root, path) {
|
|
|
404
405
|
}
|
|
405
406
|
let current = root;
|
|
406
407
|
for (const segment of segments) {
|
|
407
|
-
if (
|
|
408
|
-
if (
|
|
409
|
-
|
|
408
|
+
if (Array.isArray(current)) {
|
|
409
|
+
if (segment === "length") {
|
|
410
|
+
current = current.length;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
const index = typeof segment === "number" ? segment : /^\d+$/.test(segment) ? Number(segment) : -1;
|
|
414
|
+
if (index < 0 || index >= current.length) return { exists: false };
|
|
415
|
+
current = current[index];
|
|
410
416
|
continue;
|
|
411
417
|
}
|
|
418
|
+
if (typeof segment === "number") {
|
|
419
|
+
return { exists: false };
|
|
420
|
+
}
|
|
412
421
|
if (!isRecord(current) || !hasOwn(current, segment)) return { exists: false };
|
|
413
422
|
current = current[segment];
|
|
414
423
|
}
|
|
@@ -550,6 +559,23 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
550
559
|
return receipt;
|
|
551
560
|
});
|
|
552
561
|
}
|
|
562
|
+
function profileSetupDeterministicRuntimeReceipts(results) {
|
|
563
|
+
return results.filter((result) => profileSetupResultAction(result) === "deterministic_runtime").map((result) => ({
|
|
564
|
+
ordinal: result.ordinal ?? null,
|
|
565
|
+
ok: result.ok !== false,
|
|
566
|
+
random_enabled: result.random_enabled ?? null,
|
|
567
|
+
random_queue_added: result.random_queue_added ?? null,
|
|
568
|
+
random_queue_length: result.random_queue_length ?? null,
|
|
569
|
+
random_queue_mode: result.random_queue_mode ?? null,
|
|
570
|
+
random_underflow_count: result.random_underflow_count ?? null,
|
|
571
|
+
clock_enabled: result.clock_enabled ?? null,
|
|
572
|
+
previous_now: result.previous_now ?? null,
|
|
573
|
+
now: result.now ?? null,
|
|
574
|
+
advance_ms: result.advance_ms ?? null,
|
|
575
|
+
restored: result.restored ?? null,
|
|
576
|
+
reason: result.reason ?? result.error ?? null
|
|
577
|
+
}));
|
|
578
|
+
}
|
|
553
579
|
function profileSetupReturnSummaryFields(result) {
|
|
554
580
|
const input = result.return_summary_fields;
|
|
555
581
|
if (!Array.isArray(input)) return [];
|
|
@@ -764,6 +790,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
764
790
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
765
791
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
766
792
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
793
|
+
const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
|
|
794
|
+
const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
|
|
767
795
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
768
796
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
769
797
|
const dragReceipts = profileSetupDragReceipts(results);
|
|
@@ -823,6 +851,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
823
851
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
824
852
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
825
853
|
window_eval: sampledWindowEvalReceipts,
|
|
854
|
+
deterministic_runtime_total: deterministicRuntimeReceipts.length,
|
|
855
|
+
deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
|
|
856
|
+
deterministic_runtime: sampledDeterministicRuntimeReceipts,
|
|
826
857
|
set_range_value_total: rangeValueReceipts.length,
|
|
827
858
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
828
859
|
set_range_value: sampledRangeValueReceipts,
|
|
@@ -885,7 +916,7 @@ function isSupportedCheckType(value) {
|
|
|
885
916
|
}
|
|
886
917
|
function normalizeSetupActionType(value, index) {
|
|
887
918
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
888
|
-
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 === "canvas_hash" || normalizedInput === "capture_canvas_hash" || normalizedInput === "capture_canvas_signature" || normalizedInput === "canvas_state_signature" ? "canvas_signature" : 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;
|
|
919
|
+
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 === "deterministic_runtime" || normalizedInput === "mock_runtime" || normalizedInput === "mock_random" || normalizedInput === "mock_random_queue" || normalizedInput === "seed_random_queue" || normalizedInput === "set_random_queue" || normalizedInput === "mock_clock" || normalizedInput === "set_mock_clock" || normalizedInput === "set_runtime_determinism" || normalizedInput === "runtime_determinism" ? "deterministic_runtime" : normalizedInput === "canvas_hash" || normalizedInput === "capture_canvas_hash" || normalizedInput === "capture_canvas_signature" || normalizedInput === "canvas_state_signature" ? "canvas_signature" : 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;
|
|
889
920
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
890
921
|
return normalized;
|
|
891
922
|
}
|
|
@@ -1004,6 +1035,39 @@ function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
|
1004
1035
|
}
|
|
1005
1036
|
return values[0];
|
|
1006
1037
|
}
|
|
1038
|
+
function normalizeSetupActionRandomQueue(input, index) {
|
|
1039
|
+
const rawQueue = valueFromOwn(
|
|
1040
|
+
input,
|
|
1041
|
+
"random_queue",
|
|
1042
|
+
"randomQueue",
|
|
1043
|
+
"random_values",
|
|
1044
|
+
"randomValues",
|
|
1045
|
+
"random_sequence",
|
|
1046
|
+
"randomSequence",
|
|
1047
|
+
"math_random",
|
|
1048
|
+
"mathRandom"
|
|
1049
|
+
);
|
|
1050
|
+
if (rawQueue === void 0) return void 0;
|
|
1051
|
+
if (!Array.isArray(rawQueue) || rawQueue.length === 0) {
|
|
1052
|
+
throw new Error(`target.setup_actions[${index}].random_queue must be a non-empty array of numbers from 0 inclusive to 1 exclusive.`);
|
|
1053
|
+
}
|
|
1054
|
+
return rawQueue.map((item, queueIndex) => {
|
|
1055
|
+
const value = numberValue(item);
|
|
1056
|
+
if (value === void 0 || value < 0 || value >= 1) {
|
|
1057
|
+
throw new Error(`target.setup_actions[${index}].random_queue[${queueIndex}] must be a finite number from 0 inclusive to 1 exclusive.`);
|
|
1058
|
+
}
|
|
1059
|
+
return value;
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
function normalizeSetupActionNonNegativeNumber(input, index, outputKey, ...keys) {
|
|
1063
|
+
const rawValue = valueFromOwn(input, ...keys);
|
|
1064
|
+
if (rawValue === void 0) return void 0;
|
|
1065
|
+
const value = numberValue(rawValue);
|
|
1066
|
+
if (value === void 0 || value < 0) {
|
|
1067
|
+
throw new Error(`target.setup_actions[${index}].${outputKey} must be a finite non-negative number.`);
|
|
1068
|
+
}
|
|
1069
|
+
return value;
|
|
1070
|
+
}
|
|
1007
1071
|
function normalizeSetupAction(input, index) {
|
|
1008
1072
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
1009
1073
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -1064,6 +1128,14 @@ function normalizeSetupAction(input, index) {
|
|
|
1064
1128
|
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
1065
1129
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
1066
1130
|
}
|
|
1131
|
+
const randomQueue = type === "deterministic_runtime" ? normalizeSetupActionRandomQueue(input, index) : void 0;
|
|
1132
|
+
const deterministicNow = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "now", "now", "date_now", "dateNow", "mock_now", "mockNow", "clock", "timestamp", "time_ms", "timeMs") : void 0;
|
|
1133
|
+
const deterministicAdvanceMs = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "advance_ms", "advance_ms", "advanceMs", "tick_ms", "tickMs", "add_ms", "addMs") : void 0;
|
|
1134
|
+
const deterministicAppend = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "append", "append_random", "appendRandom")) === true;
|
|
1135
|
+
const deterministicRestore = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "restore", "reset", "restore_originals", "restoreOriginals")) === true;
|
|
1136
|
+
if (type === "deterministic_runtime" && randomQueue === void 0 && deterministicNow === void 0 && deterministicAdvanceMs === void 0 && !deterministicRestore) {
|
|
1137
|
+
throw new Error(`target.setup_actions[${index}] deterministic_runtime requires random_queue, now, advance_ms, or restore.`);
|
|
1138
|
+
}
|
|
1067
1139
|
const key = stringValue(input.key);
|
|
1068
1140
|
let dialogAccept;
|
|
1069
1141
|
if (type === "dialog_response") {
|
|
@@ -1171,6 +1243,11 @@ function normalizeSetupAction(input, index) {
|
|
|
1171
1243
|
key,
|
|
1172
1244
|
value,
|
|
1173
1245
|
value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
|
|
1246
|
+
random_queue: randomQueue,
|
|
1247
|
+
now: deterministicNow,
|
|
1248
|
+
advance_ms: deterministicAdvanceMs,
|
|
1249
|
+
append: deterministicAppend || void 0,
|
|
1250
|
+
restore: deterministicRestore || void 0,
|
|
1174
1251
|
label: stringFromOwn(input, "label", "name", "screenshot_label", "screenshotLabel"),
|
|
1175
1252
|
script,
|
|
1176
1253
|
path,
|
|
@@ -4247,6 +4324,25 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
4247
4324
|
return receipt;
|
|
4248
4325
|
});
|
|
4249
4326
|
}
|
|
4327
|
+
function profileSetupDeterministicRuntimeReceipts(results) {
|
|
4328
|
+
return (results || [])
|
|
4329
|
+
.filter((result) => result && profileSetupResultAction(result) === "deterministic_runtime")
|
|
4330
|
+
.map((result) => ({
|
|
4331
|
+
ordinal: result.ordinal ?? null,
|
|
4332
|
+
ok: result.ok !== false,
|
|
4333
|
+
random_enabled: result.random_enabled ?? null,
|
|
4334
|
+
random_queue_added: result.random_queue_added ?? null,
|
|
4335
|
+
random_queue_length: result.random_queue_length ?? null,
|
|
4336
|
+
random_queue_mode: result.random_queue_mode ?? null,
|
|
4337
|
+
random_underflow_count: result.random_underflow_count ?? null,
|
|
4338
|
+
clock_enabled: result.clock_enabled ?? null,
|
|
4339
|
+
previous_now: result.previous_now ?? null,
|
|
4340
|
+
now: result.now ?? null,
|
|
4341
|
+
advance_ms: result.advance_ms ?? null,
|
|
4342
|
+
restored: result.restored ?? null,
|
|
4343
|
+
reason: result.reason || result.error || null,
|
|
4344
|
+
}));
|
|
4345
|
+
}
|
|
4250
4346
|
function profileSetupReturnSummaryFields(result) {
|
|
4251
4347
|
const input = result && result.return_summary_fields;
|
|
4252
4348
|
if (!Array.isArray(input)) return [];
|
|
@@ -4490,6 +4586,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4490
4586
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
4491
4587
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
4492
4588
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
4589
|
+
const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
|
|
4590
|
+
const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
|
|
4493
4591
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
4494
4592
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
4495
4593
|
const dragReceipts = profileSetupDragReceipts(results);
|
|
@@ -4559,6 +4657,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
4559
4657
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
4560
4658
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
4561
4659
|
window_eval: sampledWindowEvalReceipts,
|
|
4660
|
+
deterministic_runtime_total: deterministicRuntimeReceipts.length,
|
|
4661
|
+
deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
|
|
4662
|
+
deterministic_runtime: sampledDeterministicRuntimeReceipts,
|
|
4562
4663
|
set_range_value_total: rangeValueReceipts.length,
|
|
4563
4664
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
4564
4665
|
set_range_value: sampledRangeValueReceipts,
|
|
@@ -6180,6 +6281,111 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
6180
6281
|
}
|
|
6181
6282
|
return { ...base, ...setupScopeEvidence(scope), ok: true, storage, reload: action.reload === true };
|
|
6182
6283
|
}
|
|
6284
|
+
if (type === "deterministic_runtime") {
|
|
6285
|
+
const scope = await setupActionScope(action, timeout);
|
|
6286
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
6287
|
+
const randomQueue = Array.isArray(action.random_queue)
|
|
6288
|
+
? action.random_queue
|
|
6289
|
+
: Array.isArray(action.randomQueue)
|
|
6290
|
+
? action.randomQueue
|
|
6291
|
+
: null;
|
|
6292
|
+
const now = setupFiniteNumber(action.now ?? action.date_now ?? action.dateNow ?? action.mock_now ?? action.mockNow ?? action.clock ?? action.timestamp ?? action.time_ms ?? action.timeMs);
|
|
6293
|
+
const advanceMs = setupFiniteNumber(action.advance_ms ?? action.advanceMs ?? action.tick_ms ?? action.tickMs ?? action.add_ms ?? action.addMs);
|
|
6294
|
+
const append = action.append === true || action.append_random === true || action.appendRandom === true;
|
|
6295
|
+
const restore = action.restore === true || action.reset === true || action.restore_originals === true || action.restoreOriginals === true;
|
|
6296
|
+
const runtimeResult = await scope.context.evaluate((payload) => {
|
|
6297
|
+
const root = window;
|
|
6298
|
+
const stateKey = "__RIDDLE_PROOF_DETERMINISTIC_RUNTIME__";
|
|
6299
|
+
const state = root[stateKey] && typeof root[stateKey] === "object" && !Array.isArray(root[stateKey])
|
|
6300
|
+
? root[stateKey]
|
|
6301
|
+
: {};
|
|
6302
|
+
root[stateKey] = state;
|
|
6303
|
+
if (typeof state.originalRandom !== "function") state.originalRandom = Math.random;
|
|
6304
|
+
if (typeof state.originalDateNow !== "function") state.originalDateNow = Date.now;
|
|
6305
|
+
const previousNow = typeof state.now === "number" && Number.isFinite(state.now)
|
|
6306
|
+
? state.now
|
|
6307
|
+
: Date.now === state.originalDateNow
|
|
6308
|
+
? null
|
|
6309
|
+
: Date.now();
|
|
6310
|
+
if (payload.restore) {
|
|
6311
|
+
Math.random = state.originalRandom;
|
|
6312
|
+
Date.now = state.originalDateNow;
|
|
6313
|
+
delete root[stateKey];
|
|
6314
|
+
return {
|
|
6315
|
+
ok: true,
|
|
6316
|
+
restored: true,
|
|
6317
|
+
random_enabled: false,
|
|
6318
|
+
random_queue_added: 0,
|
|
6319
|
+
random_queue_length: 0,
|
|
6320
|
+
random_queue_mode: null,
|
|
6321
|
+
random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
|
|
6322
|
+
clock_enabled: false,
|
|
6323
|
+
previous_now: previousNow,
|
|
6324
|
+
now: null,
|
|
6325
|
+
advance_ms: null,
|
|
6326
|
+
};
|
|
6327
|
+
}
|
|
6328
|
+
let randomQueueAdded = null;
|
|
6329
|
+
let randomQueueMode = null;
|
|
6330
|
+
if (Array.isArray(payload.random_queue)) {
|
|
6331
|
+
const queue = payload.random_queue.filter((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value < 1);
|
|
6332
|
+
const existing = Array.isArray(state.randomQueue) ? state.randomQueue : [];
|
|
6333
|
+
state.randomQueue = payload.append ? existing.concat(queue) : queue.slice();
|
|
6334
|
+
randomQueueAdded = queue.length;
|
|
6335
|
+
randomQueueMode = payload.append ? "append" : "replace";
|
|
6336
|
+
Math.random = function riddleProofMockRandom() {
|
|
6337
|
+
const activeQueue = Array.isArray(state.randomQueue) ? state.randomQueue : [];
|
|
6338
|
+
if (activeQueue.length) return activeQueue.shift();
|
|
6339
|
+
state.randomUnderflowCount = (typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0) + 1;
|
|
6340
|
+
return 0;
|
|
6341
|
+
};
|
|
6342
|
+
}
|
|
6343
|
+
if (typeof payload.now === "number" && Number.isFinite(payload.now)) {
|
|
6344
|
+
state.now = payload.now;
|
|
6345
|
+
Date.now = function riddleProofMockDateNow() {
|
|
6346
|
+
return state.now;
|
|
6347
|
+
};
|
|
6348
|
+
}
|
|
6349
|
+
if (typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms)) {
|
|
6350
|
+
const baseNow = typeof state.now === "number" && Number.isFinite(state.now)
|
|
6351
|
+
? state.now
|
|
6352
|
+
: Date.now();
|
|
6353
|
+
state.now = baseNow + payload.advance_ms;
|
|
6354
|
+
Date.now = function riddleProofMockDateNow() {
|
|
6355
|
+
return state.now;
|
|
6356
|
+
};
|
|
6357
|
+
}
|
|
6358
|
+
return {
|
|
6359
|
+
ok: true,
|
|
6360
|
+
restored: false,
|
|
6361
|
+
random_enabled: Math.random !== state.originalRandom,
|
|
6362
|
+
random_queue_added: randomQueueAdded,
|
|
6363
|
+
random_queue_length: Array.isArray(state.randomQueue) ? state.randomQueue.length : 0,
|
|
6364
|
+
random_queue_mode: randomQueueMode,
|
|
6365
|
+
random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
|
|
6366
|
+
clock_enabled: Date.now !== state.originalDateNow,
|
|
6367
|
+
previous_now: previousNow,
|
|
6368
|
+
now: typeof state.now === "number" && Number.isFinite(state.now) ? state.now : null,
|
|
6369
|
+
advance_ms: typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms) ? payload.advance_ms : null,
|
|
6370
|
+
};
|
|
6371
|
+
}, { random_queue: randomQueue, now, advance_ms: advanceMs, append, restore });
|
|
6372
|
+
return {
|
|
6373
|
+
...base,
|
|
6374
|
+
...setupScopeEvidence(scope),
|
|
6375
|
+
ok: runtimeResult && runtimeResult.ok === true,
|
|
6376
|
+
random_enabled: runtimeResult?.random_enabled,
|
|
6377
|
+
random_queue_added: runtimeResult?.random_queue_added,
|
|
6378
|
+
random_queue_length: runtimeResult?.random_queue_length,
|
|
6379
|
+
random_queue_mode: runtimeResult?.random_queue_mode,
|
|
6380
|
+
random_underflow_count: runtimeResult?.random_underflow_count,
|
|
6381
|
+
clock_enabled: runtimeResult?.clock_enabled,
|
|
6382
|
+
previous_now: runtimeResult?.previous_now,
|
|
6383
|
+
now: runtimeResult?.now,
|
|
6384
|
+
advance_ms: runtimeResult?.advance_ms,
|
|
6385
|
+
restored: runtimeResult?.restored,
|
|
6386
|
+
reason: runtimeResult && runtimeResult.ok === true ? undefined : runtimeResult?.reason || "deterministic_runtime_not_applied",
|
|
6387
|
+
};
|
|
6388
|
+
}
|
|
6183
6389
|
if (type === "window_eval") {
|
|
6184
6390
|
const script = String(action.script || action.code || action.source || action.body || "");
|
|
6185
6391
|
const args = Array.isArray(action.args) ? action.args : [];
|
|
@@ -7226,11 +7432,17 @@ function resolveJsonProbePath(root, path) {
|
|
|
7226
7432
|
}
|
|
7227
7433
|
let current = root;
|
|
7228
7434
|
for (const segment of segments) {
|
|
7229
|
-
if (
|
|
7230
|
-
if (
|
|
7231
|
-
|
|
7435
|
+
if (Array.isArray(current)) {
|
|
7436
|
+
if (segment === "length") {
|
|
7437
|
+
current = current.length;
|
|
7438
|
+
continue;
|
|
7439
|
+
}
|
|
7440
|
+
const index = typeof segment === "number" ? segment : (/^\d+$/.test(segment) ? Number(segment) : -1);
|
|
7441
|
+
if (index < 0 || index >= current.length) return { exists: false };
|
|
7442
|
+
current = current[index];
|
|
7232
7443
|
continue;
|
|
7233
7444
|
}
|
|
7445
|
+
if (typeof segment === "number") return { exists: false };
|
|
7234
7446
|
if (!current || typeof current !== "object" || Array.isArray(current) || !Object.hasOwn(current, segment)) {
|
|
7235
7447
|
return { exists: false };
|
|
7236
7448
|
}
|
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", "observe_within", "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", "set_range_value", "canvas_signature", "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", "deterministic_runtime", "canvas_signature", "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];
|
|
@@ -126,6 +126,11 @@ interface RiddleProofProfileSetupAction {
|
|
|
126
126
|
key?: string;
|
|
127
127
|
value?: string;
|
|
128
128
|
value_json?: JsonValue;
|
|
129
|
+
random_queue?: number[];
|
|
130
|
+
now?: number;
|
|
131
|
+
advance_ms?: number;
|
|
132
|
+
append?: boolean;
|
|
133
|
+
restore?: boolean;
|
|
129
134
|
label?: string;
|
|
130
135
|
script?: string;
|
|
131
136
|
path?: string;
|
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", "observe_within", "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", "set_range_value", "canvas_signature", "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", "deterministic_runtime", "canvas_signature", "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];
|
|
@@ -126,6 +126,11 @@ interface RiddleProofProfileSetupAction {
|
|
|
126
126
|
key?: string;
|
|
127
127
|
value?: string;
|
|
128
128
|
value_json?: JsonValue;
|
|
129
|
+
random_queue?: number[];
|
|
130
|
+
now?: number;
|
|
131
|
+
advance_ms?: number;
|
|
132
|
+
append?: boolean;
|
|
133
|
+
restore?: boolean;
|
|
129
134
|
label?: string;
|
|
130
135
|
script?: string;
|
|
131
136
|
path?: string;
|
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-5ELOMJ7U.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|