From 9b79d18201a0caa48224245b47e4b270bd835407 Mon Sep 17 00:00:00 2001 From: rgriffith Date: Sun, 5 Apr 2026 22:14:56 -0400 Subject: [PATCH] feat(lan-client): triggers panel + CMD DMG score badges + fix encoding project-wide Left action panel revised to show triggers list + Create Token/Auto-Arrange. CMD DMG badges added to center life-panel score areas (click opens matrix). Removed renderEnhancedPanels calls that split the battlefield on damage adjust. Added encoding='utf-8' to all bare open() calls across 17 Python files to prevent cp1252 crashes on MTG card text with smart quotes/em-dashes. Co-Authored-By: Claude Opus 4.6 --- coach/coach_service.py | 8 +- lan-client/engine.js | 10 +- lan-client/index.html | 141 +++++++++++++- lan-client/style.css | 256 +++++++++++++++++++++++++ ml/actions/labeler.py | 2 +- ml/data/dataset_builder.py | 2 +- ml/data/quality_gate.py | 4 +- ml/encoder/state_encoder.py | 2 +- ml/eval/elo_tracker.py | 4 +- ml/eval/forge_evaluator.py | 4 +- ml/eval/forge_evaluator_FIXED.py | 4 +- ml/eval/tournament.py | 2 +- ml/scripts/generate_synthetic_data.py | 4 +- ml/scripts/ml_cli.py | 6 +- ml/training/decision_exporter.py | 2 +- ml/training/distillation_loop.py | 4 +- ml/training/forge_episode_generator.py | 2 +- ml/training/ppo_trainer.py | 2 +- ml/training/trainer.py | 6 +- patch_eval.py | 2 +- routes/deepseek.py | 2 +- routes/ml.py | 22 +-- scripts/compare_eval.py | 4 +- services/forge_runner.py | 2 +- 24 files changed, 442 insertions(+), 55 deletions(-) diff --git a/coach/coach_service.py b/coach/coach_service.py index 685fdb0..f81fddc 100644 --- a/coach/coach_service.py +++ b/coach/coach_service.py @@ -77,7 +77,7 @@ class CoachService: logger.warning("Deck report not found: %s", deck_id) return None try: - with open(report_path, "r") as f: + with open(report_path, "r", encoding="utf-8") as f: data = json.load(f) return DeckReport(**data) except Exception as e: @@ -95,7 +95,7 @@ class CoachService: """Persist a coaching session to disk and SQLite.""" COACH_SESSIONS_DIR.mkdir(parents=True, exist_ok=True) path = COACH_SESSIONS_DIR / f"{session.sessionId}.json" - with open(path, "w") as f: + with open(path, "w", encoding="utf-8") as f: f.write(session.model_dump_json(indent=2)) if _DB_AVAILABLE: try: @@ -147,7 +147,7 @@ class CoachService: if not path.exists(): return None try: - with open(path, "r") as f: + with open(path, "r", encoding="utf-8") as f: data = json.load(f) return CoachSession(**data) except Exception as e: @@ -168,7 +168,7 @@ class CoachService: sessions = [] for f in sorted(COACH_SESSIONS_DIR.glob("*.json"), reverse=True): try: - with open(f, "r") as fh: + with open(f, "r", encoding="utf-8") as fh: data = json.load(fh) if deck_id and data.get("deckId", "") != deck_id: continue diff --git a/lan-client/engine.js b/lan-client/engine.js index bb38f8a..245161a 100644 --- a/lan-client/engine.js +++ b/lan-client/engine.js @@ -5286,8 +5286,7 @@ function setLife(playerId, newLife) { eliminatePlayer(playerId, 'life total reached 0'); } checkStateBasedActions(); - // Sync enhanced player panels - if (typeof renderEnhancedPanels === 'function') renderEnhancedPanels(); + if (typeof renderCmdDmgInline === 'function') renderCmdDmgInline(); } // ============================================================ @@ -5322,8 +5321,7 @@ function adjustCommanderDamage(targetPlayerId, sourcePlayerId, amount) { panelContainer.replaceWith(newPanel); } checkStateBasedActions(); - // Sync enhanced player panels - if (typeof renderEnhancedPanels === 'function') renderEnhancedPanels(); + if (typeof renderCmdDmgInline === 'function') renderCmdDmgInline(); } // ============================================================ @@ -5356,8 +5354,6 @@ function adjustPoison(playerId, amount) { panelContainer.replaceWith(newPanel); } if (gameState.rulesEngine && gameState.rulesEngine.sbaChecks) checkStateBasedActions(); - // Sync enhanced player panels - if (typeof renderEnhancedPanels === 'function') renderEnhancedPanels(); } // ============================================================ @@ -13049,6 +13045,8 @@ function startGame() { renderHandArea(); renderPhaseTracker(); updateTurnDisplay(); + if (typeof renderCmdDmgInline === 'function') renderCmdDmgInline(); + if (typeof refreshLeftPanelTriggers === 'function') refreshLeftPanelTriggers(); // Set default search focus setTimeout(() => { diff --git a/lan-client/index.html b/lan-client/index.html index 182f799..0a2c5e5 100644 --- a/lan-client/index.html +++ b/lan-client/index.html @@ -269,7 +269,7 @@ -
+
Cmd Dmg
—
@@ -288,7 +288,7 @@
-
+
Cmd Dmg
—
@@ -307,7 +307,7 @@
-
+
Cmd Dmg
—
@@ -326,7 +326,7 @@
-
+
Cmd Dmg
—
@@ -369,6 +369,24 @@ + + + + +
›
+