Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(news): expire the archive month cache for still-mutable months
fudjiaa11037283535
diff --git a/api/_lib/news-archive-store.js b/api/_lib/news-archive-store.jsindex df1a4d7c9..60a20faa0 100644--- a/api/_lib/news-archive-store.js+++ b/api/_lib/news-archive-store.js@@ -18,8 +18,12 @@ const GCS_LIST =const MONTH_CACHE_MAX = 5;const META_TTL_MS = 3600_000;+// The hourly archiver keeps appending to the last two month files; a cached+// copy of those must expire or a long-lived instance never sees new stories+// and their fresh permalinks 404 until restart. Older months are immutable.+const MUTABLE_MONTH_TTL_MS = 10 * 60_000;-// month "YYYY-MM" → compact article records (newest month files are ~2–11 MB+// month "YYYY-MM" → { records, expiresAt } (newest month files are ~2–11 MB// raw; compact form keeps only serving fields). LRU by Map insertion order.const monthCache = new Map();// small metadata caches: { value, expiresAt }@@ -87,13 +91,23 @@ export async function getMonths() {return value;}+// The archiver still appends to the current and previous month; everything+// older is a sealed, immutable file.+function isMutableMonth(month) {+ const d = new Date();+ const cur = d.toISOString().slice(0, 7);+ d.setUTCDate(1);+ d.setUTCMonth(d.getUTCMonth() - 1);+ return month === cur || month === d.toISOString().slice(0, 7);+}+/** One month of compact records, newest-first, LRU-cached. */export async function loadMonth(month) {- if (monthCache.has(month)) {- const records = monthCache.get(month);+ const hit = monthCache.get(month);+ if (hit && hit.expiresAt > Date.now()) {monthCache.delete(month);- monthCache.set(month, records); // refresh LRU recency- return records;+ monthCache.set(month, hit); // refresh LRU recency+ return hit.records;}const resp = await fetch(`${GCS_BASE}/articles/${month}.jsonl`, {signal: AbortSignal.timeout(30_000),@@ -111,7 +125,10 @@ export async function loadMonth(month) {}// newest-first inside the month so early-stop pagination is stablerecords.sort((a, b) => new Date(b.pub_date || 0) - new Date(a.pub_date || 0));- monthCache.set(month, records);+ monthCache.set(month, {+ records,+ expiresAt: isMutableMonth(month) ? Date.now() + MUTABLE_MONTH_TTL_MS : Infinity,+ });while (monthCache.size > MONTH_CACHE_MAX) {monthCache.delete(monthCache.keys().next().value);}