2.5 KiB
2.5 KiB
Web Cache Cleanup Entry — 2026-05
BOSS requested a Web UI entry to clear xianyu-hunter cached collection results while optionally preserving Hermes-approved quality results.
Implemented in local clone:
/Users/chick/.Hermes/workspace/research/xianyu-hunter
Files changed:
-
lib/task.mjs- Added
TaskManager.clearTaskCache(id, { mode, minScore }). - Refuses running tasks by returning
null. mode: 'all': clearsproducts.raw,products.coarseFiltered,products.fineFiltered,hermesAnalysis, chat arrays; resets stage topending.mode: 'hermes-recommend': keeps onlyfineFiltereditems withitem.hermesAnalysis.verdict === 'recommend'.mode: 'hermes-pass': keepsrecommendorcautionitems whose score is >=minScore.- For keep modes, retained items are written to all three product buckets so the task still visibly has cached quality results.
- Adds a log line and broadcasts
task:updated.
- Added
-
server.mjs- Added
POST /api/tasks/:id/clear-cachewith JSON body:
- Added
{ "mode": "all|hermes-recommend|hermes-pass", "minScore": 75 }
-
public/index.html- Header button:
清除缓存. - Modal
#clear-cache-modal-overlaywith scope (active/all), mode, min score, preview, and log. - Cache-busted assets to
style.css?v=15andapp.js?v=15.
- Header button:
-
public/app.js- Added
showClearCacheModal,hideClearCacheModal,renderClearCachePreview,clearCacheFromModal,getClearTargets,countQualityItems. - Frontend can clean current selected task or all non-running tasks.
- Shows preview of raw/coarse/fine counts and how many quality items will be retained.
- Added
-
public/style.css- Added
.clear-cache-modal,.cache-warning,.cache-preview*,.cache-countsstyles.
- Added
Verification performed:
node --check public/app.js
node --check server.mjs
node --check lib/task.mjs
Restart caveat:
node tools/xianyu_ops.mjs start --port 3000reported running but did not replace stale PID 9407, so new route initially 404'd.- Correct recovery was to kill the stale listener (
kill 9407) and start tracked server withPORT=3000 node server.mjs. - Active verified process after implementation: PID 11594 from Hermes background session
proc_41df821080bd.
Smoke test:
- Fetch
/and verifyapp.js?v=15,clear-cache-modal-overlay. - Create save-only
__cache_smoke_test__task viaPOST /api/tasks. - Call
POST /api/tasks/<id>/clear-cachewith{ "mode": "all" }. - Verify response
ok: trueand all counts zero. - Delete smoke task.