@riddledc/riddle-proof 0.7.219 → 0.7.221

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 +142 -3
  2. package/dist/cli.js +142 -3
  3. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -17432,15 +17432,19 @@ function profileHasRestartReadyReceipt(receipts) {
17432
17432
  const statusText = profileLowerSummaryValue(receipt, ["statusText", "status", "message"]);
17433
17433
  const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
17434
17434
  const haystack = `${storedTo} ${label} ${path7} ${slot} ${statusText} ${summary}`.toLowerCase();
17435
- const labelsRestart = haystack.includes("restart") || haystack.includes("play again") || haystack.includes("play-again") || haystack.includes("playagain") || haystack.includes("retry");
17435
+ const labelsRestart = haystack.includes("restart") || haystack.includes("reset") || haystack.includes("reset-ready") || haystack.includes("reset ready") || haystack.includes("play again") || haystack.includes("play-again") || haystack.includes("playagain") || haystack.includes("retry");
17436
17436
  if (!labelsRestart) return false;
17437
17437
  const ok = receipt.ok !== false && setupReturnSummaryValue(receipt, ["ok"]) !== false;
17438
17438
  const controlsEnabled = setupReturnSummaryValue(receipt, ["controlsEnabled", "inputControlsEnabled", "inputEnabled", "canInput"]) === true || setupReturnSummaryValue(receipt, ["shortDisabled"]) === false && setupReturnSummaryValue(receipt, ["longDisabled"]) === false;
17439
17439
  const level = cliFiniteNumber(setupReturnSummaryValue(receipt, ["level"]));
17440
17440
  const streak = cliFiniteNumber(setupReturnSummaryValue(receipt, ["streak"]));
17441
17441
  const best = cliFiniteNumber(setupReturnSummaryValue(receipt, ["best"]));
17442
- const readyState = statusText.includes("your turn") || statusText.includes("ready") || setupReturnSummaryValue(receipt, ["ready", "restartReady", "restart_ready"]) === true;
17443
- return ok && controlsEnabled && (readyState || level !== void 0 || streak !== void 0 || best !== void 0);
17442
+ const readyState = statusText.includes("your turn") || statusText.includes("ready") || setupReturnSummaryValue(receipt, ["ready", "restartReady", "restart_ready", "resetReady", "reset_ready"]) === true;
17443
+ const hiddenCount = cliFiniteNumber(setupReturnSummaryValue(receipt, ["hiddenCount", "hidden_count"]));
17444
+ const moves = cliFiniteNumber(setupReturnSummaryValue(receipt, ["moves", "moveCount", "move_count"]));
17445
+ const winner = setupReturnSummaryValue(receipt, ["hasWinner", "winner", "won", "gameWon"]);
17446
+ const resetBoardReady = hiddenCount !== void 0 && hiddenCount > 0 && moves === 0 && winner === false;
17447
+ return ok && controlsEnabled && (readyState || resetBoardReady || level !== void 0 || streak !== void 0 || best !== void 0);
17444
17448
  });
17445
17449
  }
17446
17450
  function profileMetadataHasGeneratedOutputContract(metadata) {
@@ -17475,6 +17479,137 @@ function profileHasGeneratedOutputReceipt(receipts) {
17475
17479
  }
17476
17480
  return outputReady && outputChanged;
17477
17481
  }
17482
+ function profileSemanticReceiptPassed(receipt) {
17483
+ if (receipt.ok === false) return false;
17484
+ return setupReturnSummaryValue(receipt, ["ok", "success", "passed", "completed", "valid"]) === true;
17485
+ }
17486
+ function profileSemanticArrayEvidence(value) {
17487
+ if (Array.isArray(value)) return value.length > 0;
17488
+ const text = cliString(value);
17489
+ return Boolean(text && text.trim());
17490
+ }
17491
+ function profileSemanticTruthyField(receipt, names) {
17492
+ return names.some((name) => setupReturnSummaryValue(receipt, [name]) === true);
17493
+ }
17494
+ function profileHasBoardEvidence(receipt) {
17495
+ return [
17496
+ "board",
17497
+ "beforeBoard",
17498
+ "afterBoard",
17499
+ "cells",
17500
+ "grid",
17501
+ "state"
17502
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
17503
+ }
17504
+ function profileHasTurnEvidence(receipt) {
17505
+ return [
17506
+ "activeX",
17507
+ "activeO",
17508
+ "turn",
17509
+ "currentTurn",
17510
+ "nextTurn",
17511
+ "currentPlayer",
17512
+ "nextPlayer",
17513
+ "isXNext"
17514
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
17515
+ }
17516
+ function profileSemanticInvalidStateReason(receipts, text) {
17517
+ 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");
17518
+ if (!asksInvalidOrBlocked) return void 0;
17519
+ const asksTurn = text.includes("turn") || text.includes("player");
17520
+ for (const receipt of receipts) {
17521
+ if (!profileSemanticReceiptPassed(receipt)) continue;
17522
+ const unchanged = profileSemanticTruthyField(receipt, [
17523
+ "sameBoard",
17524
+ "same_board",
17525
+ "boardUnchanged",
17526
+ "stateUnchanged",
17527
+ "unchanged",
17528
+ "noMutation",
17529
+ "no_mutation"
17530
+ ]);
17531
+ const blocked = profileSemanticTruthyField(receipt, [
17532
+ "blocked",
17533
+ "invalid",
17534
+ "rejected",
17535
+ "ignored",
17536
+ "prevented"
17537
+ ]);
17538
+ if (!(unchanged || blocked)) continue;
17539
+ if (!profileHasBoardEvidence(receipt)) continue;
17540
+ if (asksTurn && !profileHasTurnEvidence(receipt)) continue;
17541
+ const parts = [
17542
+ unchanged ? "unchanged=true" : "",
17543
+ blocked ? "blocked=true" : "",
17544
+ profileHasTurnEvidence(receipt) ? "turn evidence present" : ""
17545
+ ].filter(Boolean);
17546
+ return `semantic invalid-state receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
17547
+ }
17548
+ return void 0;
17549
+ }
17550
+ function profileSemanticTerminalLockReason(receipts, text) {
17551
+ 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");
17552
+ if (!asksLock) return void 0;
17553
+ for (const receipt of receipts) {
17554
+ if (!profileSemanticReceiptPassed(receipt)) continue;
17555
+ const unchanged = profileSemanticTruthyField(receipt, [
17556
+ "sameBoard",
17557
+ "same_board",
17558
+ "boardUnchanged",
17559
+ "stateUnchanged",
17560
+ "unchanged",
17561
+ "noMutation",
17562
+ "no_mutation",
17563
+ "locked"
17564
+ ]);
17565
+ if (!unchanged) continue;
17566
+ const hasTerminal = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon", "terminal", "locked"]) || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv", "winnerText", "terminalText", "statusText"])));
17567
+ if (!hasTerminal) continue;
17568
+ return "semantic terminal-lock receipt present: unchanged=true";
17569
+ }
17570
+ return void 0;
17571
+ }
17572
+ function profileSemanticWinnerReason(receipts, text) {
17573
+ const asksWinner = text.includes("winner") || text.includes("win-cell") || text.includes("winning") || /\bwin\b/.test(text);
17574
+ if (!asksWinner) return void 0;
17575
+ const asksCounts = text.includes("count");
17576
+ const asksWinCells = text.includes("win-cell") || text.includes("winning") || text.includes("inventory") || text.includes("top-row");
17577
+ const asksPlayAgain = text.includes("play again") || text.includes("play-again") || text.includes("playagain");
17578
+ for (const receipt of receipts) {
17579
+ if (!profileSemanticReceiptPassed(receipt)) continue;
17580
+ const winnerText = (cliString(setupReturnSummaryValue(receipt, ["winnerText", "terminalText", "statusText"])) || "").toLowerCase();
17581
+ const hasWinner = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon"]) || winnerText.includes("win") || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
17582
+ if (!hasWinner) continue;
17583
+ const hasCounts = [
17584
+ "xCount",
17585
+ "oCount",
17586
+ "count",
17587
+ "filledCount",
17588
+ "winnerCount",
17589
+ "score"
17590
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
17591
+ const hasWinCells = profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
17592
+ const hasPlayAgain = profileSemanticTruthyField(receipt, [
17593
+ "playAgainVisible",
17594
+ "play_again_visible",
17595
+ "restartVisible",
17596
+ "resetVisible"
17597
+ ]);
17598
+ if (asksCounts && !hasCounts) continue;
17599
+ if (asksWinCells && !hasWinCells) continue;
17600
+ if (asksPlayAgain && !hasPlayAgain) continue;
17601
+ const parts = [
17602
+ hasCounts ? "counts present" : "",
17603
+ hasWinCells ? "win cells present" : "",
17604
+ hasPlayAgain ? "play-again visible" : ""
17605
+ ].filter(Boolean);
17606
+ return `semantic winner receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
17607
+ }
17608
+ return void 0;
17609
+ }
17610
+ function profileSemanticStateReceiptReason(receipts, text) {
17611
+ return profileSemanticTerminalLockReason(receipts, text) || profileSemanticInvalidStateReason(receipts, text) || profileSemanticWinnerReason(receipts, text);
17612
+ }
17478
17613
  function profilePackReceiptStatus(result, metadata, receipt) {
17479
17614
  const text = receipt.toLowerCase();
17480
17615
  const setupSummary = profileSetupSummaryRecord(result);
@@ -17933,6 +18068,10 @@ function profilePackReceiptStatus(result, metadata, receipt) {
17933
18068
  if (text.includes("measured") || text.includes("state-change") || text.includes("pixel delta") || text.includes("movement receipt") || text.includes("canvas hash")) {
17934
18069
  return profileReceiptSignalStatus(hasMeasuredStateChange, "measured-change evidence present", "measured-change evidence missing");
17935
18070
  }
18071
+ const semanticStateReason = profileSemanticStateReceiptReason(valueReceipts, text);
18072
+ if (semanticStateReason) {
18073
+ return { status: "present", reason: semanticStateReason };
18074
+ }
17936
18075
  return { status: "manual", reason: "semantic receipt requires audit review" };
17937
18076
  }
17938
18077
  function profilePackMetadataMarkdown(result) {
package/dist/cli.js CHANGED
@@ -1141,15 +1141,19 @@ function profileHasRestartReadyReceipt(receipts) {
1141
1141
  const statusText = profileLowerSummaryValue(receipt, ["statusText", "status", "message"]);
1142
1142
  const summary = cliReturnSummaryLabel(receipt.return_summary) || "";
1143
1143
  const haystack = `${storedTo} ${label} ${path2} ${slot} ${statusText} ${summary}`.toLowerCase();
1144
- const labelsRestart = haystack.includes("restart") || haystack.includes("play again") || haystack.includes("play-again") || haystack.includes("playagain") || haystack.includes("retry");
1144
+ const labelsRestart = haystack.includes("restart") || haystack.includes("reset") || haystack.includes("reset-ready") || haystack.includes("reset ready") || haystack.includes("play again") || haystack.includes("play-again") || haystack.includes("playagain") || haystack.includes("retry");
1145
1145
  if (!labelsRestart) return false;
1146
1146
  const ok = receipt.ok !== false && setupReturnSummaryValue(receipt, ["ok"]) !== false;
1147
1147
  const controlsEnabled = setupReturnSummaryValue(receipt, ["controlsEnabled", "inputControlsEnabled", "inputEnabled", "canInput"]) === true || setupReturnSummaryValue(receipt, ["shortDisabled"]) === false && setupReturnSummaryValue(receipt, ["longDisabled"]) === false;
1148
1148
  const level = cliFiniteNumber(setupReturnSummaryValue(receipt, ["level"]));
1149
1149
  const streak = cliFiniteNumber(setupReturnSummaryValue(receipt, ["streak"]));
1150
1150
  const best = cliFiniteNumber(setupReturnSummaryValue(receipt, ["best"]));
1151
- const readyState = statusText.includes("your turn") || statusText.includes("ready") || setupReturnSummaryValue(receipt, ["ready", "restartReady", "restart_ready"]) === true;
1152
- return ok && controlsEnabled && (readyState || level !== void 0 || streak !== void 0 || best !== void 0);
1151
+ const readyState = statusText.includes("your turn") || statusText.includes("ready") || setupReturnSummaryValue(receipt, ["ready", "restartReady", "restart_ready", "resetReady", "reset_ready"]) === true;
1152
+ const hiddenCount = cliFiniteNumber(setupReturnSummaryValue(receipt, ["hiddenCount", "hidden_count"]));
1153
+ const moves = cliFiniteNumber(setupReturnSummaryValue(receipt, ["moves", "moveCount", "move_count"]));
1154
+ const winner = setupReturnSummaryValue(receipt, ["hasWinner", "winner", "won", "gameWon"]);
1155
+ const resetBoardReady = hiddenCount !== void 0 && hiddenCount > 0 && moves === 0 && winner === false;
1156
+ return ok && controlsEnabled && (readyState || resetBoardReady || level !== void 0 || streak !== void 0 || best !== void 0);
1153
1157
  });
1154
1158
  }
1155
1159
  function profileMetadataHasGeneratedOutputContract(metadata) {
@@ -1184,6 +1188,137 @@ function profileHasGeneratedOutputReceipt(receipts) {
1184
1188
  }
1185
1189
  return outputReady && outputChanged;
1186
1190
  }
1191
+ function profileSemanticReceiptPassed(receipt) {
1192
+ if (receipt.ok === false) return false;
1193
+ return setupReturnSummaryValue(receipt, ["ok", "success", "passed", "completed", "valid"]) === true;
1194
+ }
1195
+ function profileSemanticArrayEvidence(value) {
1196
+ if (Array.isArray(value)) return value.length > 0;
1197
+ const text = cliString(value);
1198
+ return Boolean(text && text.trim());
1199
+ }
1200
+ function profileSemanticTruthyField(receipt, names) {
1201
+ return names.some((name) => setupReturnSummaryValue(receipt, [name]) === true);
1202
+ }
1203
+ function profileHasBoardEvidence(receipt) {
1204
+ return [
1205
+ "board",
1206
+ "beforeBoard",
1207
+ "afterBoard",
1208
+ "cells",
1209
+ "grid",
1210
+ "state"
1211
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
1212
+ }
1213
+ function profileHasTurnEvidence(receipt) {
1214
+ return [
1215
+ "activeX",
1216
+ "activeO",
1217
+ "turn",
1218
+ "currentTurn",
1219
+ "nextTurn",
1220
+ "currentPlayer",
1221
+ "nextPlayer",
1222
+ "isXNext"
1223
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
1224
+ }
1225
+ function profileSemanticInvalidStateReason(receipts, text) {
1226
+ 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");
1227
+ if (!asksInvalidOrBlocked) return void 0;
1228
+ const asksTurn = text.includes("turn") || text.includes("player");
1229
+ for (const receipt of receipts) {
1230
+ if (!profileSemanticReceiptPassed(receipt)) continue;
1231
+ const unchanged = profileSemanticTruthyField(receipt, [
1232
+ "sameBoard",
1233
+ "same_board",
1234
+ "boardUnchanged",
1235
+ "stateUnchanged",
1236
+ "unchanged",
1237
+ "noMutation",
1238
+ "no_mutation"
1239
+ ]);
1240
+ const blocked = profileSemanticTruthyField(receipt, [
1241
+ "blocked",
1242
+ "invalid",
1243
+ "rejected",
1244
+ "ignored",
1245
+ "prevented"
1246
+ ]);
1247
+ if (!(unchanged || blocked)) continue;
1248
+ if (!profileHasBoardEvidence(receipt)) continue;
1249
+ if (asksTurn && !profileHasTurnEvidence(receipt)) continue;
1250
+ const parts = [
1251
+ unchanged ? "unchanged=true" : "",
1252
+ blocked ? "blocked=true" : "",
1253
+ profileHasTurnEvidence(receipt) ? "turn evidence present" : ""
1254
+ ].filter(Boolean);
1255
+ return `semantic invalid-state receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
1256
+ }
1257
+ return void 0;
1258
+ }
1259
+ function profileSemanticTerminalLockReason(receipts, text) {
1260
+ 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");
1261
+ if (!asksLock) return void 0;
1262
+ for (const receipt of receipts) {
1263
+ if (!profileSemanticReceiptPassed(receipt)) continue;
1264
+ const unchanged = profileSemanticTruthyField(receipt, [
1265
+ "sameBoard",
1266
+ "same_board",
1267
+ "boardUnchanged",
1268
+ "stateUnchanged",
1269
+ "unchanged",
1270
+ "noMutation",
1271
+ "no_mutation",
1272
+ "locked"
1273
+ ]);
1274
+ if (!unchanged) continue;
1275
+ const hasTerminal = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon", "terminal", "locked"]) || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv", "winnerText", "terminalText", "statusText"])));
1276
+ if (!hasTerminal) continue;
1277
+ return "semantic terminal-lock receipt present: unchanged=true";
1278
+ }
1279
+ return void 0;
1280
+ }
1281
+ function profileSemanticWinnerReason(receipts, text) {
1282
+ const asksWinner = text.includes("winner") || text.includes("win-cell") || text.includes("winning") || /\bwin\b/.test(text);
1283
+ if (!asksWinner) return void 0;
1284
+ const asksCounts = text.includes("count");
1285
+ const asksWinCells = text.includes("win-cell") || text.includes("winning") || text.includes("inventory") || text.includes("top-row");
1286
+ const asksPlayAgain = text.includes("play again") || text.includes("play-again") || text.includes("playagain");
1287
+ for (const receipt of receipts) {
1288
+ if (!profileSemanticReceiptPassed(receipt)) continue;
1289
+ const winnerText = (cliString(setupReturnSummaryValue(receipt, ["winnerText", "terminalText", "statusText"])) || "").toLowerCase();
1290
+ const hasWinner = profileSemanticTruthyField(receipt, ["hasWinner", "winner", "won", "gameWon"]) || winnerText.includes("win") || profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
1291
+ if (!hasWinner) continue;
1292
+ const hasCounts = [
1293
+ "xCount",
1294
+ "oCount",
1295
+ "count",
1296
+ "filledCount",
1297
+ "winnerCount",
1298
+ "score"
1299
+ ].some((name) => setupReturnSummaryValue(receipt, [name]) !== void 0);
1300
+ const hasWinCells = profileSemanticArrayEvidence(setupReturnSummaryValue(receipt, ["winCells", "winningCells", "winningLine"])) || Boolean(cliString(setupReturnSummaryValue(receipt, ["winCellsCsv"])));
1301
+ const hasPlayAgain = profileSemanticTruthyField(receipt, [
1302
+ "playAgainVisible",
1303
+ "play_again_visible",
1304
+ "restartVisible",
1305
+ "resetVisible"
1306
+ ]);
1307
+ if (asksCounts && !hasCounts) continue;
1308
+ if (asksWinCells && !hasWinCells) continue;
1309
+ if (asksPlayAgain && !hasPlayAgain) continue;
1310
+ const parts = [
1311
+ hasCounts ? "counts present" : "",
1312
+ hasWinCells ? "win cells present" : "",
1313
+ hasPlayAgain ? "play-again visible" : ""
1314
+ ].filter(Boolean);
1315
+ return `semantic winner receipt present${parts.length ? `: ${parts.join(", ")}` : ""}`;
1316
+ }
1317
+ return void 0;
1318
+ }
1319
+ function profileSemanticStateReceiptReason(receipts, text) {
1320
+ return profileSemanticTerminalLockReason(receipts, text) || profileSemanticInvalidStateReason(receipts, text) || profileSemanticWinnerReason(receipts, text);
1321
+ }
1187
1322
  function profilePackReceiptStatus(result, metadata, receipt) {
1188
1323
  const text = receipt.toLowerCase();
1189
1324
  const setupSummary = profileSetupSummaryRecord(result);
@@ -1642,6 +1777,10 @@ function profilePackReceiptStatus(result, metadata, receipt) {
1642
1777
  if (text.includes("measured") || text.includes("state-change") || text.includes("pixel delta") || text.includes("movement receipt") || text.includes("canvas hash")) {
1643
1778
  return profileReceiptSignalStatus(hasMeasuredStateChange, "measured-change evidence present", "measured-change evidence missing");
1644
1779
  }
1780
+ const semanticStateReason = profileSemanticStateReceiptReason(valueReceipts, text);
1781
+ if (semanticStateReason) {
1782
+ return { status: "present", reason: semanticStateReason };
1783
+ }
1645
1784
  return { status: "manual", reason: "semantic receipt requires audit review" };
1646
1785
  }
1647
1786
  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.221",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",