@riddledc/riddle-proof 0.7.71 → 0.7.73

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
@@ -10980,7 +10980,7 @@ function usage() {
10980
10980
  " riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
10981
10981
  " riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
10982
10982
  " riddle-proof-loop status --state-path <path>",
10983
- " riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false] [--output <dir>] [--quiet]",
10983
+ " riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false] [--poll-attempts n] [--output <dir>] [--quiet]",
10984
10984
  " riddle-proof-loop riddle-preview-deploy <build-dir> <label>",
10985
10985
  " riddle-proof-loop riddle-server-preview <directory> --script-file <file> [--path /route] [--wait-for-selector selector]",
10986
10986
  " riddle-proof-loop riddle-run-script --url <url> --script-file <file> [--viewport 1280x720] [--strict true|false]",
@@ -11032,6 +11032,13 @@ function optionBoolean(options, key) {
11032
11032
  const flag = key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
11033
11033
  throw new Error(`--${flag} must be true or false.`);
11034
11034
  }
11035
+ function optionNumber(options, ...keys) {
11036
+ for (const key of keys) {
11037
+ const value = optionString(options, key);
11038
+ if (value !== void 0) return Number(value);
11039
+ }
11040
+ return void 0;
11041
+ }
11035
11042
  function readStdin() {
11036
11043
  return (0, import_node_fs6.readFileSync)(0, "utf-8");
11037
11044
  }
@@ -11256,6 +11263,10 @@ function profileResultMarkdown(result) {
11256
11263
  if (networkMockSummaryLines.length) {
11257
11264
  lines.push("", "## Network Mocks", "", ...networkMockSummaryLines);
11258
11265
  }
11266
+ const routeInventorySummaryLines = profileRouteInventorySummaryMarkdown(result);
11267
+ if (routeInventorySummaryLines.length) {
11268
+ lines.push("", "## Route Inventory", "", ...routeInventorySummaryLines);
11269
+ }
11259
11270
  if (result.artifacts.riddle_artifacts?.length) {
11260
11271
  lines.push("", "## Riddle Artifacts", "");
11261
11272
  for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
@@ -11274,6 +11285,9 @@ function cliFiniteNumber(value) {
11274
11285
  function cliString(value) {
11275
11286
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
11276
11287
  }
11288
+ function cliStringArray(value) {
11289
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && Boolean(entry.trim())) : [];
11290
+ }
11277
11291
  function profileSetupSummaryMarkdown(result) {
11278
11292
  const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
11279
11293
  const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
@@ -11355,6 +11369,46 @@ function profileNetworkMockSummaryMarkdown(result) {
11355
11369
  if (labels.length > 16) lines.push(`- ${labels.length - 16} additional network mock label(s) omitted from summary.`);
11356
11370
  return lines;
11357
11371
  }
11372
+ function profileRouteInventorySummaryMarkdown(result) {
11373
+ const routeInventoryChecks = result.checks.filter((check) => check.type === "route_inventory");
11374
+ const lines = [];
11375
+ for (const check of routeInventoryChecks) {
11376
+ const evidence = cliRecord(check.evidence);
11377
+ if (!evidence) continue;
11378
+ const label = check.label || check.type;
11379
+ const expectedCount = cliFiniteNumber(evidence.expected_count);
11380
+ const sourceLinkCount = cliFiniteNumber(evidence.source_link_count);
11381
+ const sourceUniqueLinkCount = cliFiniteNumber(evidence.source_unique_link_count);
11382
+ const directRouteCount = cliFiniteNumber(evidence.direct_route_count);
11383
+ const clickthroughCount = cliFiniteNumber(evidence.clickthrough_count);
11384
+ const topLevelFailures = Array.isArray(evidence.failures) ? evidence.failures.length : void 0;
11385
+ const viewports = Array.isArray(evidence.viewports) ? evidence.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
11386
+ const viewportFailureTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.failure_count) || 0), 0);
11387
+ const failureCount = topLevelFailures === void 0 ? viewportFailureTotal : topLevelFailures;
11388
+ lines.push(
11389
+ `- ${label}: expected ${expectedCount ?? "unknown"}, source links ${sourceLinkCount ?? "unknown"}${sourceUniqueLinkCount === void 0 ? "" : ` (${sourceUniqueLinkCount} unique)`}, direct ${directRouteCount ?? "unknown"}, clickthrough ${clickthroughCount ?? "unknown"}, failures ${failureCount}`
11390
+ );
11391
+ const duplicateCount = cliFiniteNumber(evidence.duplicate_source_link_count) || 0;
11392
+ const duplicateLinks = cliStringArray(evidence.duplicate_source_links);
11393
+ if (duplicateCount || duplicateLinks.length) {
11394
+ const duplicateText = duplicateLinks.length ? `: ${duplicateLinks.slice(0, 8).join(", ")}${duplicateLinks.length > 8 ? `, ${duplicateLinks.length - 8} more` : ""}` : "";
11395
+ lines.push(`- ${label} duplicate source links: ${duplicateCount}${evidence.duplicates_allowed === true ? " allowed" : ""}${duplicateText}`);
11396
+ }
11397
+ for (const viewport of viewports.slice(0, 8)) {
11398
+ const viewportName = cliString(viewport.viewport) || cliString(viewport.name) || "viewport";
11399
+ const viewportSourceLinkCount = cliFiniteNumber(viewport.source_link_count);
11400
+ const viewportSourceUniqueLinkCount = cliFiniteNumber(viewport.source_unique_link_count);
11401
+ const viewportDirectRouteCount = cliFiniteNumber(viewport.direct_route_count);
11402
+ const viewportClickthroughCount = cliFiniteNumber(viewport.clickthrough_count);
11403
+ const viewportFailureCount = cliFiniteNumber(viewport.failure_count) || 0;
11404
+ lines.push(
11405
+ `- ${label} ${viewportName}: source ${viewportSourceLinkCount ?? "unknown"}${viewportSourceUniqueLinkCount === void 0 ? "" : ` (${viewportSourceUniqueLinkCount} unique)`}, direct ${viewportDirectRouteCount ?? "unknown"}, clickthrough ${viewportClickthroughCount ?? "unknown"}, failures ${viewportFailureCount}`
11406
+ );
11407
+ }
11408
+ if (viewports.length > 8) lines.push(`- ${label}: ${viewports.length - 8} additional viewport(s) omitted from route inventory summary.`);
11409
+ }
11410
+ return lines;
11411
+ }
11358
11412
  function writeProfileOutput(outputDir, result) {
11359
11413
  if (!outputDir) return;
11360
11414
  (0, import_node_fs6.mkdirSync)(outputDir, { recursive: true });
@@ -11449,9 +11503,9 @@ async function runProfileForCli(profile, options) {
11449
11503
  }
11450
11504
  const poll = await client.pollJob(jobId, {
11451
11505
  wait: true,
11452
- attempts: optionString(options, "attempts") ? Number(optionString(options, "attempts")) : void 0,
11453
- intervalMs: optionString(options, "intervalMs") ? Number(optionString(options, "intervalMs")) : void 0,
11454
- progressEveryMs: optionString(options, "progressEveryMs") ? Number(optionString(options, "progressEveryMs")) : void 0,
11506
+ attempts: optionNumber(options, "pollAttempts", "attempts"),
11507
+ intervalMs: optionNumber(options, "intervalMs"),
11508
+ progressEveryMs: optionNumber(options, "progressEveryMs"),
11455
11509
  onProgress: options.quiet !== true ? (snapshot) => {
11456
11510
  process.stderr.write(`${riddlePollProgressLine(snapshot)}
11457
11511
  `);
package/dist/cli.js CHANGED
@@ -44,7 +44,7 @@ function usage() {
44
44
  " riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
45
45
  " riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
46
46
  " riddle-proof-loop status --state-path <path>",
47
- " riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false] [--output <dir>] [--quiet]",
47
+ " riddle-proof-loop run-profile --profile <file|json|-> --url <base-url> [--runner riddle] [--strict true|false] [--poll-attempts n] [--output <dir>] [--quiet]",
48
48
  " riddle-proof-loop riddle-preview-deploy <build-dir> <label>",
49
49
  " riddle-proof-loop riddle-server-preview <directory> --script-file <file> [--path /route] [--wait-for-selector selector]",
50
50
  " riddle-proof-loop riddle-run-script --url <url> --script-file <file> [--viewport 1280x720] [--strict true|false]",
@@ -96,6 +96,13 @@ function optionBoolean(options, key) {
96
96
  const flag = key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
97
97
  throw new Error(`--${flag} must be true or false.`);
98
98
  }
99
+ function optionNumber(options, ...keys) {
100
+ for (const key of keys) {
101
+ const value = optionString(options, key);
102
+ if (value !== void 0) return Number(value);
103
+ }
104
+ return void 0;
105
+ }
99
106
  function readStdin() {
100
107
  return readFileSync(0, "utf-8");
101
108
  }
@@ -320,6 +327,10 @@ function profileResultMarkdown(result) {
320
327
  if (networkMockSummaryLines.length) {
321
328
  lines.push("", "## Network Mocks", "", ...networkMockSummaryLines);
322
329
  }
330
+ const routeInventorySummaryLines = profileRouteInventorySummaryMarkdown(result);
331
+ if (routeInventorySummaryLines.length) {
332
+ lines.push("", "## Route Inventory", "", ...routeInventorySummaryLines);
333
+ }
323
334
  if (result.artifacts.riddle_artifacts?.length) {
324
335
  lines.push("", "## Riddle Artifacts", "");
325
336
  for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
@@ -338,6 +349,9 @@ function cliFiniteNumber(value) {
338
349
  function cliString(value) {
339
350
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
340
351
  }
352
+ function cliStringArray(value) {
353
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && Boolean(entry.trim())) : [];
354
+ }
341
355
  function profileSetupSummaryMarkdown(result) {
342
356
  const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
343
357
  const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
@@ -419,6 +433,46 @@ function profileNetworkMockSummaryMarkdown(result) {
419
433
  if (labels.length > 16) lines.push(`- ${labels.length - 16} additional network mock label(s) omitted from summary.`);
420
434
  return lines;
421
435
  }
436
+ function profileRouteInventorySummaryMarkdown(result) {
437
+ const routeInventoryChecks = result.checks.filter((check) => check.type === "route_inventory");
438
+ const lines = [];
439
+ for (const check of routeInventoryChecks) {
440
+ const evidence = cliRecord(check.evidence);
441
+ if (!evidence) continue;
442
+ const label = check.label || check.type;
443
+ const expectedCount = cliFiniteNumber(evidence.expected_count);
444
+ const sourceLinkCount = cliFiniteNumber(evidence.source_link_count);
445
+ const sourceUniqueLinkCount = cliFiniteNumber(evidence.source_unique_link_count);
446
+ const directRouteCount = cliFiniteNumber(evidence.direct_route_count);
447
+ const clickthroughCount = cliFiniteNumber(evidence.clickthrough_count);
448
+ const topLevelFailures = Array.isArray(evidence.failures) ? evidence.failures.length : void 0;
449
+ const viewports = Array.isArray(evidence.viewports) ? evidence.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
450
+ const viewportFailureTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.failure_count) || 0), 0);
451
+ const failureCount = topLevelFailures === void 0 ? viewportFailureTotal : topLevelFailures;
452
+ lines.push(
453
+ `- ${label}: expected ${expectedCount ?? "unknown"}, source links ${sourceLinkCount ?? "unknown"}${sourceUniqueLinkCount === void 0 ? "" : ` (${sourceUniqueLinkCount} unique)`}, direct ${directRouteCount ?? "unknown"}, clickthrough ${clickthroughCount ?? "unknown"}, failures ${failureCount}`
454
+ );
455
+ const duplicateCount = cliFiniteNumber(evidence.duplicate_source_link_count) || 0;
456
+ const duplicateLinks = cliStringArray(evidence.duplicate_source_links);
457
+ if (duplicateCount || duplicateLinks.length) {
458
+ const duplicateText = duplicateLinks.length ? `: ${duplicateLinks.slice(0, 8).join(", ")}${duplicateLinks.length > 8 ? `, ${duplicateLinks.length - 8} more` : ""}` : "";
459
+ lines.push(`- ${label} duplicate source links: ${duplicateCount}${evidence.duplicates_allowed === true ? " allowed" : ""}${duplicateText}`);
460
+ }
461
+ for (const viewport of viewports.slice(0, 8)) {
462
+ const viewportName = cliString(viewport.viewport) || cliString(viewport.name) || "viewport";
463
+ const viewportSourceLinkCount = cliFiniteNumber(viewport.source_link_count);
464
+ const viewportSourceUniqueLinkCount = cliFiniteNumber(viewport.source_unique_link_count);
465
+ const viewportDirectRouteCount = cliFiniteNumber(viewport.direct_route_count);
466
+ const viewportClickthroughCount = cliFiniteNumber(viewport.clickthrough_count);
467
+ const viewportFailureCount = cliFiniteNumber(viewport.failure_count) || 0;
468
+ lines.push(
469
+ `- ${label} ${viewportName}: source ${viewportSourceLinkCount ?? "unknown"}${viewportSourceUniqueLinkCount === void 0 ? "" : ` (${viewportSourceUniqueLinkCount} unique)`}, direct ${viewportDirectRouteCount ?? "unknown"}, clickthrough ${viewportClickthroughCount ?? "unknown"}, failures ${viewportFailureCount}`
470
+ );
471
+ }
472
+ if (viewports.length > 8) lines.push(`- ${label}: ${viewports.length - 8} additional viewport(s) omitted from route inventory summary.`);
473
+ }
474
+ return lines;
475
+ }
422
476
  function writeProfileOutput(outputDir, result) {
423
477
  if (!outputDir) return;
424
478
  mkdirSync(outputDir, { recursive: true });
@@ -513,9 +567,9 @@ async function runProfileForCli(profile, options) {
513
567
  }
514
568
  const poll = await client.pollJob(jobId, {
515
569
  wait: true,
516
- attempts: optionString(options, "attempts") ? Number(optionString(options, "attempts")) : void 0,
517
- intervalMs: optionString(options, "intervalMs") ? Number(optionString(options, "intervalMs")) : void 0,
518
- progressEveryMs: optionString(options, "progressEveryMs") ? Number(optionString(options, "progressEveryMs")) : void 0,
570
+ attempts: optionNumber(options, "pollAttempts", "attempts"),
571
+ intervalMs: optionNumber(options, "intervalMs"),
572
+ progressEveryMs: optionNumber(options, "progressEveryMs"),
519
573
  onProgress: options.quiet !== true ? (snapshot) => {
520
574
  process.stderr.write(`${riddlePollProgressLine(snapshot)}
521
575
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.71",
3
+ "version": "0.7.73",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",