@riddledc/riddle-proof 0.7.65 → 0.7.66

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
@@ -11138,6 +11138,10 @@ function profileResultMarkdown(result) {
11138
11138
  lines.push(`- ${check.status}: ${check.label || check.type}`);
11139
11139
  if (check.message) lines.push(` ${check.message}`);
11140
11140
  }
11141
+ const setupSummaryLines = profileSetupSummaryMarkdown(result);
11142
+ if (setupSummaryLines.length) {
11143
+ lines.push("", "## Setup Summary", "", ...setupSummaryLines);
11144
+ }
11141
11145
  if (result.artifacts.riddle_artifacts?.length) {
11142
11146
  lines.push("", "## Riddle Artifacts", "");
11143
11147
  for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
@@ -11147,6 +11151,46 @@ function profileResultMarkdown(result) {
11147
11151
  return `${lines.join("\n")}
11148
11152
  `;
11149
11153
  }
11154
+ function cliRecord(value) {
11155
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
11156
+ }
11157
+ function cliFiniteNumber(value) {
11158
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
11159
+ }
11160
+ function cliString(value) {
11161
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
11162
+ }
11163
+ function profileSetupSummaryMarkdown(result) {
11164
+ const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
11165
+ const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
11166
+ if (!setupSummary) return [];
11167
+ const viewports = Array.isArray(setupSummary.viewports) ? setupSummary.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
11168
+ if (!viewports.length) return [];
11169
+ const declaredActions = cliFiniteNumber(setupSummary.action_count);
11170
+ const totalResults = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.result_count) || 0), 0);
11171
+ const setupScreenshots = viewports.reduce((sum, viewport) => {
11172
+ const labels = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots : [];
11173
+ return sum + labels.filter((label) => typeof label === "string" && label.trim()).length;
11174
+ }, 0);
11175
+ const clickedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0);
11176
+ const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
11177
+ const lines = [
11178
+ `- setup actions: ${declaredActions === void 0 ? "unknown" : declaredActions} declared, ${totalResults} recorded result(s) across ${viewports.length} viewport(s)`,
11179
+ `- setup screenshots: ${setupScreenshots}`,
11180
+ `- clicked targets: ${clickedTotal}${failedTotal ? `; failed setup actions: ${failedTotal}` : ""}`
11181
+ ];
11182
+ for (const viewport of viewports.slice(0, 8)) {
11183
+ const name = cliString(viewport.name) || "viewport";
11184
+ const ok = viewport.ok === false ? "failed" : "ok";
11185
+ const resultCount = cliFiniteNumber(viewport.result_count) || 0;
11186
+ const screenshotCount = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
11187
+ const clicked = cliFiniteNumber(viewport.clicked_total) || 0;
11188
+ const observedPath = cliString(viewport.observed_path);
11189
+ lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${observedPath ? `, path ${observedPath}` : ""}`);
11190
+ }
11191
+ if (viewports.length > 8) lines.push(`- ${viewports.length - 8} additional viewport(s) omitted from setup summary.`);
11192
+ return lines;
11193
+ }
11150
11194
  function writeProfileOutput(outputDir, result) {
11151
11195
  if (!outputDir) return;
11152
11196
  (0, import_node_fs6.mkdirSync)(outputDir, { recursive: true });
package/dist/cli.js CHANGED
@@ -312,6 +312,10 @@ function profileResultMarkdown(result) {
312
312
  lines.push(`- ${check.status}: ${check.label || check.type}`);
313
313
  if (check.message) lines.push(` ${check.message}`);
314
314
  }
315
+ const setupSummaryLines = profileSetupSummaryMarkdown(result);
316
+ if (setupSummaryLines.length) {
317
+ lines.push("", "## Setup Summary", "", ...setupSummaryLines);
318
+ }
315
319
  if (result.artifacts.riddle_artifacts?.length) {
316
320
  lines.push("", "## Riddle Artifacts", "");
317
321
  for (const artifact of result.artifacts.riddle_artifacts.slice(0, 40)) {
@@ -321,6 +325,46 @@ function profileResultMarkdown(result) {
321
325
  return `${lines.join("\n")}
322
326
  `;
323
327
  }
328
+ function cliRecord(value) {
329
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
330
+ }
331
+ function cliFiniteNumber(value) {
332
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
333
+ }
334
+ function cliString(value) {
335
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
336
+ }
337
+ function profileSetupSummaryMarkdown(result) {
338
+ const setupCheck = result.checks.find((check) => check.type === "setup_actions_succeeded");
339
+ const setupSummary = cliRecord(setupCheck?.evidence?.setup_summary);
340
+ if (!setupSummary) return [];
341
+ const viewports = Array.isArray(setupSummary.viewports) ? setupSummary.viewports.map(cliRecord).filter((viewport) => Boolean(viewport)) : [];
342
+ if (!viewports.length) return [];
343
+ const declaredActions = cliFiniteNumber(setupSummary.action_count);
344
+ const totalResults = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.result_count) || 0), 0);
345
+ const setupScreenshots = viewports.reduce((sum, viewport) => {
346
+ const labels = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots : [];
347
+ return sum + labels.filter((label) => typeof label === "string" && label.trim()).length;
348
+ }, 0);
349
+ const clickedTotal = viewports.reduce((sum, viewport) => sum + (cliFiniteNumber(viewport.clicked_total) || 0), 0);
350
+ const failedTotal = viewports.reduce((sum, viewport) => sum + (Array.isArray(viewport.failed) ? viewport.failed.length : 0), 0);
351
+ const lines = [
352
+ `- setup actions: ${declaredActions === void 0 ? "unknown" : declaredActions} declared, ${totalResults} recorded result(s) across ${viewports.length} viewport(s)`,
353
+ `- setup screenshots: ${setupScreenshots}`,
354
+ `- clicked targets: ${clickedTotal}${failedTotal ? `; failed setup actions: ${failedTotal}` : ""}`
355
+ ];
356
+ for (const viewport of viewports.slice(0, 8)) {
357
+ const name = cliString(viewport.name) || "viewport";
358
+ const ok = viewport.ok === false ? "failed" : "ok";
359
+ const resultCount = cliFiniteNumber(viewport.result_count) || 0;
360
+ const screenshotCount = Array.isArray(viewport.setup_screenshots) ? viewport.setup_screenshots.filter((label) => typeof label === "string" && label.trim()).length : 0;
361
+ const clicked = cliFiniteNumber(viewport.clicked_total) || 0;
362
+ const observedPath = cliString(viewport.observed_path);
363
+ lines.push(`- ${name}: ${ok}, ${resultCount} result(s), ${screenshotCount} setup screenshot(s), ${clicked} click(s)${observedPath ? `, path ${observedPath}` : ""}`);
364
+ }
365
+ if (viewports.length > 8) lines.push(`- ${viewports.length - 8} additional viewport(s) omitted from setup summary.`);
366
+ return lines;
367
+ }
324
368
  function writeProfileOutput(outputDir, result) {
325
369
  if (!outputDir) return;
326
370
  mkdirSync(outputDir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.65",
3
+ "version": "0.7.66",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",