refactor: remove the billing tier model (P0.1)

The community edition has no monetization (ADR-0001). Remove the tier
model (packages/shared/src/tiers.ts), the requireTier middleware and every
tier gate, GET/PATCH /api/tier and the trial start, and the Stripe
integration, which depends on the tier model.

Personal features a tier used to limit are open to everyone: unlimited
workspaces and connectors, every embedding provider including LiteLLM,
per-workspace costs, Approvals. The workspace session cap is one constant
(100). Team and enterprise surfaces are hidden instead of unlocked (team
dock zone, Settings Team/Enterprise/Plan tabs, workspace Team tab);
cloud sync reports unavailable, as it did for free users.

The sidecar ignores the tier keys in config.json but does not delete them:
both editions may still share ~/.waggle.

Web billing UI is deleted: plan cards, upgrade and trial modals, payment
success route, the KVARK sales block, tier 403 handling.
This commit is contained in:
shumeiko.it
2026-10-15 19:31:50 +02:00
parent 369d8269c1
commit fe2eb0f648
117 changed files with 342 additions and 6424 deletions

View File

@@ -13,13 +13,10 @@ import { PERSONAS } from '@/lib/personas';
import { motion, AnimatePresence, useDragControls } from 'framer-motion';
import { adapter } from '@/lib/adapter';
import { useWorkspaces } from '@/hooks/useWorkspaces';
import { useShell } from '@/providers/ShellContext';
import { canCreateWorkspaceAtTier } from '@/lib/workspace-limit';
import LockedFeature from '@/components/os/LockedFeature';
import { buildBreadcrumbs } from '@/lib/browse-breadcrumbs';
import { useFocusTrap } from '@/hooks/useFocusTrap';
import type { StorageType, WorkspaceTemplate, TemplateCategory } from '@/lib/types';
import { TIER_CAPABILITIES, type ConnectorDefinition } from '@waggle/shared';
import type { ConnectorDefinition } from '@waggle/shared';
/** Use native OS folder picker when running inside Tauri, falls back to custom browse modal. */
async function pickFolderNative(): Promise<string | null> {
@@ -729,12 +726,6 @@ function TemplateCreatorModal({ open, onClose, onCreated, availableConnectors, e
const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialogProps) => {
const { workspaces } = useWorkspaces();
const { billingTier } = useShell();
// Gate off the SAME canonical rule the server enforces (tiers.ts
// workspaceLimit), not the retired onboarding-complexity flag that blocked
// Solo at workspace #2 while the backend would have allowed unlimited. Client
// and server now agree by construction.
const canCreateWorkspace = canCreateWorkspaceAtTier(billingTier, workspaces.length);
const [name, setName] = useState('');
const [group, setGroup] = useState('Personal');
@@ -856,28 +847,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
if (!open) return null;
if (!canCreateWorkspace) {
return (
<AnimatePresence>
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}
className="fixed inset-0 z-[100] flex items-center justify-center" onClick={onClose}>
<div className="absolute inset-0 bg-black/50 backdrop-blur-sm" />
<motion.div initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.95 }}
className="relative w-full max-w-sm glass-strong rounded-2xl shadow-2xl overflow-hidden"
onClick={e => e.stopPropagation()}>
<div className="p-6">
{/* The gate now matches the server (tiers.ts workspaceLimit), so
the count is finally safe to quote: this paywall only fires once
a FREE user has actually reached the limit. */}
<LockedFeature featureName="Multiple Workspaces" upgradePrompt={`Upgrade for unlimited workspaces. The Free plan includes ${TIER_CAPABILITIES.FREE.workspaceLimit}.`} />
</div>
</motion.div>
</motion.div>
</AnimatePresence>
);
}
const virtualPath = defaultVirtualPath(name);
// Non-blocking dup-name warning: two "Research Hub"s are indistinguishable in