feat(session-10/stream-1): hosted consolidation bridge endpoint + billing gate
POST /api/v1/memory/consolidate and GET /api/v1/memory/consolidate/status on the bridge give hosted users parity with the self-hosted daemon.
Bridge (hub/bridge/server.mjs): - POST /api/v1/memory/consolidate — bridgeMemoryAuth, calls consolidateMemory with a per-user FileMemoryProvider (opts.mm), tracks LLM cost via a wrapping llmFn, persists cost to data/consolidation/{uid}_cost.json - GET /api/v1/memory/consolidate/status — returns last_pass, cost_today_usd, cost_cap_usd (CONSOLIDATION_COST_CAP_USD env), pass_count_month with automatic daily/monthly resets - CONSOLIDATION_LLM_API_KEY falls back to OPENAI_API_KEY; model from CONSOLIDATION_LLM_MODEL (default gpt-4o-mini)
Gateway (hub/gateway/): - server.mjs: proxy both routes; runBillingGate on POST consolidate - billing-middleware.mjs: operationFromRequest identifies consolidation; free-tier (cap=0) blocked with 402 CONSOLIDATION_NOT_AVAILABLE before tryDeduct; monthly_consolidation_jobs_used incremented on success - billing-constants.mjs: CONSOLIDATION_PASSES_BY_TIER (free:0, plus:10, growth:30, pro:null, team:100); COST_CENTS.consolidation=5; COST_BREAKDOWN - billing-logic.mjs: monthly_consolidation_jobs_used, consolidation_last_pass_at, consolidation_interval_minutes in normalizeBillingUser + defaultUserRecord; effectiveMonthlyConsolidationPassesIncluded helper - billing-store.mjs: reset monthly_consolidation_jobs_used on period rollover - billing-http.mjs: consolidation fields in GET /api/v1/billing/summary
Core (lib/memory-consolidate.mjs): - opts.mm injection in consolidateMemory, runVerifyPass, runDiscoverPass (backward-compatible; callers that omit opts.mm get createMemoryManager as before)
Tests: 46 new tests across 2 files; full suite 995 passing, 0 failing
0 comments
muse hub commit comment sha256:16c302b24c487fa18a085789ad721f3d2d8c5b0a070c0bfc53e6f9fef32b64a4 --body "your comment"
No comments yet. Be the first to start the discussion.