Villain v2 Migration · 依賴圖 & Migration 計畫
2026-04-26 · 從 poker-mentor 搬 villain v2 架構進 coldread;資料層全砍重做
Scope 修正:用戶 2026-04-26 確認 = 「以舊架構為主,但舊資料不準確 → 只搬架構,資料重新跑」。
Risk 1(baseline.ts adapter)取消,預估工時從 11-22 天降到 9-13 天。
🟢 搬架構(直接搬,~7 檔)
villainProfile/types.ts(47 行)— 21 RangeKey + interface
villainProfile/ranges.ts(41 行)— PERCENT_OPTIONS + 中文 label
villainProfile/builder.ts(30 行)— buildVillainProfile()
villainProfile/summarizer.ts(150 行)— profile → LLM prompt 翻譯
villainProfile/index.ts(6 行)— barrel export
exploit/villainProfiles.ts(219 行)— 10 type leak 模型
data/coachOnboarding.ts — 預寫 onboarding 對話 0-token
🔵 重寫(架構搬,實作改)
villainProfile/storage.ts → 改 Supabase CRUD(取代 localStorage)
villainProfile/baseline.ts → 重寫 RANGE_KEY_TO_BASELINE,不用舊 GTO data,直接用 input tool 跑出來的 v2 baseline
exploit/exploitEngine.ts → 簡化版(砍掉 getGTOAction / categorize 依賴,靠 LLM)
- Edge Function v2 → 取代既有
exploit-coach/index.ts 的 prompt 部分(保留 extract/refine)
- UI 8 screens 轉 React component(s1/sf-b/sf-c1~3/sf-name 等)
🟣 新資料(input tool 重做 21 RangeKey baseline)
- EP_RAISE / EP_CALL_3BET / EP_4BET(前位 3 個)
- MP_RAISE / MP_CALL / MP_3BET / MP_CALL_3BET / MP_4BET / MP_CALL_4BET(中位 6 個)
- LP_RAISE / LP_CALL / LP_3BET / LP_CALL_3BET / LP_4BET / LP_CALL_4BET(後位 6 個)
- BL_RAISE / BL_CALL / BL_3BET / BL_CALL_3BET / BL_4BET / BL_CALL_4BET(盲注位 6 個)
- 共 21 個 RangeKey baseline,每個 169 cell
- 用戶估計 4-8 小時點 cell(input tool 升級後)
🟡 coldread 既有(保留不動)
villain_profiles Supabase 表(schema 對的)
villain_observations 表(T-007)
- T-008 extract pipeline(演算法通用)
- T-009 Bayesian refine 演算法(input/output 改 RangeKey 命名即可)
- T-011 更新歷史 UI(data source 改吃 v2 profile)
- brand types
Fraction(dev.42,通用概念)
- Stop hook 第 1/2/3 層(包含 no-fake-vision dev.39)
🔴 廢棄(這次 session 做的會被砍)
src/lib/gto/baseline-presets.ts(dev.40 21 scenario_id 資料)
supabase/functions/exploit-coach/baseline-aggregates.ts(複本)
src/lib/villains/merge.ts(fullBaseline / baselineWithStyleBias)
src/pages/VillainNew.tsx 3 入口邏輯(重寫)
src/pages/VillainNewPrecise.tsx 21 scenario grid(重寫成 21 RangeKey grid)
src/components/RangeGridEditor.tsx(重寫對齊 v2 grid 結構)
src/lib/villains/baseline-helpers.ts(getBaselinePct etc → 用新 v2 baseline)
- T-G01b 工作(21 scenario 對照 chart)→ 內容可參考重做為 21 RangeKey
⚪ 不搬(skip)
gtoData_cash_6max_100bb.ts(poker-mentor 預存 GTO data,user 說可能不準)
baseline.ts 的 RANGE_KEY_TO_BASELINE mapping(指向 stale data)
- poker-mentor
gto/getGTOAction + explanations helper(exploitEngine 的 dep)
exploit-coach-gtow Edge Function(T-082 GTOW fork,scope 外)
- poker-mentor
analyze-hu-hand / analyze-weakness Edge Function
🔷 工具升級
~/Desktop/range-input-tool.html 加 v2 export mode:
- 目前格式:
RangeDict { 'AA':'r', ... }(action token)
- 新格式:
RangeData { totalPct: 22.5, grid: [0,1,1,...] }(binary 169 + total %)
- 切換 button:「v1 scenario / v2 RangeKey」
- 21 RangeKey 提示(左下角清單,點選 = 自動填 scenario name)
⚠ 待你拍板
- v2 baseline 是否兼做對比用?兩個用途:
(a) villain initial_range 預設值(builder 用)
(b) exploit-coach prompt 對比 villain 偏離(dev.40 用途)
— 21 RangeKey 同時涵蓋兩者?或維持兩套(v2 21 RangeKey + 既有 21 scenario)?
- 既有 villain DB 資料怎麼處理?scenario_id → RangeKey migration script / 丟棄重建?
- Phase 順序:Step 3 派 task 先做哪個 sub-task?