@riddledc/riddle-proof 0.8.43 → 0.8.45

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.
@@ -10,6 +10,7 @@ import {
10
10
  } from "./chunk-6KYXX4OE.js";
11
11
  import {
12
12
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
13
+ applyRiddleProofProfileArtifactCompleteness,
13
14
  assessRiddleProofProfileEvidence,
14
15
  buildRiddleProofProfileScript,
15
16
  collectRiddleProfileArtifactRefs,
@@ -22,7 +23,7 @@ import {
22
23
  profileStatusExitCode,
23
24
  resolveRiddleProofProfileTargetUrl,
24
25
  resolveRiddleProofProfileTimeoutSec
25
- } from "./chunk-Z2LCVROU.js";
26
+ } from "./chunk-EX7TO4I5.js";
26
27
  import {
27
28
  createDisabledRiddleProofAgentAdapter,
28
29
  readRiddleProofRunStatus,
@@ -3823,7 +3824,13 @@ async function readArtifactJson(artifact) {
3823
3824
  async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInputs) {
3824
3825
  for (const input of fallbackInputs) {
3825
3826
  const result = extractRiddleProofProfileResult(input);
3826
- if (result) return withProfileMetadata(profile, result);
3827
+ if (result) {
3828
+ return applyRiddleProofProfileArtifactCompleteness(
3829
+ profile,
3830
+ withProfileMetadata(profile, result),
3831
+ artifacts
3832
+ );
3833
+ }
3827
3834
  }
3828
3835
  const proofArtifacts = artifacts.filter((artifact) => /(^|\/)proof\.json(?:\.json)?$/i.test(artifact.name || artifact.url || artifact.path || "")).sort((left, right) => {
3829
3836
  const leftName = left.name || left.url || left.path || "";
@@ -3833,7 +3840,13 @@ async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInpu
3833
3840
  for (const artifact of proofArtifacts) {
3834
3841
  const parsed = await readArtifactJson(artifact);
3835
3842
  const result = extractRiddleProofProfileResult(parsed);
3836
- if (result) return withProfileMetadata(profile, result);
3843
+ if (result) {
3844
+ return applyRiddleProofProfileArtifactCompleteness(
3845
+ profile,
3846
+ withProfileMetadata(profile, result),
3847
+ artifacts
3848
+ );
3849
+ }
3837
3850
  }
3838
3851
  const evidenceArtifacts = artifacts.filter((artifact) => /profile-evidence|evidence\.json/i.test(artifact.name || artifact.url || artifact.path || ""));
3839
3852
  for (const artifact of evidenceArtifacts) {
@@ -4400,7 +4413,15 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
4400
4413
  jobId = typeof created.job_id === "string" ? created.job_id : typeof created.id === "string" ? created.id : "";
4401
4414
  if (!jobId) {
4402
4415
  const directResult = extractRiddleProofProfileResult(created);
4403
- return directResult ? withRiddleMetadata(withProfileMetadata(profile, directResult), { artifacts: collectRiddleProfileArtifactRefs(created) }) : createRiddleProofProfileInsufficientResult({ profile, runner, error: "Riddle run response was missing job_id.", artifacts: collectRiddleProfileArtifactRefs(created) });
4416
+ const createdArtifacts = collectRiddleProfileArtifactRefs(created);
4417
+ return directResult ? withRiddleMetadata(
4418
+ applyRiddleProofProfileArtifactCompleteness(
4419
+ profile,
4420
+ withProfileMetadata(profile, directResult),
4421
+ createdArtifacts
4422
+ ),
4423
+ { artifacts: createdArtifacts }
4424
+ ) : createRiddleProofProfileInsufficientResult({ profile, runner, error: "Riddle run response was missing job_id.", artifacts: createdArtifacts });
4404
4425
  }
4405
4426
  writeRiddleJobReceipt(input.outputDir, {
4406
4427
  profile,
@@ -3486,6 +3486,101 @@ function profileStatusFromEvidence(profile, evidence, checks) {
3486
3486
  if (checks.some((check) => check.status === "failed")) return "product_regression";
3487
3487
  return "passed";
3488
3488
  }
3489
+ function assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
3490
+ const required = profileRequiredArtifactKeys(profile, result);
3491
+ const missing = required.filter((key) => !profileArtifactKeyPresent(key, artifacts));
3492
+ return {
3493
+ ok: missing.length === 0,
3494
+ required,
3495
+ observed: artifacts.map((artifact) => profileArtifactObservedLabel(artifact)).filter(Boolean),
3496
+ missing
3497
+ };
3498
+ }
3499
+ function applyRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
3500
+ if (artifacts === void 0) return result;
3501
+ const completeness = assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts);
3502
+ if (result.status !== "passed" || completeness.ok) {
3503
+ return {
3504
+ ...result,
3505
+ artifacts: {
3506
+ ...result.artifacts,
3507
+ riddle_artifacts: artifacts
3508
+ }
3509
+ };
3510
+ }
3511
+ const missing = completeness.missing.join(", ");
3512
+ const message = `Missing required profile artifact(s): ${missing}`;
3513
+ const warnings = [...result.warnings || [], message];
3514
+ return {
3515
+ ...result,
3516
+ status: "proof_insufficient",
3517
+ artifacts: {
3518
+ ...result.artifacts,
3519
+ riddle_artifacts: artifacts
3520
+ },
3521
+ summary: `${profile.name} did not produce required profile artifact(s): ${missing}.`,
3522
+ warnings,
3523
+ error: message
3524
+ };
3525
+ }
3526
+ function profileRequiredArtifactKeys(profile, result) {
3527
+ const keys = [];
3528
+ for (const artifact of profile.artifacts || []) {
3529
+ const role = normalizeProfileArtifactRole(artifact);
3530
+ if (!role) continue;
3531
+ if (role === "screenshot") {
3532
+ const screenshots = result.artifacts.screenshots || [];
3533
+ if (screenshots.length) {
3534
+ keys.push(...screenshots.map((label) => `screenshot:${label}`));
3535
+ } else {
3536
+ keys.push("screenshot");
3537
+ }
3538
+ continue;
3539
+ }
3540
+ keys.push(role);
3541
+ }
3542
+ return uniqueNonEmptyStrings(keys);
3543
+ }
3544
+ function normalizeProfileArtifactRole(input) {
3545
+ const normalized = input.trim().toLowerCase().replace(/[\s-]+/g, "_");
3546
+ if (!normalized) return "";
3547
+ if (normalized === "screenshots") return "screenshot";
3548
+ if (normalized === "console" || normalized === "console_json" || normalized === "console.json") return "console.json";
3549
+ if (normalized === "dom_summary" || normalized === "dom_summary_json" || normalized === "dom-summary.json") return "dom-summary.json";
3550
+ if (normalized === "proof" || normalized === "proof_json" || normalized === "proof.json") return "proof.json";
3551
+ return normalizeRiddleProfileArtifactName(input.trim()).toLowerCase();
3552
+ }
3553
+ function profileArtifactKeyPresent(key, artifacts) {
3554
+ if (key.startsWith("screenshot:")) {
3555
+ const label = key.slice("screenshot:".length);
3556
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact) && profileArtifactRefText(artifact).includes(label.toLowerCase()));
3557
+ }
3558
+ if (key === "screenshot") {
3559
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact));
3560
+ }
3561
+ return artifacts.some((artifact) => {
3562
+ const name = normalizeRiddleProfileArtifactName(artifact.name || artifactNameFromPath(artifact.url || artifact.path) || "").toLowerCase();
3563
+ return name === key || profileArtifactRefText(artifact).includes(key);
3564
+ });
3565
+ }
3566
+ function profileArtifactRefIsScreenshot(artifact) {
3567
+ const kind = (artifact.kind || "").toLowerCase();
3568
+ const contentType = (artifact.content_type || "").toLowerCase();
3569
+ const text = profileArtifactRefText(artifact);
3570
+ return kind === "screenshot" || contentType.startsWith("image/") || /\.(png|jpe?g|webp)(?:$|[?#])/i.test(text) || /\.(png|jpe?g|webp)$/i.test(text);
3571
+ }
3572
+ function profileArtifactRefText(artifact) {
3573
+ return [
3574
+ artifact.name,
3575
+ artifact.url,
3576
+ artifact.path,
3577
+ artifact.kind,
3578
+ artifact.content_type
3579
+ ].filter(Boolean).join(" ").toLowerCase();
3580
+ }
3581
+ function profileArtifactObservedLabel(artifact) {
3582
+ return artifact.name || artifact.url || artifact.path || artifact.kind || "";
3583
+ }
3489
3584
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3490
3585
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
3491
3586
  const warnings = collectRiddleProofProfileWarnings(profile);
@@ -3497,7 +3592,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3497
3592
  const status = profileStatusFromEvidence(profile, evidence, checks);
3498
3593
  const firstViewport = evidence?.viewports?.[0];
3499
3594
  const screenshots = profileScreenshotLabels(evidence?.viewports);
3500
- return {
3595
+ const result = {
3501
3596
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
3502
3597
  profile_name: profile.name,
3503
3598
  runner: options.runner || "riddle",
@@ -3519,6 +3614,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3519
3614
  evidence,
3520
3615
  riddle: options.riddle
3521
3616
  };
3617
+ return applyRiddleProofProfileArtifactCompleteness(profile, result, options.artifacts);
3522
3618
  }
3523
3619
  function summarizeRiddleProofProfileResult(input) {
3524
3620
  const passedChecks = input.checks.filter((check) => check.status === "passed").length;
@@ -9468,6 +9564,8 @@ export {
9468
9564
  resolveRiddleProofProfileTimeoutSec,
9469
9565
  preflightRiddleProofProfileHttpStatusChecks,
9470
9566
  resolveRiddleProofProfileRouteUrl,
9567
+ assessRiddleProofProfileArtifactCompleteness,
9568
+ applyRiddleProofProfileArtifactCompleteness,
9471
9569
  assessRiddleProofProfileEvidence,
9472
9570
  summarizeRiddleProofProfileResult,
9473
9571
  profileStatusExitCode,
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "../chunk-MVJBPCZ4.js";
1
+ import "../chunk-EPFGN7G7.js";
2
2
  import "../chunk-DI2XNGEZ.js";
3
3
  import "../chunk-6KYXX4OE.js";
4
- import "../chunk-Z2LCVROU.js";
4
+ import "../chunk-EX7TO4I5.js";
5
5
  import "../chunk-ZREWMTFA.js";
6
6
  import "../chunk-ZQWVXQKJ.js";
7
7
  import "../chunk-RDPG554T.js";
package/dist/cli.cjs CHANGED
@@ -11427,6 +11427,101 @@ function profileStatusFromEvidence(profile, evidence, checks) {
11427
11427
  if (checks.some((check) => check.status === "failed")) return "product_regression";
11428
11428
  return "passed";
11429
11429
  }
11430
+ function assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
11431
+ const required = profileRequiredArtifactKeys(profile, result);
11432
+ const missing = required.filter((key) => !profileArtifactKeyPresent(key, artifacts));
11433
+ return {
11434
+ ok: missing.length === 0,
11435
+ required,
11436
+ observed: artifacts.map((artifact) => profileArtifactObservedLabel(artifact)).filter(Boolean),
11437
+ missing
11438
+ };
11439
+ }
11440
+ function applyRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
11441
+ if (artifacts === void 0) return result;
11442
+ const completeness = assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts);
11443
+ if (result.status !== "passed" || completeness.ok) {
11444
+ return {
11445
+ ...result,
11446
+ artifacts: {
11447
+ ...result.artifacts,
11448
+ riddle_artifacts: artifacts
11449
+ }
11450
+ };
11451
+ }
11452
+ const missing = completeness.missing.join(", ");
11453
+ const message = `Missing required profile artifact(s): ${missing}`;
11454
+ const warnings = [...result.warnings || [], message];
11455
+ return {
11456
+ ...result,
11457
+ status: "proof_insufficient",
11458
+ artifacts: {
11459
+ ...result.artifacts,
11460
+ riddle_artifacts: artifacts
11461
+ },
11462
+ summary: `${profile.name} did not produce required profile artifact(s): ${missing}.`,
11463
+ warnings,
11464
+ error: message
11465
+ };
11466
+ }
11467
+ function profileRequiredArtifactKeys(profile, result) {
11468
+ const keys = [];
11469
+ for (const artifact of profile.artifacts || []) {
11470
+ const role = normalizeProfileArtifactRole(artifact);
11471
+ if (!role) continue;
11472
+ if (role === "screenshot") {
11473
+ const screenshots = result.artifacts.screenshots || [];
11474
+ if (screenshots.length) {
11475
+ keys.push(...screenshots.map((label) => `screenshot:${label}`));
11476
+ } else {
11477
+ keys.push("screenshot");
11478
+ }
11479
+ continue;
11480
+ }
11481
+ keys.push(role);
11482
+ }
11483
+ return uniqueNonEmptyStrings(keys);
11484
+ }
11485
+ function normalizeProfileArtifactRole(input) {
11486
+ const normalized = input.trim().toLowerCase().replace(/[\s-]+/g, "_");
11487
+ if (!normalized) return "";
11488
+ if (normalized === "screenshots") return "screenshot";
11489
+ if (normalized === "console" || normalized === "console_json" || normalized === "console.json") return "console.json";
11490
+ if (normalized === "dom_summary" || normalized === "dom_summary_json" || normalized === "dom-summary.json") return "dom-summary.json";
11491
+ if (normalized === "proof" || normalized === "proof_json" || normalized === "proof.json") return "proof.json";
11492
+ return normalizeRiddleProfileArtifactName(input.trim()).toLowerCase();
11493
+ }
11494
+ function profileArtifactKeyPresent(key, artifacts) {
11495
+ if (key.startsWith("screenshot:")) {
11496
+ const label = key.slice("screenshot:".length);
11497
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact) && profileArtifactRefText(artifact).includes(label.toLowerCase()));
11498
+ }
11499
+ if (key === "screenshot") {
11500
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact));
11501
+ }
11502
+ return artifacts.some((artifact) => {
11503
+ const name = normalizeRiddleProfileArtifactName(artifact.name || artifactNameFromPath(artifact.url || artifact.path) || "").toLowerCase();
11504
+ return name === key || profileArtifactRefText(artifact).includes(key);
11505
+ });
11506
+ }
11507
+ function profileArtifactRefIsScreenshot(artifact) {
11508
+ const kind = (artifact.kind || "").toLowerCase();
11509
+ const contentType = (artifact.content_type || "").toLowerCase();
11510
+ const text = profileArtifactRefText(artifact);
11511
+ return kind === "screenshot" || contentType.startsWith("image/") || /\.(png|jpe?g|webp)(?:$|[?#])/i.test(text) || /\.(png|jpe?g|webp)$/i.test(text);
11512
+ }
11513
+ function profileArtifactRefText(artifact) {
11514
+ return [
11515
+ artifact.name,
11516
+ artifact.url,
11517
+ artifact.path,
11518
+ artifact.kind,
11519
+ artifact.content_type
11520
+ ].filter(Boolean).join(" ").toLowerCase();
11521
+ }
11522
+ function profileArtifactObservedLabel(artifact) {
11523
+ return artifact.name || artifact.url || artifact.path || artifact.kind || "";
11524
+ }
11430
11525
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
11431
11526
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
11432
11527
  const warnings = collectRiddleProofProfileWarnings(profile);
@@ -11438,7 +11533,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
11438
11533
  const status = profileStatusFromEvidence(profile, evidence, checks);
11439
11534
  const firstViewport = evidence?.viewports?.[0];
11440
11535
  const screenshots = profileScreenshotLabels(evidence?.viewports);
11441
- return {
11536
+ const result = {
11442
11537
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
11443
11538
  profile_name: profile.name,
11444
11539
  runner: options.runner || "riddle",
@@ -11460,6 +11555,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
11460
11555
  evidence,
11461
11556
  riddle: options.riddle
11462
11557
  };
11558
+ return applyRiddleProofProfileArtifactCompleteness(profile, result, options.artifacts);
11463
11559
  }
11464
11560
  function summarizeRiddleProofProfileResult(input) {
11465
11561
  const passedChecks = input.checks.filter((check) => check.status === "passed").length;
@@ -21365,7 +21461,13 @@ async function readArtifactJson(artifact) {
21365
21461
  async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInputs) {
21366
21462
  for (const input of fallbackInputs) {
21367
21463
  const result = extractRiddleProofProfileResult(input);
21368
- if (result) return withProfileMetadata(profile, result);
21464
+ if (result) {
21465
+ return applyRiddleProofProfileArtifactCompleteness(
21466
+ profile,
21467
+ withProfileMetadata(profile, result),
21468
+ artifacts
21469
+ );
21470
+ }
21369
21471
  }
21370
21472
  const proofArtifacts = artifacts.filter((artifact) => /(^|\/)proof\.json(?:\.json)?$/i.test(artifact.name || artifact.url || artifact.path || "")).sort((left, right) => {
21371
21473
  const leftName = left.name || left.url || left.path || "";
@@ -21375,7 +21477,13 @@ async function profileResultFromRiddleArtifacts(profile, artifacts, fallbackInpu
21375
21477
  for (const artifact of proofArtifacts) {
21376
21478
  const parsed = await readArtifactJson(artifact);
21377
21479
  const result = extractRiddleProofProfileResult(parsed);
21378
- if (result) return withProfileMetadata(profile, result);
21480
+ if (result) {
21481
+ return applyRiddleProofProfileArtifactCompleteness(
21482
+ profile,
21483
+ withProfileMetadata(profile, result),
21484
+ artifacts
21485
+ );
21486
+ }
21379
21487
  }
21380
21488
  const evidenceArtifacts = artifacts.filter((artifact) => /profile-evidence|evidence\.json/i.test(artifact.name || artifact.url || artifact.path || ""));
21381
21489
  for (const artifact of evidenceArtifacts) {
@@ -21942,7 +22050,15 @@ async function runSingleRiddleProfileForCli(profile, options, input) {
21942
22050
  jobId = typeof created.job_id === "string" ? created.job_id : typeof created.id === "string" ? created.id : "";
21943
22051
  if (!jobId) {
21944
22052
  const directResult = extractRiddleProofProfileResult(created);
21945
- return directResult ? withRiddleMetadata(withProfileMetadata(profile, directResult), { artifacts: collectRiddleProfileArtifactRefs(created) }) : createRiddleProofProfileInsufficientResult({ profile, runner, error: "Riddle run response was missing job_id.", artifacts: collectRiddleProfileArtifactRefs(created) });
22053
+ const createdArtifacts = collectRiddleProfileArtifactRefs(created);
22054
+ return directResult ? withRiddleMetadata(
22055
+ applyRiddleProofProfileArtifactCompleteness(
22056
+ profile,
22057
+ withProfileMetadata(profile, directResult),
22058
+ createdArtifacts
22059
+ ),
22060
+ { artifacts: createdArtifacts }
22061
+ ) : createRiddleProofProfileInsufficientResult({ profile, runner, error: "Riddle run response was missing job_id.", artifacts: createdArtifacts });
21946
22062
  }
21947
22063
  writeRiddleJobReceipt(input.outputDir, {
21948
22064
  profile,
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-MVJBPCZ4.js";
2
+ import "./chunk-EPFGN7G7.js";
3
3
  import "./chunk-DI2XNGEZ.js";
4
4
  import "./chunk-6KYXX4OE.js";
5
- import "./chunk-Z2LCVROU.js";
5
+ import "./chunk-EX7TO4I5.js";
6
6
  import "./chunk-ZREWMTFA.js";
7
7
  import "./chunk-ZQWVXQKJ.js";
8
8
  import "./chunk-RDPG554T.js";
package/dist/index.cjs CHANGED
@@ -3421,12 +3421,14 @@ __export(index_exports, {
3421
3421
  appendRunEvent: () => appendRunEvent,
3422
3422
  appendStageHeartbeat: () => appendStageHeartbeat,
3423
3423
  applyPrLifecycleState: () => applyPrLifecycleState,
3424
+ applyRiddleProofProfileArtifactCompleteness: () => applyRiddleProofProfileArtifactCompleteness,
3424
3425
  applyTerminalMetadata: () => applyTerminalMetadata,
3425
3426
  assessBasicGameplayEvidence: () => assessBasicGameplayEvidence,
3426
3427
  assessBasicGameplayProgressionCheck: () => assessBasicGameplayProgressionCheck,
3427
3428
  assessBasicGameplayProgressionChecks: () => assessBasicGameplayProgressionChecks,
3428
3429
  assessBasicGameplayRoute: () => assessBasicGameplayRoute,
3429
3430
  assessPlayabilityEvidence: () => assessPlayabilityEvidence,
3431
+ assessRiddleProofProfileArtifactCompleteness: () => assessRiddleProofProfileArtifactCompleteness,
3430
3432
  assessRiddleProofProfileEvidence: () => assessRiddleProofProfileEvidence,
3431
3433
  attachBasicGameplayArtifactScreenshotHashes: () => attachBasicGameplayArtifactScreenshotHashes,
3432
3434
  augmentBasicGameplayAssessmentWithProgressionChecks: () => augmentBasicGameplayAssessmentWithProgressionChecks,
@@ -13020,6 +13022,101 @@ function profileStatusFromEvidence(profile, evidence, checks) {
13020
13022
  if (checks.some((check) => check.status === "failed")) return "product_regression";
13021
13023
  return "passed";
13022
13024
  }
13025
+ function assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
13026
+ const required = profileRequiredArtifactKeys(profile, result);
13027
+ const missing = required.filter((key) => !profileArtifactKeyPresent(key, artifacts));
13028
+ return {
13029
+ ok: missing.length === 0,
13030
+ required,
13031
+ observed: artifacts.map((artifact) => profileArtifactObservedLabel(artifact)).filter(Boolean),
13032
+ missing
13033
+ };
13034
+ }
13035
+ function applyRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
13036
+ if (artifacts === void 0) return result;
13037
+ const completeness = assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts);
13038
+ if (result.status !== "passed" || completeness.ok) {
13039
+ return {
13040
+ ...result,
13041
+ artifacts: {
13042
+ ...result.artifacts,
13043
+ riddle_artifacts: artifacts
13044
+ }
13045
+ };
13046
+ }
13047
+ const missing = completeness.missing.join(", ");
13048
+ const message = `Missing required profile artifact(s): ${missing}`;
13049
+ const warnings = [...result.warnings || [], message];
13050
+ return {
13051
+ ...result,
13052
+ status: "proof_insufficient",
13053
+ artifacts: {
13054
+ ...result.artifacts,
13055
+ riddle_artifacts: artifacts
13056
+ },
13057
+ summary: `${profile.name} did not produce required profile artifact(s): ${missing}.`,
13058
+ warnings,
13059
+ error: message
13060
+ };
13061
+ }
13062
+ function profileRequiredArtifactKeys(profile, result) {
13063
+ const keys = [];
13064
+ for (const artifact of profile.artifacts || []) {
13065
+ const role = normalizeProfileArtifactRole(artifact);
13066
+ if (!role) continue;
13067
+ if (role === "screenshot") {
13068
+ const screenshots = result.artifacts.screenshots || [];
13069
+ if (screenshots.length) {
13070
+ keys.push(...screenshots.map((label) => `screenshot:${label}`));
13071
+ } else {
13072
+ keys.push("screenshot");
13073
+ }
13074
+ continue;
13075
+ }
13076
+ keys.push(role);
13077
+ }
13078
+ return uniqueNonEmptyStrings(keys);
13079
+ }
13080
+ function normalizeProfileArtifactRole(input) {
13081
+ const normalized = input.trim().toLowerCase().replace(/[\s-]+/g, "_");
13082
+ if (!normalized) return "";
13083
+ if (normalized === "screenshots") return "screenshot";
13084
+ if (normalized === "console" || normalized === "console_json" || normalized === "console.json") return "console.json";
13085
+ if (normalized === "dom_summary" || normalized === "dom_summary_json" || normalized === "dom-summary.json") return "dom-summary.json";
13086
+ if (normalized === "proof" || normalized === "proof_json" || normalized === "proof.json") return "proof.json";
13087
+ return normalizeRiddleProfileArtifactName(input.trim()).toLowerCase();
13088
+ }
13089
+ function profileArtifactKeyPresent(key, artifacts) {
13090
+ if (key.startsWith("screenshot:")) {
13091
+ const label = key.slice("screenshot:".length);
13092
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact) && profileArtifactRefText(artifact).includes(label.toLowerCase()));
13093
+ }
13094
+ if (key === "screenshot") {
13095
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact));
13096
+ }
13097
+ return artifacts.some((artifact) => {
13098
+ const name = normalizeRiddleProfileArtifactName(artifact.name || artifactNameFromPath(artifact.url || artifact.path) || "").toLowerCase();
13099
+ return name === key || profileArtifactRefText(artifact).includes(key);
13100
+ });
13101
+ }
13102
+ function profileArtifactRefIsScreenshot(artifact) {
13103
+ const kind = (artifact.kind || "").toLowerCase();
13104
+ const contentType = (artifact.content_type || "").toLowerCase();
13105
+ const text = profileArtifactRefText(artifact);
13106
+ return kind === "screenshot" || contentType.startsWith("image/") || /\.(png|jpe?g|webp)(?:$|[?#])/i.test(text) || /\.(png|jpe?g|webp)$/i.test(text);
13107
+ }
13108
+ function profileArtifactRefText(artifact) {
13109
+ return [
13110
+ artifact.name,
13111
+ artifact.url,
13112
+ artifact.path,
13113
+ artifact.kind,
13114
+ artifact.content_type
13115
+ ].filter(Boolean).join(" ").toLowerCase();
13116
+ }
13117
+ function profileArtifactObservedLabel(artifact) {
13118
+ return artifact.name || artifact.url || artifact.path || artifact.kind || "";
13119
+ }
13023
13120
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
13024
13121
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
13025
13122
  const warnings = collectRiddleProofProfileWarnings(profile);
@@ -13031,7 +13128,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
13031
13128
  const status = profileStatusFromEvidence(profile, evidence, checks);
13032
13129
  const firstViewport = evidence?.viewports?.[0];
13033
13130
  const screenshots = profileScreenshotLabels(evidence?.viewports);
13034
- return {
13131
+ const result = {
13035
13132
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
13036
13133
  profile_name: profile.name,
13037
13134
  runner: options.runner || "riddle",
@@ -13053,6 +13150,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
13053
13150
  evidence,
13054
13151
  riddle: options.riddle
13055
13152
  };
13153
+ return applyRiddleProofProfileArtifactCompleteness(profile, result, options.artifacts);
13056
13154
  }
13057
13155
  function summarizeRiddleProofProfileResult(input) {
13058
13156
  const passedChecks = input.checks.filter((check) => check.status === "passed").length;
@@ -19807,12 +19905,14 @@ function buildRiddleProofPrCommentMarkdown(input) {
19807
19905
  appendRunEvent,
19808
19906
  appendStageHeartbeat,
19809
19907
  applyPrLifecycleState,
19908
+ applyRiddleProofProfileArtifactCompleteness,
19810
19909
  applyTerminalMetadata,
19811
19910
  assessBasicGameplayEvidence,
19812
19911
  assessBasicGameplayProgressionCheck,
19813
19912
  assessBasicGameplayProgressionChecks,
19814
19913
  assessBasicGameplayRoute,
19815
19914
  assessPlayabilityEvidence,
19915
+ assessRiddleProofProfileArtifactCompleteness,
19816
19916
  assessRiddleProofProfileEvidence,
19817
19917
  attachBasicGameplayArtifactScreenshotHashes,
19818
19918
  augmentBasicGameplayAssessmentWithProgressionChecks,
package/dist/index.d.cts CHANGED
@@ -10,6 +10,6 @@ export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_D
10
10
  export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.cjs';
11
11
  export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.cjs';
12
12
  export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.cjs';
13
- export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
13
+ export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.cjs';
14
14
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployProgressSnapshot, RiddlePreviewDeployResult, RiddlePreviewDeployStage, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.cjs';
15
15
  export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.cjs';
package/dist/index.d.ts CHANGED
@@ -10,6 +10,6 @@ export { CreateCaptureDiagnosticInput, DEFAULT_DIAGNOSTIC_ARRAY_LIMIT, DEFAULT_D
10
10
  export { BuildVisualProofSessionInput, RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION, RIDDLE_PROOF_VISUAL_SESSION_VERSION, VisualProofSessionMismatch, buildVisualProofSession, compareVisualProofSessionFingerprint, parseVisualProofSession, visualSessionFingerprint, visualSessionFingerprintBasis } from './proof-session.js';
11
11
  export { AssessPlayabilityOptions, RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION, RIDDLE_PROOF_PLAYABILITY_VERSION, RiddleProofPlayabilityAssessment, RiddleProofPlayabilityEvidence, assessPlayabilityEvidence, extractPlayabilityEvidence, isRiddleProofPlayabilityMode } from './playability.js';
12
12
  export { AssessBasicGameplayOptions, AttachBasicGameplayArtifactOptions, BASIC_GAMEPLAY_ACTION_TYPES, BASIC_GAMEPLAY_PROGRESS_CHECK_TYPES, BasicGameplayActionResult, BasicGameplayActionType, BasicGameplayArtifactResolution, BasicGameplayAssessmentSummary, BasicGameplayBoundsOffender, BasicGameplayCanvasState, BasicGameplayCatchRecord, BasicGameplayChangeSummary, BasicGameplayFailureCode, BasicGameplayFixReference, BasicGameplayMetric, BasicGameplayMobileEvidence, BasicGameplayProgressCheckType, BasicGameplayProgressionCheck, BasicGameplayProofArtifact, BasicGameplayResponsiveViewportEvidence, BasicGameplayRouteReference, BasicGameplaySnapshot, BasicGameplaySuiteFailure, BasicGameplayWarningCode, CreateBasicGameplayCatchSummaryInput, RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION, RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION, RiddleProofBasicGameplayAssessment, RiddleProofBasicGameplayCatchSummary, RiddleProofBasicGameplayEvidence, RiddleProofBasicGameplayRouteAssessment, RiddleProofBasicGameplayRouteEvidence, assessBasicGameplayEvidence, assessBasicGameplayProgressionCheck, assessBasicGameplayProgressionChecks, assessBasicGameplayRoute, attachBasicGameplayArtifactScreenshotHashes, augmentBasicGameplayAssessmentWithProgressionChecks, compactBasicGameplayText, createBasicGameplayCatchRecords, createBasicGameplayCatchSummary, extractBasicGameplayEvidence, resolveBasicGameplayProgressionCheckWithArtifactScreenshots, sanitizeBasicGameplayJsonString } from './basic-gameplay.js';
13
- export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
13
+ export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from './profile.js';
14
14
  export { DEFAULT_RIDDLE_API_BASE_URL, DEFAULT_RIDDLE_API_KEY_FILE, RiddleApiError, RiddleApiKeySource, RiddleBalanceResult, RiddleClientConfig, RiddleFetch, RiddlePollJobOptions, RiddlePollJobResult, RiddlePollProgressSnapshot, RiddlePollSummary, RiddlePreviewDeployProgressSnapshot, RiddlePreviewDeployResult, RiddlePreviewDeployStage, RiddlePreviewFramework, RiddleRunScriptInput, RiddleServerPreviewInput, RiddleServerPreviewResult, collectRiddlePreviewDeployWarnings, createRiddleApiClient, deployRiddlePreview, deployRiddleStaticPreview, getRiddleBalance, isTerminalRiddleJobStatus, parseRiddleViewport, pollRiddleJob, resolveRiddleApiKey, resolveRiddleApiKeySource, riddleRequestJson, runRiddleScript, runRiddleServerPreview } from './riddle-client.js';
15
15
  export { RIDDLE_PROOF_PR_COMMENT_MARKER, RiddleProofPrCommentArtifact, RiddleProofPrCommentArtifactKind, RiddleProofPrCommentInput, RiddleProofPrCommentPageSummary, RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment } from './pr-comment.js';
package/dist/index.js CHANGED
@@ -68,6 +68,8 @@ import {
68
68
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
69
69
  RIDDLE_PROOF_PROFILE_STATUSES,
70
70
  RIDDLE_PROOF_PROFILE_VERSION,
71
+ applyRiddleProofProfileArtifactCompleteness,
72
+ assessRiddleProofProfileArtifactCompleteness,
71
73
  assessRiddleProofProfileEvidence,
72
74
  buildRiddleProofProfileScript,
73
75
  collectRiddleProfileArtifactRefs,
@@ -85,7 +87,7 @@ import {
85
87
  resolveRiddleProofProfileTimeoutSec,
86
88
  slugifyRiddleProofProfileName,
87
89
  summarizeRiddleProofProfileResult
88
- } from "./chunk-Z2LCVROU.js";
90
+ } from "./chunk-EX7TO4I5.js";
89
91
  import {
90
92
  DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
91
93
  DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
@@ -184,12 +186,14 @@ export {
184
186
  appendRunEvent,
185
187
  appendStageHeartbeat,
186
188
  applyPrLifecycleState,
189
+ applyRiddleProofProfileArtifactCompleteness,
187
190
  applyTerminalMetadata,
188
191
  assessBasicGameplayEvidence,
189
192
  assessBasicGameplayProgressionCheck,
190
193
  assessBasicGameplayProgressionChecks,
191
194
  assessBasicGameplayRoute,
192
195
  assessPlayabilityEvidence,
196
+ assessRiddleProofProfileArtifactCompleteness,
193
197
  assessRiddleProofProfileEvidence,
194
198
  attachBasicGameplayArtifactScreenshotHashes,
195
199
  augmentBasicGameplayAssessmentWithProgressionChecks,
@@ -27,6 +27,8 @@ __export(profile_exports, {
27
27
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: () => RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
28
28
  RIDDLE_PROOF_PROFILE_STATUSES: () => RIDDLE_PROOF_PROFILE_STATUSES,
29
29
  RIDDLE_PROOF_PROFILE_VERSION: () => RIDDLE_PROOF_PROFILE_VERSION,
30
+ applyRiddleProofProfileArtifactCompleteness: () => applyRiddleProofProfileArtifactCompleteness,
31
+ assessRiddleProofProfileArtifactCompleteness: () => assessRiddleProofProfileArtifactCompleteness,
30
32
  assessRiddleProofProfileEvidence: () => assessRiddleProofProfileEvidence,
31
33
  buildRiddleProofProfileScript: () => buildRiddleProofProfileScript,
32
34
  collectRiddleProfileArtifactRefs: () => collectRiddleProfileArtifactRefs,
@@ -3535,6 +3537,101 @@ function profileStatusFromEvidence(profile, evidence, checks) {
3535
3537
  if (checks.some((check) => check.status === "failed")) return "product_regression";
3536
3538
  return "passed";
3537
3539
  }
3540
+ function assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
3541
+ const required = profileRequiredArtifactKeys(profile, result);
3542
+ const missing = required.filter((key) => !profileArtifactKeyPresent(key, artifacts));
3543
+ return {
3544
+ ok: missing.length === 0,
3545
+ required,
3546
+ observed: artifacts.map((artifact) => profileArtifactObservedLabel(artifact)).filter(Boolean),
3547
+ missing
3548
+ };
3549
+ }
3550
+ function applyRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
3551
+ if (artifacts === void 0) return result;
3552
+ const completeness = assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts);
3553
+ if (result.status !== "passed" || completeness.ok) {
3554
+ return {
3555
+ ...result,
3556
+ artifacts: {
3557
+ ...result.artifacts,
3558
+ riddle_artifacts: artifacts
3559
+ }
3560
+ };
3561
+ }
3562
+ const missing = completeness.missing.join(", ");
3563
+ const message = `Missing required profile artifact(s): ${missing}`;
3564
+ const warnings = [...result.warnings || [], message];
3565
+ return {
3566
+ ...result,
3567
+ status: "proof_insufficient",
3568
+ artifacts: {
3569
+ ...result.artifacts,
3570
+ riddle_artifacts: artifacts
3571
+ },
3572
+ summary: `${profile.name} did not produce required profile artifact(s): ${missing}.`,
3573
+ warnings,
3574
+ error: message
3575
+ };
3576
+ }
3577
+ function profileRequiredArtifactKeys(profile, result) {
3578
+ const keys = [];
3579
+ for (const artifact of profile.artifacts || []) {
3580
+ const role = normalizeProfileArtifactRole(artifact);
3581
+ if (!role) continue;
3582
+ if (role === "screenshot") {
3583
+ const screenshots = result.artifacts.screenshots || [];
3584
+ if (screenshots.length) {
3585
+ keys.push(...screenshots.map((label) => `screenshot:${label}`));
3586
+ } else {
3587
+ keys.push("screenshot");
3588
+ }
3589
+ continue;
3590
+ }
3591
+ keys.push(role);
3592
+ }
3593
+ return uniqueNonEmptyStrings(keys);
3594
+ }
3595
+ function normalizeProfileArtifactRole(input) {
3596
+ const normalized = input.trim().toLowerCase().replace(/[\s-]+/g, "_");
3597
+ if (!normalized) return "";
3598
+ if (normalized === "screenshots") return "screenshot";
3599
+ if (normalized === "console" || normalized === "console_json" || normalized === "console.json") return "console.json";
3600
+ if (normalized === "dom_summary" || normalized === "dom_summary_json" || normalized === "dom-summary.json") return "dom-summary.json";
3601
+ if (normalized === "proof" || normalized === "proof_json" || normalized === "proof.json") return "proof.json";
3602
+ return normalizeRiddleProfileArtifactName(input.trim()).toLowerCase();
3603
+ }
3604
+ function profileArtifactKeyPresent(key, artifacts) {
3605
+ if (key.startsWith("screenshot:")) {
3606
+ const label = key.slice("screenshot:".length);
3607
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact) && profileArtifactRefText(artifact).includes(label.toLowerCase()));
3608
+ }
3609
+ if (key === "screenshot") {
3610
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact));
3611
+ }
3612
+ return artifacts.some((artifact) => {
3613
+ const name = normalizeRiddleProfileArtifactName(artifact.name || artifactNameFromPath(artifact.url || artifact.path) || "").toLowerCase();
3614
+ return name === key || profileArtifactRefText(artifact).includes(key);
3615
+ });
3616
+ }
3617
+ function profileArtifactRefIsScreenshot(artifact) {
3618
+ const kind = (artifact.kind || "").toLowerCase();
3619
+ const contentType = (artifact.content_type || "").toLowerCase();
3620
+ const text = profileArtifactRefText(artifact);
3621
+ return kind === "screenshot" || contentType.startsWith("image/") || /\.(png|jpe?g|webp)(?:$|[?#])/i.test(text) || /\.(png|jpe?g|webp)$/i.test(text);
3622
+ }
3623
+ function profileArtifactRefText(artifact) {
3624
+ return [
3625
+ artifact.name,
3626
+ artifact.url,
3627
+ artifact.path,
3628
+ artifact.kind,
3629
+ artifact.content_type
3630
+ ].filter(Boolean).join(" ").toLowerCase();
3631
+ }
3632
+ function profileArtifactObservedLabel(artifact) {
3633
+ return artifact.name || artifact.url || artifact.path || artifact.kind || "";
3634
+ }
3538
3635
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3539
3636
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
3540
3637
  const warnings = collectRiddleProofProfileWarnings(profile);
@@ -3546,7 +3643,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3546
3643
  const status = profileStatusFromEvidence(profile, evidence, checks);
3547
3644
  const firstViewport = evidence?.viewports?.[0];
3548
3645
  const screenshots = profileScreenshotLabels(evidence?.viewports);
3549
- return {
3646
+ const result = {
3550
3647
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
3551
3648
  profile_name: profile.name,
3552
3649
  runner: options.runner || "riddle",
@@ -3568,6 +3665,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3568
3665
  evidence,
3569
3666
  riddle: options.riddle
3570
3667
  };
3668
+ return applyRiddleProofProfileArtifactCompleteness(profile, result, options.artifacts);
3571
3669
  }
3572
3670
  function summarizeRiddleProofProfileResult(input) {
3573
3671
  const passedChecks = input.checks.filter((check) => check.status === "passed").length;
@@ -9509,6 +9607,8 @@ function extractRiddleProofProfileResult(input) {
9509
9607
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
9510
9608
  RIDDLE_PROOF_PROFILE_STATUSES,
9511
9609
  RIDDLE_PROOF_PROFILE_VERSION,
9610
+ applyRiddleProofProfileArtifactCompleteness,
9611
+ assessRiddleProofProfileArtifactCompleteness,
9512
9612
  assessRiddleProofProfileEvidence,
9513
9613
  buildRiddleProofProfileScript,
9514
9614
  collectRiddleProfileArtifactRefs,
@@ -1,2 +1,2 @@
1
- export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.cjs';
1
+ export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.cjs';
2
2
  import '../types.cjs';
@@ -1,2 +1,2 @@
1
- export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileArtifactRef, RiddleProofProfileBaselinePolicy, RiddleProofProfileBoundsOffender, RiddleProofProfileCheck, RiddleProofProfileCheckResult, RiddleProofProfileCheckType, RiddleProofProfileEvidence, RiddleProofProfileFailureAction, RiddleProofProfileHttpStatusBodyJsonAssertion, RiddleProofProfileHttpStatusBodyJsonAssertionResult, RiddleProofProfileHttpStatusPreflightCheckResult, RiddleProofProfileHttpStatusPreflightFetch, RiddleProofProfileHttpStatusPreflightFetchResponse, RiddleProofProfileHttpStatusPreflightOptions, RiddleProofProfileHttpStatusPreflightResult, RiddleProofProfileJsonValueType, RiddleProofProfileNetworkAbortErrorCode, RiddleProofProfileNetworkMock, RiddleProofProfileNetworkMockResponse, RiddleProofProfileResult, RiddleProofProfileReturnSummaryField, RiddleProofProfileRouteEvidence, RiddleProofProfileRouteInventoryRoute, RiddleProofProfileRunner, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.js';
1
+ export { NormalizeRiddleProofProfileOptions, 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, RiddleProofProfileSetupAction, RiddleProofProfileSetupActionType, RiddleProofProfileStatus, RiddleProofProfileTarget, RiddleProofProfileViewport, RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult } from '../profile.js';
2
2
  import '../types.js';
@@ -6,6 +6,8 @@ import {
6
6
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
7
7
  RIDDLE_PROOF_PROFILE_STATUSES,
8
8
  RIDDLE_PROOF_PROFILE_VERSION,
9
+ applyRiddleProofProfileArtifactCompleteness,
10
+ assessRiddleProofProfileArtifactCompleteness,
9
11
  assessRiddleProofProfileEvidence,
10
12
  buildRiddleProofProfileScript,
11
13
  collectRiddleProfileArtifactRefs,
@@ -23,7 +25,7 @@ import {
23
25
  resolveRiddleProofProfileTimeoutSec,
24
26
  slugifyRiddleProofProfileName,
25
27
  summarizeRiddleProofProfileResult
26
- } from "../chunk-Z2LCVROU.js";
28
+ } from "../chunk-EX7TO4I5.js";
27
29
  import "../chunk-MLKGABMK.js";
28
30
  export {
29
31
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
@@ -33,6 +35,8 @@ export {
33
35
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
34
36
  RIDDLE_PROOF_PROFILE_STATUSES,
35
37
  RIDDLE_PROOF_PROFILE_VERSION,
38
+ applyRiddleProofProfileArtifactCompleteness,
39
+ assessRiddleProofProfileArtifactCompleteness,
36
40
  assessRiddleProofProfileEvidence,
37
41
  buildRiddleProofProfileScript,
38
42
  collectRiddleProfileArtifactRefs,
package/dist/profile.cjs CHANGED
@@ -27,6 +27,8 @@ __export(profile_exports, {
27
27
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES: () => RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
28
28
  RIDDLE_PROOF_PROFILE_STATUSES: () => RIDDLE_PROOF_PROFILE_STATUSES,
29
29
  RIDDLE_PROOF_PROFILE_VERSION: () => RIDDLE_PROOF_PROFILE_VERSION,
30
+ applyRiddleProofProfileArtifactCompleteness: () => applyRiddleProofProfileArtifactCompleteness,
31
+ assessRiddleProofProfileArtifactCompleteness: () => assessRiddleProofProfileArtifactCompleteness,
30
32
  assessRiddleProofProfileEvidence: () => assessRiddleProofProfileEvidence,
31
33
  buildRiddleProofProfileScript: () => buildRiddleProofProfileScript,
32
34
  collectRiddleProfileArtifactRefs: () => collectRiddleProfileArtifactRefs,
@@ -3533,6 +3535,101 @@ function profileStatusFromEvidence(profile, evidence, checks) {
3533
3535
  if (checks.some((check) => check.status === "failed")) return "product_regression";
3534
3536
  return "passed";
3535
3537
  }
3538
+ function assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
3539
+ const required = profileRequiredArtifactKeys(profile, result);
3540
+ const missing = required.filter((key) => !profileArtifactKeyPresent(key, artifacts));
3541
+ return {
3542
+ ok: missing.length === 0,
3543
+ required,
3544
+ observed: artifacts.map((artifact) => profileArtifactObservedLabel(artifact)).filter(Boolean),
3545
+ missing
3546
+ };
3547
+ }
3548
+ function applyRiddleProofProfileArtifactCompleteness(profile, result, artifacts) {
3549
+ if (artifacts === void 0) return result;
3550
+ const completeness = assessRiddleProofProfileArtifactCompleteness(profile, result, artifacts);
3551
+ if (result.status !== "passed" || completeness.ok) {
3552
+ return {
3553
+ ...result,
3554
+ artifacts: {
3555
+ ...result.artifacts,
3556
+ riddle_artifacts: artifacts
3557
+ }
3558
+ };
3559
+ }
3560
+ const missing = completeness.missing.join(", ");
3561
+ const message = `Missing required profile artifact(s): ${missing}`;
3562
+ const warnings = [...result.warnings || [], message];
3563
+ return {
3564
+ ...result,
3565
+ status: "proof_insufficient",
3566
+ artifacts: {
3567
+ ...result.artifacts,
3568
+ riddle_artifacts: artifacts
3569
+ },
3570
+ summary: `${profile.name} did not produce required profile artifact(s): ${missing}.`,
3571
+ warnings,
3572
+ error: message
3573
+ };
3574
+ }
3575
+ function profileRequiredArtifactKeys(profile, result) {
3576
+ const keys = [];
3577
+ for (const artifact of profile.artifacts || []) {
3578
+ const role = normalizeProfileArtifactRole(artifact);
3579
+ if (!role) continue;
3580
+ if (role === "screenshot") {
3581
+ const screenshots = result.artifacts.screenshots || [];
3582
+ if (screenshots.length) {
3583
+ keys.push(...screenshots.map((label) => `screenshot:${label}`));
3584
+ } else {
3585
+ keys.push("screenshot");
3586
+ }
3587
+ continue;
3588
+ }
3589
+ keys.push(role);
3590
+ }
3591
+ return uniqueNonEmptyStrings(keys);
3592
+ }
3593
+ function normalizeProfileArtifactRole(input) {
3594
+ const normalized = input.trim().toLowerCase().replace(/[\s-]+/g, "_");
3595
+ if (!normalized) return "";
3596
+ if (normalized === "screenshots") return "screenshot";
3597
+ if (normalized === "console" || normalized === "console_json" || normalized === "console.json") return "console.json";
3598
+ if (normalized === "dom_summary" || normalized === "dom_summary_json" || normalized === "dom-summary.json") return "dom-summary.json";
3599
+ if (normalized === "proof" || normalized === "proof_json" || normalized === "proof.json") return "proof.json";
3600
+ return normalizeRiddleProfileArtifactName(input.trim()).toLowerCase();
3601
+ }
3602
+ function profileArtifactKeyPresent(key, artifacts) {
3603
+ if (key.startsWith("screenshot:")) {
3604
+ const label = key.slice("screenshot:".length);
3605
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact) && profileArtifactRefText(artifact).includes(label.toLowerCase()));
3606
+ }
3607
+ if (key === "screenshot") {
3608
+ return artifacts.some((artifact) => profileArtifactRefIsScreenshot(artifact));
3609
+ }
3610
+ return artifacts.some((artifact) => {
3611
+ const name = normalizeRiddleProfileArtifactName(artifact.name || artifactNameFromPath(artifact.url || artifact.path) || "").toLowerCase();
3612
+ return name === key || profileArtifactRefText(artifact).includes(key);
3613
+ });
3614
+ }
3615
+ function profileArtifactRefIsScreenshot(artifact) {
3616
+ const kind = (artifact.kind || "").toLowerCase();
3617
+ const contentType = (artifact.content_type || "").toLowerCase();
3618
+ const text = profileArtifactRefText(artifact);
3619
+ return kind === "screenshot" || contentType.startsWith("image/") || /\.(png|jpe?g|webp)(?:$|[?#])/i.test(text) || /\.(png|jpe?g|webp)$/i.test(text);
3620
+ }
3621
+ function profileArtifactRefText(artifact) {
3622
+ return [
3623
+ artifact.name,
3624
+ artifact.url,
3625
+ artifact.path,
3626
+ artifact.kind,
3627
+ artifact.content_type
3628
+ ].filter(Boolean).join(" ").toLowerCase();
3629
+ }
3630
+ function profileArtifactObservedLabel(artifact) {
3631
+ return artifact.name || artifact.url || artifact.path || artifact.kind || "";
3632
+ }
3536
3633
  function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3537
3634
  const capturedAt = evidence?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
3538
3635
  const warnings = collectRiddleProofProfileWarnings(profile);
@@ -3544,7 +3641,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3544
3641
  const status = profileStatusFromEvidence(profile, evidence, checks);
3545
3642
  const firstViewport = evidence?.viewports?.[0];
3546
3643
  const screenshots = profileScreenshotLabels(evidence?.viewports);
3547
- return {
3644
+ const result = {
3548
3645
  version: RIDDLE_PROOF_PROFILE_RESULT_VERSION,
3549
3646
  profile_name: profile.name,
3550
3647
  runner: options.runner || "riddle",
@@ -3566,6 +3663,7 @@ function assessRiddleProofProfileEvidence(profile, evidence, options = {}) {
3566
3663
  evidence,
3567
3664
  riddle: options.riddle
3568
3665
  };
3666
+ return applyRiddleProofProfileArtifactCompleteness(profile, result, options.artifacts);
3569
3667
  }
3570
3668
  function summarizeRiddleProofProfileResult(input) {
3571
3669
  const passedChecks = input.checks.filter((check) => check.status === "passed").length;
@@ -9507,6 +9605,8 @@ function extractRiddleProofProfileResult(input) {
9507
9605
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
9508
9606
  RIDDLE_PROOF_PROFILE_STATUSES,
9509
9607
  RIDDLE_PROOF_PROFILE_VERSION,
9608
+ applyRiddleProofProfileArtifactCompleteness,
9609
+ assessRiddleProofProfileArtifactCompleteness,
9510
9610
  assessRiddleProofProfileEvidence,
9511
9611
  buildRiddleProofProfileScript,
9512
9612
  collectRiddleProfileArtifactRefs,
@@ -452,6 +452,14 @@ declare function resolveRiddleProofProfileTargetUrl(profile: RiddleProofProfile)
452
452
  declare function resolveRiddleProofProfileTimeoutSec(profile: RiddleProofProfile, requestedTimeoutSec?: number): number | undefined;
453
453
  declare function preflightRiddleProofProfileHttpStatusChecks(profile: RiddleProofProfile, options?: RiddleProofProfileHttpStatusPreflightOptions): Promise<RiddleProofProfileHttpStatusPreflightResult>;
454
454
  declare function resolveRiddleProofProfileRouteUrl(targetUrl: string, route: string): string;
455
+ interface RiddleProofProfileArtifactCompleteness {
456
+ ok: boolean;
457
+ required: string[];
458
+ observed: string[];
459
+ missing: string[];
460
+ }
461
+ declare function assessRiddleProofProfileArtifactCompleteness(profile: RiddleProofProfile, result: RiddleProofProfileResult, artifacts: RiddleProofProfileArtifactRef[]): RiddleProofProfileArtifactCompleteness;
462
+ declare function applyRiddleProofProfileArtifactCompleteness(profile: RiddleProofProfile, result: RiddleProofProfileResult, artifacts: RiddleProofProfileArtifactRef[] | undefined): RiddleProofProfileResult;
455
463
  declare function assessRiddleProofProfileEvidence(profile: RiddleProofProfile, evidence: RiddleProofProfileEvidence | undefined, options?: {
456
464
  runner?: RiddleProofProfileRunner;
457
465
  riddle?: RiddleProofProfileResult["riddle"];
@@ -484,4 +492,4 @@ declare function buildRiddleProofProfileScript(profile: RiddleProofProfile): str
484
492
  declare function collectRiddleProfileArtifactRefs(input: unknown): RiddleProofProfileArtifactRef[];
485
493
  declare function extractRiddleProofProfileResult(input: unknown): RiddleProofProfileResult | undefined;
486
494
 
487
- export { type NormalizeRiddleProofProfileOptions, 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, type RiddleProofArtifactBodyAssertionInput, type RiddleProofArtifactBodyAssertionResult, type RiddleProofProfile, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileHttpStatusBodyJsonAssertion, type RiddleProofProfileHttpStatusBodyJsonAssertionResult, type RiddleProofProfileHttpStatusPreflightCheckResult, type RiddleProofProfileHttpStatusPreflightFetch, type RiddleProofProfileHttpStatusPreflightFetchResponse, type RiddleProofProfileHttpStatusPreflightOptions, type RiddleProofProfileHttpStatusPreflightResult, type RiddleProofProfileJsonValueType, type RiddleProofProfileNetworkAbortErrorCode, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileReturnSummaryField, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
495
+ export { type NormalizeRiddleProofProfileOptions, 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, type RiddleProofArtifactBodyAssertionInput, type RiddleProofArtifactBodyAssertionResult, type RiddleProofProfile, type RiddleProofProfileArtifactCompleteness, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileHttpStatusBodyJsonAssertion, type RiddleProofProfileHttpStatusBodyJsonAssertionResult, type RiddleProofProfileHttpStatusPreflightCheckResult, type RiddleProofProfileHttpStatusPreflightFetch, type RiddleProofProfileHttpStatusPreflightFetchResponse, type RiddleProofProfileHttpStatusPreflightOptions, type RiddleProofProfileHttpStatusPreflightResult, type RiddleProofProfileJsonValueType, type RiddleProofProfileNetworkAbortErrorCode, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileReturnSummaryField, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
package/dist/profile.d.ts CHANGED
@@ -452,6 +452,14 @@ declare function resolveRiddleProofProfileTargetUrl(profile: RiddleProofProfile)
452
452
  declare function resolveRiddleProofProfileTimeoutSec(profile: RiddleProofProfile, requestedTimeoutSec?: number): number | undefined;
453
453
  declare function preflightRiddleProofProfileHttpStatusChecks(profile: RiddleProofProfile, options?: RiddleProofProfileHttpStatusPreflightOptions): Promise<RiddleProofProfileHttpStatusPreflightResult>;
454
454
  declare function resolveRiddleProofProfileRouteUrl(targetUrl: string, route: string): string;
455
+ interface RiddleProofProfileArtifactCompleteness {
456
+ ok: boolean;
457
+ required: string[];
458
+ observed: string[];
459
+ missing: string[];
460
+ }
461
+ declare function assessRiddleProofProfileArtifactCompleteness(profile: RiddleProofProfile, result: RiddleProofProfileResult, artifacts: RiddleProofProfileArtifactRef[]): RiddleProofProfileArtifactCompleteness;
462
+ declare function applyRiddleProofProfileArtifactCompleteness(profile: RiddleProofProfile, result: RiddleProofProfileResult, artifacts: RiddleProofProfileArtifactRef[] | undefined): RiddleProofProfileResult;
455
463
  declare function assessRiddleProofProfileEvidence(profile: RiddleProofProfile, evidence: RiddleProofProfileEvidence | undefined, options?: {
456
464
  runner?: RiddleProofProfileRunner;
457
465
  riddle?: RiddleProofProfileResult["riddle"];
@@ -484,4 +492,4 @@ declare function buildRiddleProofProfileScript(profile: RiddleProofProfile): str
484
492
  declare function collectRiddleProfileArtifactRefs(input: unknown): RiddleProofProfileArtifactRef[];
485
493
  declare function extractRiddleProofProfileResult(input: unknown): RiddleProofProfileResult | undefined;
486
494
 
487
- export { type NormalizeRiddleProofProfileOptions, 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, type RiddleProofArtifactBodyAssertionInput, type RiddleProofArtifactBodyAssertionResult, type RiddleProofProfile, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileHttpStatusBodyJsonAssertion, type RiddleProofProfileHttpStatusBodyJsonAssertionResult, type RiddleProofProfileHttpStatusPreflightCheckResult, type RiddleProofProfileHttpStatusPreflightFetch, type RiddleProofProfileHttpStatusPreflightFetchResponse, type RiddleProofProfileHttpStatusPreflightOptions, type RiddleProofProfileHttpStatusPreflightResult, type RiddleProofProfileJsonValueType, type RiddleProofProfileNetworkAbortErrorCode, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileReturnSummaryField, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
495
+ export { type NormalizeRiddleProofProfileOptions, 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, type RiddleProofArtifactBodyAssertionInput, type RiddleProofArtifactBodyAssertionResult, type RiddleProofProfile, type RiddleProofProfileArtifactCompleteness, type RiddleProofProfileArtifactRef, type RiddleProofProfileBaselinePolicy, type RiddleProofProfileBoundsOffender, type RiddleProofProfileCheck, type RiddleProofProfileCheckResult, type RiddleProofProfileCheckType, type RiddleProofProfileEvidence, type RiddleProofProfileFailureAction, type RiddleProofProfileHttpStatusBodyJsonAssertion, type RiddleProofProfileHttpStatusBodyJsonAssertionResult, type RiddleProofProfileHttpStatusPreflightCheckResult, type RiddleProofProfileHttpStatusPreflightFetch, type RiddleProofProfileHttpStatusPreflightFetchResponse, type RiddleProofProfileHttpStatusPreflightOptions, type RiddleProofProfileHttpStatusPreflightResult, type RiddleProofProfileJsonValueType, type RiddleProofProfileNetworkAbortErrorCode, type RiddleProofProfileNetworkMock, type RiddleProofProfileNetworkMockResponse, type RiddleProofProfileResult, type RiddleProofProfileReturnSummaryField, type RiddleProofProfileRouteEvidence, type RiddleProofProfileRouteInventoryRoute, type RiddleProofProfileRunner, type RiddleProofProfileSetupAction, type RiddleProofProfileSetupActionType, type RiddleProofProfileStatus, type RiddleProofProfileTarget, type RiddleProofProfileViewport, type RiddleProofProfileViewportEvidence, applyRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileArtifactCompleteness, assessRiddleProofProfileEvidence, buildRiddleProofProfileScript, collectRiddleProfileArtifactRefs, collectRiddleProofProfileWarnings, createRiddleProofProfileConfigurationError, createRiddleProofProfileEnvironmentBlockedResult, createRiddleProofProfileInsufficientResult, deriveRiddleProofArtifactBodyAssertions, extractRiddleProofProfileResult, normalizeRiddleProofProfile, preflightRiddleProofProfileHttpStatusChecks, profileStatusExitCode, resolveRiddleProofProfileRouteUrl, resolveRiddleProofProfileTargetUrl, resolveRiddleProofProfileTimeoutSec, slugifyRiddleProofProfileName, summarizeRiddleProofProfileResult };
package/dist/profile.js CHANGED
@@ -6,6 +6,8 @@ import {
6
6
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
7
7
  RIDDLE_PROOF_PROFILE_STATUSES,
8
8
  RIDDLE_PROOF_PROFILE_VERSION,
9
+ applyRiddleProofProfileArtifactCompleteness,
10
+ assessRiddleProofProfileArtifactCompleteness,
9
11
  assessRiddleProofProfileEvidence,
10
12
  buildRiddleProofProfileScript,
11
13
  collectRiddleProfileArtifactRefs,
@@ -23,7 +25,7 @@ import {
23
25
  resolveRiddleProofProfileTimeoutSec,
24
26
  slugifyRiddleProofProfileName,
25
27
  summarizeRiddleProofProfileResult
26
- } from "./chunk-Z2LCVROU.js";
28
+ } from "./chunk-EX7TO4I5.js";
27
29
  import "./chunk-MLKGABMK.js";
28
30
  export {
29
31
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
@@ -33,6 +35,8 @@ export {
33
35
  RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES,
34
36
  RIDDLE_PROOF_PROFILE_STATUSES,
35
37
  RIDDLE_PROOF_PROFILE_VERSION,
38
+ applyRiddleProofProfileArtifactCompleteness,
39
+ assessRiddleProofProfileArtifactCompleteness,
36
40
  assessRiddleProofProfileEvidence,
37
41
  buildRiddleProofProfileScript,
38
42
  collectRiddleProfileArtifactRefs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.8.43",
3
+ "version": "0.8.45",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",