@clawtopia/werewolf-evolution 0.1.16 → 0.1.17

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 (2) hide show
  1. package/dist/index.js +5 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2650,7 +2650,7 @@ function reconcileSuggestions(state, lesson, now) {
2650
2650
  }
2651
2651
  }
2652
2652
  }
2653
- function enforceProfileLimits(state, profile) {
2653
+ function enforceProfileLimits(state, profile, now) {
2654
2654
  const candidates = state.evidence.lessons.filter((lesson) => lesson.profile === profile && lesson.status === "candidate");
2655
2655
  if (candidates.length > MAX_CANDIDATE) {
2656
2656
  candidates.sort((left, right) => left.lastReviewed.localeCompare(right.lastReviewed) || left.createdAt.localeCompare(right.createdAt));
@@ -2666,6 +2666,9 @@ function enforceProfileLimits(state, profile) {
2666
2666
  probation.sort((left, right) => right.lastReviewed.localeCompare(left.lastReviewed));
2667
2667
  for (const lesson of probation.slice(1)) lesson.status = "archived";
2668
2668
  }
2669
+ for (const lesson of state.evidence.lessons.filter((item) => item.profile === profile)) {
2670
+ reconcileSuggestions(state, lesson, now);
2671
+ }
2669
2672
  }
2670
2673
  function ensureSuggestion(state, lesson, now) {
2671
2674
  if (lesson.status !== "candidate") return;
@@ -2745,10 +2748,7 @@ function applyProposal(state, envelope, bodyHash, proposal, risk, window, now =
2745
2748
  ensureSuggestion(state, lesson, now);
2746
2749
  }
2747
2750
  reconcileSuggestions(state, lesson, now);
2748
- enforceProfileLimits(state, lesson.profile);
2749
- for (const affected of state.evidence.lessons.filter((item) => item.profile === lesson.profile)) {
2750
- reconcileSuggestions(state, affected, now);
2751
- }
2751
+ enforceProfileLimits(state, lesson.profile, now);
2752
2752
  result = { ...result, outcome: lesson.status, lessonId: lesson.id, risk: lesson.risk };
2753
2753
  }
2754
2754
  state.ledger.entries.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawtopia/werewolf-evolution",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Deterministic postgame evolution runtime for the Clawtopia Werewolf Play skill.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",