@riddledc/riddle-proof 0.7.219 → 0.7.220

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.
Files changed (3) hide show
  1. package/dist/cli.cjs +135 -0
  2. package/dist/cli.js +135 -0
  3. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -17475,6 +17475,137 @@ function profileHasGeneratedOutputReceipt(receipts) {
17475
17475
  }
17476
17476
  return outputReady && outputChanged;
17477
17477
  }
17478
+ function profileSemanticReceiptPassed(receipt) {
17479
+ if (receipt.ok === false) return false;
17480
+ return setupReturnSummaryValue(receipt, ["ok", "success", "passed", "completed", "valid"]) === true;
17481
+ }
17482
+ function profileSemanticArrayEvidence(value) {
17483
+ if (Array.isArray(value)) return value.length > 0;
17484
+ const text = cliString(value);
17485
+ return Boolean(text && text.trim());
17486
+ }
17487
+ function profileSemanticTruthyField(receipt, names) {
17488
+ return names.some((name) => setupReturnSummaryValue(receipt, [name]) === true);
17489
+ }
17490
+ function profileHasBoardEvidence(receipt) {
17491
+ return [
17492
+ "board",
17493
+ "beforeBoard",
17494
+ "afterBoard",
17495
+ "cells",
17496
+ "grid",
17497
+ "state"
17498
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
17499
+ }
17500
+ function profileHasTurnEvidence(receipt) {
17501
+ return [
17502
+ "activeX",
17503
+ "activeO",
17504
+ "turn",
17505
+ "currentTurn",
17506
+ "nextTurn",
17507
+ "currentPlayer",
17508
+ "nextPlayer",
17509
+ "isXNext"
17510
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
17511
+ }
17512
+ function profileSemanticInvalidStateReason(receipts, text) {
17513
+ const asksInvalidOrBlocked = text.includes("invalid") || text.includes("blocked") || text.includes("occupied") || text.includes("replay") || text.includes("ignored") || text.includes("reject") || text.includes("same board") || text.includes("unchanged");
17514
+ if (!asksInvalidOrBlocked) return void 0;
17515
+ const asksTurn = text.includes("turn") || text.includes("player");
17516
+ for (const receipt of receipts) {
17517
+ if (!profileSemanticReceiptPassed(receipt)) continue;
17518
+ const unchanged = profileSemanticTruthyField(receipt, [
17519
+ "sameBoard",
17520
+ "same_board",
17521
+ "boardUnchanged",
17522
+ "stateUnchanged",
17523
+ "unchanged",
17524
+ "noMutation",
17525
+ "no_mutation"
17526
+ ]);
17527
+ const blocked = profileSemanticTruthyField(receipt, [
17528
+ "blocked",
17529
+ "invalid",
17530
+ "rejected",
17531
+ "ignored",
17532
+ "prevented"
17533
+ ]);
17534
+ if (!(unchanged || blocked)) continue;
17535
+ if (!profileHasBoardEvidence(receipt)) continue;
17536
+ if (asksTurn && !profileHasTurnEvidence(receipt)) continue;
17537
+ const parts = [
17538
+ unchanged ? "unchanged=true" : "",
17539
+ blocked ? "blocked=true" : "",
17540
+ profileHasTurnEvidence(receipt) ? "turn evidence present" : ""
17541
+ ].filter(Boolean);
17542
+ return `semantic invalid-state receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
17543
+ }
17544
+ return void 0;
17545
+ }
17546
+ function profileSemanticTerminalLockReason(receipts, text) {
17547
+ const asksLock = text.includes("lock") || text.includes("cannot mutate") || text.includes("can not mutate") || text.includes("can't mutate") || text.includes("cannot change") || text.includes("unchanged after") || text.includes("post-winner") && text.includes("click") || text.includes("post winner") && text.includes("click");
17548
+ if (!asksLock) return void 0;
17549
+ for (const receipt of receipts) {
17550
+ if (!profileSemanticReceiptPassed(receipt)) continue;
17551
+ const unchanged = profileSemanticTruthyField(receipt, [
17552
+ "sameBoard",
17553
+ "same_board",
17554
+ "boardUnchanged",
17555
+ "stateUnchanged",
17556
+ "unchanged",
17557
+ "noMutation",
17558
+ "no_mutation",
17559
+ "locked"
17560
+ ]);
17561
+ if (!unchanged) continue;
17562
+ const hasTerminal = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon", "terminal", "locked"]) || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv", "winnerText", "terminalText", "statusText"])));
17563
+ if (!hasTerminal) continue;
17564
+ return "semantic terminal-lock receipt present: unchanged=true";
17565
+ }
17566
+ return void 0;
17567
+ }
17568
+ function profileSemanticWinnerReason(receipts, text) {
17569
+ const asksWinner = text.includes("winner") || text.includes("win-cell") || text.includes("winning") || /\bwin\b/.test(text);
17570
+ if (!asksWinner) return void 0;
17571
+ const asksCounts = text.includes("count");
17572
+ const asksWinCells = text.includes("win-cell") || text.includes("winning") || text.includes("inventory") || text.includes("top-row");
17573
+ const asksPlayAgain = text.includes("play again") || text.includes("play-again") || text.includes("playagain");
17574
+ for (const receipt of receipts) {
17575
+ if (!profileSemanticReceiptPassed(receipt)) continue;
17576
+ const winnerText = (cliString(setupReturnSummaryValue(receipt, ["winnerText", "terminalText", "statusText"])) || "").toLowerCase();
17577
+ const hasWinner = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon"]) || winnerText.includes("win") || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
17578
+ if (!hasWinner) continue;
17579
+ const hasCounts = [
17580
+ "xCount",
17581
+ "oCount",
17582
+ "count",
17583
+ "filledCount",
17584
+ "winnerCount",
17585
+ "score"
17586
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
17587
+ const hasWinCells = profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
17588
+ const hasPlayAgain = profileSemanticTruthyField(receipt, [
17589
+ "playAgainVisible",
17590
+ "play_again_visible",
17591
+ "restartVisible",
17592
+ "resetVisible"
17593
+ ]);
17594
+ if (asksCounts && !hasCounts) continue;
17595
+ if (asksWinCells && !hasWinCells) continue;
17596
+ if (asksPlayAgain && !hasPlayAgain) continue;
17597
+ const parts = [
17598
+ hasCounts ? "counts present" : "",
17599
+ hasWinCells ? "win cells present" : "",
17600
+ hasPlayAgain ? "play-again visible" : ""
17601
+ ].filter(Boolean);
17602
+ return `semantic winner receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
17603
+ }
17604
+ return void 0;
17605
+ }
17606
+ function profileSemanticStateReceiptReason(receipts, text) {
17607
+ return profileSemanticTerminalLockReason(receipts, text) || profileSemanticInvalidStateReason(receipts, text) || profileSemanticWinnerReason(receipts, text);
17608
+ }
17478
17609
  function profilePackReceiptStatus(result, metadata, receipt) {
17479
17610
  const text = receipt.toLowerCase();
17480
17611
  const setupSummary = profileSetupSummaryRecord(result);
@@ -17933,6 +18064,10 @@ function profilePackReceiptStatus(result, metadata, receipt) {
17933
18064
  if (text.includes("measured") || text.includes("state-change") || text.includes("pixel delta") || text.includes("movement receipt") || text.includes("canvas hash")) {
17934
18065
  return profileReceiptSignalStatus(hasMeasuredStateChange, "measured-change evidence present", "measured-change evidence missing");
17935
18066
  }
18067
+ const semanticStateReason = profileSemanticStateReceiptReason(valueReceipts, text);
18068
+ if (semanticStateReason) {
18069
+ return { status: "present", reason: semanticStateReason };
18070
+ }
17936
18071
  return { status: "manual", reason: "semantic receipt requires audit review" };
17937
18072
  }
17938
18073
  function profilePackMetadataMarkdown(result) {
package/dist/cli.js CHANGED
@@ -1184,6 +1184,137 @@ function profileHasGeneratedOutputReceipt(receipts) {
1184
1184
  }
1185
1185
  return outputReady && outputChanged;
1186
1186
  }
1187
+ function profileSemanticReceiptPassed(receipt) {
1188
+ if (receipt.ok === false) return false;
1189
+ return setupReturnSummaryValue(receipt, ["ok", "success", "passed", "completed", "valid"]) === true;
1190
+ }
1191
+ function profileSemanticArrayEvidence(value) {
1192
+ if (Array.isArray(value)) return value.length > 0;
1193
+ const text = cliString(value);
1194
+ return Boolean(text && text.trim());
1195
+ }
1196
+ function profileSemanticTruthyField(receipt, names) {
1197
+ return names.some((name) => setupReturnSummaryValue(receipt, [name]) === true);
1198
+ }
1199
+ function profileHasBoardEvidence(receipt) {
1200
+ return [
1201
+ "board",
1202
+ "beforeBoard",
1203
+ "afterBoard",
1204
+ "cells",
1205
+ "grid",
1206
+ "state"
1207
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
1208
+ }
1209
+ function profileHasTurnEvidence(receipt) {
1210
+ return [
1211
+ "activeX",
1212
+ "activeO",
1213
+ "turn",
1214
+ "currentTurn",
1215
+ "nextTurn",
1216
+ "currentPlayer",
1217
+ "nextPlayer",
1218
+ "isXNext"
1219
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
1220
+ }
1221
+ function profileSemanticInvalidStateReason(receipts, text) {
1222
+ const asksInvalidOrBlocked = text.includes("invalid") || text.includes("blocked") || text.includes("occupied") || text.includes("replay") || text.includes("ignored") || text.includes("reject") || text.includes("same board") || text.includes("unchanged");
1223
+ if (!asksInvalidOrBlocked) return void 0;
1224
+ const asksTurn = text.includes("turn") || text.includes("player");
1225
+ for (const receipt of receipts) {
1226
+ if (!profileSemanticReceiptPassed(receipt)) continue;
1227
+ const unchanged = profileSemanticTruthyField(receipt, [
1228
+ "sameBoard",
1229
+ "same_board",
1230
+ "boardUnchanged",
1231
+ "stateUnchanged",
1232
+ "unchanged",
1233
+ "noMutation",
1234
+ "no_mutation"
1235
+ ]);
1236
+ const blocked = profileSemanticTruthyField(receipt, [
1237
+ "blocked",
1238
+ "invalid",
1239
+ "rejected",
1240
+ "ignored",
1241
+ "prevented"
1242
+ ]);
1243
+ if (!(unchanged || blocked)) continue;
1244
+ if (!profileHasBoardEvidence(receipt)) continue;
1245
+ if (asksTurn && !profileHasTurnEvidence(receipt)) continue;
1246
+ const parts = [
1247
+ unchanged ? "unchanged=true" : "",
1248
+ blocked ? "blocked=true" : "",
1249
+ profileHasTurnEvidence(receipt) ? "turn evidence present" : ""
1250
+ ].filter(Boolean);
1251
+ return `semantic invalid-state receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
1252
+ }
1253
+ return void 0;
1254
+ }
1255
+ function profileSemanticTerminalLockReason(receipts, text) {
1256
+ const asksLock = text.includes("lock") || text.includes("cannot mutate") || text.includes("can not mutate") || text.includes("can't mutate") || text.includes("cannot change") || text.includes("unchanged after") || text.includes("post-winner") && text.includes("click") || text.includes("post winner") && text.includes("click");
1257
+ if (!asksLock) return void 0;
1258
+ for (const receipt of receipts) {
1259
+ if (!profileSemanticReceiptPassed(receipt)) continue;
1260
+ const unchanged = profileSemanticTruthyField(receipt, [
1261
+ "sameBoard",
1262
+ "same_board",
1263
+ "boardUnchanged",
1264
+ "stateUnchanged",
1265
+ "unchanged",
1266
+ "noMutation",
1267
+ "no_mutation",
1268
+ "locked"
1269
+ ]);
1270
+ if (!unchanged) continue;
1271
+ const hasTerminal = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon", "terminal", "locked"]) || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv", "winnerText", "terminalText", "statusText"])));
1272
+ if (!hasTerminal) continue;
1273
+ return "semantic terminal-lock receipt present: unchanged=true";
1274
+ }
1275
+ return void 0;
1276
+ }
1277
+ function profileSemanticWinnerReason(receipts, text) {
1278
+ const asksWinner = text.includes("winner") || text.includes("win-cell") || text.includes("winning") || /\bwin\b/.test(text);
1279
+ if (!asksWinner) return void 0;
1280
+ const asksCounts = text.includes("count");
1281
+ const asksWinCells = text.includes("win-cell") || text.includes("winning") || text.includes("inventory") || text.includes("top-row");
1282
+ const asksPlayAgain = text.includes("play again") || text.includes("play-again") || text.includes("playagain");
1283
+ for (const receipt of receipts) {
1284
+ if (!profileSemanticReceiptPassed(receipt)) continue;
1285
+ const winnerText = (cliString(setupReturnSummaryValue(receipt, ["winnerText", "terminalText", "statusText"])) || "").toLowerCase();
1286
+ const hasWinner = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon"]) || winnerText.includes("win") || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
1287
+ if (!hasWinner) continue;
1288
+ const hasCounts = [
1289
+ "xCount",
1290
+ "oCount",
1291
+ "count",
1292
+ "filledCount",
1293
+ "winnerCount",
1294
+ "score"
1295
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
1296
+ const hasWinCells = profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
1297
+ const hasPlayAgain = profileSemanticTruthyField(receipt, [
1298
+ "playAgainVisible",
1299
+ "play_again_visible",
1300
+ "restartVisible",
1301
+ "resetVisible"
1302
+ ]);
1303
+ if (asksCounts && !hasCounts) continue;
1304
+ if (asksWinCells && !hasWinCells) continue;
1305
+ if (asksPlayAgain && !hasPlayAgain) continue;
1306
+ const parts = [
1307
+ hasCounts ? "counts present" : "",
1308
+ hasWinCells ? "win cells present" : "",
1309
+ hasPlayAgain ? "play-again visible" : ""
1310
+ ].filter(Boolean);
1311
+ return `semantic winner receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
1312
+ }
1313
+ return void 0;
1314
+ }
1315
+ function profileSemanticStateReceiptReason(receipts, text) {
1316
+ return profileSemanticTerminalLockReason(receipts, text) || profileSemanticInvalidStateReason(receipts, text) || profileSemanticWinnerReason(receipts, text);
1317
+ }
1187
1318
  function profilePackReceiptStatus(result, metadata, receipt) {
1188
1319
  const text = receipt.toLowerCase();
1189
1320
  const setupSummary = profileSetupSummaryRecord(result);
@@ -1642,6 +1773,10 @@ function profilePackReceiptStatus(result, metadata, receipt) {
1642
1773
  if (text.includes("measured") || text.includes("state-change") || text.includes("pixel delta") || text.includes("movement receipt") || text.includes("canvas hash")) {
1643
1774
  return profileReceiptSignalStatus(hasMeasuredStateChange, "measured-change evidence present", "measured-change evidence missing");
1644
1775
  }
1776
+ const semanticStateReason = profileSemanticStateReceiptReason(valueReceipts, text);
1777
+ if (semanticStateReason) {
1778
+ return { status: "present", reason: semanticStateReason };
1779
+ }
1645
1780
  return { status: "manual", reason: "semantic receipt requires audit review" };
1646
1781
  }
1647
1782
  function profilePackMetadataMarkdown(result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.219",
3
+ "version": "0.7.220",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",