YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(app): recognize Business capacity plans (#5735)
Louis Beaumont50dcd646b6c2
diff --git a/apps/screenpipe-app-tauri/components/app-entitlement-gate.test.tsx b/apps/screenpipe-app-tauri/components/app-entitlement-gate.test.tsxindex 6bfd405f0..979d1c965 100644--- a/apps/screenpipe-app-tauri/components/app-entitlement-gate.test.tsx+++ b/apps/screenpipe-app-tauri/components/app-entitlement-gate.test.tsx@@ -833,6 +833,37 @@ describe("AppEntitlementGate", () => {expect(mocks.stopScreenpipe).not.toHaveBeenCalled();});+ it.each(["pro_max", "pro_ultra"] as const)(+ "does not route an enterprise workspace admin with a %s consumer plan away",+ (plan) => {+ mocks.state.user = baseUser({+ app_entitled: true,+ cloud_subscribed: true,+ subscription_plan: plan,+ enterprise_account: {+ org_name: "Screenpipe",+ role: "admin",+ requires_enterprise_app: true,+ },+ entitlement: {+ active: true,+ plan,+ source: "manual",+ checked_at: minsAgo(1),+ features: { app: true, cloud: true, enterprise: false },+ },+ });++ render(<AppEntitlementGate>{protectedApp}</AppEntitlementGate>);++ expect(+ screen.queryByText(/enterprise app required/i),+ ).not.toBeInTheDocument();+ expect(screen.getByTestId("protected-app")).toBeInTheDocument();+ expect(mocks.stopScreenpipe).not.toHaveBeenCalled();+ },+ );+it("does not show the consumer-app warning inside the enterprise build", () => {mocks.enterprise.isManagedDeployment = true;mocks.state.user = baseUser({diff --git a/apps/screenpipe-app-tauri/lib/app-entitlement.test.ts b/apps/screenpipe-app-tauri/lib/app-entitlement.test.tsindex 7fe0f7f72..ae7a862e1 100644--- a/apps/screenpipe-app-tauri/lib/app-entitlement.test.ts+++ b/apps/screenpipe-app-tauri/lib/app-entitlement.test.ts@@ -285,6 +285,32 @@ describe("app entitlement", () => {).toBe(false);});+ it.each(["pro_max", "pro_ultra"] as const)(+ "recognizes %s as a consumer plan when the user also belongs to an enterprise workspace",+ (plan) => {+ const capacityUser = user({+ cloud_subscribed: true,+ app_entitled: true,+ subscription_plan: plan,+ entitlement: {+ active: true,+ plan,+ checked_at: "2026-06-05T11:00:00.000Z",+ source: "manual",+ features: { app: true, cloud: true, enterprise: false },+ },+ enterprise_account: {+ org_name: "Screenpipe",+ role: "admin",+ requires_enterprise_app: true,+ },+ });++ expect(getLocalPlanPolicy(capacityUser)).toBe("verified-paid");+ expect(hasConsumerAppSubscription(capacityUser)).toBe(true);+ },+ );+it("does not unlock new cloud features from stale entitlement data", () => {expect(hasCloudEntitlement(user({ cloud_subscribed: true, entitlement: null })),diff --git a/apps/screenpipe-app-tauri/lib/app-entitlement.ts b/apps/screenpipe-app-tauri/lib/app-entitlement.tsindex f23bd64fd..515b3d0eb 100644--- a/apps/screenpipe-app-tauri/lib/app-entitlement.ts+++ b/apps/screenpipe-app-tauri/lib/app-entitlement.ts@@ -9,6 +9,8 @@ export type AppEntitlementPlan =| "none"| "standard"| "pro"+ | "pro_max"+ | "pro_ultra"| "team"| "enterprise"| "lifetime";@@ -72,6 +74,8 @@ export const ENTERPRISE_DOWNLOAD_URL = screenpipeWebUrl("/api/download", "https:const VERIFIED_PAID_PLAN_IDS = new Set(["standard","pro",+ "pro_max",+ "pro_ultra","team","enterprise","lifetime",diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rsindex 3d64a5645..5a97f8986 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs@@ -1226,6 +1226,19 @@ fn entitlement_is_lifetime(entitlement: &serde_json::Value) -> bool {field("plan") == "lifetime" || field("source") == "lifetime"}+fn is_verified_paid_plan_id(plan: &str) -> bool {+ matches!(+ plan.trim().to_ascii_lowercase().as_str(),+ "standard"+ | "pro"+ | "pro_max"+ | "pro_ultra"+ | "team"+ | "enterprise"+ | "lifetime"+ )+}+fn entitlement_feature(entitlement: &serde_json::Value, feature: &str) -> bool {entitlement.get("features")@@ -1699,11 +1712,7 @@ impl SettingsStore {else {return false;};- let account_plan_is_paid = matches!(- account_plan.to_ascii_lowercase().as_str(),- "standard" | "pro" | "team" | "enterprise" | "lifetime"- );- if !account_plan_is_paid {+ if !is_verified_paid_plan_id(account_plan) {return false;}let Some(entitlement) = self.user.entitlement.as_ref() else {@@ -1720,11 +1729,7 @@ impl SettingsStore {else {return false;};- let entitlement_plan_is_paid = matches!(- entitlement_plan.to_ascii_lowercase().as_str(),- "standard" | "pro" | "team" | "enterprise" | "lifetime"- );- if !entitlement_plan_is_paid {+ if !is_verified_paid_plan_id(entitlement_plan) {return false;}if !account_plan.eq_ignore_ascii_case(entitlement_plan) {@@ -2494,6 +2499,31 @@ mod tests {assert!(!store.requires_enterprise_app_for_consumer());}+ #[test]+ fn business_capacity_plans_override_enterprise_app_requirement() {+ for plan in ["pro_max", "pro_ultra"] {+ let mut store = SettingsStore::default();+ store.user.id = Some("consumer_capacity_paid".to_string());+ store.user.app_entitled = Some(true);+ store.user.cloud_subscribed = Some(true);+ store.user.subscription_plan = Some(plan.to_string());+ store.user.enterprise_account = Some(json!({ "requires_enterprise_app": true }));+ store.user.entitlement = Some(json!({+ "active": true,+ "plan": plan,+ "source": "manual",+ "checked_at": chrono::Utc::now().to_rfc3339(),+ "features": { "app": true, "cloud": true, "enterprise": false }+ }));++ assert_eq!(store.local_plan_policy(), LocalPlanPolicy::VerifiedPaid);+ assert!(!store.restricts_paid_local_features());+ assert!(!store.requires_enterprise_app_for_consumer());+ let config = store.to_recording_config(std::path::PathBuf::from("/tmp/screenpipe"));+ assert_eq!(config.max_non_template_pipes, None);+ }+ }+#[test]fn screenpipe_cloud_falls_back_when_not_logged_in() {let mut store = SettingsStore::default();