@riddledc/riddle-proof 0.7.171 → 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/dist/cli.cjs CHANGED
@@ -7006,6 +7006,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
7006
7006
  "fill",
7007
7007
  "set_input_value",
7008
7008
  "set_range_value",
7009
+ "deterministic_runtime",
7009
7010
  "canvas_signature",
7010
7011
  "assert_text_visible",
7011
7012
  "assert_text_absent",
@@ -7468,6 +7469,23 @@ function profileSetupWindowEvalReceipts(results) {
7468
7469
  return receipt;
7469
7470
  });
7470
7471
  }
7472
+ function profileSetupDeterministicRuntimeReceipts(results) {
7473
+ return results.filter((result) => profileSetupResultAction(result) === "deterministic_runtime").map((result) => ({
7474
+ ordinal: result.ordinal ?? null,
7475
+ ok: result.ok !== false,
7476
+ random_enabled: result.random_enabled ?? null,
7477
+ random_queue_added: result.random_queue_added ?? null,
7478
+ random_queue_length: result.random_queue_length ?? null,
7479
+ random_queue_mode: result.random_queue_mode ?? null,
7480
+ random_underflow_count: result.random_underflow_count ?? null,
7481
+ clock_enabled: result.clock_enabled ?? null,
7482
+ previous_now: result.previous_now ?? null,
7483
+ now: result.now ?? null,
7484
+ advance_ms: result.advance_ms ?? null,
7485
+ restored: result.restored ?? null,
7486
+ reason: result.reason ?? result.error ?? null
7487
+ }));
7488
+ }
7471
7489
  function profileSetupReturnSummaryFields(result) {
7472
7490
  const input = result.return_summary_fields;
7473
7491
  if (!Array.isArray(input)) return [];
@@ -7682,6 +7700,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
7682
7700
  const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
7683
7701
  const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
7684
7702
  const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
7703
+ const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
7704
+ const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
7685
7705
  const rangeValueReceipts = profileSetupRangeValueReceipts(results);
7686
7706
  const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
7687
7707
  const dragReceipts = profileSetupDragReceipts(results);
@@ -7741,6 +7761,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
7741
7761
  window_eval_captured_total: windowEvalCapturedTotal,
7742
7762
  window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
7743
7763
  window_eval: sampledWindowEvalReceipts,
7764
+ deterministic_runtime_total: deterministicRuntimeReceipts.length,
7765
+ deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
7766
+ deterministic_runtime: sampledDeterministicRuntimeReceipts,
7744
7767
  set_range_value_total: rangeValueReceipts.length,
7745
7768
  set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
7746
7769
  set_range_value: sampledRangeValueReceipts,
@@ -7803,7 +7826,7 @@ function isSupportedCheckType(value) {
7803
7826
  }
7804
7827
  function normalizeSetupActionType(value, index) {
7805
7828
  const normalizedInput = String(value || "").trim().replace(/-/g, "_");
7806
- 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;
7829
+ 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;
7807
7830
  if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
7808
7831
  return normalized;
7809
7832
  }
@@ -7922,6 +7945,39 @@ function normalizeSetupActionScreenshotFullPage(input, type, index) {
7922
7945
  }
7923
7946
  return values[0];
7924
7947
  }
7948
+ function normalizeSetupActionRandomQueue(input, index) {
7949
+ const rawQueue = valueFromOwn(
7950
+ input,
7951
+ "random_queue",
7952
+ "randomQueue",
7953
+ "random_values",
7954
+ "randomValues",
7955
+ "random_sequence",
7956
+ "randomSequence",
7957
+ "math_random",
7958
+ "mathRandom"
7959
+ );
7960
+ if (rawQueue === void 0) return void 0;
7961
+ if (!Array.isArray(rawQueue) || rawQueue.length === 0) {
7962
+ throw new Error(`target.setup_actions[${index}].random_queue must be a non-empty array of numbers from 0 inclusive to 1 exclusive.`);
7963
+ }
7964
+ return rawQueue.map((item, queueIndex) => {
7965
+ const value = numberValue(item);
7966
+ if (value === void 0 || value < 0 || value >= 1) {
7967
+ throw new Error(`target.setup_actions[${index}].random_queue[${queueIndex}] must be a finite number from 0 inclusive to 1 exclusive.`);
7968
+ }
7969
+ return value;
7970
+ });
7971
+ }
7972
+ function normalizeSetupActionNonNegativeNumber(input, index, outputKey, ...keys) {
7973
+ const rawValue = valueFromOwn(input, ...keys);
7974
+ if (rawValue === void 0) return void 0;
7975
+ const value = numberValue(rawValue);
7976
+ if (value === void 0 || value < 0) {
7977
+ throw new Error(`target.setup_actions[${index}].${outputKey} must be a finite non-negative number.`);
7978
+ }
7979
+ return value;
7980
+ }
7925
7981
  function normalizeSetupAction(input, index) {
7926
7982
  if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
7927
7983
  const type = normalizeSetupActionType(stringValue2(input.type), index);
@@ -7982,6 +8038,14 @@ function normalizeSetupAction(input, index) {
7982
8038
  if ((type === "fill" || type === "set_input_value" || type === "set_range_value") && value === void 0 && !hasJsonValue) {
7983
8039
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
7984
8040
  }
8041
+ const randomQueue = type === "deterministic_runtime" ? normalizeSetupActionRandomQueue(input, index) : void 0;
8042
+ const deterministicNow = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "now", "now", "date_now", "dateNow", "mock_now", "mockNow", "clock", "timestamp", "time_ms", "timeMs") : void 0;
8043
+ const deterministicAdvanceMs = type === "deterministic_runtime" ? normalizeSetupActionNonNegativeNumber(input, index, "advance_ms", "advance_ms", "advanceMs", "tick_ms", "tickMs", "add_ms", "addMs") : void 0;
8044
+ const deterministicAppend = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "append", "append_random", "appendRandom")) === true;
8045
+ const deterministicRestore = type === "deterministic_runtime" && booleanValue(valueFromOwn(input, "restore", "reset", "restore_originals", "restoreOriginals")) === true;
8046
+ if (type === "deterministic_runtime" && randomQueue === void 0 && deterministicNow === void 0 && deterministicAdvanceMs === void 0 && !deterministicRestore) {
8047
+ throw new Error(`target.setup_actions[${index}] deterministic_runtime requires random_queue, now, advance_ms, or restore.`);
8048
+ }
7985
8049
  const key = stringValue2(input.key);
7986
8050
  let dialogAccept;
7987
8051
  if (type === "dialog_response") {
@@ -8089,6 +8153,11 @@ function normalizeSetupAction(input, index) {
8089
8153
  key,
8090
8154
  value,
8091
8155
  value_json: hasJsonValue ? toJsonValue(input.value_json ?? input.valueJson ?? input.json) : void 0,
8156
+ random_queue: randomQueue,
8157
+ now: deterministicNow,
8158
+ advance_ms: deterministicAdvanceMs,
8159
+ append: deterministicAppend || void 0,
8160
+ restore: deterministicRestore || void 0,
8092
8161
  label: stringFromOwn(input, "label", "name", "screenshot_label", "screenshotLabel"),
8093
8162
  script,
8094
8163
  path: path7,
@@ -11149,6 +11218,25 @@ function profileSetupWindowEvalReceipts(results) {
11149
11218
  return receipt;
11150
11219
  });
11151
11220
  }
11221
+ function profileSetupDeterministicRuntimeReceipts(results) {
11222
+ return (results || [])
11223
+ .filter((result) => result && profileSetupResultAction(result) === "deterministic_runtime")
11224
+ .map((result) => ({
11225
+ ordinal: result.ordinal ?? null,
11226
+ ok: result.ok !== false,
11227
+ random_enabled: result.random_enabled ?? null,
11228
+ random_queue_added: result.random_queue_added ?? null,
11229
+ random_queue_length: result.random_queue_length ?? null,
11230
+ random_queue_mode: result.random_queue_mode ?? null,
11231
+ random_underflow_count: result.random_underflow_count ?? null,
11232
+ clock_enabled: result.clock_enabled ?? null,
11233
+ previous_now: result.previous_now ?? null,
11234
+ now: result.now ?? null,
11235
+ advance_ms: result.advance_ms ?? null,
11236
+ restored: result.restored ?? null,
11237
+ reason: result.reason || result.error || null,
11238
+ }));
11239
+ }
11152
11240
  function profileSetupReturnSummaryFields(result) {
11153
11241
  const input = result && result.return_summary_fields;
11154
11242
  if (!Array.isArray(input)) return [];
@@ -11392,6 +11480,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
11392
11480
  const windowEvalStoredTotal = windowEvalReceipts.filter((result) => typeof result.return_stored_to === "string" && result.return_stored_to.trim()).length;
11393
11481
  const windowEvalCapturedTotal = windowEvalReceipts.filter((result) => result.return_captured === true).length;
11394
11482
  const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
11483
+ const deterministicRuntimeReceipts = profileSetupDeterministicRuntimeReceipts(results);
11484
+ const sampledDeterministicRuntimeReceipts = sampleProfileSetupSummaryItems(deterministicRuntimeReceipts, 8);
11395
11485
  const rangeValueReceipts = profileSetupRangeValueReceipts(results);
11396
11486
  const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
11397
11487
  const dragReceipts = profileSetupDragReceipts(results);
@@ -11461,6 +11551,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
11461
11551
  window_eval_captured_total: windowEvalCapturedTotal,
11462
11552
  window_eval_truncated: windowEvalReceipts.length > sampledWindowEvalReceipts.length,
11463
11553
  window_eval: sampledWindowEvalReceipts,
11554
+ deterministic_runtime_total: deterministicRuntimeReceipts.length,
11555
+ deterministic_runtime_truncated: deterministicRuntimeReceipts.length > sampledDeterministicRuntimeReceipts.length,
11556
+ deterministic_runtime: sampledDeterministicRuntimeReceipts,
11464
11557
  set_range_value_total: rangeValueReceipts.length,
11465
11558
  set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
11466
11559
  set_range_value: sampledRangeValueReceipts,
@@ -13082,6 +13175,111 @@ async function executeSetupAction(action, ordinal, viewport) {
13082
13175
  }
13083
13176
  return { ...base, ...setupScopeEvidence(scope), ok: true, storage, reload: action.reload === true };
13084
13177
  }
13178
+ if (type === "deterministic_runtime") {
13179
+ const scope = await setupActionScope(action, timeout);
13180
+ if (!scope.ok) return setupScopeFailure(base, scope);
13181
+ const randomQueue = Array.isArray(action.random_queue)
13182
+ ? action.random_queue
13183
+ : Array.isArray(action.randomQueue)
13184
+ ? action.randomQueue
13185
+ : null;
13186
+ const now = setupFiniteNumber(action.now ?? action.date_now ?? action.dateNow ?? action.mock_now ?? action.mockNow ?? action.clock ?? action.timestamp ?? action.time_ms ?? action.timeMs);
13187
+ const advanceMs = setupFiniteNumber(action.advance_ms ?? action.advanceMs ?? action.tick_ms ?? action.tickMs ?? action.add_ms ?? action.addMs);
13188
+ const append = action.append === true || action.append_random === true || action.appendRandom === true;
13189
+ const restore = action.restore === true || action.reset === true || action.restore_originals === true || action.restoreOriginals === true;
13190
+ const runtimeResult = await scope.context.evaluate((payload) => {
13191
+ const root = window;
13192
+ const stateKey = "__RIDDLE_PROOF_DETERMINISTIC_RUNTIME__";
13193
+ const state = root[stateKey] && typeof root[stateKey] === "object" && !Array.isArray(root[stateKey])
13194
+ ? root[stateKey]
13195
+ : {};
13196
+ root[stateKey] = state;
13197
+ if (typeof state.originalRandom !== "function") state.originalRandom = Math.random;
13198
+ if (typeof state.originalDateNow !== "function") state.originalDateNow = Date.now;
13199
+ const previousNow = typeof state.now === "number" && Number.isFinite(state.now)
13200
+ ? state.now
13201
+ : Date.now === state.originalDateNow
13202
+ ? null
13203
+ : Date.now();
13204
+ if (payload.restore) {
13205
+ Math.random = state.originalRandom;
13206
+ Date.now = state.originalDateNow;
13207
+ delete root[stateKey];
13208
+ return {
13209
+ ok: true,
13210
+ restored: true,
13211
+ random_enabled: false,
13212
+ random_queue_added: 0,
13213
+ random_queue_length: 0,
13214
+ random_queue_mode: null,
13215
+ random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
13216
+ clock_enabled: false,
13217
+ previous_now: previousNow,
13218
+ now: null,
13219
+ advance_ms: null,
13220
+ };
13221
+ }
13222
+ let randomQueueAdded = null;
13223
+ let randomQueueMode = null;
13224
+ if (Array.isArray(payload.random_queue)) {
13225
+ const queue = payload.random_queue.filter((value) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value < 1);
13226
+ const existing = Array.isArray(state.randomQueue) ? state.randomQueue : [];
13227
+ state.randomQueue = payload.append ? existing.concat(queue) : queue.slice();
13228
+ randomQueueAdded = queue.length;
13229
+ randomQueueMode = payload.append ? "append" : "replace";
13230
+ Math.random = function riddleProofMockRandom() {
13231
+ const activeQueue = Array.isArray(state.randomQueue) ? state.randomQueue : [];
13232
+ if (activeQueue.length) return activeQueue.shift();
13233
+ state.randomUnderflowCount = (typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0) + 1;
13234
+ return 0;
13235
+ };
13236
+ }
13237
+ if (typeof payload.now === "number" && Number.isFinite(payload.now)) {
13238
+ state.now = payload.now;
13239
+ Date.now = function riddleProofMockDateNow() {
13240
+ return state.now;
13241
+ };
13242
+ }
13243
+ if (typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms)) {
13244
+ const baseNow = typeof state.now === "number" && Number.isFinite(state.now)
13245
+ ? state.now
13246
+ : Date.now();
13247
+ state.now = baseNow + payload.advance_ms;
13248
+ Date.now = function riddleProofMockDateNow() {
13249
+ return state.now;
13250
+ };
13251
+ }
13252
+ return {
13253
+ ok: true,
13254
+ restored: false,
13255
+ random_enabled: Math.random !== state.originalRandom,
13256
+ random_queue_added: randomQueueAdded,
13257
+ random_queue_length: Array.isArray(state.randomQueue) ? state.randomQueue.length : 0,
13258
+ random_queue_mode: randomQueueMode,
13259
+ random_underflow_count: typeof state.randomUnderflowCount === "number" ? state.randomUnderflowCount : 0,
13260
+ clock_enabled: Date.now !== state.originalDateNow,
13261
+ previous_now: previousNow,
13262
+ now: typeof state.now === "number" && Number.isFinite(state.now) ? state.now : null,
13263
+ advance_ms: typeof payload.advance_ms === "number" && Number.isFinite(payload.advance_ms) ? payload.advance_ms : null,
13264
+ };
13265
+ }, { random_queue: randomQueue, now, advance_ms: advanceMs, append, restore });
13266
+ return {
13267
+ ...base,
13268
+ ...setupScopeEvidence(scope),
13269
+ ok: runtimeResult && runtimeResult.ok === true,
13270
+ random_enabled: runtimeResult?.random_enabled,
13271
+ random_queue_added: runtimeResult?.random_queue_added,
13272
+ random_queue_length: runtimeResult?.random_queue_length,
13273
+ random_queue_mode: runtimeResult?.random_queue_mode,
13274
+ random_underflow_count: runtimeResult?.random_underflow_count,
13275
+ clock_enabled: runtimeResult?.clock_enabled,
13276
+ previous_now: runtimeResult?.previous_now,
13277
+ now: runtimeResult?.now,
13278
+ advance_ms: runtimeResult?.advance_ms,
13279
+ restored: runtimeResult?.restored,
13280
+ reason: runtimeResult && runtimeResult.ok === true ? undefined : runtimeResult?.reason || "deterministic_runtime_not_applied",
13281
+ };
13282
+ }
13085
13283
  if (type === "window_eval") {
13086
13284
  const script = String(action.script || action.code || action.source || action.body || "");
13087
13285
  const args = Array.isArray(action.args) ? action.args : [];
@@ -16062,6 +16260,7 @@ function profileSetupSummaryMarkdown(result) {
16062
16260
  const windowEvalTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_total) || 0), 0);
16063
16261
  const windowEvalStoredTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_stored_total) || 0), 0);
16064
16262
  const windowEvalCapturedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_captured_total) || 0), 0);
16263
+ const deterministicRuntimeTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.deterministic_runtime_total) || 0), 0);
16065
16264
  const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
16066
16265
  const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
16067
16266
  const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
@@ -16086,6 +16285,9 @@ function profileSetupSummaryMarkdown(result) {
16086
16285
  if (windowEvalTotal) {
16087
16286
  lines.push(`- window_eval: ${windowEvalTotal} action(s), stored returns ${windowEvalStoredTotal}, captured returns ${windowEvalCapturedTotal}`);
16088
16287
  }
16288
+ if (deterministicRuntimeTotal) {
16289
+ lines.push(`- deterministic_runtime: ${deterministicRuntimeTotal} action(s)`);
16290
+ }
16089
16291
  if (windowCallUntilTotal) {
16090
16292
  lines.push(`- window_call_until: ${windowCallUntilTotal} action(s), call_count total ${windowCallUntilCallTotal}`);
16091
16293
  }
@@ -16112,13 +16314,14 @@ function profileSetupSummaryMarkdown(result) {
16112
16314
  const windowEvalActions = cliFiniteNumber(viewport.window_eval_total) || 0;
16113
16315
  const windowEvalStored = cliFiniteNumber(viewport.window_eval_stored_total) || 0;
16114
16316
  const windowEvalCaptured = cliFiniteNumber(viewport.window_eval_captured_total) || 0;
16317
+ const deterministicRuntimeActions = cliFiniteNumber(viewport.deterministic_runtime_total) || 0;
16115
16318
  const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
16116
16319
  const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
16117
16320
  const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
16118
16321
  const dragActions = cliFiniteNumber(viewport.drag_total) || 0;
16119
16322
  const canvasSignatureActions = cliFiniteNumber(viewport.canvas_signature_total) || 0;
16120
16323
  const observedPath = cliString(viewport.observed_path);
16121
- lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickSequenceCount ? `, ${clickSequenceCount} click sequence(s)` : ""}${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
16324
+ lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickSequenceCount ? `, ${clickSequenceCount} click sequence(s)` : ""}${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${deterministicRuntimeActions ? `, ${deterministicRuntimeActions} deterministic_runtime action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
16122
16325
  }
16123
16326
  const clickSequenceGroups = viewports.map((viewport) => {
16124
16327
  const name = cliString(viewport.name) || "viewport";
@@ -16210,6 +16413,31 @@ function profileSetupSummaryMarkdown(result) {
16210
16413
  lines.push(`- ${name} canvas_signature warning: ${markdownInlineCode(selector)}${frameSelector ? ` in frame ${markdownInlineCode(frameSelector)}` : ""} returned the same hash${hash ? ` ${markdownInlineCode(hash, 80)}` : ""} for ${count ?? labelCount ?? "multiple"} labeled capture(s)${labelText}; treat canvas signatures as diagnostic when runtime evidence or screenshots show state changes.`);
16211
16414
  }
16212
16415
  if (canvasSignatureWarnings.length > sampledCanvasSignatureWarnings.length) lines.push(`- ${canvasSignatureWarnings.length - sampledCanvasSignatureWarnings.length} additional canvas_signature warning(s) omitted.`);
16416
+ const deterministicRuntimeGroups = viewports.map((viewport) => {
16417
+ const name = cliString(viewport.name) || "viewport";
16418
+ const receipts = Array.isArray(viewport.deterministic_runtime) ? viewport.deterministic_runtime.map(cliRecord).filter((item) => Boolean(item)) : [];
16419
+ return receipts.map((receipt) => ({ name, receipt }));
16420
+ });
16421
+ const deterministicRuntimeDetails = deterministicRuntimeGroups.flat();
16422
+ const sampledDeterministicRuntimeDetails = balancedSetupReceiptDetails(deterministicRuntimeGroups, 12);
16423
+ for (const { name, receipt } of sampledDeterministicRuntimeDetails) {
16424
+ const ok = receipt.ok === false ? "failed" : "ok";
16425
+ const randomEnabled = receipt.random_enabled === true ? "on" : receipt.random_enabled === false ? "off" : "unknown";
16426
+ const clockEnabled = receipt.clock_enabled === true ? "on" : receipt.clock_enabled === false ? "off" : "unknown";
16427
+ const randomQueueAdded = cliFiniteNumber(receipt.random_queue_added);
16428
+ const randomQueueLength = cliFiniteNumber(receipt.random_queue_length);
16429
+ const randomQueueMode = cliString(receipt.random_queue_mode);
16430
+ const randomUnderflowCount = cliFiniteNumber(receipt.random_underflow_count);
16431
+ const previousNow = cliFiniteNumber(receipt.previous_now);
16432
+ const now = cliFiniteNumber(receipt.now);
16433
+ const advanceMs = cliFiniteNumber(receipt.advance_ms);
16434
+ const restored = receipt.restored === true;
16435
+ const reason = cliString(receipt.reason);
16436
+ const randomText = randomQueueAdded === void 0 && randomQueueLength === void 0 ? `random ${randomEnabled}` : `random ${randomEnabled}${randomQueueMode ? ` ${randomQueueMode}` : ""}${randomQueueAdded === void 0 ? "" : ` +${randomQueueAdded}`}${randomQueueLength === void 0 ? "" : ` -> ${randomQueueLength}`}`;
16437
+ const clockText = now === void 0 ? `clock ${clockEnabled}` : `clock ${clockEnabled}${previousNow === void 0 ? "" : ` ${previousNow} ->`} ${now}`;
16438
+ lines.push(`- ${name} deterministic_runtime: ${ok}, ${restored ? "restored, " : ""}${randomText}${randomUnderflowCount ? `, underflows ${randomUnderflowCount}` : ""}, ${clockText}${advanceMs === void 0 ? "" : `, advance ${advanceMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
16439
+ }
16440
+ if (deterministicRuntimeDetails.length > sampledDeterministicRuntimeDetails.length) lines.push(`- ${deterministicRuntimeDetails.length - sampledDeterministicRuntimeDetails.length} additional deterministic_runtime receipt(s) omitted.`);
16213
16441
  const rangeValueGroups = viewports.map((viewport) => {
16214
16442
  const name = cliString(viewport.name) || "viewport";
16215
16443
  const receipts = Array.isArray(viewport.set_range_value) ? viewport.set_range_value.map(cliRecord).filter((item) => Boolean(item)) : [];
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  profileStatusExitCode,
14
14
  resolveRiddleProofProfileTargetUrl,
15
15
  resolveRiddleProofProfileTimeoutSec
16
- } from "./chunk-KBLWL6MZ.js";
16
+ } from "./chunk-5ELOMJ7U.js";
17
17
  import {
18
18
  createRiddleApiClient,
19
19
  isTerminalRiddleJobStatus,
@@ -785,6 +785,7 @@ function profileSetupSummaryMarkdown(result) {
785
785
  const windowEvalTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_total) || 0), 0);
786
786
  const windowEvalStoredTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_stored_total) || 0), 0);
787
787
  const windowEvalCapturedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_eval_captured_total) || 0), 0);
788
+ const deterministicRuntimeTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.deterministic_runtime_total) || 0), 0);
788
789
  const windowCallUntilTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_total) || 0), 0);
789
790
  const windowCallUntilCallTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.window_call_until_call_total) || 0), 0);
790
791
  const rangeValueTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.set_range_value_total) || 0), 0);
@@ -809,6 +810,9 @@ function profileSetupSummaryMarkdown(result) {
809
810
  if (windowEvalTotal) {
810
811
  lines.push(`- window_eval: ${windowEvalTotal} action(s), stored returns ${windowEvalStoredTotal}, captured returns ${windowEvalCapturedTotal}`);
811
812
  }
813
+ if (deterministicRuntimeTotal) {
814
+ lines.push(`- deterministic_runtime: ${deterministicRuntimeTotal} action(s)`);
815
+ }
812
816
  if (windowCallUntilTotal) {
813
817
  lines.push(`- window_call_until: ${windowCallUntilTotal} action(s), call_count total ${windowCallUntilCallTotal}`);
814
818
  }
@@ -835,13 +839,14 @@ function profileSetupSummaryMarkdown(result) {
835
839
  const windowEvalActions = cliFiniteNumber(viewport.window_eval_total) || 0;
836
840
  const windowEvalStored = cliFiniteNumber(viewport.window_eval_stored_total) || 0;
837
841
  const windowEvalCaptured = cliFiniteNumber(viewport.window_eval_captured_total) || 0;
842
+ const deterministicRuntimeActions = cliFiniteNumber(viewport.deterministic_runtime_total) || 0;
838
843
  const windowCallUntilActions = cliFiniteNumber(viewport.window_call_until_total) || 0;
839
844
  const windowCallUntilCalls = cliFiniteNumber(viewport.window_call_until_call_total) || 0;
840
845
  const rangeValueActions = cliFiniteNumber(viewport.set_range_value_total) || 0;
841
846
  const dragActions = cliFiniteNumber(viewport.drag_total) || 0;
842
847
  const canvasSignatureActions = cliFiniteNumber(viewport.canvas_signature_total) || 0;
843
848
  const observedPath = cliString(viewport.observed_path);
844
- lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickSequenceCount ? `, ${clickSequenceCount} click sequence(s)` : ""}${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
849
+ lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${clickSequenceCount ? `, ${clickSequenceCount} click sequence(s)` : ""}${clickCountActions ? `, ${clickCountActions} click_count action(s)` : ""}${rangeValueActions ? `, ${rangeValueActions} set_range_value action(s)` : ""}${dragActions ? `, ${dragActions} drag action(s)` : ""}${canvasSignatureActions ? `, ${canvasSignatureActions} canvas_signature action(s)` : ""}${deterministicRuntimeActions ? `, ${deterministicRuntimeActions} deterministic_runtime action(s)` : ""}${windowCallActions ? `, ${windowCallActions} window_call action(s), ${windowCallStored} stored return(s), ${windowCallCaptured} captured return(s)` : ""}${windowEvalActions ? `, ${windowEvalActions} window_eval action(s), ${windowEvalStored} stored return(s), ${windowEvalCaptured} captured return(s)` : ""}${windowCallUntilActions ? `, ${windowCallUntilActions} window_call_until action(s), ${windowCallUntilCalls} call(s)` : ""}${observedPath ? `, path ${observedPath}` : ""}`);
845
850
  }
846
851
  const clickSequenceGroups = viewports.map((viewport) => {
847
852
  const name = cliString(viewport.name) || "viewport";
@@ -933,6 +938,31 @@ function profileSetupSummaryMarkdown(result) {
933
938
  lines.push(`- ${name} canvas_signature warning: ${markdownInlineCode(selector)}${frameSelector ? ` in frame ${markdownInlineCode(frameSelector)}` : ""} returned the same hash${hash ? ` ${markdownInlineCode(hash, 80)}` : ""} for ${count ?? labelCount ?? "multiple"} labeled capture(s)${labelText}; treat canvas signatures as diagnostic when runtime evidence or screenshots show state changes.`);
934
939
  }
935
940
  if (canvasSignatureWarnings.length > sampledCanvasSignatureWarnings.length) lines.push(`- ${canvasSignatureWarnings.length - sampledCanvasSignatureWarnings.length} additional canvas_signature warning(s) omitted.`);
941
+ const deterministicRuntimeGroups = viewports.map((viewport) => {
942
+ const name = cliString(viewport.name) || "viewport";
943
+ const receipts = Array.isArray(viewport.deterministic_runtime) ? viewport.deterministic_runtime.map(cliRecord).filter((item) => Boolean(item)) : [];
944
+ return receipts.map((receipt) => ({ name, receipt }));
945
+ });
946
+ const deterministicRuntimeDetails = deterministicRuntimeGroups.flat();
947
+ const sampledDeterministicRuntimeDetails = balancedSetupReceiptDetails(deterministicRuntimeGroups, 12);
948
+ for (const { name, receipt } of sampledDeterministicRuntimeDetails) {
949
+ const ok = receipt.ok === false ? "failed" : "ok";
950
+ const randomEnabled = receipt.random_enabled === true ? "on" : receipt.random_enabled === false ? "off" : "unknown";
951
+ const clockEnabled = receipt.clock_enabled === true ? "on" : receipt.clock_enabled === false ? "off" : "unknown";
952
+ const randomQueueAdded = cliFiniteNumber(receipt.random_queue_added);
953
+ const randomQueueLength = cliFiniteNumber(receipt.random_queue_length);
954
+ const randomQueueMode = cliString(receipt.random_queue_mode);
955
+ const randomUnderflowCount = cliFiniteNumber(receipt.random_underflow_count);
956
+ const previousNow = cliFiniteNumber(receipt.previous_now);
957
+ const now = cliFiniteNumber(receipt.now);
958
+ const advanceMs = cliFiniteNumber(receipt.advance_ms);
959
+ const restored = receipt.restored === true;
960
+ const reason = cliString(receipt.reason);
961
+ const randomText = randomQueueAdded === void 0 && randomQueueLength === void 0 ? `random ${randomEnabled}` : `random ${randomEnabled}${randomQueueMode ? ` ${randomQueueMode}` : ""}${randomQueueAdded === void 0 ? "" : ` +${randomQueueAdded}`}${randomQueueLength === void 0 ? "" : ` -> ${randomQueueLength}`}`;
962
+ const clockText = now === void 0 ? `clock ${clockEnabled}` : `clock ${clockEnabled}${previousNow === void 0 ? "" : ` ${previousNow} ->`} ${now}`;
963
+ lines.push(`- ${name} deterministic_runtime: ${ok}, ${restored ? "restored, " : ""}${randomText}${randomUnderflowCount ? `, underflows ${randomUnderflowCount}` : ""}, ${clockText}${advanceMs === void 0 ? "" : `, advance ${advanceMs}ms`}${reason ? `, reason ${markdownInlineCode(reason, 100)}` : ""}`);
964
+ }
965
+ if (deterministicRuntimeDetails.length > sampledDeterministicRuntimeDetails.length) lines.push(`- ${deterministicRuntimeDetails.length - sampledDeterministicRuntimeDetails.length} additional deterministic_runtime receipt(s) omitted.`);
936
966
  const rangeValueGroups = viewports.map((viewport) => {
937
967
  const name = cliString(viewport.name) || "viewport";
938
968
  const receipts = Array.isArray(viewport.set_range_value) ? viewport.set_range_value.map(cliRecord).filter((item) => Boolean(item)) : [];