@riddledc/riddle-proof 0.8.79 → 0.8.81

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.
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var profile_exports = {};
22
22
  __export(profile_exports, {
23
23
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS: () => RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
24
+ RIDDLE_PROOF_ORDERED_TRACE_OPERATORS: () => RIDDLE_PROOF_ORDERED_TRACE_OPERATORS,
24
25
  RIDDLE_PROOF_PROFILE_CHECK_TYPES: () => RIDDLE_PROOF_PROFILE_CHECK_TYPES,
25
26
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION: () => RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
26
27
  RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES: () => RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES,
@@ -29,6 +30,8 @@ __export(profile_exports, {
29
30
  RIDDLE_PROOF_PROFILE_STATUSES: () => RIDDLE_PROOF_PROFILE_STATUSES,
30
31
  RIDDLE_PROOF_PROFILE_VERSION: () => RIDDLE_PROOF_PROFILE_VERSION,
31
32
  applyRiddleProofProfileArtifactCompleteness: () => applyRiddleProofProfileArtifactCompleteness,
33
+ assessRiddleProofOrderedTrace: () => assessRiddleProofOrderedTrace,
34
+ assessRiddleProofOrderedTraceSetupResults: () => assessRiddleProofOrderedTraceSetupResults,
32
35
  assessRiddleProofProfileArtifactCompleteness: () => assessRiddleProofProfileArtifactCompleteness,
33
36
  assessRiddleProofProfileEvidence: () => assessRiddleProofProfileEvidence,
34
37
  buildRiddleProofProfileScript: () => buildRiddleProofProfileScript,
@@ -79,6 +82,7 @@ var RIDDLE_PROOF_PROFILE_CHECK_TYPES = [
79
82
  "selector_text_visible",
80
83
  "selector_text_absent",
81
84
  "selector_text_order",
85
+ "ordered_trace",
82
86
  "observe_within",
83
87
  "frame_text_visible",
84
88
  "frame_url_equals",
@@ -142,6 +146,21 @@ var RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES = [
142
146
  "timedout",
143
147
  "failed"
144
148
  ];
149
+ var RIDDLE_PROOF_ORDERED_TRACE_OPERATORS = [
150
+ "exists",
151
+ "equals",
152
+ "not_equals",
153
+ "truthy",
154
+ "falsy",
155
+ "gt",
156
+ "gte",
157
+ "lt",
158
+ "lte",
159
+ "abs_gt",
160
+ "abs_gte",
161
+ "abs_lt",
162
+ "abs_lte"
163
+ ];
145
164
  function uniqueNonEmptyStrings(values) {
146
165
  const seen = /* @__PURE__ */ new Set();
147
166
  const result = [];
@@ -433,6 +452,185 @@ function resolveJsonPath(root, path) {
433
452
  }
434
453
  return { exists: true, value: current };
435
454
  }
455
+ function assessRiddleProofOrderedTrace(trace, events) {
456
+ const insufficient = (reason, traceLength = Array.isArray(trace) ? trace.length : 0, witnesses2 = [], missingEvent, missingPaths) => ({
457
+ version: "riddle-proof.ordered-trace-assessment.v1",
458
+ status: "proof_insufficient",
459
+ trace_length: traceLength,
460
+ witnesses: witnesses2,
461
+ missing_event: missingEvent,
462
+ missing_paths: missingPaths,
463
+ reason
464
+ });
465
+ const parsePath = (path) => {
466
+ const segments = [];
467
+ let token = "";
468
+ const pushToken = () => {
469
+ const value = token.trim();
470
+ if (value) segments.push(value);
471
+ token = "";
472
+ };
473
+ for (let index = 0; index < path.length; index += 1) {
474
+ const char = path[index];
475
+ if (char === ".") {
476
+ pushToken();
477
+ continue;
478
+ }
479
+ if (char !== "[") {
480
+ token += char;
481
+ continue;
482
+ }
483
+ pushToken();
484
+ const closeIndex = path.indexOf("]", index + 1);
485
+ if (closeIndex === -1) throw new Error(`unterminated bracket at ${index}`);
486
+ const bracket = path.slice(index + 1, closeIndex).trim();
487
+ if (!bracket) throw new Error(`empty bracket at ${index}`);
488
+ if (/^\d+$/.test(bracket)) {
489
+ segments.push(Number(bracket));
490
+ } else {
491
+ segments.push(bracket.replace(/^['"]|['"]$/g, ""));
492
+ }
493
+ index = closeIndex;
494
+ }
495
+ pushToken();
496
+ return segments;
497
+ };
498
+ const resolve = (root, path) => {
499
+ let segments;
500
+ try {
501
+ segments = parsePath(path);
502
+ } catch {
503
+ return { exists: false };
504
+ }
505
+ let current = root;
506
+ for (const segment of segments) {
507
+ if (Array.isArray(current)) {
508
+ const index = typeof segment === "number" ? segment : /^\d+$/.test(segment) ? Number(segment) : -1;
509
+ if (index < 0 || index >= current.length) return { exists: false };
510
+ current = current[index];
511
+ continue;
512
+ }
513
+ if (typeof segment !== "string" || current === null || typeof current !== "object") return { exists: false };
514
+ if (!Object.hasOwn(current, segment)) return { exists: false };
515
+ current = current[segment];
516
+ }
517
+ return { exists: true, value: current };
518
+ };
519
+ const valuesEqual = (left, right) => {
520
+ if (Object.is(left, right)) return true;
521
+ if (Array.isArray(left) || Array.isArray(right)) {
522
+ return Array.isArray(left) && Array.isArray(right) && left.length === right.length && left.every((value, index) => valuesEqual(value, right[index]));
523
+ }
524
+ if (left === null || right === null || typeof left !== "object" || typeof right !== "object") return false;
525
+ const leftRecord = left;
526
+ const rightRecord = right;
527
+ const leftKeys = Object.keys(leftRecord).sort();
528
+ const rightKeys = Object.keys(rightRecord).sort();
529
+ return leftKeys.length === rightKeys.length && leftKeys.every((key, index) => key === rightKeys[index] && valuesEqual(leftRecord[key], rightRecord[key]));
530
+ };
531
+ const numericOperator = (op) => [
532
+ "gt",
533
+ "gte",
534
+ "lt",
535
+ "lte",
536
+ "abs_gt",
537
+ "abs_gte",
538
+ "abs_lt",
539
+ "abs_lte"
540
+ ].includes(op);
541
+ const matches = (value, predicate) => {
542
+ if (predicate.op === "exists") return true;
543
+ if (predicate.op === "equals") return valuesEqual(value, predicate.value);
544
+ if (predicate.op === "not_equals") return !valuesEqual(value, predicate.value);
545
+ if (predicate.op === "truthy") return Boolean(value);
546
+ if (predicate.op === "falsy") return !value;
547
+ const observed = typeof value === "number" ? value : Number.NaN;
548
+ const expected = typeof predicate.value === "number" ? predicate.value : Number.NaN;
549
+ if (!Number.isFinite(observed) || !Number.isFinite(expected)) return false;
550
+ const candidate = predicate.op.startsWith("abs_") ? Math.abs(observed) : observed;
551
+ if (predicate.op === "gt" || predicate.op === "abs_gt") return candidate > expected;
552
+ if (predicate.op === "gte" || predicate.op === "abs_gte") return candidate >= expected;
553
+ if (predicate.op === "lt" || predicate.op === "abs_lt") return candidate < expected;
554
+ return candidate <= expected;
555
+ };
556
+ if (!Array.isArray(trace) || trace.length === 0) return insufficient("trace_missing_or_empty");
557
+ if (!Array.isArray(events) || events.length === 0) return insufficient("events_missing", trace.length);
558
+ for (const event of events) {
559
+ const missingPaths = event.predicates.filter((predicate) => !trace.some((sample) => {
560
+ const resolved = resolve(sample, predicate.path);
561
+ return resolved.exists && (!numericOperator(predicate.op) || typeof resolved.value === "number" && Number.isFinite(resolved.value));
562
+ })).map((predicate) => predicate.path);
563
+ if (missingPaths.length) {
564
+ return insufficient("required_trace_field_missing", trace.length, [], event.label, Array.from(new Set(missingPaths)));
565
+ }
566
+ }
567
+ const witnesses = [];
568
+ let cursor = 0;
569
+ for (const event of events) {
570
+ let witnessIndex = -1;
571
+ for (let index = cursor; index < trace.length; index += 1) {
572
+ if (event.predicates.every((predicate) => {
573
+ const resolved = resolve(trace[index], predicate.path);
574
+ return resolved.exists && matches(resolved.value, predicate);
575
+ })) {
576
+ witnessIndex = index;
577
+ break;
578
+ }
579
+ }
580
+ if (witnessIndex < 0) {
581
+ return {
582
+ version: "riddle-proof.ordered-trace-assessment.v1",
583
+ status: "failed",
584
+ trace_length: trace.length,
585
+ witnesses,
586
+ missing_event: event.label,
587
+ reason: "ordered_event_not_observed"
588
+ };
589
+ }
590
+ witnesses.push({
591
+ label: event.label,
592
+ index: witnessIndex,
593
+ observations: event.predicates.map((predicate) => {
594
+ const observed = resolve(trace[witnessIndex], predicate.path).value;
595
+ return {
596
+ path: predicate.path,
597
+ op: predicate.op,
598
+ expected: predicate.value,
599
+ observed
600
+ };
601
+ })
602
+ });
603
+ cursor = witnessIndex + 1;
604
+ }
605
+ return {
606
+ version: "riddle-proof.ordered-trace-assessment.v1",
607
+ status: "passed",
608
+ trace_length: trace.length,
609
+ witnesses
610
+ };
611
+ }
612
+ function assessRiddleProofOrderedTraceSetupResults(results, setupActionLabel, tracePath, events) {
613
+ const insufficient = (reason) => ({
614
+ version: "riddle-proof.ordered-trace-assessment.v1",
615
+ status: "proof_insufficient",
616
+ trace_length: 0,
617
+ witnesses: [],
618
+ reason
619
+ });
620
+ if (!Array.isArray(results)) return insufficient("setup_results_missing");
621
+ const source = results.find((item) => item && typeof item === "object" && !Array.isArray(item) && item.label === setupActionLabel);
622
+ if (!source) return insufficient("setup_action_result_missing");
623
+ if (!Object.hasOwn(source, "returned")) return insufficient("setup_action_return_missing");
624
+ const segments = tracePath.split(".").map((segment) => segment.trim()).filter(Boolean);
625
+ let trace = source.returned;
626
+ for (const segment of segments) {
627
+ if (trace === null || typeof trace !== "object" || Array.isArray(trace) || !Object.hasOwn(trace, segment)) {
628
+ return insufficient("trace_path_missing");
629
+ }
630
+ trace = trace[segment];
631
+ }
632
+ return assessRiddleProofOrderedTrace(trace, events);
633
+ }
436
634
  function evaluateHttpStatusBodyJsonAssertion(root, assertion) {
437
635
  const resolved = resolveJsonPath(root, assertion.path);
438
636
  const errors = [];
@@ -539,6 +737,7 @@ function profileSetupWindowCallReceipts(results) {
539
737
  return results.filter((result) => profileSetupResultAction(result) === "window_call").map((result) => {
540
738
  const receipt = {
541
739
  ordinal: result.ordinal ?? null,
740
+ label: result.label ?? null,
542
741
  ok: result.ok !== false,
543
742
  path: result.path ?? null,
544
743
  return_captured: result.return_captured ?? null,
@@ -557,6 +756,7 @@ function profileSetupWindowEvalReceipts(results) {
557
756
  return results.filter((result) => profileSetupResultAction(result) === "window_eval").map((result) => {
558
757
  const receipt = {
559
758
  ordinal: result.ordinal ?? null,
759
+ label: result.label ?? null,
560
760
  ok: result.ok !== false,
561
761
  script_length: result.script_length ?? null,
562
762
  return_captured: result.return_captured ?? null,
@@ -1000,10 +1200,14 @@ function normalizeViewport(input, index) {
1000
1200
  if (!width || !height || width < 100 || height < 100) {
1001
1201
  throw new Error(`target.viewports[${index}] requires numeric width and height >= 100.`);
1002
1202
  }
1203
+ const hasTouch = booleanValue(valueFromOwn(input, "hasTouch", "has_touch"));
1204
+ const isMobile = booleanValue(valueFromOwn(input, "isMobile", "is_mobile"));
1003
1205
  return {
1004
1206
  name: normalizeName(input.name || input.label, `viewport-${index + 1}`),
1005
1207
  width: Math.round(width),
1006
- height: Math.round(height)
1208
+ height: Math.round(height),
1209
+ ...hasTouch === void 0 ? {} : { hasTouch },
1210
+ ...isMobile === void 0 ? {} : { isMobile }
1007
1211
  };
1008
1212
  }
1009
1213
  function normalizeViewports(value) {
@@ -1829,6 +2033,51 @@ function dialogCountFieldForCheckType(type) {
1829
2033
  if (type === "dialog_dismiss_count_equals") return "dialog_dismiss_count";
1830
2034
  return "dialog_count";
1831
2035
  }
2036
+ function normalizeOrderedTraceEvents(value, label) {
2037
+ if (value === void 0) return void 0;
2038
+ if (!Array.isArray(value) || !value.length) throw new Error(`${label} must be a non-empty array.`);
2039
+ const seenLabels = /* @__PURE__ */ new Set();
2040
+ return value.map((item, eventIndex) => {
2041
+ const eventLabel = `${label}[${eventIndex}]`;
2042
+ if (!isRecord(item)) throw new Error(`${eventLabel} must be an object.`);
2043
+ const name = stringFromOwn(item, "label", "name", "event");
2044
+ if (!name) throw new Error(`${eventLabel}.label is required.`);
2045
+ if (seenLabels.has(name)) throw new Error(`${eventLabel}.label must be unique.`);
2046
+ seenLabels.add(name);
2047
+ const predicatesInput = item.predicates ?? item.all ?? item.where;
2048
+ if (!Array.isArray(predicatesInput) || !predicatesInput.length) {
2049
+ throw new Error(`${eventLabel}.predicates must be a non-empty array.`);
2050
+ }
2051
+ const predicates = predicatesInput.map((predicateInput, predicateIndex) => {
2052
+ const predicateLabel = `${eventLabel}.predicates[${predicateIndex}]`;
2053
+ if (!isRecord(predicateInput)) throw new Error(`${predicateLabel} must be an object.`);
2054
+ const path = stringFromOwn(predicateInput, "path", "field", "key");
2055
+ if (!path) throw new Error(`${predicateLabel}.path is required.`);
2056
+ const op = stringFromOwn(predicateInput, "op", "operator");
2057
+ if (!op || !RIDDLE_PROOF_ORDERED_TRACE_OPERATORS.includes(op)) {
2058
+ throw new Error(`${predicateLabel}.op must be one of ${RIDDLE_PROOF_ORDERED_TRACE_OPERATORS.join(", ")}.`);
2059
+ }
2060
+ const requiresValue = !["exists", "truthy", "falsy"].includes(op);
2061
+ const hasValue = hasOwn(predicateInput, "value") || hasOwn(predicateInput, "expected");
2062
+ if (requiresValue && !hasValue) throw new Error(`${predicateLabel}.value is required for ${op}.`);
2063
+ const value2 = hasOwn(predicateInput, "value") ? predicateInput.value : predicateInput.expected;
2064
+ if (["gt", "gte", "lt", "lte", "abs_gt", "abs_gte", "abs_lt", "abs_lte"].includes(op)) {
2065
+ if (typeof value2 !== "number" || !Number.isFinite(value2)) {
2066
+ throw new Error(`${predicateLabel}.value must be a finite number for ${op}.`);
2067
+ }
2068
+ if (op.startsWith("abs_") && value2 < 0) {
2069
+ throw new Error(`${predicateLabel}.value must be non-negative for ${op}.`);
2070
+ }
2071
+ }
2072
+ return {
2073
+ path,
2074
+ op,
2075
+ value: requiresValue ? toJsonValue(value2) : void 0
2076
+ };
2077
+ });
2078
+ return { label: name, predicates };
2079
+ });
2080
+ }
1832
2081
  function normalizeCheck(input, index) {
1833
2082
  if (!isRecord(input)) throw new Error(`checks[${index}] must be an object.`);
1834
2083
  const type = stringValue(input.type);
@@ -1879,6 +2128,17 @@ function normalizeCheck(input, index) {
1879
2128
  if (!stringValue(input.selector)) throw new Error(`checks[${index}] selector_text_order requires selector.`);
1880
2129
  if (!expectedTexts?.length) throw new Error(`checks[${index}] selector_text_order requires expected_texts.`);
1881
2130
  }
2131
+ const setupActionLabel = stringFromOwn(input, "setup_action_label", "setupActionLabel", "source_action_label", "sourceActionLabel");
2132
+ const tracePath = stringFromOwn(input, "trace_path", "tracePath", "path");
2133
+ const orderedTraceEvents = normalizeOrderedTraceEvents(
2134
+ input.events ?? input.sequence ?? input.ordered_events ?? input.orderedEvents,
2135
+ `checks[${index}].events`
2136
+ );
2137
+ if (type === "ordered_trace") {
2138
+ if (!setupActionLabel) throw new Error(`checks[${index}] ordered_trace requires setup_action_label.`);
2139
+ if (!tracePath) throw new Error(`checks[${index}] ordered_trace requires trace_path.`);
2140
+ if (!orderedTraceEvents?.length) throw new Error(`checks[${index}] ordered_trace requires events.`);
2141
+ }
1882
2142
  const expectedRoutes = normalizeRouteInventoryRoutes(input.expected_routes ?? input.expectedRoutes, index);
1883
2143
  if (type === "route_inventory" && !expectedRoutes?.length) {
1884
2144
  throw new Error(`checks[${index}] route_inventory requires expected_routes.`);
@@ -1951,6 +2211,9 @@ function normalizeCheck(input, index) {
1951
2211
  body_not_patterns: bodyNotPatterns,
1952
2212
  body_json_assertions: bodyJsonAssertions,
1953
2213
  expected_texts: expectedTexts,
2214
+ setup_action_label: type === "ordered_trace" ? setupActionLabel : void 0,
2215
+ trace_path: type === "ordered_trace" ? tracePath : void 0,
2216
+ events: type === "ordered_trace" ? orderedTraceEvents : void 0,
1954
2217
  link_selector: stringValue(input.link_selector) || stringValue(input.linkSelector),
1955
2218
  source_selector: stringValue(input.source_selector) || stringValue(input.sourceSelector),
1956
2219
  route_path_prefix: stringValue(input.route_path_prefix) || stringValue(input.routePathPrefix),
@@ -2017,6 +2280,20 @@ function normalizeRiddleProofProfile(input, options = {}) {
2017
2280
  const targetUrl = stringValue(options.url) || stringValue(targetInput.url);
2018
2281
  const route = stringValue(options.route) || stringValue(targetInput.route);
2019
2282
  if (!targetUrl && !route) throw new Error("profile.target requires url or route, or pass --url.");
2283
+ const setupActions = normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions);
2284
+ for (const [index, check] of checks.entries()) {
2285
+ if (check.type !== "ordered_trace") continue;
2286
+ const matches = (setupActions || []).filter((action) => action.label === check.setup_action_label);
2287
+ if (matches.length !== 1) {
2288
+ throw new Error(`checks[${index}] ordered_trace setup_action_label must match exactly one target.setup_actions label.`);
2289
+ }
2290
+ if (!["window_eval", "window_call", "window_call_until"].includes(matches[0].type)) {
2291
+ throw new Error(`checks[${index}] ordered_trace source action must capture a window_eval, window_call, or window_call_until return.`);
2292
+ }
2293
+ if (matches[0].capture_return === false) {
2294
+ throw new Error(`checks[${index}] ordered_trace source action must not set capture_return to false.`);
2295
+ }
2296
+ }
2020
2297
  return {
2021
2298
  version: RIDDLE_PROOF_PROFILE_VERSION,
2022
2299
  name: normalizeName(input.name, "riddle-proof-profile"),
@@ -2029,7 +2306,7 @@ function normalizeRiddleProofProfile(input, options = {}) {
2029
2306
  wait_for_selector: stringValue(targetInput.wait_for_selector) || stringValue(targetInput.waitForSelector),
2030
2307
  wait_ms: numberValue(targetInput.wait_ms) ?? numberValue(targetInput.waitMs),
2031
2308
  screenshot_full_page: normalizeTargetScreenshotFullPage(targetInput),
2032
- setup_actions: normalizeSetupActions(targetInput.setup_actions ?? targetInput.setupActions),
2309
+ setup_actions: setupActions,
2033
2310
  network_mocks: normalizeNetworkMocks(targetInput.network_mocks ?? targetInput.networkMocks)
2034
2311
  },
2035
2312
  checks,
@@ -3042,6 +3319,32 @@ function assessCheckFromEvidence(check, evidence) {
3042
3319
  message: failed ? `Selector ${key} text order failed in ${failed} viewport(s).` : void 0
3043
3320
  };
3044
3321
  }
3322
+ if (check.type === "ordered_trace") {
3323
+ const assessments = viewports.map((viewport) => ({
3324
+ viewport: viewport.name,
3325
+ assessment: assessRiddleProofOrderedTraceSetupResults(
3326
+ viewport.setup_action_results,
3327
+ check.setup_action_label || "",
3328
+ check.trace_path || "",
3329
+ check.events || []
3330
+ )
3331
+ }));
3332
+ const insufficient = assessments.filter((item) => item.assessment.status === "proof_insufficient");
3333
+ const failed = assessments.filter((item) => item.assessment.status === "failed");
3334
+ const status = insufficient.length ? "proof_insufficient" : failed.length ? "failed" : "passed";
3335
+ return {
3336
+ type: check.type,
3337
+ label: checkLabel(check),
3338
+ status,
3339
+ evidence: {
3340
+ setup_action_label: check.setup_action_label || "",
3341
+ trace_path: check.trace_path || "",
3342
+ events: toJsonValue((check.events || []).map((event) => event.label)),
3343
+ viewports: toJsonValue(assessments)
3344
+ },
3345
+ message: insufficient.length ? `Ordered trace evidence was insufficient in ${insufficient.length} viewport(s).` : failed.length ? `Ordered trace did not contain the required event sequence in ${failed.length} viewport(s).` : void 0
3346
+ };
3347
+ }
3045
3348
  if (check.type === "observe_within") {
3046
3349
  const key = observeWithinKey(check);
3047
3350
  const timeoutMs = observeWithinTimeoutMs(check);
@@ -3541,6 +3844,7 @@ function profileStatusFromEvidence(profile, evidence, checks) {
3541
3844
  if (!viewports.length || !checks.length) return "proof_insufficient";
3542
3845
  if (viewports.some((viewport) => viewport.navigation_error)) return "environment_blocked";
3543
3846
  if (expectedViewportCount && viewports.length < expectedViewportCount) return "proof_insufficient";
3847
+ if (checks.some((check) => check.status === "proof_insufficient")) return "proof_insufficient";
3544
3848
  if (checks.some((check) => check.status === "needs_human_review")) return "needs_human_review";
3545
3849
  if (checks.some((check) => check.status === "failed")) return "product_regression";
3546
3850
  return "passed";
@@ -3870,8 +4174,12 @@ function createRiddleProofProfileInsufficientResult(input) {
3870
4174
  error: message
3871
4175
  };
3872
4176
  }
3873
- function runtimeScriptAssessmentSource() {
4177
+ function runtimeScriptAssessmentSource(includeOrderedTrace = false) {
4178
+ const orderedTraceSource = includeOrderedTrace ? String.raw`
4179
+ const assessRiddleProofOrderedTrace = ${assessRiddleProofOrderedTrace.toString()};
4180
+ const assessRiddleProofOrderedTraceSetupResults = ${assessRiddleProofOrderedTraceSetupResults.toString()};` : "";
3874
4181
  return String.raw`
4182
+ ${orderedTraceSource}
3875
4183
  function normalizeRoutePath(path) {
3876
4184
  const value = path || "/";
3877
4185
  if (value === "/") return "/";
@@ -4701,6 +5009,7 @@ function profileSetupWindowCallReceipts(results) {
4701
5009
  .map((result) => {
4702
5010
  const receipt = {
4703
5011
  ordinal: result.ordinal ?? null,
5012
+ label: result.label ?? null,
4704
5013
  ok: result.ok !== false,
4705
5014
  path: result.path ?? null,
4706
5015
  return_captured: result.return_captured ?? null,
@@ -4721,6 +5030,7 @@ function profileSetupWindowEvalReceipts(results) {
4721
5030
  .map((result) => {
4722
5031
  const receipt = {
4723
5032
  ordinal: result.ordinal ?? null,
5033
+ label: result.label ?? null,
4724
5034
  ok: result.ok !== false,
4725
5035
  script_length: result.script_length ?? null,
4726
5036
  return_captured: result.return_captured ?? null,
@@ -5536,6 +5846,36 @@ function assessProfile(profile, evidence) {
5536
5846
  });
5537
5847
  continue;
5538
5848
  }
5849
+ if (check.type === "ordered_trace") {
5850
+ const assessments = checkViewports.map((viewport) => ({
5851
+ viewport: viewport.name,
5852
+ assessment: assessRiddleProofOrderedTraceSetupResults(
5853
+ viewport.setup_action_results,
5854
+ check.setup_action_label || "",
5855
+ check.trace_path || "",
5856
+ check.events || [],
5857
+ ),
5858
+ }));
5859
+ const insufficient = assessments.filter((item) => item.assessment.status === "proof_insufficient");
5860
+ const failed = assessments.filter((item) => item.assessment.status === "failed");
5861
+ checks.push({
5862
+ type: check.type,
5863
+ label: check.label || check.type,
5864
+ status: insufficient.length ? "proof_insufficient" : failed.length ? "failed" : "passed",
5865
+ evidence: {
5866
+ setup_action_label: check.setup_action_label || "",
5867
+ trace_path: check.trace_path || "",
5868
+ events: (check.events || []).map((event) => event.label),
5869
+ viewports: assessments,
5870
+ },
5871
+ message: insufficient.length
5872
+ ? "Ordered trace evidence was insufficient in " + insufficient.length + " viewport(s)."
5873
+ : failed.length
5874
+ ? "Ordered trace did not contain the required event sequence in " + failed.length + " viewport(s)."
5875
+ : undefined,
5876
+ });
5877
+ continue;
5878
+ }
5539
5879
  if (check.type === "observe_within") {
5540
5880
  const key = observeWithinKey(check);
5541
5881
  const timeoutMs = observeWithinTimeoutMs(check);
@@ -5892,6 +6232,7 @@ function assessProfile(profile, evidence) {
5892
6232
  if (!viewports.length || !checks.length) status = "proof_insufficient";
5893
6233
  else if (viewports.some((viewport) => viewport.navigation_error)) status = "environment_blocked";
5894
6234
  else if (expectedViewportCount && viewports.length < expectedViewportCount) status = "proof_insufficient";
6235
+ else if (checks.some((check) => check.status === "proof_insufficient")) status = "proof_insufficient";
5895
6236
  else if (checks.some((check) => check.status === "needs_human_review")) status = "needs_human_review";
5896
6237
  else if (checks.some((check) => check.status === "failed")) status = "product_regression";
5897
6238
  const screenshotLabels = profileScreenshotLabels(viewports);
@@ -6823,7 +7164,7 @@ let activeViewportName = null;
6823
7164
  async function executeSetupAction(action, ordinal, viewport) {
6824
7165
  const type = setupActionType(action);
6825
7166
  const frameSelector = setupFrameSelector(action);
6826
- const base = { ok: false, action: type || "unknown", ordinal, selector: action.selector || null, frame_selector: frameSelector || null, optional: action.optional === true };
7167
+ const base = { ok: false, action: type || "unknown", ordinal, label: action.label || null, selector: action.selector || null, frame_selector: frameSelector || null, optional: action.optional === true };
6827
7168
  const timeout = setupNumber(action.timeout_ms, 5000);
6828
7169
  try {
6829
7170
  if (type === "wait") {
@@ -9475,7 +9816,7 @@ async function captureViewport(viewport) {
9475
9816
  wait_error: waitError,
9476
9817
  };
9477
9818
  }
9478
- ${runtimeScriptAssessmentSource()}
9819
+ ${runtimeScriptAssessmentSource(profile.checks.some((check) => check.type === "ordered_trace"))}
9479
9820
  const viewports = [];
9480
9821
  function buildProfileEvidence(currentViewports) {
9481
9822
  const expectedViewportCount = (profile.target.viewports || []).length;
@@ -9680,6 +10021,7 @@ function extractRiddleProofProfileResult(input) {
9680
10021
  // Annotate the CommonJS export names for ESM import in node:
9681
10022
  0 && (module.exports = {
9682
10023
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
10024
+ RIDDLE_PROOF_ORDERED_TRACE_OPERATORS,
9683
10025
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
9684
10026
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
9685
10027
  RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES,
@@ -9688,6 +10030,8 @@ function extractRiddleProofProfileResult(input) {
9688
10030
  RIDDLE_PROOF_PROFILE_STATUSES,
9689
10031
  RIDDLE_PROOF_PROFILE_VERSION,
9690
10032
  applyRiddleProofProfileArtifactCompleteness,
10033
+ assessRiddleProofOrderedTrace,
10034
+ assessRiddleProofOrderedTraceSetupResults,
9691
10035
  assessRiddleProofProfileArtifactCompleteness,
9692
10036
  assessRiddleProofProfileEvidence,
9693
10037
  buildRiddleProofProfileScript,
@@ -1,3 +1,3 @@
1
- export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactCompleteness, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileRunnerArtifactPreflight, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, preflightRiddleProofProfileRunnerArtifacts, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.cjs';
1
+ export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS, RIDDLE_PROOF_ORDERED_TRACE_OPERATORS, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofOrderedTraceAssessment, RiddleProofOrderedTraceEvent, RiddleProofOrderedTraceOperator, RiddleProofOrderedTracePredicate, RiddleProofOrderedTraceWitness, RiddleProofProfile, RiddleProofProfileArtifactCompleteness, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileRunnerArtifactPreflight, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofOrderedTrace, assessRiddleProofOrderedTraceSetupResults, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, preflightRiddleProofProfileRunnerArtifacts, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.cjs';
2
2
  import '../types.cjs';
3
3
  import '../public-state.cjs';
@@ -1,3 +1,3 @@
1
- export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofProfile, RiddleProofProfileArtifactCompleteness, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileRunnerArtifactPreflight, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, preflightRiddleProofProfileRunnerArtifacts, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.js';
1
+ export { NormalizeRiddleProofProfileOptions, RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS, RIDDLE_PROOF_ORDERED_TRACE_OPERATORS, RIDDLE_PROOF_PROFILE_CHECK_TYPES, RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION, RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES, RIDDLE_PROOF_PROFILE_RESULT_VERSION, RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES, RIDDLE_PROOF_PROFILE_STATUSES, RIDDLE_PROOF_PROFILE_VERSION, RiddleProofArtifactBodyAssertionInput, RiddleProofArtifactBodyAssertionResult, RiddleProofOrderedTraceAssessment, RiddleProofOrderedTraceEvent, RiddleProofOrderedTraceOperator, RiddleProofOrderedTracePredicate, RiddleProofOrderedTraceWitness, RiddleProofProfile, RiddleProofProfileArtifactCompleteness, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileRunnerArtifactPreflight, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofOrderedTrace, assessRiddleProofOrderedTraceSetupResults, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, preflightRiddleProofProfileRunnerArtifacts, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.js';
2
2
  import '../types.js';
3
3
  import '../public-state.js';
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
3
+ RIDDLE_PROOF_ORDERED_TRACE_OPERATORS,
3
4
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
4
5
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
5
6
  RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES,
@@ -8,6 +9,8 @@ import {
8
9
  RIDDLE_PROOF_PROFILE_STATUSES,
9
10
  RIDDLE_PROOF_PROFILE_VERSION,
10
11
  applyRiddleProofProfileArtifactCompleteness,
12
+ assessRiddleProofOrderedTrace,
13
+ assessRiddleProofOrderedTraceSetupResults,
11
14
  assessRiddleProofProfileArtifactCompleteness,
12
15
  assessRiddleProofProfileEvidence,
13
16
  buildRiddleProofProfileScript,
@@ -27,10 +30,11 @@ import {
27
30
  resolveRiddleProofProfileTimeoutSec,
28
31
  slugifyRiddleProofProfileName,
29
32
  summarizeRiddleProofProfileResult
30
- } from "../chunk-FCSJZBC5.js";
33
+ } from "../chunk-2K3DIK7A.js";
31
34
  import "../chunk-MLKGABMK.js";
32
35
  export {
33
36
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
37
+ RIDDLE_PROOF_ORDERED_TRACE_OPERATORS,
34
38
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
35
39
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
36
40
  RIDDLE_PROOF_PROFILE_NETWORK_ABORT_ERROR_CODES,
@@ -39,6 +43,8 @@ export {
39
43
  RIDDLE_PROOF_PROFILE_STATUSES,
40
44
  RIDDLE_PROOF_PROFILE_VERSION,
41
45
  applyRiddleProofProfileArtifactCompleteness,
46
+ assessRiddleProofOrderedTrace,
47
+ assessRiddleProofOrderedTraceSetupResults,
42
48
  assessRiddleProofProfileArtifactCompleteness,
43
49
  assessRiddleProofProfileEvidence,
44
50
  buildRiddleProofProfileScript,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,
3
3
  suggestRiddleProofProfileChecks
4
- } from "./chunk-RQPCKRKT.js";
5
- import "./chunk-FCSJZBC5.js";
4
+ } from "./chunk-FW7CKARF.js";
5
+ import "./chunk-2K3DIK7A.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  RIDDLE_PROOF_PROFILE_SUGGESTIONS_VERSION,