@riddledc/riddle-proof 0.7.70 → 0.7.71

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.
@@ -1497,11 +1497,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
1497
1497
  requiredNetworkMockHitCount(mock)
1498
1498
  ])),
1499
1499
  max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
1500
+ response_hits_by_label: networkMockResponseHitsByLabel(events),
1500
1501
  failed
1501
1502
  },
1502
1503
  message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
1503
1504
  };
1504
1505
  }
1506
+ function networkMockResponseHitsByLabel(events) {
1507
+ const responseHits = {};
1508
+ for (const event of events) {
1509
+ if (!event || event.ok === false) continue;
1510
+ const label = typeof event.label === "string" ? event.label : "";
1511
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
1512
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
1513
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
1514
+ responseHits[label] || (responseHits[label] = {});
1515
+ responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
1516
+ }
1517
+ return responseHits;
1518
+ }
1505
1519
  function requiredNetworkMockHitCount(mock) {
1506
1520
  if (mock.required === false) return 0;
1507
1521
  if (mock.required_hit_count !== void 0) return mock.required_hit_count;
@@ -2025,11 +2039,21 @@ function assessProfile(profile, evidence) {
2025
2039
  const hitsByLabel = {};
2026
2040
  const requiredHitsByLabel = {};
2027
2041
  const maxHitsByLabel = {};
2042
+ const responseHitsByLabel = {};
2028
2043
  for (const mock of profile.target.network_mocks) {
2029
2044
  hitsByLabel[mock.label] = hitCountForMock(mock);
2030
2045
  if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
2031
2046
  if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
2032
2047
  }
2048
+ for (const event of events) {
2049
+ if (!event || event.ok === false) continue;
2050
+ const label = typeof event.label === "string" ? event.label : "";
2051
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
2052
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
2053
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
2054
+ responseHitsByLabel[label] ||= {};
2055
+ responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
2056
+ }
2033
2057
  checks.push({
2034
2058
  type: "network_mocks_succeeded",
2035
2059
  label: "network mocks succeeded",
@@ -2041,6 +2065,7 @@ function assessProfile(profile, evidence) {
2041
2065
  hits_by_label: hitsByLabel,
2042
2066
  required_hits_by_label: requiredHitsByLabel,
2043
2067
  max_hits_by_label: maxHitsByLabel,
2068
+ response_hits_by_label: responseHitsByLabel,
2044
2069
  failed,
2045
2070
  },
2046
2071
  message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
package/dist/cli.cjs CHANGED
@@ -8370,11 +8370,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
8370
8370
  requiredNetworkMockHitCount(mock)
8371
8371
  ])),
8372
8372
  max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
8373
+ response_hits_by_label: networkMockResponseHitsByLabel(events),
8373
8374
  failed
8374
8375
  },
8375
8376
  message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
8376
8377
  };
8377
8378
  }
8379
+ function networkMockResponseHitsByLabel(events) {
8380
+ const responseHits = {};
8381
+ for (const event of events) {
8382
+ if (!event || event.ok === false) continue;
8383
+ const label = typeof event.label === "string" ? event.label : "";
8384
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
8385
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
8386
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
8387
+ responseHits[label] || (responseHits[label] = {});
8388
+ responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
8389
+ }
8390
+ return responseHits;
8391
+ }
8378
8392
  function requiredNetworkMockHitCount(mock) {
8379
8393
  if (mock.required === false) return 0;
8380
8394
  if (mock.required_hit_count !== void 0) return mock.required_hit_count;
@@ -8882,11 +8896,21 @@ function assessProfile(profile, evidence) {
8882
8896
  const hitsByLabel = {};
8883
8897
  const requiredHitsByLabel = {};
8884
8898
  const maxHitsByLabel = {};
8899
+ const responseHitsByLabel = {};
8885
8900
  for (const mock of profile.target.network_mocks) {
8886
8901
  hitsByLabel[mock.label] = hitCountForMock(mock);
8887
8902
  if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
8888
8903
  if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
8889
8904
  }
8905
+ for (const event of events) {
8906
+ if (!event || event.ok === false) continue;
8907
+ const label = typeof event.label === "string" ? event.label : "";
8908
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
8909
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
8910
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
8911
+ responseHitsByLabel[label] ||= {};
8912
+ responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
8913
+ }
8890
8914
  checks.push({
8891
8915
  type: "network_mocks_succeeded",
8892
8916
  label: "network mocks succeeded",
@@ -8898,6 +8922,7 @@ function assessProfile(profile, evidence) {
8898
8922
  hits_by_label: hitsByLabel,
8899
8923
  required_hits_by_label: requiredHitsByLabel,
8900
8924
  max_hits_by_label: maxHitsByLabel,
8925
+ response_hits_by_label: responseHitsByLabel,
8901
8926
  failed,
8902
8927
  },
8903
8928
  message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
@@ -11296,10 +11321,12 @@ function profileNetworkMockSummaryMarkdown(result) {
11296
11321
  const hitsByLabel = cliRecord(evidence.hits_by_label) || {};
11297
11322
  const requiredHitsByLabel = cliRecord(evidence.required_hits_by_label) || {};
11298
11323
  const maxHitsByLabel = cliRecord(evidence.max_hits_by_label) || {};
11324
+ const responseHitsByLabel = cliRecord(evidence.response_hits_by_label) || {};
11299
11325
  const labels = Array.from(/* @__PURE__ */ new Set([
11300
11326
  ...Object.keys(hitsByLabel),
11301
11327
  ...Object.keys(requiredHitsByLabel),
11302
- ...Object.keys(maxHitsByLabel)
11328
+ ...Object.keys(maxHitsByLabel),
11329
+ ...Object.keys(responseHitsByLabel)
11303
11330
  ])).sort();
11304
11331
  const mockCount = cliFiniteNumber(evidence.mock_count);
11305
11332
  const requiredCount = cliFiniteNumber(evidence.required_count);
@@ -11317,6 +11344,13 @@ function profileNetworkMockSummaryMarkdown(result) {
11317
11344
  if (requiredHits !== void 0) parts.push(`required ${requiredHits}`);
11318
11345
  if (maxHits !== void 0) parts.push(`max ${maxHits}`);
11319
11346
  lines.push(`- ${label}: ${parts.join(", ")}`);
11347
+ const responseHits = cliRecord(responseHitsByLabel[label]);
11348
+ const responseLabels = responseHits ? Object.keys(responseHits).sort() : [];
11349
+ if (responseHits && responseLabels.length) {
11350
+ const responseParts = responseLabels.slice(0, 8).map((responseLabel) => `${responseLabel} ${cliRecordNumber(responseHits, responseLabel) ?? 0}`);
11351
+ const omitted = responseLabels.length > 8 ? `; ${responseLabels.length - 8} additional response label(s) omitted` : "";
11352
+ lines.push(`- ${label} responses: ${responseParts.join("; ")}${omitted}`);
11353
+ }
11320
11354
  }
11321
11355
  if (labels.length > 16) lines.push(`- ${labels.length - 16} additional network mock label(s) omitted from summary.`);
11322
11356
  return lines;
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  profileStatusExitCode,
11
11
  resolveRiddleProofProfileTargetUrl,
12
12
  resolveRiddleProofProfileTimeoutSec
13
- } from "./chunk-KMJBTFLI.js";
13
+ } from "./chunk-HXYLTNZT.js";
14
14
  import {
15
15
  createRiddleApiClient,
16
16
  parseRiddleViewport
@@ -385,10 +385,12 @@ function profileNetworkMockSummaryMarkdown(result) {
385
385
  const hitsByLabel = cliRecord(evidence.hits_by_label) || {};
386
386
  const requiredHitsByLabel = cliRecord(evidence.required_hits_by_label) || {};
387
387
  const maxHitsByLabel = cliRecord(evidence.max_hits_by_label) || {};
388
+ const responseHitsByLabel = cliRecord(evidence.response_hits_by_label) || {};
388
389
  const labels = Array.from(/* @__PURE__ */ new Set([
389
390
  ...Object.keys(hitsByLabel),
390
391
  ...Object.keys(requiredHitsByLabel),
391
- ...Object.keys(maxHitsByLabel)
392
+ ...Object.keys(maxHitsByLabel),
393
+ ...Object.keys(responseHitsByLabel)
392
394
  ])).sort();
393
395
  const mockCount = cliFiniteNumber(evidence.mock_count);
394
396
  const requiredCount = cliFiniteNumber(evidence.required_count);
@@ -406,6 +408,13 @@ function profileNetworkMockSummaryMarkdown(result) {
406
408
  if (requiredHits !== void 0) parts.push(`required ${requiredHits}`);
407
409
  if (maxHits !== void 0) parts.push(`max ${maxHits}`);
408
410
  lines.push(`- ${label}: ${parts.join(", ")}`);
411
+ const responseHits = cliRecord(responseHitsByLabel[label]);
412
+ const responseLabels = responseHits ? Object.keys(responseHits).sort() : [];
413
+ if (responseHits && responseLabels.length) {
414
+ const responseParts = responseLabels.slice(0, 8).map((responseLabel) => `${responseLabel} ${cliRecordNumber(responseHits, responseLabel) ?? 0}`);
415
+ const omitted = responseLabels.length > 8 ? `; ${responseLabels.length - 8} additional response label(s) omitted` : "";
416
+ lines.push(`- ${label} responses: ${responseParts.join("; ")}${omitted}`);
417
+ }
409
418
  }
410
419
  if (labels.length > 16) lines.push(`- ${labels.length - 16} additional network mock label(s) omitted from summary.`);
411
420
  return lines;
package/dist/index.cjs CHANGED
@@ -10211,11 +10211,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
10211
10211
  requiredNetworkMockHitCount(mock)
10212
10212
  ])),
10213
10213
  max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
10214
+ response_hits_by_label: networkMockResponseHitsByLabel(events),
10214
10215
  failed
10215
10216
  },
10216
10217
  message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
10217
10218
  };
10218
10219
  }
10220
+ function networkMockResponseHitsByLabel(events) {
10221
+ const responseHits = {};
10222
+ for (const event of events) {
10223
+ if (!event || event.ok === false) continue;
10224
+ const label = typeof event.label === "string" ? event.label : "";
10225
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
10226
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
10227
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
10228
+ responseHits[label] || (responseHits[label] = {});
10229
+ responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
10230
+ }
10231
+ return responseHits;
10232
+ }
10219
10233
  function requiredNetworkMockHitCount(mock) {
10220
10234
  if (mock.required === false) return 0;
10221
10235
  if (mock.required_hit_count !== void 0) return mock.required_hit_count;
@@ -10739,11 +10753,21 @@ function assessProfile(profile, evidence) {
10739
10753
  const hitsByLabel = {};
10740
10754
  const requiredHitsByLabel = {};
10741
10755
  const maxHitsByLabel = {};
10756
+ const responseHitsByLabel = {};
10742
10757
  for (const mock of profile.target.network_mocks) {
10743
10758
  hitsByLabel[mock.label] = hitCountForMock(mock);
10744
10759
  if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
10745
10760
  if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
10746
10761
  }
10762
+ for (const event of events) {
10763
+ if (!event || event.ok === false) continue;
10764
+ const label = typeof event.label === "string" ? event.label : "";
10765
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
10766
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
10767
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
10768
+ responseHitsByLabel[label] ||= {};
10769
+ responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
10770
+ }
10747
10771
  checks.push({
10748
10772
  type: "network_mocks_succeeded",
10749
10773
  label: "network mocks succeeded",
@@ -10755,6 +10779,7 @@ function assessProfile(profile, evidence) {
10755
10779
  hits_by_label: hitsByLabel,
10756
10780
  required_hits_by_label: requiredHitsByLabel,
10757
10781
  max_hits_by_label: maxHitsByLabel,
10782
+ response_hits_by_label: responseHitsByLabel,
10758
10783
  failed,
10759
10784
  },
10760
10785
  message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  resolveRiddleProofProfileTimeoutSec,
59
59
  slugifyRiddleProofProfileName,
60
60
  summarizeRiddleProofProfileResult
61
- } from "./chunk-KMJBTFLI.js";
61
+ } from "./chunk-HXYLTNZT.js";
62
62
  import {
63
63
  DEFAULT_RIDDLE_API_BASE_URL,
64
64
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -1540,11 +1540,25 @@ function assessNetworkMocksFromEvidence(profile, evidence) {
1540
1540
  requiredNetworkMockHitCount(mock)
1541
1541
  ])),
1542
1542
  max_hits_by_label: Object.fromEntries(mocks.filter((mock) => mock.max_hit_count !== void 0).map((mock) => [mock.label, mock.max_hit_count ?? null])),
1543
+ response_hits_by_label: networkMockResponseHitsByLabel(events),
1543
1544
  failed
1544
1545
  },
1545
1546
  message: failed.length ? `Network mocks failed or hit-count contracts failed for ${failed.length} mock(s).` : void 0
1546
1547
  };
1547
1548
  }
1549
+ function networkMockResponseHitsByLabel(events) {
1550
+ const responseHits = {};
1551
+ for (const event of events) {
1552
+ if (!event || event.ok === false) continue;
1553
+ const label = typeof event.label === "string" ? event.label : "";
1554
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
1555
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
1556
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
1557
+ responseHits[label] || (responseHits[label] = {});
1558
+ responseHits[label][responseLabel] = (responseHits[label][responseLabel] || 0) + 1;
1559
+ }
1560
+ return responseHits;
1561
+ }
1548
1562
  function requiredNetworkMockHitCount(mock) {
1549
1563
  if (mock.required === false) return 0;
1550
1564
  if (mock.required_hit_count !== void 0) return mock.required_hit_count;
@@ -2068,11 +2082,21 @@ function assessProfile(profile, evidence) {
2068
2082
  const hitsByLabel = {};
2069
2083
  const requiredHitsByLabel = {};
2070
2084
  const maxHitsByLabel = {};
2085
+ const responseHitsByLabel = {};
2071
2086
  for (const mock of profile.target.network_mocks) {
2072
2087
  hitsByLabel[mock.label] = hitCountForMock(mock);
2073
2088
  if (mock && mock.required !== false) requiredHitsByLabel[mock.label] = requiredNetworkMockHitCount(mock);
2074
2089
  if (mock && mock.max_hit_count !== undefined) maxHitsByLabel[mock.label] = mock.max_hit_count;
2075
2090
  }
2091
+ for (const event of events) {
2092
+ if (!event || event.ok === false) continue;
2093
+ const label = typeof event.label === "string" ? event.label : "";
2094
+ const responseLabel = typeof event.response_label === "string" ? event.response_label : "";
2095
+ const hasSequenceResponse = typeof event.response_index === "number" || event.sequence_cycle === true || Boolean(responseLabel && responseLabel !== label);
2096
+ if (!label || !responseLabel || !hasSequenceResponse) continue;
2097
+ responseHitsByLabel[label] ||= {};
2098
+ responseHitsByLabel[label][responseLabel] = (responseHitsByLabel[label][responseLabel] || 0) + 1;
2099
+ }
2076
2100
  checks.push({
2077
2101
  type: "network_mocks_succeeded",
2078
2102
  label: "network mocks succeeded",
@@ -2084,6 +2108,7 @@ function assessProfile(profile, evidence) {
2084
2108
  hits_by_label: hitsByLabel,
2085
2109
  required_hits_by_label: requiredHitsByLabel,
2086
2110
  max_hits_by_label: maxHitsByLabel,
2111
+ response_hits_by_label: responseHitsByLabel,
2087
2112
  failed,
2088
2113
  },
2089
2114
  message: failed.length ? "Network mocks failed or hit-count contracts failed for " + failed.length + " mock(s)." : undefined,
package/dist/profile.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  resolveRiddleProofProfileTimeoutSec,
20
20
  slugifyRiddleProofProfileName,
21
21
  summarizeRiddleProofProfileResult
22
- } from "./chunk-KMJBTFLI.js";
22
+ } from "./chunk-HXYLTNZT.js";
23
23
  export {
24
24
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
25
25
  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.70",
3
+ "version": "0.7.71",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",