@riddledc/riddle-proof 0.7.193 → 0.7.194

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
@@ -16529,6 +16529,17 @@ function compactProfileReceiptReason(value, limit = 180) {
16529
16529
  if (!text) return void 0;
16530
16530
  return text.length <= limit ? text : `${text.slice(0, Math.max(0, limit - 3)).trimEnd()}...`;
16531
16531
  }
16532
+ function profileCleanupInventoryHaystack(receipt) {
16533
+ const returnStoredTo = cliString(receipt.return_stored_to) || "";
16534
+ const reason = cliString(receipt.reason) || "";
16535
+ const error = cliString(receipt.error) || "";
16536
+ const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
16537
+ return `${returnStoredTo} ${reason} ${error} ${summary}`.toLowerCase();
16538
+ }
16539
+ function profileIsCleanupInventoryReceipt(receipt) {
16540
+ const haystack = profileCleanupInventoryHaystack(receipt);
16541
+ return haystack.includes("cleanup") || haystack.includes("post-cleanup") || haystack.includes("stale") || haystack.includes("statehygiene") || haystack.includes("state hygiene") || haystack.includes("remained after") || haystack.includes("still present");
16542
+ }
16532
16543
  function profileFailedCleanupInventoryReason(setupViewports) {
16533
16544
  const receipts = setupViewports.flatMap((viewport) => [
16534
16545
  ...setupReceiptArray(viewport, "window_eval"),
@@ -16536,17 +16547,28 @@ function profileFailedCleanupInventoryReason(setupViewports) {
16536
16547
  ]);
16537
16548
  for (const receipt of receipts) {
16538
16549
  if (receipt.ok !== false) continue;
16539
- const returnStoredTo = cliString(receipt.return_stored_to) || "";
16540
- const reason = cliString(receipt.reason) || "";
16541
- const error = cliString(receipt.error) || "";
16542
- const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
16543
- const haystack = `${returnStoredTo} ${reason} ${error} ${summary}`.toLowerCase();
16544
- const isCleanupReceipt = haystack.includes("cleanup") || haystack.includes("post-cleanup") || haystack.includes("stale") || haystack.includes("statehygiene") || haystack.includes("state hygiene") || haystack.includes("remained after") || haystack.includes("still present");
16545
- if (!isCleanupReceipt) continue;
16550
+ if (!profileIsCleanupInventoryReceipt(receipt)) continue;
16551
+ const error = cliString(receipt.error);
16552
+ const reason = cliString(receipt.reason);
16546
16553
  return compactProfileReceiptReason(error) || compactProfileReceiptReason(reason) || "cleanup inventory failed";
16547
16554
  }
16548
16555
  return void 0;
16549
16556
  }
16557
+ function profilePassedCleanupInventoryReason(setupViewports) {
16558
+ const receipts = setupViewports.flatMap((viewport) => [
16559
+ ...setupReceiptArray(viewport, "window_eval"),
16560
+ ...setupReceiptArray(viewport, "window_call")
16561
+ ]);
16562
+ for (const receipt of receipts) {
16563
+ if (receipt.ok === false || !profileIsCleanupInventoryReceipt(receipt)) continue;
16564
+ if (setupReturnSummaryValue(receipt, ["ok"]) === false) continue;
16565
+ const staleCount = cliFiniteNumber(setupReturnSummaryValue(receipt, ["staleCount"]));
16566
+ const staleNames = setupReturnSummaryValue(receipt, ["staleNames"]);
16567
+ if (staleCount !== 0 || !Array.isArray(staleNames) || staleNames.length !== 0) continue;
16568
+ return "staleCount=0, staleNames=[]";
16569
+ }
16570
+ return void 0;
16571
+ }
16550
16572
  function profileHasRouteExitAffordanceReceipt(receipts) {
16551
16573
  const affordanceFields = [
16552
16574
  "navVisibleBeforeExit",
@@ -16740,6 +16762,7 @@ function profilePackReceiptStatus(result, metadata, receipt) {
16740
16762
  const hasRouteContinuationReceipt = profileHasRouteContinuationReceipt(valueReceipts);
16741
16763
  const hasRecoveredStateReceipt = profileHasRecoveredStateReceipt(valueReceipts);
16742
16764
  const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
16765
+ const passedCleanupInventoryReason = profilePassedCleanupInventoryReason(setupViewports);
16743
16766
  if (text.includes("artifact link") || text.includes("artifact path")) {
16744
16767
  return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
16745
16768
  }
@@ -16765,9 +16788,13 @@ function profilePackReceiptStatus(result, metadata, receipt) {
16765
16788
  return profileReceiptSignalStatus(hasStateContract, "state contract metadata or receipts present", "state contract evidence missing");
16766
16789
  }
16767
16790
  if (text.includes("stale") || text.includes("absence")) {
16768
- if (failedCleanupInventoryReason && (text.includes("cleanup") || text.includes("post-cleanup") || text.includes("stale-state") || text.includes("stale state"))) {
16791
+ const expectsCleanupInventory = text.includes("cleanup") || text.includes("post-cleanup") || text.includes("stale-state") || text.includes("stale state") || text.includes("inventory");
16792
+ if (failedCleanupInventoryReason && expectsCleanupInventory) {
16769
16793
  return { status: "failed", reason: `cleanup inventory failed: ${failedCleanupInventoryReason}` };
16770
16794
  }
16795
+ if (passedCleanupInventoryReason && expectsCleanupInventory) {
16796
+ return { status: "present", reason: `cleanup inventory passed: ${passedCleanupInventoryReason}` };
16797
+ }
16771
16798
  return profileReceiptSignalStatus(hasTextAbsence, "absence check passed", "absence check missing");
16772
16799
  }
16773
16800
  if (text.includes("recovered") || text.includes("final state")) {
package/dist/cli.js CHANGED
@@ -621,6 +621,17 @@ function compactProfileReceiptReason(value, limit = 180) {
621
621
  if (!text) return void 0;
622
622
  return text.length <= limit ? text : `${text.slice(0, Math.max(0, limit - 3)).trimEnd()}...`;
623
623
  }
624
+ function profileCleanupInventoryHaystack(receipt) {
625
+ const returnStoredTo = cliString(receipt.return_stored_to) || "";
626
+ const reason = cliString(receipt.reason) || "";
627
+ const error = cliString(receipt.error) || "";
628
+ const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
629
+ return `${returnStoredTo} ${reason} ${error} ${summary}`.toLowerCase();
630
+ }
631
+ function profileIsCleanupInventoryReceipt(receipt) {
632
+ const haystack = profileCleanupInventoryHaystack(receipt);
633
+ return haystack.includes("cleanup") || haystack.includes("post-cleanup") || haystack.includes("stale") || haystack.includes("statehygiene") || haystack.includes("state hygiene") || haystack.includes("remained after") || haystack.includes("still present");
634
+ }
624
635
  function profileFailedCleanupInventoryReason(setupViewports) {
625
636
  const receipts = setupViewports.flatMap((viewport) => [
626
637
  ...setupReceiptArray(viewport, "window_eval"),
@@ -628,17 +639,28 @@ function profileFailedCleanupInventoryReason(setupViewports) {
628
639
  ]);
629
640
  for (const receipt of receipts) {
630
641
  if (receipt.ok !== false) continue;
631
- const returnStoredTo = cliString(receipt.return_stored_to) || "";
632
- const reason = cliString(receipt.reason) || "";
633
- const error = cliString(receipt.error) || "";
634
- const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
635
- const haystack = `${returnStoredTo} ${reason} ${error} ${summary}`.toLowerCase();
636
- const isCleanupReceipt = haystack.includes("cleanup") || haystack.includes("post-cleanup") || haystack.includes("stale") || haystack.includes("statehygiene") || haystack.includes("state hygiene") || haystack.includes("remained after") || haystack.includes("still present");
637
- if (!isCleanupReceipt) continue;
642
+ if (!profileIsCleanupInventoryReceipt(receipt)) continue;
643
+ const error = cliString(receipt.error);
644
+ const reason = cliString(receipt.reason);
638
645
  return compactProfileReceiptReason(error) || compactProfileReceiptReason(reason) || "cleanup inventory failed";
639
646
  }
640
647
  return void 0;
641
648
  }
649
+ function profilePassedCleanupInventoryReason(setupViewports) {
650
+ const receipts = setupViewports.flatMap((viewport) => [
651
+ ...setupReceiptArray(viewport, "window_eval"),
652
+ ...setupReceiptArray(viewport, "window_call")
653
+ ]);
654
+ for (const receipt of receipts) {
655
+ if (receipt.ok === false || !profileIsCleanupInventoryReceipt(receipt)) continue;
656
+ if (setupReturnSummaryValue(receipt, ["ok"]) === false) continue;
657
+ const staleCount = cliFiniteNumber(setupReturnSummaryValue(receipt, ["staleCount"]));
658
+ const staleNames = setupReturnSummaryValue(receipt, ["staleNames"]);
659
+ if (staleCount !== 0 || !Array.isArray(staleNames) || staleNames.length !== 0) continue;
660
+ return "staleCount=0, staleNames=[]";
661
+ }
662
+ return void 0;
663
+ }
642
664
  function profileHasRouteExitAffordanceReceipt(receipts) {
643
665
  const affordanceFields = [
644
666
  "navVisibleBeforeExit",
@@ -832,6 +854,7 @@ function profilePackReceiptStatus(result, metadata, receipt) {
832
854
  const hasRouteContinuationReceipt = profileHasRouteContinuationReceipt(valueReceipts);
833
855
  const hasRecoveredStateReceipt = profileHasRecoveredStateReceipt(valueReceipts);
834
856
  const failedCleanupInventoryReason = profileFailedCleanupInventoryReason(setupViewports);
857
+ const passedCleanupInventoryReason = profilePassedCleanupInventoryReason(setupViewports);
835
858
  if (text.includes("artifact link") || text.includes("artifact path")) {
836
859
  return profileReceiptSignalStatus(profileResultHasArtifact(result), "artifact references listed", "no artifact references found");
837
860
  }
@@ -857,9 +880,13 @@ function profilePackReceiptStatus(result, metadata, receipt) {
857
880
  return profileReceiptSignalStatus(hasStateContract, "state contract metadata or receipts present", "state contract evidence missing");
858
881
  }
859
882
  if (text.includes("stale") || text.includes("absence")) {
860
- if (failedCleanupInventoryReason && (text.includes("cleanup") || text.includes("post-cleanup") || text.includes("stale-state") || text.includes("stale state"))) {
883
+ const expectsCleanupInventory = text.includes("cleanup") || text.includes("post-cleanup") || text.includes("stale-state") || text.includes("stale state") || text.includes("inventory");
884
+ if (failedCleanupInventoryReason && expectsCleanupInventory) {
861
885
  return { status: "failed", reason: `cleanup inventory failed: ${failedCleanupInventoryReason}` };
862
886
  }
887
+ if (passedCleanupInventoryReason && expectsCleanupInventory) {
888
+ return { status: "present", reason: `cleanup inventory passed: ${passedCleanupInventoryReason}` };
889
+ }
863
890
  return profileReceiptSignalStatus(hasTextAbsence, "absence check passed", "absence check missing");
864
891
  }
865
892
  if (text.includes("recovered") || text.includes("final state")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.193",
3
+ "version": "0.7.194",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",