@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/index.cjs
CHANGED
|
@@ -8782,6 +8782,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
8782
8782
|
"fill",
|
|
8783
8783
|
"set_input_value",
|
|
8784
8784
|
"set_range_value",
|
|
8785
|
+
"deterministic_runtime",
|
|
8785
8786
|
"canvas_signature",
|
|
8786
8787
|
"assert_text_visible",
|
|
8787
8788
|
"assert_text_absent",
|
|
@@ -9090,11 +9091,19 @@ function resolveJsonPath(root, path6) {
|
|
|
9090
9091
|
}
|
|
9091
9092
|
let current = root;
|
|
9092
9093
|
for (const segment of segments) {
|
|
9093
|
-
if (
|
|
9094
|
-
if (
|
|
9095
|
-
|
|
9094
|
+
if (Array.isArray(current)) {
|
|
9095
|
+
if (segment === "length") {
|
|
9096
|
+
current = current.length;
|
|
9097
|
+
continue;
|
|
9098
|
+
}
|
|
9099
|
+
const index = typeof segment === "number" ? segment : /^\d+$/.test(segment) ? Number(segment) : -1;
|
|
9100
|
+
if (index < 0 || index >= current.length) return { exists: false };
|
|
9101
|
+
current = current[index];
|
|
9096
9102
|
continue;
|
|
9097
9103
|
}
|
|
9104
|
+
if (typeof segment === "number") {
|
|
9105
|
+
return { exists: false };
|
|
9106
|
+
}
|
|
9098
9107
|
if (!isRecord2(current) || !hasOwn(current, segment)) return { exists: false };
|
|
9099
9108
|
current = current[segment];
|
|
9100
9109
|
}
|
|
@@ -9236,6 +9245,23 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
9236
9245
|
return receipt;
|
|
9237
9246
|
});
|
|
9238
9247
|
}
|
|
9248
|
+
function profileSetupDeterministicRuntimeReceipts(results) {
|
|
9249
|
+
return results.filter((result) => profileSetupResultAction(result) === "deterministic_runtime").map((result) => ({
|
|
9250
|
+
ordinal: result.ordinal ?? null,
|
|
9251
|
+
ok: result.ok !== false,
|
|
9252
|
+
random_enabled: result.random_enabled ?? null,
|
|
9253
|
+
random_queue_added: result.random_queue_added ?? null,
|
|
9254
|
+
random_queue_length: result.random_queue_length ?? null,
|
|
9255
|
+
random_queue_mode: result.random_queue_mode ?? null,
|
|
9256
|
+
random_underflow_count: result.random_underflow_count ?? null,
|
|
9257
|
+
clock_enabled: result.clock_enabled ?? null,
|
|
9258
|
+
previous_now: result.previous_now ?? null,
|
|
9259
|
+
now: result.now ?? null,
|
|
9260
|
+
advance_ms: result.advance_ms ?? null,
|
|
9261
|
+
restored: result.restored ?? null,
|
|
9262
|
+
reason: result.reason ?? result.error ?? null
|
|
9263
|
+
}));
|
|
9264
|
+
}
|
|
9239
9265
|
function profileSetupReturnSummaryFields(result) {
|
|
9240
9266
|
const input = result.return_summary_fields;
|
|
9241
9267
|
if (!Array.isArray(input)) return [];
|
|
@@ -9450,6 +9476,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9450
9476
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
9451
9477
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
9452
9478
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
9479
|
+
const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
|
|
9480
|
+
const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
|
|
9453
9481
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
9454
9482
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
9455
9483
|
const dragReceipts = profileSetupDragReceipts(results);
|
|
@@ -9509,6 +9537,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9509
9537
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
9510
9538
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
9511
9539
|
window_eval: sampledWindowEvalReceipts,
|
|
9540
|
+
deterministic_runtime_total: deterministicRuntimeReceipts.length,
|
|
9541
|
+
deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
|
|
9542
|
+
deterministic_runtime: sampledDeterministicRuntimeReceipts,
|
|
9512
9543
|
set_range_value_total: rangeValueReceipts.length,
|
|
9513
9544
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
9514
9545
|
set_range_value: sampledRangeValueReceipts,
|
|
@@ -9571,7 +9602,7 @@ function isSupportedCheckType(value) {
|
|
|
9571
9602
|
}
|
|
9572
9603
|
function normalizeSetupActionType(value, index) {
|
|
9573
9604
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
9574
|
-
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;
|
|
9605
|
+
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;
|
|
9575
9606
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
9576
9607
|
return normalized;
|
|
9577
9608
|
}
|
|
@@ -9690,6 +9721,39 @@ function normalizeSetupActionScreenshotFullPage(input, type, index) {
|
|
|
9690
9721
|
}
|
|
9691
9722
|
return values[0];
|
|
9692
9723
|
}
|
|
9724
|
+
function normalizeSetupActionRandomQueue(input, index) {
|
|
9725
|
+
const rawQueue = valueFromOwn(
|
|
9726
|
+
input,
|
|
9727
|
+
"random_queue",
|
|
9728
|
+
"randomQueue",
|
|
9729
|
+
"random_values",
|
|
9730
|
+
"randomValues",
|
|
9731
|
+
"random_sequence",
|
|
9732
|
+
"randomSequence",
|
|
9733
|
+
"math_random",
|
|
9734
|
+
"mathRandom"
|
|
9735
|
+
);
|
|
9736
|
+
if (rawQueue === void 0) return void 0;
|
|
9737
|
+
if (!Array.isArray(rawQueue) || rawQueue.length === 0) {
|
|
9738
|
+
throw new Error(`target.setup_actions[${index}].random_queue must be a non-empty array of numbers from 0 inclusive to 1 exclusive.`);
|
|
9739
|
+
}
|
|
9740
|
+
return rawQueue.map((item, queueIndex) => {
|
|
9741
|
+
const value = numberValue3(item);
|
|
9742
|
+
if (value === void 0 || value < 0 || value >= 1) {
|
|
9743
|
+
throw new Error(`target.setup_actions[${index}].random_queue[${queueIndex}] must be a finite number from 0 inclusive to 1 exclusive.`);
|
|
9744
|
+
}
|
|
9745
|
+
return value;
|
|
9746
|
+
});
|
|
9747
|
+
}
|
|
9748
|
+
function normalizeSetupActionNonNegativeNumber(input, index, outputKey, ...keys) {
|
|
9749
|
+
const rawValue = valueFromOwn(input, ...keys);
|
|
9750
|
+
if (rawValue === void 0) return void 0;
|
|
9751
|
+
const value = numberValue3(rawValue);
|
|
9752
|
+
if (value === void 0 || value < 0) {
|
|
9753
|
+
throw new Error(`target.setup_actions[${index}].${outputKey} must be a finite non-negative number.`);
|
|
9754
|
+
}
|
|
9755
|
+
return value;
|
|
9756
|
+
}
|
|
9693
9757
|
function normalizeSetupAction(input, index) {
|
|
9694
9758
|
if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
9695
9759
|
const type = normalizeSetupActionType(stringValue5(input.type), index);
|
|
@@ -9750,6 +9814,14 @@ function normalizeSetupAction(input, index) {
|
|
|
9750
9814
|
if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
|
|
9751
9815
|
throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
|
|
9752
9816
|
}
|
|
9817
|
+
const randomQueue = type === "deterministic_runtime" ? normalizeSetupActionRandomQueue(input, index) : void 0;
|
|
9818
|
+
const deterministicNow = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "now", "now", "date_now", "dateNow", "mock_now", "mockNow", "clock", "timestamp", "time_ms", "timeMs") : void 0;
|
|
9819
|
+
const deterministicAdvanceMs = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "advance_ms", "advance_ms", "advanceMs", "tick_ms", "tickMs", "add_ms", "addMs") : void 0;
|
|
9820
|
+
const deterministicAppend = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "append", "append_random", "appendRandom")) === true;
|
|
9821
|
+
const deterministicRestore = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "restore", "reset", "restore_originals", "restoreOriginals")) === true;
|
|
9822
|
+
if (type === "deterministic_runtime" && randomQueue === void 0 && deterministicNow === void 0 && deterministicAdvanceMs === void 0 && !deterministicRestore) {
|
|
9823
|
+
throw new Error(`target.setup_actions[${index}] deterministic_runtime requires random_queue, now, advance_ms, or restore.`);
|
|
9824
|
+
}
|
|
9753
9825
|
const key = stringValue5(input.key);
|
|
9754
9826
|
let dialogAccept;
|
|
9755
9827
|
if (type === "dialog_response") {
|
|
@@ -9857,6 +9929,11 @@ function normalizeSetupAction(input, index) {
|
|
|
9857
9929
|
key,
|
|
9858
9930
|
value,
|
|
9859
9931
|
value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
|
|
9932
|
+
random_queue: randomQueue,
|
|
9933
|
+
now: deterministicNow,
|
|
9934
|
+
advance_ms: deterministicAdvanceMs,
|
|
9935
|
+
append: deterministicAppend || void 0,
|
|
9936
|
+
restore: deterministicRestore || void 0,
|
|
9860
9937
|
label: stringFromOwn(input, "label", "name", "screenshot_label", "screenshotLabel"),
|
|
9861
9938
|
script,
|
|
9862
9939
|
path: path6,
|
|
@@ -12933,6 +13010,25 @@ function profileSetupWindowEvalReceipts(results) {
|
|
|
12933
13010
|
return receipt;
|
|
12934
13011
|
});
|
|
12935
13012
|
}
|
|
13013
|
+
function profileSetupDeterministicRuntimeReceipts(results) {
|
|
13014
|
+
return (results || [])
|
|
13015
|
+
.filter((result) => result && profileSetupResultAction(result) === "deterministic_runtime")
|
|
13016
|
+
.map((result) => ({
|
|
13017
|
+
ordinal: result.ordinal ?? null,
|
|
13018
|
+
ok: result.ok !== false,
|
|
13019
|
+
random_enabled: result.random_enabled ?? null,
|
|
13020
|
+
random_queue_added: result.random_queue_added ?? null,
|
|
13021
|
+
random_queue_length: result.random_queue_length ?? null,
|
|
13022
|
+
random_queue_mode: result.random_queue_mode ?? null,
|
|
13023
|
+
random_underflow_count: result.random_underflow_count ?? null,
|
|
13024
|
+
clock_enabled: result.clock_enabled ?? null,
|
|
13025
|
+
previous_now: result.previous_now ?? null,
|
|
13026
|
+
now: result.now ?? null,
|
|
13027
|
+
advance_ms: result.advance_ms ?? null,
|
|
13028
|
+
restored: result.restored ?? null,
|
|
13029
|
+
reason: result.reason || result.error || null,
|
|
13030
|
+
}));
|
|
13031
|
+
}
|
|
12936
13032
|
function profileSetupReturnSummaryFields(result) {
|
|
12937
13033
|
const input = result && result.return_summary_fields;
|
|
12938
13034
|
if (!Array.isArray(input)) return [];
|
|
@@ -13176,6 +13272,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
13176
13272
|
const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
|
|
13177
13273
|
const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
|
|
13178
13274
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
13275
|
+
const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
|
|
13276
|
+
const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
|
|
13179
13277
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
13180
13278
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
13181
13279
|
const dragReceipts = profileSetupDragReceipts(results);
|
|
@@ -13245,6 +13343,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
13245
13343
|
window_eval_captured_total: windowEvalCapturedTotal,
|
|
13246
13344
|
window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
|
|
13247
13345
|
window_eval: sampledWindowEvalReceipts,
|
|
13346
|
+
deterministic_runtime_total: deterministicRuntimeReceipts.length,
|
|
13347
|
+
deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
|
|
13348
|
+
deterministic_runtime: sampledDeterministicRuntimeReceipts,
|
|
13248
13349
|
set_range_value_total: rangeValueReceipts.length,
|
|
13249
13350
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
13250
13351
|
set_range_value: sampledRangeValueReceipts,
|
|
@@ -14866,6 +14967,111 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
14866
14967
|
}
|
|
14867
14968
|
return { ...base, ...setupScopeEvidence(scope), ok: true, storage, reload: action.reload === true };
|
|
14868
14969
|
}
|
|
14970
|
+
if (type === "deterministic_runtime") {
|
|
14971
|
+
const scope = await setupActionScope(action, timeout);
|
|
14972
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
14973
|
+
const randomQueue = Array.isArray(action.random_queue)
|
|
14974
|
+
? action.random_queue
|
|
14975
|
+
: Array.isArray(action.randomQueue)
|
|
14976
|
+
? action.randomQueue
|
|
14977
|
+
: null;
|
|
14978
|
+
const now = setupFiniteNumber(action.now ?? action.date_now ?? action.dateNow ?? action.mock_now ?? action.mockNow ?? action.clock ?? action.timestamp ?? action.time_ms ?? action.timeMs);
|
|
14979
|
+
const advanceMs = setupFiniteNumber(action.advance_ms ?? action.advanceMs ?? action.tick_ms ?? action.tickMs ?? action.add_ms ?? action.addMs);
|
|
14980
|
+
const append = action.append === true || action.append_random === true || action.appendRandom === true;
|
|
14981
|
+
const restore = action.restore === true || action.reset === true || action.restore_originals === true || action.restoreOriginals === true;
|
|
14982
|
+
const runtimeResult = await scope.context.evaluate((payload) => {
|
|
14983
|
+
const root = window;
|
|
14984
|
+
const stateKey = "__RIDDLE_PROOF_DETERMINISTIC_RUNTIME__";
|
|
14985
|
+
const state = root[stateKey] && typeof root[stateKey] === "object" && !Array.isArray(root[stateKey])
|
|
14986
|
+
? root[stateKey]
|
|
14987
|
+
: {};
|
|
14988
|
+
root[stateKey] = state;
|
|
14989
|
+
if (typeof state.originalRandom !== "function") state.originalRandom = Math.random;
|
|
14990
|
+
if (typeof state.originalDateNow !== "function") state.originalDateNow = Date.now;
|
|
14991
|
+
const previousNow = typeof state.now === "number" && Number.isFinite(state.now)
|
|
14992
|
+
? state.now
|
|
14993
|
+
: Date.now === state.originalDateNow
|
|
14994
|
+
? null
|
|
14995
|
+
: Date.now();
|
|
14996
|
+
if (payload.restore) {
|
|
14997
|
+
Math.random = state.originalRandom;
|
|
14998
|
+
Date.now = state.originalDateNow;
|
|
14999
|
+
delete root[stateKey];
|
|
15000
|
+
return {
|
|
15001
|
+
ok: true,
|
|
15002
|
+
restored: true,
|
|
15003
|
+
random_enabled: false,
|
|
15004
|
+
random_queue_added: 0,
|
|
15005
|
+
random_queue_length: 0,
|
|
15006
|
+
random_queue_mode: null,
|
|
15007
|
+
random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
|
|
15008
|
+
clock_enabled: false,
|
|
15009
|
+
previous_now: previousNow,
|
|
15010
|
+
now: null,
|
|
15011
|
+
advance_ms: null,
|
|
15012
|
+
};
|
|
15013
|
+
}
|
|
15014
|
+
let randomQueueAdded = null;
|
|
15015
|
+
let randomQueueMode = null;
|
|
15016
|
+
if (Array.isArray(payload.random_queue)) {
|
|
15017
|
+
const queue = payload.random_queue.filter((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value < 1);
|
|
15018
|
+
const existing = Array.isArray(state.randomQueue) ? state.randomQueue : [];
|
|
15019
|
+
state.randomQueue = payload.append ? existing.concat(queue) : queue.slice();
|
|
15020
|
+
randomQueueAdded = queue.length;
|
|
15021
|
+
randomQueueMode = payload.append ? "append" : "replace";
|
|
15022
|
+
Math.random = function riddleProofMockRandom() {
|
|
15023
|
+
const activeQueue = Array.isArray(state.randomQueue) ? state.randomQueue : [];
|
|
15024
|
+
if (activeQueue.length) return activeQueue.shift();
|
|
15025
|
+
state.randomUnderflowCount = (typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0) + 1;
|
|
15026
|
+
return 0;
|
|
15027
|
+
};
|
|
15028
|
+
}
|
|
15029
|
+
if (typeof payload.now === "number" && Number.isFinite(payload.now)) {
|
|
15030
|
+
state.now = payload.now;
|
|
15031
|
+
Date.now = function riddleProofMockDateNow() {
|
|
15032
|
+
return state.now;
|
|
15033
|
+
};
|
|
15034
|
+
}
|
|
15035
|
+
if (typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms)) {
|
|
15036
|
+
const baseNow = typeof state.now === "number" && Number.isFinite(state.now)
|
|
15037
|
+
? state.now
|
|
15038
|
+
: Date.now();
|
|
15039
|
+
state.now = baseNow + payload.advance_ms;
|
|
15040
|
+
Date.now = function riddleProofMockDateNow() {
|
|
15041
|
+
return state.now;
|
|
15042
|
+
};
|
|
15043
|
+
}
|
|
15044
|
+
return {
|
|
15045
|
+
ok: true,
|
|
15046
|
+
restored: false,
|
|
15047
|
+
random_enabled: Math.random !== state.originalRandom,
|
|
15048
|
+
random_queue_added: randomQueueAdded,
|
|
15049
|
+
random_queue_length: Array.isArray(state.randomQueue) ? state.randomQueue.length : 0,
|
|
15050
|
+
random_queue_mode: randomQueueMode,
|
|
15051
|
+
random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
|
|
15052
|
+
clock_enabled: Date.now !== state.originalDateNow,
|
|
15053
|
+
previous_now: previousNow,
|
|
15054
|
+
now: typeof state.now === "number" && Number.isFinite(state.now) ? state.now : null,
|
|
15055
|
+
advance_ms: typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms) ? payload.advance_ms : null,
|
|
15056
|
+
};
|
|
15057
|
+
}, { random_queue: randomQueue, now, advance_ms: advanceMs, append, restore });
|
|
15058
|
+
return {
|
|
15059
|
+
...base,
|
|
15060
|
+
...setupScopeEvidence(scope),
|
|
15061
|
+
ok: runtimeResult && runtimeResult.ok === true,
|
|
15062
|
+
random_enabled: runtimeResult?.random_enabled,
|
|
15063
|
+
random_queue_added: runtimeResult?.random_queue_added,
|
|
15064
|
+
random_queue_length: runtimeResult?.random_queue_length,
|
|
15065
|
+
random_queue_mode: runtimeResult?.random_queue_mode,
|
|
15066
|
+
random_underflow_count: runtimeResult?.random_underflow_count,
|
|
15067
|
+
clock_enabled: runtimeResult?.clock_enabled,
|
|
15068
|
+
previous_now: runtimeResult?.previous_now,
|
|
15069
|
+
now: runtimeResult?.now,
|
|
15070
|
+
advance_ms: runtimeResult?.advance_ms,
|
|
15071
|
+
restored: runtimeResult?.restored,
|
|
15072
|
+
reason: runtimeResult && runtimeResult.ok === true ? undefined : runtimeResult?.reason || "deterministic_runtime_not_applied",
|
|
15073
|
+
};
|
|
15074
|
+
}
|
|
14869
15075
|
if (type === "window_eval") {
|
|
14870
15076
|
const script = String(action.script || action.code || action.source || action.body || "");
|
|
14871
15077
|
const args = Array.isArray(action.args) ? action.args : [];
|
|
@@ -15912,11 +16118,17 @@ function resolveJsonProbePath(root, path) {
|
|
|
15912
16118
|
}
|
|
15913
16119
|
let current = root;
|
|
15914
16120
|
for (const segment of segments) {
|
|
15915
|
-
if (
|
|
15916
|
-
if (
|
|
15917
|
-
|
|
16121
|
+
if (Array.isArray(current)) {
|
|
16122
|
+
if (segment === "length") {
|
|
16123
|
+
current = current.length;
|
|
16124
|
+
continue;
|
|
16125
|
+
}
|
|
16126
|
+
const index = typeof segment === "number" ? segment : (/^\d+$/.test(segment) ? Number(segment) : -1);
|
|
16127
|
+
if (index < 0 || index >= current.length) return { exists: false };
|
|
16128
|
+
current = current[index];
|
|
15918
16129
|
continue;
|
|
15919
16130
|
}
|
|
16131
|
+
if (typeof segment === "number") return { exists: false };
|
|
15920
16132
|
if (!current || typeof current !== "object" || Array.isArray(current) || !Object.hasOwn(current, segment)) {
|
|
15921
16133
|
return { exists: false };
|
|
15922
16134
|
}
|
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-5ELOMJ7U.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|