From a0ff285bcd1599e85a278003db5c46944dc2f375 Mon Sep 17 00:00:00 2001 From: Roberto Date: Tue, 12 May 2026 07:39:36 +0200 Subject: [PATCH] feat(api): tier features for folder integration Add folder_max_files and folder_monthly_tokens to all four tier dicts in FEATURES, and add get_feature_value() helper to TierManager. Co-Authored-By: Claude Sonnet 4.6 --- app/billing/tier_manager.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/billing/tier_manager.py b/app/billing/tier_manager.py index 2491022..c09ce8d 100644 --- a/app/billing/tier_manager.py +++ b/app/billing/tier_manager.py @@ -29,6 +29,8 @@ FEATURES: dict[str, dict[str, Any]] = { "realtime_extraction": False, # batch queue (Phase 2) "relational_memory": False, # relational tier (Phase 3) — Pro+ "proactive_mining": False, # Power+ only (Phase 5) + "folder_max_files": 200, + "folder_monthly_tokens": 100_000, }, "pro": { "agents": -1, # unlimited @@ -41,6 +43,8 @@ FEATURES: dict[str, dict[str, Any]] = { "realtime_extraction": True, # fire-and-forget asyncio.create_task "relational_memory": True, # person/project predicates "proactive_mining": False, # Power+ only (Phase 5) + "folder_max_files": 5000, + "folder_monthly_tokens": 2_000_000, }, "power": { "agents": -1, @@ -53,6 +57,8 @@ FEATURES: dict[str, dict[str, Any]] = { "realtime_extraction": True, "relational_memory": True, # all predicates incl. custom "proactive_mining": True, # scheduled pattern mining (Phase 5) + "folder_max_files": -1, # unlimited + "folder_monthly_tokens": -1, # unlimited }, "team": { "agents": -1, @@ -65,6 +71,8 @@ FEATURES: dict[str, dict[str, Any]] = { "realtime_extraction": True, "relational_memory": True, # all predicates incl. custom "proactive_mining": True, # scheduled pattern mining (Phase 5) + "folder_max_files": -1, # unlimited + "folder_monthly_tokens": -1, # unlimited }, } @@ -123,6 +131,13 @@ class TierManager: ) raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=detail) + def get_feature_value(self, tier: BillingTier, feature: str) -> int: + """Return integer feature value for tier. -1 means unlimited.""" + value = FEATURES.get(tier, FEATURES["free"]).get(feature) + if not isinstance(value, int): + return 0 + return value + # ── Rate limiting ──────────────────────────────────────────────────── def get_rate_limit(self, tier: BillingTier) -> int: