@riddledc/riddle-proof 0.7.171 → 0.7.173

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/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",
@@ -558,6 +559,23 @@ function profileSetupWindowEvalReceipts(results) {
558
559
  return receipt;
559
560
  });
560
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
+ }
561
579
  function profileSetupReturnSummaryFields(result) {
562
580
  const input = result.return_summary_fields;
563
581
  if (!Array.isArray(input)) return [];
@@ -661,21 +679,28 @@ function profileSetupCanvasSignatureStableHashGroups(results) {
661
679
  }
662
680
  const warnings = [];
663
681
  for (const group of groups.values()) {
664
- const hashes = new Set(group.receipts.map((receipt) => receipt.hash));
665
- const labels = [...new Set(group.receipts.map((receipt) => receipt.label))];
666
- if (group.receipts.length < 2 || labels.length < 2 || hashes.size !== 1) continue;
667
- const visibleLabels = labels.slice(0, 8);
668
- warnings.push({
669
- selector: group.selector,
670
- frame_selector: group.frame_selector ?? null,
671
- hash: group.receipts[0].hash,
672
- count: group.receipts.length,
673
- label_count: labels.length,
674
- labels: visibleLabels,
675
- omitted_label_count: Math.max(0, labels.length - visibleLabels.length),
676
- ordinals: group.receipts.map((receipt) => receipt.ordinal).filter((value) => value !== void 0).slice(0, 12),
677
- reason: "stable_canvas_signature_hash"
678
- });
682
+ const receiptsByHash = /* @__PURE__ */ new Map();
683
+ for (const receipt of group.receipts) {
684
+ const hashReceipts = receiptsByHash.get(receipt.hash) || [];
685
+ hashReceipts.push(receipt);
686
+ receiptsByHash.set(receipt.hash, hashReceipts);
687
+ }
688
+ for (const [hash, receipts] of receiptsByHash.entries()) {
689
+ const labels = [...new Set(receipts.map((receipt) => receipt.label))];
690
+ if (receipts.length < 2 || labels.length < 2) continue;
691
+ const visibleLabels = labels.slice(0, 8);
692
+ warnings.push({
693
+ selector: group.selector,
694
+ frame_selector: group.frame_selector ?? null,
695
+ hash,
696
+ count: receipts.length,
697
+ label_count: labels.length,
698
+ labels: visibleLabels,
699
+ omitted_label_count: Math.max(0, labels.length - visibleLabels.length),
700
+ ordinals: receipts.map((receipt) => receipt.ordinal).filter((value) => value !== void 0).slice(0, 12),
701
+ reason: "stable_canvas_signature_hash"
702
+ });
703
+ }
679
704
  }
680
705
  return warnings;
681
706
  }
@@ -772,6 +797,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
772
797
  const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
773
798
  const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
774
799
  const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
800
+ const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
801
+ const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
775
802
  const rangeValueReceipts = profileSetupRangeValueReceipts(results);
776
803
  const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
777
804
  const dragReceipts = profileSetupDragReceipts(results);
@@ -831,6 +858,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
831
858
  window_eval_captured_total: windowEvalCapturedTotal,
832
859
  window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
833
860
  window_eval: sampledWindowEvalReceipts,
861
+ deterministic_runtime_total: deterministicRuntimeReceipts.length,
862
+ deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
863
+ deterministic_runtime: sampledDeterministicRuntimeReceipts,
834
864
  set_range_value_total: rangeValueReceipts.length,
835
865
  set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
836
866
  set_range_value: sampledRangeValueReceipts,
@@ -893,7 +923,7 @@ function isSupportedCheckType(value) {
893
923
  }
894
924
  function normalizeSetupActionType(value, index) {
895
925
  const normalizedInput = String(value || "").trim().replace(/-/g, "_");
896
- 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;
926
+ 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;
897
927
  if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
898
928
  return normalized;
899
929
  }
@@ -1012,6 +1042,39 @@ function normalizeSetupActionScreenshotFullPage(input, type, index) {
1012
1042
  }
1013
1043
  return values[0];
1014
1044
  }
1045
+ function normalizeSetupActionRandomQueue(input, index) {
1046
+ const rawQueue = valueFromOwn(
1047
+ input,
1048
+ "random_queue",
1049
+ "randomQueue",
1050
+ "random_values",
1051
+ "randomValues",
1052
+ "random_sequence",
1053
+ "randomSequence",
1054
+ "math_random",
1055
+ "mathRandom"
1056
+ );
1057
+ if (rawQueue === void 0) return void 0;
1058
+ if (!Array.isArray(rawQueue) || rawQueue.length === 0) {
1059
+ throw new Error(`target.setup_actions[${index}].random_queue must be a non-empty array of numbers from 0 inclusive to 1 exclusive.`);
1060
+ }
1061
+ return rawQueue.map((item, queueIndex) => {
1062
+ const value = numberValue(item);
1063
+ if (value === void 0 || value < 0 || value >= 1) {
1064
+ throw new Error(`target.setup_actions[${index}].random_queue[${queueIndex}] must be a finite number from 0 inclusive to 1 exclusive.`);
1065
+ }
1066
+ return value;
1067
+ });
1068
+ }
1069
+ function normalizeSetupActionNonNegativeNumber(input, index, outputKey, ...keys) {
1070
+ const rawValue = valueFromOwn(input, ...keys);
1071
+ if (rawValue === void 0) return void 0;
1072
+ const value = numberValue(rawValue);
1073
+ if (value === void 0 || value < 0) {
1074
+ throw new Error(`target.setup_actions[${index}].${outputKey} must be a finite non-negative number.`);
1075
+ }
1076
+ return value;
1077
+ }
1015
1078
  function normalizeSetupAction(input, index) {
1016
1079
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
1017
1080
  const type = normalizeSetupActionType(stringValue(input.type), index);
@@ -1072,6 +1135,14 @@ function normalizeSetupAction(input, index) {
1072
1135
  if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
1073
1136
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
1074
1137
  }
1138
+ const randomQueue = type === "deterministic_runtime" ? normalizeSetupActionRandomQueue(input, index) : void 0;
1139
+ const deterministicNow = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "now", "now", "date_now", "dateNow", "mock_now", "mockNow", "clock", "timestamp", "time_ms", "timeMs") : void 0;
1140
+ const deterministicAdvanceMs = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "advance_ms", "advance_ms", "advanceMs", "tick_ms", "tickMs", "add_ms", "addMs") : void 0;
1141
+ const deterministicAppend = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "append", "append_random", "appendRandom")) === true;
1142
+ const deterministicRestore = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "restore", "reset", "restore_originals", "restoreOriginals")) === true;
1143
+ if (type === "deterministic_runtime" && randomQueue === void 0 && deterministicNow === void 0 && deterministicAdvanceMs === void 0 && !deterministicRestore) {
1144
+ throw new Error(`target.setup_actions[${index}] deterministic_runtime requires random_queue, now, advance_ms, or restore.`);
1145
+ }
1075
1146
  const key = stringValue(input.key);
1076
1147
  let dialogAccept;
1077
1148
  if (type === "dialog_response") {
@@ -1179,6 +1250,11 @@ function normalizeSetupAction(input, index) {
1179
1250
  key,
1180
1251
  value,
1181
1252
  value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
1253
+ random_queue: randomQueue,
1254
+ now: deterministicNow,
1255
+ advance_ms: deterministicAdvanceMs,
1256
+ append: deterministicAppend || void 0,
1257
+ restore: deterministicRestore || void 0,
1182
1258
  label: stringFromOwn(input, "label", "name", "screenshot_label", "screenshotLabel"),
1183
1259
  script,
1184
1260
  path,
@@ -4255,6 +4331,25 @@ function profileSetupWindowEvalReceipts(results) {
4255
4331
  return receipt;
4256
4332
  });
4257
4333
  }
4334
+ function profileSetupDeterministicRuntimeReceipts(results) {
4335
+ return (results || [])
4336
+ .filter((result) => result && profileSetupResultAction(result) === "deterministic_runtime")
4337
+ .map((result) => ({
4338
+ ordinal: result.ordinal ?? null,
4339
+ ok: result.ok !== false,
4340
+ random_enabled: result.random_enabled ?? null,
4341
+ random_queue_added: result.random_queue_added ?? null,
4342
+ random_queue_length: result.random_queue_length ?? null,
4343
+ random_queue_mode: result.random_queue_mode ?? null,
4344
+ random_underflow_count: result.random_underflow_count ?? null,
4345
+ clock_enabled: result.clock_enabled ?? null,
4346
+ previous_now: result.previous_now ?? null,
4347
+ now: result.now ?? null,
4348
+ advance_ms: result.advance_ms ?? null,
4349
+ restored: result.restored ?? null,
4350
+ reason: result.reason || result.error || null,
4351
+ }));
4352
+ }
4258
4353
  function profileSetupReturnSummaryFields(result) {
4259
4354
  const input = result && result.return_summary_fields;
4260
4355
  if (!Array.isArray(input)) return [];
@@ -4368,24 +4463,31 @@ function profileSetupCanvasSignatureStableHashGroups(results) {
4368
4463
  }
4369
4464
  const warnings = [];
4370
4465
  for (const group of groups.values()) {
4371
- const hashes = new Set(group.receipts.map((receipt) => receipt.hash));
4372
- const labels = [...new Set(group.receipts.map((receipt) => receipt.label))];
4373
- if (group.receipts.length < 2 || labels.length < 2 || hashes.size !== 1) continue;
4374
- const visibleLabels = labels.slice(0, 8);
4375
- warnings.push({
4376
- selector: group.selector,
4377
- frame_selector: group.frame_selector || null,
4378
- hash: group.receipts[0].hash,
4379
- count: group.receipts.length,
4380
- label_count: labels.length,
4381
- labels: visibleLabels,
4382
- omitted_label_count: Math.max(0, labels.length - visibleLabels.length),
4383
- ordinals: group.receipts
4384
- .map((receipt) => receipt.ordinal)
4385
- .filter((value) => value !== undefined)
4386
- .slice(0, 12),
4387
- reason: "stable_canvas_signature_hash",
4388
- });
4466
+ const receiptsByHash = new Map();
4467
+ for (const receipt of group.receipts) {
4468
+ const hashReceipts = receiptsByHash.get(receipt.hash) || [];
4469
+ hashReceipts.push(receipt);
4470
+ receiptsByHash.set(receipt.hash, hashReceipts);
4471
+ }
4472
+ for (const [hash, receipts] of receiptsByHash.entries()) {
4473
+ const labels = [...new Set(receipts.map((receipt) => receipt.label))];
4474
+ if (receipts.length < 2 || labels.length < 2) continue;
4475
+ const visibleLabels = labels.slice(0, 8);
4476
+ warnings.push({
4477
+ selector: group.selector,
4478
+ frame_selector: group.frame_selector || null,
4479
+ hash,
4480
+ count: receipts.length,
4481
+ label_count: labels.length,
4482
+ labels: visibleLabels,
4483
+ omitted_label_count: Math.max(0, labels.length - visibleLabels.length),
4484
+ ordinals: receipts
4485
+ .map((receipt) => receipt.ordinal)
4486
+ .filter((value) => value !== undefined)
4487
+ .slice(0, 12),
4488
+ reason: "stable_canvas_signature_hash",
4489
+ });
4490
+ }
4389
4491
  }
4390
4492
  return warnings;
4391
4493
  }
@@ -4498,6 +4600,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
4498
4600
  const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
4499
4601
  const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
4500
4602
  const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
4603
+ const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
4604
+ const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
4501
4605
  const rangeValueReceipts = profileSetupRangeValueReceipts(results);
4502
4606
  const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
4503
4607
  const dragReceipts = profileSetupDragReceipts(results);
@@ -4567,6 +4671,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
4567
4671
  window_eval_captured_total: windowEvalCapturedTotal,
4568
4672
  window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
4569
4673
  window_eval: sampledWindowEvalReceipts,
4674
+ deterministic_runtime_total: deterministicRuntimeReceipts.length,
4675
+ deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
4676
+ deterministic_runtime: sampledDeterministicRuntimeReceipts,
4570
4677
  set_range_value_total: rangeValueReceipts.length,
4571
4678
  set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
4572
4679
  set_range_value: sampledRangeValueReceipts,
@@ -6188,6 +6295,111 @@ async function executeSetupAction(action, ordinal, viewport) {
6188
6295
  }
6189
6296
  return { ...base, ...setupScopeEvidence(scope), ok: true, storage, reload: action.reload === true };
6190
6297
  }
6298
+ if (type === "deterministic_runtime") {
6299
+ const scope = await setupActionScope(action, timeout);
6300
+ if (!scope.ok) return setupScopeFailure(base, scope);
6301
+ const randomQueue = Array.isArray(action.random_queue)
6302
+ ? action.random_queue
6303
+ : Array.isArray(action.randomQueue)
6304
+ ? action.randomQueue
6305
+ : null;
6306
+ const now = setupFiniteNumber(action.now ?? action.date_now ?? action.dateNow ?? action.mock_now ?? action.mockNow ?? action.clock ?? action.timestamp ?? action.time_ms ?? action.timeMs);
6307
+ const advanceMs = setupFiniteNumber(action.advance_ms ?? action.advanceMs ?? action.tick_ms ?? action.tickMs ?? action.add_ms ?? action.addMs);
6308
+ const append = action.append === true || action.append_random === true || action.appendRandom === true;
6309
+ const restore = action.restore === true || action.reset === true || action.restore_originals === true || action.restoreOriginals === true;
6310
+ const runtimeResult = await scope.context.evaluate((payload) => {
6311
+ const root = window;
6312
+ const stateKey = "__RIDDLE_PROOF_DETERMINISTIC_RUNTIME__";
6313
+ const state = root[stateKey] && typeof root[stateKey] === "object" && !Array.isArray(root[stateKey])
6314
+ ? root[stateKey]
6315
+ : {};
6316
+ root[stateKey] = state;
6317
+ if (typeof state.originalRandom !== "function") state.originalRandom = Math.random;
6318
+ if (typeof state.originalDateNow !== "function") state.originalDateNow = Date.now;
6319
+ const previousNow = typeof state.now === "number" && Number.isFinite(state.now)
6320
+ ? state.now
6321
+ : Date.now === state.originalDateNow
6322
+ ? null
6323
+ : Date.now();
6324
+ if (payload.restore) {
6325
+ Math.random = state.originalRandom;
6326
+ Date.now = state.originalDateNow;
6327
+ delete root[stateKey];
6328
+ return {
6329
+ ok: true,
6330
+ restored: true,
6331
+ random_enabled: false,
6332
+ random_queue_added: 0,
6333
+ random_queue_length: 0,
6334
+ random_queue_mode: null,
6335
+ random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
6336
+ clock_enabled: false,
6337
+ previous_now: previousNow,
6338
+ now: null,
6339
+ advance_ms: null,
6340
+ };
6341
+ }
6342
+ let randomQueueAdded = null;
6343
+ let randomQueueMode = null;
6344
+ if (Array.isArray(payload.random_queue)) {
6345
+ const queue = payload.random_queue.filter((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value < 1);
6346
+ const existing = Array.isArray(state.randomQueue) ? state.randomQueue : [];
6347
+ state.randomQueue = payload.append ? existing.concat(queue) : queue.slice();
6348
+ randomQueueAdded = queue.length;
6349
+ randomQueueMode = payload.append ? "append" : "replace";
6350
+ Math.random = function riddleProofMockRandom() {
6351
+ const activeQueue = Array.isArray(state.randomQueue) ? state.randomQueue : [];
6352
+ if (activeQueue.length) return activeQueue.shift();
6353
+ state.randomUnderflowCount = (typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0) + 1;
6354
+ return 0;
6355
+ };
6356
+ }
6357
+ if (typeof payload.now === "number" && Number.isFinite(payload.now)) {
6358
+ state.now = payload.now;
6359
+ Date.now = function riddleProofMockDateNow() {
6360
+ return state.now;
6361
+ };
6362
+ }
6363
+ if (typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms)) {
6364
+ const baseNow = typeof state.now === "number" && Number.isFinite(state.now)
6365
+ ? state.now
6366
+ : Date.now();
6367
+ state.now = baseNow + payload.advance_ms;
6368
+ Date.now = function riddleProofMockDateNow() {
6369
+ return state.now;
6370
+ };
6371
+ }
6372
+ return {
6373
+ ok: true,
6374
+ restored: false,
6375
+ random_enabled: Math.random !== state.originalRandom,
6376
+ random_queue_added: randomQueueAdded,
6377
+ random_queue_length: Array.isArray(state.randomQueue) ? state.randomQueue.length : 0,
6378
+ random_queue_mode: randomQueueMode,
6379
+ random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
6380
+ clock_enabled: Date.now !== state.originalDateNow,
6381
+ previous_now: previousNow,
6382
+ now: typeof state.now === "number" && Number.isFinite(state.now) ? state.now : null,
6383
+ advance_ms: typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms) ? payload.advance_ms : null,
6384
+ };
6385
+ }, { random_queue: randomQueue, now, advance_ms: advanceMs, append, restore });
6386
+ return {
6387
+ ...base,
6388
+ ...setupScopeEvidence(scope),
6389
+ ok: runtimeResult && runtimeResult.ok === true,
6390
+ random_enabled: runtimeResult?.random_enabled,
6391
+ random_queue_added: runtimeResult?.random_queue_added,
6392
+ random_queue_length: runtimeResult?.random_queue_length,
6393
+ random_queue_mode: runtimeResult?.random_queue_mode,
6394
+ random_underflow_count: runtimeResult?.random_underflow_count,
6395
+ clock_enabled: runtimeResult?.clock_enabled,
6396
+ previous_now: runtimeResult?.previous_now,
6397
+ now: runtimeResult?.now,
6398
+ advance_ms: runtimeResult?.advance_ms,
6399
+ restored: runtimeResult?.restored,
6400
+ reason: runtimeResult && runtimeResult.ok === true ? undefined : runtimeResult?.reason || "deterministic_runtime_not_applied",
6401
+ };
6402
+ }
6191
6403
  if (type === "window_eval") {
6192
6404
  const script = String(action.script || action.code || action.source || action.body || "");
6193
6405
  const args = Array.isArray(action.args) ? action.args : [];
@@ -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-KBLWL6MZ.js";
26
+ } from "./chunk-JIAMASZX.js";
27
27
  export {
28
28
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
29
29
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.171",
3
+ "version": "0.7.173",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",