feat(bridge): Netlify Blobs-backed memory events + cost tracking for hosted
The bridge was crashing with ENOENT /var/task/data/consolidation because saveConsolidationCost() tried to mkdir on the read-only Lambda filesystem. Beyond the crash, all memory events were lost between Lambda invocations (ephemeral /tmp) so consolidation always saw 0 events.
Full Blobs-backed hosted path:
- blobsGetMemoryEvents / blobsSetMemoryEvents / blobsAppendMemoryEvent: store memory events as a JSON array in Netlify Blobs under memory/{uid}/{vaultId}/events — capped at 500, durable across cold starts
- loadConsolidationCost / saveConsolidationCost: use Blobs when __netlify_blob_store is set, file fallback for self-hosted — no more mkdir crash on /var/task/data/consolidation
- fireBridgeCaptureEvent: appends to Blobs on hosted (durable), falls back to FileMemoryProvider on self-hosted
- POST /api/v1/memory/consolidate: loads Blobs events into a temp FileMemoryProvider, runs consolidateMemory against it, syncs remaining (post-consolidation) events back to Blobs — complete round-trip
- GET /api/v1/memory: reads from Blobs on hosted, file on self-hosted
- consolidationConfig.data_dir: uses os.tmpdir() on hosted path (writable)
Detection: globalThis.__netlify_blob_store (set by netlify/functions/bridge.mjs before each invocation) — 100% reliable, no env var guessing needed.
0 comments
muse hub commit comment sha256:40af1b2eaeefe5ad8fa949db0a41e26f492702d82d0547078a033687b40e2628 --body "your comment"
No comments yet. Be the first to start the discussion.