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
feat(enterprise): enforce enterprise-only build access (#6806)
Ezra Ellette4d2f504c8a8d
diff --git a/apps/screenpipe-app-tauri/components/app-entitlement-gate.test.tsx b/apps/screenpipe-app-tauri/components/app-entitlement-gate.test.tsxindex a3119df2d..c1d96cbc2 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,32 @@ describe("AppEntitlementGate", () => {expect(mocks.stopScreenpipe).not.toHaveBeenCalled();});+ it("routes restricted enterprise members away even with a consumer subscription", () => {+ mocks.state.user = baseUser({+ app_entitled: true,+ cloud_subscribed: true,+ subscription_plan: "pro",+ enterprise_account: {+ org_name: "Bungalow",+ role: "member",+ requires_enterprise_app: true,+ restrict_consumer_build_access: true,+ },+ entitlement: {+ active: true,+ plan: "pro",+ source: "subscription",+ checked_at: minsAgo(1),+ features: { app: true, cloud: true },+ },+ });++ render(<AppEntitlementGate>{protectedApp}</AppEntitlementGate>);++ expect(screen.getByText(/enterprise app required/i)).toBeInTheDocument();+ expect(screen.queryByTestId("protected-app")).not.toBeInTheDocument();+ });+it.each(["pro_max", "pro_ultra"] as const)("does not route an enterprise workspace admin with a %s consumer plan away",(plan) => {diff --git a/apps/screenpipe-app-tauri/components/app-entitlement-gate.tsx b/apps/screenpipe-app-tauri/components/app-entitlement-gate.tsxindex 785c31c91..e043dab47 100644--- a/apps/screenpipe-app-tauri/components/app-entitlement-gate.tsx+++ b/apps/screenpipe-app-tauri/components/app-entitlement-gate.tsx@@ -247,8 +247,9 @@ export function AppEntitlementGate({!devBypass &&!isManagedDeployment &&Boolean(user?.token) &&- !hasConsumerSubscription &&- enterpriseAccount?.requires_enterprise_app === true;+ enterpriseAccount?.requires_enterprise_app === true &&+ (!hasConsumerSubscription ||+ enterpriseAccount.restrict_consumer_build_access === true);const shouldGateForEntitlement = shouldGateForUnknownConsumerPolicy;const shouldGate = isOnboardingRoute? false@@ -307,8 +308,7 @@ export function AppEntitlementGate({// Must follow the same precedence as the render branches below (and as// `gate_path`). Checking unknown-policy before enterprise-app reported// "plan_verification_required" for users who were actually looking at the- // "enterprise app required" screen — both flags are true at once, since an- // unknown plan is what clears hasConsumerAppSubscription in the first place.+ // "enterprise app required" screen — both flags can be true at once.reason: shouldGateForEnterpriseLogin? "enterprise_login_required": shouldGateForEnterpriseAppdiff --git a/apps/screenpipe-app-tauri/lib/app-entitlement.ts b/apps/screenpipe-app-tauri/lib/app-entitlement.tsindex ffb88a5ae..aaf8366a8 100644--- a/apps/screenpipe-app-tauri/lib/app-entitlement.ts+++ b/apps/screenpipe-app-tauri/lib/app-entitlement.ts@@ -52,6 +52,7 @@ export type AppEnterpriseAccount = {org_name?: string | null;role?: string | null;requires_enterprise_app?: boolean | null;+ restrict_consumer_build_access?: boolean | null;is_screenpipe_user?: boolean | null;};