From fe2eb0f6489cd3a47f2739c245b3aecaa9569cd4 Mon Sep 17 00:00:00 2001 From: "shumeiko.it" Date: Thu, 15 Oct 2026 19:31:50 +0200 Subject: [PATCH] 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. --- apps/web/src/App.tsx | 8 +- apps/web/src/components/os/AppShell.tsx | 85 +--- .../components/os/EmbeddingRoutingCard.tsx | 15 +- apps/web/src/components/os/LockedFeature.tsx | 30 -- apps/web/src/components/os/Sidebar.tsx | 5 - apps/web/src/components/os/StatusBar.tsx | 24 +- .../components/os/apps/CapabilitiesApp.tsx | 29 +- apps/web/src/components/os/apps/MCPHubApp.tsx | 23 +- .../src/components/os/apps/MarketplaceApp.tsx | 4 +- .../components/os/apps/PaymentSuccessApp.tsx | 99 ---- .../src/components/os/apps/SettingsApp.tsx | 307 +----------- .../src/components/os/apps/TelemetryApp.tsx | 10 +- .../os/apps/WorkspaceDesktopApp.tsx | 111 +---- .../os/apps/mcp/AddCustomMcpForm.tsx | 10 +- .../os/apps/skills/SkillBuilder.tsx | 8 +- .../src/components/os/auth/ClerkAuthForm.tsx | 3 - .../src/components/os/auth/EnterpriseCTA.tsx | 24 - .../src/components/os/billing/PlanCards.tsx | 180 ------- .../components/os/overlays/CommandCenter.tsx | 33 +- .../os/overlays/CreateWorkspaceDialog.tsx | 33 +- .../os/overlays/TrialExpiredModal.tsx | 129 ----- .../components/os/overlays/UpgradeModal.tsx | 170 ------- .../os/overlays/onboarding/constants.ts | 9 +- .../os/settings/CoverageCompassCard.test.tsx | 15 - .../os/settings/CoverageCompassCard.tsx | 105 ---- apps/web/src/hooks/useBilling.ts | 156 ------ apps/web/src/hooks/useChat.ts | 9 +- apps/web/src/hooks/useOnboarding.ts | 3 +- apps/web/src/index.css | 2 +- apps/web/src/lib/adapter.authgate.test.ts | 54 +- apps/web/src/lib/adapter.startTrial.test.ts | 89 ---- apps/web/src/lib/adapter.ts | 147 +----- apps/web/src/lib/coach-marks-gate.ts | 3 +- apps/web/src/lib/command-catalog.test.ts | 10 +- apps/web/src/lib/command-catalog.ts | 31 +- apps/web/src/lib/dock-tiers.ts | 49 +- apps/web/src/lib/extension-catalog.ts | 4 +- apps/web/src/lib/install-store.test.ts | 14 +- apps/web/src/lib/install-store.ts | 8 - apps/web/src/lib/settings-tier-filter.test.ts | 81 ++- apps/web/src/lib/settings-tier-filter.ts | 22 +- apps/web/src/lib/tiers.test.ts | 208 -------- apps/web/src/lib/trial-expired-gate.test.ts | 127 ----- apps/web/src/lib/trial-expired-gate.ts | 121 ----- apps/web/src/lib/types.ts | 2 +- apps/web/src/lib/workspace-limit.test.ts | 31 -- apps/web/src/lib/workspace-limit.ts | 19 - apps/web/src/providers/InstallProvider.tsx | 15 +- apps/web/src/providers/ServiceProvider.tsx | 2 +- apps/web/src/providers/ShellContext.tsx | 104 +--- apps/web/src/routes/ApprovalsRoute.tsx | 3 - apps/web/src/routes/PaymentSuccessRoute.tsx | 13 - apps/web/src/routes/TeamRoute.tsx | 4 +- apps/web/src/routes/WorkspaceRoute.tsx | 4 +- apps/web/src/routes/index.ts | 2 - .../src/test/build-warning-hygiene.test.ts | 1 - .../src/test/embedding-routing-card.test.tsx | 36 +- apps/web/src/test/lane-hm-hero-morph.test.tsx | 2 - apps/web/src/test/p1a-chat-state.test.tsx | 2 +- apps/web/src/test/p1a-routes.test.ts | 14 +- .../src/test/p1b-authgate-surfaces.test.tsx | 168 +------ .../src/test/p7-b1-approvals-error.test.tsx | 2 +- .../src/test/phase3c-skill-builder.test.tsx | 10 +- apps/web/src/test/phase4b-mcp-hub.test.tsx | 28 +- apps/web/src/test/pr4-install-store.test.tsx | 16 +- .../web/src/test/pr5-settings-reskin.test.tsx | 14 +- apps/web/src/test/pr7a-billing.test.tsx | 179 ------- apps/web/src/test/pr7b-auth.test.tsx | 9 +- apps/web/src/test/settings-trust.test.tsx | 4 - .../src/test/shell-overlay-contracts.test.tsx | 31 +- .../src/test/sidebar-active-state.test.tsx | 1 - .../test/skill-row-verified-badge.test.tsx | 2 +- docs/oss/adr/0001-no-monetization.md | 11 +- packages/core/src/index.ts | 2 +- .../tests/embedding-provider-quota.test.ts | 272 ----------- packages/hive-mind-core/src/index.ts | 2 +- .../src/mind/embedding-provider.ts | 103 +--- .../server/src/local/command-interpret.ts | 23 +- packages/server/src/local/command-registry.ts | 26 +- packages/server/src/local/index.ts | 18 +- packages/server/src/local/routes/agents.ts | 8 +- packages/server/src/local/routes/command.ts | 2 - .../server/src/local/routes/connectors.ts | 48 -- packages/server/src/local/routes/cost.ts | 11 +- packages/server/src/local/routes/embedding.ts | 35 +- packages/server/src/local/routes/fleet.ts | 11 +- .../server/src/local/routes/marketplace.ts | 3 +- packages/server/src/local/routes/settings.ts | 161 +----- packages/server/src/local/routes/team.ts | 5 +- .../server/src/local/routes/workspaces.ts | 20 - .../server/src/local/security-middleware.ts | 17 +- packages/server/src/local/service.ts | 7 +- packages/server/src/local/tier-session-cap.ts | 7 - .../server/src/local/workspace-sessions.ts | 5 +- packages/server/src/middleware/assert-tier.ts | 63 --- packages/server/src/stripe/checkout.ts | 67 --- packages/server/src/stripe/index.ts | 140 ------ packages/server/src/stripe/portal.ts | 54 -- packages/server/src/stripe/sync.ts | 90 ---- packages/server/src/stripe/webhook.ts | 189 ------- ...tadir-tier.test.ts => d11-datadir.test.ts} | 45 +- .../tests/local/embedding-routing.test.ts | 18 +- packages/server/tests/local/fleet.test.ts | 6 +- .../tests/routes/connectors-tier.test.ts | 33 -- packages/server/tests/start-trial.test.ts | 369 -------------- packages/server/tests/stripe/checkout.test.ts | 160 ------ .../server/tests/stripe/smoke-e2e.test.ts | 291 ----------- packages/server/tests/stripe/status.test.ts | 42 -- packages/server/tests/stripe/sync.test.ts | 150 ------ packages/server/tests/stripe/webhook.test.ts | 460 ------------------ .../tests/tier-enforcement-matrix.test.ts | 181 ------- .../tests/unit/command-interpret.test.ts | 13 +- .../tests/unit/command-registry.test.ts | 12 - .../workspace-sessions-concurrency.test.ts | 7 +- packages/shared/src/command-intent.ts | 9 +- packages/shared/src/index.ts | 1 - packages/shared/src/tiers.ts | 244 ---------- 117 files changed, 342 insertions(+), 6424 deletions(-) delete mode 100644 apps/web/src/components/os/LockedFeature.tsx delete mode 100644 apps/web/src/components/os/apps/PaymentSuccessApp.tsx delete mode 100644 apps/web/src/components/os/auth/EnterpriseCTA.tsx delete mode 100644 apps/web/src/components/os/billing/PlanCards.tsx delete mode 100644 apps/web/src/components/os/overlays/TrialExpiredModal.tsx delete mode 100644 apps/web/src/components/os/overlays/UpgradeModal.tsx delete mode 100644 apps/web/src/components/os/settings/CoverageCompassCard.test.tsx delete mode 100644 apps/web/src/components/os/settings/CoverageCompassCard.tsx delete mode 100644 apps/web/src/hooks/useBilling.ts delete mode 100644 apps/web/src/lib/adapter.startTrial.test.ts delete mode 100644 apps/web/src/lib/tiers.test.ts delete mode 100644 apps/web/src/lib/trial-expired-gate.test.ts delete mode 100644 apps/web/src/lib/trial-expired-gate.ts delete mode 100644 apps/web/src/lib/workspace-limit.test.ts delete mode 100644 apps/web/src/lib/workspace-limit.ts delete mode 100644 apps/web/src/routes/PaymentSuccessRoute.tsx delete mode 100644 apps/web/src/test/pr7a-billing.test.tsx delete mode 100644 packages/core/tests/embedding-provider-quota.test.ts delete mode 100644 packages/server/src/local/tier-session-cap.ts delete mode 100644 packages/server/src/middleware/assert-tier.ts delete mode 100644 packages/server/src/stripe/checkout.ts delete mode 100644 packages/server/src/stripe/index.ts delete mode 100644 packages/server/src/stripe/portal.ts delete mode 100644 packages/server/src/stripe/sync.ts delete mode 100644 packages/server/src/stripe/webhook.ts rename packages/server/tests/{d11-datadir-tier.test.ts => d11-datadir.test.ts} (59%) delete mode 100644 packages/server/tests/routes/connectors-tier.test.ts delete mode 100644 packages/server/tests/start-trial.test.ts delete mode 100644 packages/server/tests/stripe/checkout.test.ts delete mode 100644 packages/server/tests/stripe/smoke-e2e.test.ts delete mode 100644 packages/server/tests/stripe/status.test.ts delete mode 100644 packages/server/tests/stripe/sync.test.ts delete mode 100644 packages/server/tests/stripe/webhook.test.ts delete mode 100644 packages/server/tests/tier-enforcement-matrix.test.ts delete mode 100644 packages/shared/src/tiers.ts diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index c6830dd..64c97bd 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -1,5 +1,5 @@ import { lazy, Suspense, useEffect, type ReactNode } from "react"; -import { BrowserRouter, Navigate, Route, Routes, useNavigate } from "react-router-dom"; +import { BrowserRouter, Route, Routes, useNavigate } from "react-router-dom"; import { Toaster as Sonner } from "@/components/ui/sonner"; import { Toaster } from "@/components/ui/toaster"; import { TooltipProvider } from "@/components/ui/tooltip"; @@ -39,7 +39,6 @@ const UsageRoute = lazy(() => import("@/routes/UsageRoute")); const BenchmarkRoute = lazy(() => import("@/routes/BenchmarkRoute")); const PlatformRoute = lazy(() => import("@/routes/PlatformRoute")); const WorkspacesRoute = lazy(() => import("@/routes/WorkspacesRoute")); -const PaymentSuccessRoute = lazy(() => import("@/routes/PaymentSuccessRoute")); const AuthRoute = lazy(() => import("@/routes/AuthRoute")); // Theme is now owned by ; the pre-paint apply lives in main.tsx @@ -153,7 +152,7 @@ const App = () => ( )} /> )} /> )} /> - {/* ── Team (route registered; nav tier-hidden below TEAMS, D5) ── */} + {/* ── Team (route registered; no nav entry — team mode is not shipped, ADR-0003) ── */} )} /> {/* ── System (§9.4: System surfaces nest under /settings/*) ── */} )} /> @@ -166,9 +165,6 @@ const App = () => ( {/* ── PR6a: ⌘K-only static surfaces ── */} )} /> )} /> - {/* ── PR7a: Stripe Checkout return URLs (checkout.ts:42-43) ── */} - )} /> - } /> {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> diff --git a/apps/web/src/components/os/AppShell.tsx b/apps/web/src/components/os/AppShell.tsx index 5b53169..765ead8 100644 --- a/apps/web/src/components/os/AppShell.tsx +++ b/apps/web/src/components/os/AppShell.tsx @@ -4,9 +4,9 @@ * Owns: BootScreen gate (FR #23 sequencing ported from the retired * pages/Index.tsx), the §3.3 window-state migration boot (one-shot, before the * first canvas render), onboarding takeover (§1.2 — wizard renders INSTEAD of - * nav+canvas), left nav (same getDockForTier/filterByBillingTier data the dock - * consumed, §1.3), StatusBar, global overlays (the old Desktop.tsx mount block - * relocated), the `waggle:open-app` shim (§2.3), the keep-alive ChatHost + * nav+canvas), left nav (same getDockForTier data the dock consumed, §1.3), + * StatusBar, global overlays (the old Desktop.tsx mount block relocated), + * the `waggle:open-app` shim (§2.3), the keep-alive ChatHost * (§4.2), and `` as the single canvas. * * Stage C (the flip): this IS the live shell — App.tsx mounts it as the `/` @@ -23,7 +23,6 @@ import StatusBar from './StatusBar'; import RouteTransition from './RouteTransition'; import Sidebar, { type SidebarNavItem } from './Sidebar'; import AppErrorBoundary from './ErrorBoundary'; -import UpgradeModal from './overlays/UpgradeModal'; import { adapter } from '@/lib/adapter'; import { stashDeepLink } from '@/lib/app-deeplink'; import { writeLoginBriefingDismissed, writeLoginBriefingLastDismissedAt, readLoginBriefingDismissed, readSkipBriefingParam } from '@/lib/login-briefing'; @@ -33,8 +32,7 @@ import { resolveReturningUserOnboarding, isOnboardingStatusKnownSync } from '@/h import { shouldShowCoachMarks, readOnboardedThisSession, readForceTour, clearForceTour } from '@/lib/coach-marks-gate'; import { matchNavRoute, queryString, routeFor, routeForSearchResult } from '@/lib/routes'; import { bootWindowStateMigration, indexLandingRoute } from '@/lib/window-state-migration'; -import { getDockForTier, BILLING_TIER_ORDER, type AppId, type DockEntry } from '@/lib/dock-tiers'; -import { TIER_LABELS } from '@waggle/shared'; +import { getDockForTier, type AppId, type DockEntry } from '@/lib/dock-tiers'; import { buildCommandCatalog, type CatalogCommand } from '@/lib/command-catalog'; import { ShellProvider, useShell } from '@/providers/ShellContext'; import { seedChat, useChatWidgetState } from '@/hooks/useChatWidgetState'; @@ -58,7 +56,6 @@ const OnboardingWizard = lazy(() => import('./overlays/OnboardingWizard')); const OnboardingTooltips = lazy(() => import('./overlays/OnboardingTooltips')); const LoginBriefing = lazy(() => import('./overlays/LoginBriefing')); const ContextRail = lazy(() => import('./overlays/ContextRail')); -const TrialExpiredModal = lazy(() => import('./overlays/TrialExpiredModal')); const deferredShellElement = (element: ReactNode) => ( {element} @@ -74,7 +71,7 @@ const deferredShellElement = (element: ReactNode) => ( */ const WORKSPACE_TAB_LABELS: Record = { overview: 'Overview', chat: 'Chat', memory: 'Memory', - artifacts: 'Artifacts', files: 'Files', team: 'Team', tasks: 'Tasks', + artifacts: 'Artifacts', files: 'Files', tasks: 'Tasks', }; /** Flatten zone-parents so nav active-state/title lookups see every app entry. */ @@ -124,7 +121,7 @@ const ShellLayout = () => { workspaces, activeWorkspace, activeWorkspaceId, selectWorkspace, createWorkspace, patchWorkspace, refreshWorkspaces, workspacesError, workspacesLoading, - currentTier, billingTier, trialInfo, refreshTier, showTrialExpired, setShowTrialExpired, + currentTier, notifications, unreadCount, markRead, markAllRead, onboardingState, updateOnboarding, completeOnboarding, offline, agentStatus, @@ -197,9 +194,6 @@ const ShellLayout = () => { // call can race the session-token attach and 401 → name:null. Falls back to // "Account" in the row when unconfigured. const [userName, setUserName] = useState(null); - // F5: the UpgradeModal self-opens on a window event, so the shell can't see - // its open state without this. Feeds `anyModalOpen` so coach-marks hide under it. - const [upgradeOpen, setUpgradeOpen] = useState(false); useEffect(() => { let cancelled = false; const loadIdentity = () => { @@ -299,10 +293,7 @@ const ShellLayout = () => { // Onboarding completion handlers (relocated from Desktop.tsx:290-313). const handleOnboardingComplete = useCallback((_serverBaseUrl: string) => { completeOnboarding(); - // Atomic start. 409 (trial already started) is fine — refresh state - // either way so the StatusBar countdown picks up the existing timestamp. - adapter.startTrial().then(refreshTier).catch(refreshTier); - }, [completeOnboarding, refreshTier]); + }, [completeOnboarding]); const handleOnboardingFinish = useCallback((workspaceId: string, workspaceName: string, firstMessage?: string, personaId?: string) => { selectWorkspace(workspaceId); @@ -332,7 +323,7 @@ const ShellLayout = () => { // everything else lives one keystroke away in ⌘K. The StatusBar breadcrumb // still derives from the full dock route table — every route is now reachable // via ⌘K regardless of tier, so the label map must cover them all. - const labelEntries = useMemo(() => flattenAppEntries(getDockForTier('power', billingTier)), [billingTier]); + const labelEntries = useMemo(() => flattenAppEntries(getDockForTier('power')), []); const activeRoute = useMemo( () => matchNavRoute(location.pathname, labelEntries.map(e => e.route).filter((r): r is string => !!r)), [location.pathname, labelEntries], @@ -385,7 +376,6 @@ const ShellLayout = () => { // Agents & tasks badge surfaces unacknowledged coordination signals for now; // PR3 refines it to the real pending-approvals/tasks count. const isPro = currentTier === 'power' || currentTier === 'admin'; - const billingRank = BILLING_TIER_ORDER[billingTier] ?? 0; const spine: SidebarNavItem[] = useMemo(() => [ { key: 'home', label: 'Home', icon: Home, to: '/home', match: ['/home'] }, // Chat resolves to the active workspace's chat tab; with no real workspace, @@ -407,27 +397,17 @@ const ShellLayout = () => { ], [effectiveActiveWorkspaceId, navigateToActiveChat, waggleUnacknowledged]); const pinned: SidebarNavItem[] = useMemo(() => { if (!isPro) return []; - const items: SidebarNavItem[] = [ + return [ { key: 'swarm', label: 'Agent swarm', icon: Network, to: '/waggle-dance', match: ['/waggle-dance'] }, { key: 'connectors', label: 'Connectors', icon: Plug, to: '/connectors', match: ['/connectors'] }, + { key: 'approvals', label: 'Approvals', icon: Shield, to: '/approvals', match: ['/approvals'] }, ]; - // Approvals is a TEAMS-tier surface (parity with dock-tiers minBillingTier). - if (billingRank >= BILLING_TIER_ORDER.TEAMS) items.push({ key: 'approvals', label: 'Approvals', icon: Shield, to: '/approvals', match: ['/approvals'] }); - return items; - }, [isPro, billingRank]); - - // Plan label for the user row (e.g. "Trial · 9d", "Solo", "Team"). - const tierLabel = useMemo(() => { - if (billingTier === 'TRIAL' || (trialInfo.trialDaysRemaining > 0 && !trialInfo.trialExpired)) { - return trialInfo.trialDaysRemaining > 0 ? `Trial · ${trialInfo.trialDaysRemaining}d` : 'Trial'; - } - return TIER_LABELS[billingTier]; - }, [billingTier, trialInfo.trialDaysRemaining, trialInfo.trialExpired]); + }, [isPro]); // ⌘K curated catalog (Jump to / Do / Power tools + Pro "Pinned") → real routes. const commandCatalog = useMemo( - () => buildCommandCatalog({ chatHref: routeFor('chat', { activeWorkspaceId: effectiveActiveWorkspaceId }), isPro, billingRank }), - [effectiveActiveWorkspaceId, isPro, billingRank], + () => buildCommandCatalog({ chatHref: routeFor('chat', { activeWorkspaceId: effectiveActiveWorkspaceId }), isPro }), + [effectiveActiveWorkspaceId, isPro], ); const handleCatalogSelect = useCallback((cmd: CatalogCommand) => { if (cmd.action === 'spawn') { ov.setShowSpawnAgent(true); return; } @@ -455,12 +435,11 @@ const ShellLayout = () => { } // F5: any shell overlay open ⇒ suppress the coach-mark carousel (hide-but-keep - // tour state, per OnboardingTooltips' `suppressed` contract). Includes the - // event-driven UpgradeModal (via upgradeOpen) and the trial paywall. + // tour state, per OnboardingTooltips' `suppressed` contract). const anyModalOpen = ov.showGlobalSearch || ov.showCreateWorkspace || ov.showPersonaSwitcher || ov.showWorkspaceSwitcher || ov.showNotifications || ov.showKeyboardHelp || - ov.showSpawnAgent || showTrialExpired || upgradeOpen; + ov.showSpawnAgent; return (
@@ -475,7 +454,6 @@ const ShellLayout = () => { model={effectiveActiveWorkspace?.model ?? (agentStatus.model !== 'unknown' ? agentStatus.model : undefined)} tokensUsed={agentStatus.tokensUsed} costUsd={agentStatus.costUsd} offline={offline} unreadNotifications={unreadCount} - trialDaysRemaining={trialInfo.trialDaysRemaining} trialExpired={trialInfo.trialExpired} onSearchClick={() => ov.setShowGlobalSearch(true)} onNotificationClick={ov.toggleNotifications} />
@@ -489,7 +467,6 @@ const ShellLayout = () => { onOpenCommand={() => ov.setShowGlobalSearch(true)} onSpawnAgent={() => ov.setShowSpawnAgent(true)} userName={userName} - tierLabel={tierLabel} /> {/* Single canvas (§2.1 rule 1). Route wrappers bring their own @@ -616,38 +593,6 @@ const ShellLayout = () => { {contextRailTarget && deferredShellElement( setContextRailTarget(null)} /> )} - - { - adapter.startTrial().then(refreshTier).catch(refreshTier); - }} - onUpgrade={(tier) => { - // PR7a: navigate to hosted Stripe Checkout (the URL was previously - // discarded — a dead happy path). Same-tab assign rather than a deferred - // window.open: the open happens after an awaited round-trip, outside the - // user-gesture window, so a popup blocker / Tauri WebView could swallow it. - // Hosted Checkout redirects back to /payment-success on completion. - adapter.createCheckoutSession(tier) - .then(({ url }) => { if (url) window.location.assign(url); }) - .catch(() => { navigate('/settings?tab=billing'); }); - }} - /> - - {showTrialExpired && deferredShellElement( - setShowTrialExpired(false)} - onUpgrade={(tier) => { - setShowTrialExpired(false); - // PR7a: same-tab navigate to hosted Checkout (avoids the deferred-popup - // blocker; redirects back to /payment-success). Plan-tab fallback on failure. - adapter.createCheckoutSession(tier) - .then(({ url }) => { if (url) window.location.assign(url); }) - .catch(() => { navigate('/settings?tab=billing'); }); - }} - /> - )}
); }; diff --git a/apps/web/src/components/os/EmbeddingRoutingCard.tsx b/apps/web/src/components/os/EmbeddingRoutingCard.tsx index ec3de2e..fbf6e2e 100644 --- a/apps/web/src/components/os/EmbeddingRoutingCard.tsx +++ b/apps/web/src/components/os/EmbeddingRoutingCard.tsx @@ -2,8 +2,8 @@ * EmbeddingRoutingCard — pick the memory embedding provider (steal #10). * * Sits under ModelPilotCard in Settings › Models. Mirrors ModelPilotCard's Hive DS - * styling and key-gating pattern. The picker offers `auto` + the tier-allowed - * providers; voyage/openai are disabled when their vault key is missing. A live + * styling and key-gating pattern. The picker offers `auto` + every selectable + * provider; voyage/openai are disabled when their vault key is missing. A live * badge shows what is actually running; a Reprobe button re-runs the probe (useful * after installing Ollama or adding a key). Because the live embedder is fixed at * boot, an explicit switch shows a "restart to apply" hint honestly. @@ -13,14 +13,11 @@ import { useState, useEffect, useCallback } from 'react'; import { Boxes, RotateCw, Info, AlertTriangle } from 'lucide-react'; import { adapter, AdapterHttpError, type EmbeddingRoutingStatus } from '@/lib/adapter'; import type { Provider } from '@/hooks/useProviders'; -import { TIER_CAPABILITIES, type Tier } from '@waggle/shared'; import { HintTooltip } from '@/components/ui/hint-tooltip'; interface EmbeddingRoutingCardProps { /** For voyage/openai key-gating (mirrors ModelPilotCard). */ providers: Provider[]; - /** Gates which providers the tier may select. */ - tier: Tier; } /** Display order for the picker; 'mock' is never user-selectable. */ @@ -36,7 +33,7 @@ const PROVIDER_LABELS: Record = { mock: 'Mock (no semantics)', }; -const EmbeddingRoutingCard = ({ providers, tier }: EmbeddingRoutingCardProps) => { +const EmbeddingRoutingCard = ({ providers }: EmbeddingRoutingCardProps) => { const [status, setStatus] = useState(null); const [loading, setLoading] = useState(true); const [busy, setBusy] = useState(false); @@ -56,10 +53,6 @@ const EmbeddingRoutingCard = ({ providers, tier }: EmbeddingRoutingCardProps) => useEffect(() => { void load(); }, [load]); - // Tier-allowed providers (+ always 'auto'), in display order, minus 'mock'. - const allowed = new Set(TIER_CAPABILITIES[tier].embeddingProviders as readonly string[]); - const options = PROVIDER_ORDER.filter(p => p === 'auto' || (p !== ('mock' as string) && allowed.has(p))); - /** True when a cloud provider's key is missing (disable + hint). */ const keyMissing = (id: string): boolean => { if (id === 'openai') { @@ -182,7 +175,7 @@ const EmbeddingRoutingCard = ({ providers, tier }: EmbeddingRoutingCardProps) => onChange={(e) => void handleChange(e.target.value)} className="w-full bg-muted/50 border border-border/30 rounded-lg px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/30 disabled:opacity-50" > - {options.map(p => { + {PROVIDER_ORDER.map(p => { const missing = keyMissing(p); return (
- {trialDays !== undefined && trialDays > 0 && ( - - Trial: {trialDays}d left - - )} - {trialExpired && ( - /* R9 Lane D: the amber pill "screamed" on every screen for a benign - steady state (you're on the free Solo plan). Demoted to a quiet - neutral text-chip — still a button that routes to plans. */ - - )} -
- ) : isPaid ? ( - /* Confirmation off the SYNCED tier — no receipt rows (F5) */ - <> -
- -
-

- You’re {TIER_HEADLINE[billing.tier] ?? billing.tier}. -

-

- Your hive just leveled up — shared team memory, cross-device sync, and governance are live. -

-
- - -
- - ) : ( - /* Synced but not on a paid tier (cancelled / unpaid) — honest, no fake success */ -
-

Nothing to confirm

-

- We didn’t detect a completed checkout. If you just paid, give it a moment and refresh. -

- -
- )} - - - ); -} diff --git a/apps/web/src/components/os/apps/SettingsApp.tsx b/apps/web/src/components/os/apps/SettingsApp.tsx index 2ce5eee..a1b7b23 100644 --- a/apps/web/src/components/os/apps/SettingsApp.tsx +++ b/apps/web/src/components/os/apps/SettingsApp.tsx @@ -1,15 +1,11 @@ import { useEffect, useRef, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; import { - Cpu, Shield, Palette, Save, Loader2, Users, Database, - Download, Upload, Link2, Building, Wrench, DollarSign, Key, Lock, BarChart3, Trash2, + Cpu, Shield, Palette, Save, Loader2, Database, + Download, Upload, Wrench, DollarSign, Key, Lock, BarChart3, Trash2, RotateCcw, GraduationCap, HelpCircle, AlertTriangle, MessageCircle, } from 'lucide-react'; -import PlanCards from '@/components/os/billing/PlanCards'; import { useToast } from '@/hooks/use-toast'; -import { useBilling } from '@/hooks/useBilling'; -import { parseTier, tierSatisfies, TIER_LABELS, type Tier } from '@waggle/shared'; -import LockedFeature from '@/components/os/LockedFeature'; import { adapter } from '@/lib/adapter'; import { Input } from '@/components/ui/input'; import { HintTooltip } from '@/components/ui/hint-tooltip'; @@ -35,13 +31,12 @@ import { ModelGate } from '@/components/os/model-gate/ModelGate'; import EraseDataDialog from '@/components/os/overlays/EraseDataDialog'; import TelegramDigestCard from '@/components/os/settings/TelegramDigestCard'; import ChannelsSettings from '@/components/os/settings/ChannelsSettings'; -import CoverageCompassCard from '@/components/os/settings/CoverageCompassCard'; import BrowserCompanionSettings from '@/components/os/settings/BrowserCompanionSettings'; import { AVAILABLE_SHAPES, useSelectedShape, type PromptShape } from '@/lib/shape-selection'; import { SectionLabel } from '@/components/os/warm'; import { ApprovalModal, type ApprovalRequest } from '@/components/ui/approval-modal'; -type SettingsTab = 'general' | 'models' | 'billing' | 'permissions' | 'channels' | 'team' | 'backup' | 'enterprise' | 'advanced'; +type SettingsTab = 'general' | 'models' | 'permissions' | 'channels' | 'backup' | 'advanced'; type SettingsApproval = | { kind: 'clear-telemetry' } | { kind: 'restore-backup'; file: File }; @@ -50,12 +45,9 @@ type BackupStatus = { tone: 'success' | 'error'; message: string }; const tabs: { id: SettingsTab; label: string; icon: React.ElementType }[] = [ { id: 'general', label: 'General', icon: Palette }, { id: 'models', label: 'Models', icon: Cpu }, - { id: 'billing', label: 'Plan', icon: DollarSign }, { id: 'permissions', label: 'Permissions', icon: Shield }, { id: 'channels', label: 'Channels', icon: MessageCircle }, - { id: 'team', label: 'Team', icon: Users }, { id: 'backup', label: 'Backup', icon: Database }, - { id: 'enterprise', label: 'Enterprise', icon: Building }, { id: 'advanced', label: 'Advanced', icon: Wrench }, ]; @@ -118,13 +110,11 @@ const SettingsApp = () => { } }, [activeTab]); - // PR7a/D12: `?tab=` deep-link reader. Upgrade entry points route to - // `/settings?tab=billing`; this also fixes the pre-existing `?tab=backup` - // deep-link (routes.ts:52) that opened Models because there was no reader. - // Snaps to a KNOWN tab, respecting the tier filter (e.g. an Essential user - // deep-linked to `advanced` falls back to general, never a half-shipped tab). + // PR7a/D12: `?tab=` deep-link reader. This also fixes the pre-existing + // `?tab=backup` deep-link (routes.ts:52) that opened Models because there was + // no reader. Snaps to a KNOWN tab, respecting the tier filter (e.g. an Essential + // user deep-linked to `advanced` falls back to general, never a half-shipped tab). const [searchParams] = useSearchParams(); - const checkoutCancelled = searchParams.get('checkout') === 'cancelled'; useEffect(() => { const tabParam = searchParams.get('tab'); if (!tabParam || !tabs.some(t => t.id === tabParam)) return; @@ -135,20 +125,6 @@ const SettingsApp = () => { const { toast } = useToast(); const [showWizardReplayConfirm, setShowWizardReplayConfirm] = useState(false); - // Billing - const billing = useBilling(); - - // Tier gating — canonical resolution off the billing tier (never null: a - // legacy/unknown value falls back to Solo/FREE, never locking a user out). - const tier: Tier = parseTier(billing.tier) ?? 'FREE'; - const isTeamLocked = !tierSatisfies(tier, 'TEAMS'); - const isEnterpriseLocked = !tierSatisfies(tier, 'ENTERPRISE'); - - const LOCKED_TABS: Partial> = { - ...(isTeamLocked ? { team: { feature: 'team', label: 'Team Management', prompt: 'Upgrade to Team for shared workspaces and governance' } } : {}), - ...(isEnterpriseLocked ? { enterprise: { feature: 'enterprise', label: 'Enterprise Features', prompt: 'Enterprise feature — contact sales for audit trail, compliance, and governance' } } : {}), - }; - // P4: permissions state. `defaultAutonomy` replaces the old yoloMode // binary — it's the inherited level new chat windows start at. Per-window // overrides in Chat's AutonomyPicker always beat this. @@ -161,16 +137,6 @@ const SettingsApp = () => { // focus-visible, testable confirm row. const [pendingYolo, setPendingYolo] = useState(false); - // Team state - const [teamUrl, setTeamUrl] = useState(''); - const [teamToken, setTeamToken] = useState(''); - const [teamConnected, setTeamConnected] = useState(false); - const [teamConnecting, setTeamConnecting] = useState(false); - - // KVARK state - const [kvarkUrl, setKvarkUrl] = useState(''); - const [kvarkToken, setKvarkToken] = useState(''); - // M2-7: Telemetry state const [telemetryEnabled, setTelemetryEnabled] = useState(false); // Phase 4.1: GDPR Art. 17 erasure flow. Visible at all tiers — erasure @@ -198,7 +164,7 @@ const SettingsApp = () => { // Load settings useEffect(() => { - adapter.getSettings().then((s: { defaultModel?: string; model?: string; dailyBudget?: number; tier?: string; fallbackModel?: string; budgetModel?: string; budgetThreshold?: number }) => { + adapter.getSettings().then((s: { defaultModel?: string; model?: string; dailyBudget?: number; fallbackModel?: string; budgetModel?: string; budgetThreshold?: number }) => { setDefaultModel(s.defaultModel ?? s.model ?? ''); setFallbackModel(s.fallbackModel ?? null); setBudgetModel(s.budgetModel ?? null); @@ -213,11 +179,9 @@ const SettingsApp = () => { setExternalGates(p.externalGates); }).catch(() => {}); - adapter.getTeamStatus().then(s => setTeamConnected(s.connected)).catch(() => {}); - // M2-7: Load telemetry status. P7/D15 B5: this was the ONE loader missing a // .catch — a getTelemetryStatus rejection became an unhandled promise - // rejection (its three siblings above all swallow). Match the local pattern. + // rejection (its siblings above all swallow). Match the local pattern. adapter.getTelemetryStatus().then(s => { setTelemetryEnabled(s.enabled); setTelemetryCount(s.totalEvents); @@ -347,7 +311,6 @@ const SettingsApp = () => {
{visibleTabs.map(tab => { - const locked = LOCKED_TABS[tab.id]; return ( ); })} @@ -429,33 +391,13 @@ const SettingsApp = () => {

General

- {/* Tier. P1b D3-4: single-sourced from the resolved billing state - (was a separate getSettings-fed copy that defaulted to 'FREE' - on failure and could disagree with the Billing tab). Unresolved - renders a neutral placeholder, never 'FREE plan' as fact. */} -
-
-
-

Tier

-

- {billing.tierResolved ? `${TIER_LABELS[tier]} plan` : 'Confirming plan…'} -

-
- - {billing.tierResolved ? TIER_LABELS[tier] : '…'} - -
-
- - {/* PR5 D10 — local-first reassurance + the dock/plan distinction. The - disclosure selector that used to live here is now the "Show" - control in the settings content header (R10; D6/Wave P); QW-5's - "dock tier ≠ billing plan" note is preserved here so the - distinction isn't lost. */} + {/* PR5 D10 — local-first reassurance. The disclosure selector that + used to live here is now the "Show" control in the settings + content header (R10; D6/Wave P). */}

Local-first

- Waggle runs on your machine — your memory and data stay local, always. The Show control (top-right of Settings) sets how much of the app and these settings you see; it’s independent of your Solo/Team plan, and every app stays reachable via Ctrl+K. + Waggle runs on your machine — your memory and data stay local, always. The Show control (top-right of Settings) sets how much of the app and these settings you see; every app stays reachable via Ctrl+K.

@@ -594,7 +536,7 @@ const SettingsApp = () => { }} /> - + Model Configuration @@ -680,150 +622,6 @@ const SettingsApp = () => {
)} - {/* ═══ BILLING (PR7a — screen 14, themed over the REAL useBilling→Stripe flow) ═══ */} - {activeTab === 'billing' && ( -
-
-

Plan & Subscription

- {/* §14 load-bearing positioning copy — honestly satisfiable under the - ratified Option A (BYO-key + flat subscription): Teams unlock - scale, never feature-count paywalls on memory. */} -

- Memory is free forever. You only pay for scale — no feature-count games. -

-
- - {/* F4 from the 2026-05-28 addictiveness audit — visible value-prop - framing so users see they're replacing 7-ish subscription tools, - not adding an 8th. */} - {checkoutCancelled && ( -
-
- )} - - - - {/* Current tier badge. F7: while the tier is unresolved (boot race / - sidecar down) render an explicit unresolved state — NEVER the - default 'FREE' as fact. */} - {!billing.tierResolved ? ( -
-
-
-

Current Plan

-

- {billing.error ? 'Couldn’t reach the server to confirm your plan — retrying automatically.' : 'Confirming your plan…'} -

-
- … -
-
- ) : ( -
-
-
-

Current Plan

-

- {billing.tier === 'FREE' && 'Solo — every individual feature, free forever'} - {billing.tier === 'TRIAL' && 'Trial — 15 days of Team features, then Solo'} - {billing.tier === 'TEAMS' && '$49/mo per seat — shared workspaces, WaggleDance, governance'} - {billing.tier === 'ENTERPRISE' && 'Enterprise — KVARK sovereign deployment'} -

-
- - {TIER_LABELS[tier]} - -
-
- )} - - {/* Error display (F8 — honest, e.g. STRIPE_NOT_CONFIGURED 503; never a fake subscribe) */} - {billing.error && ( -
-

{billing.error}

-
- )} - - {/* Syncing indicator */} - {billing.syncing && ( -
- -

Confirming your payment...

-
- )} - - {/* Plans grid — tiers that still have an upgrade path (FREE/TRIAL, plus legacy PRO). - Choosing a plan hands off to hosted Stripe Checkout (D5); the - Monthly/Annual toggle resolves the REAL annual price (D8/F9), not - a cosmetic client discount. Only on a RESOLVED tier (F7). */} - {billing.tierResolved && (billing.tier === 'FREE' || billing.tier === 'TRIAL' || billing.tier === 'PRO') && ( - billing.startCheckout(tier, period)} - disabled={!billing.checkoutAvailable} - /> - )} - - {/* Manage — paid tiers. Hosted Stripe Customer Portal launchpad (D6). - The mock's invoice list / "VISA ···4242" / next-charge date are - GATED OFF (F2/F3/F4) — there is no data source; the Portal is the - real surface for payment method, invoices, plan change, cancel. */} - {billing.tierResolved && (billing.tier === 'PRO' || billing.tier === 'TEAMS') && ( -
-
-
-

Waggle {billing.tier === 'PRO' ? 'Pro (legacy)' : 'Team'}

-

Subscription managed securely via Stripe.

-
- ● Active -
-
- -

- Update payment method, view invoices, switch to annual, or cancel — all via the Stripe customer portal. -

-
-
- )} - - {/* Enterprise CTA — the KVARK funnel. Only on a RESOLVED tier (F7). */} - {billing.tierResolved && billing.tier !== 'ENTERPRISE' && ( -
-

Enterprise

-

- Need sovereign deployment, audit trail, and KVARK integration? -

- - Contact sales at kvark.ai - -
- )} -
- )} - {/* ═══ PERMISSIONS ═══ */} {activeTab === 'permissions' && (
@@ -949,56 +747,6 @@ const SettingsApp = () => { {/* ═══ CHANNELS ═══ */} {activeTab === 'channels' && } - {/* ═══ TEAM ═══ */} - {activeTab === 'team' && LOCKED_TABS.team && ( - - )} - {activeTab === 'team' && !LOCKED_TABS.team && ( -
-

Team Server

-
-
-
- {teamConnected ? 'Connected' : 'Disconnected'} -
- {!teamConnected && ( -
-

Connecting to a team server will share workspace data. Ensure you trust the server.

-
- )} -
- - setTeamUrl(e.target.value)} placeholder="https://team.waggle.ai" - className="w-full bg-muted/50 h-auto py-1.5" /> -
-
- - setTeamToken(e.target.value)} - className="w-full bg-muted/50 h-auto py-1.5" /> -
-
- {!teamConnected ? ( - - ) : ( - - )} -
-
-
- )} - {/* ═══ BACKUP ═══ */} {activeTab === 'backup' && (
@@ -1070,33 +818,6 @@ const SettingsApp = () => {
)} - {/* ═══ ENTERPRISE ═══ */} - {activeTab === 'enterprise' && LOCKED_TABS.enterprise && ( - - )} - {activeTab === 'enterprise' && !LOCKED_TABS.enterprise && ( -
-

Enterprise (KVARK)

-

Connect to KVARK for enterprise document retrieval, compliance, and governance features.

-
-
- - setKvarkUrl(e.target.value)} placeholder="https://kvark.company.com" - className="w-full bg-muted/50 h-auto py-1.5" /> -
-
- - setKvarkToken(e.target.value)} - className="w-full bg-muted/50 h-auto py-1.5" /> -
- -

Requires Enterprise tier. Contact sales for access.

-
-
- )} - {/* ═══ ADVANCED ═══ */} {activeTab === 'advanced' && (
diff --git a/apps/web/src/components/os/apps/TelemetryApp.tsx b/apps/web/src/components/os/apps/TelemetryApp.tsx index 342a9d3..2137c5e 100644 --- a/apps/web/src/components/os/apps/TelemetryApp.tsx +++ b/apps/web/src/components/os/apps/TelemetryApp.tsx @@ -49,16 +49,16 @@ const TelemetryApp = () => { const load = useCallback(async () => { try { - // /api/cost/summary is free for all tiers (P22) and carries byModel + budget. - // /api/cost/by-workspace is TEAMS-gated; tolerate its absence (object OR []). + // /api/cost/summary carries byModel + budget; /api/cost/by-workspace the + // per-workspace split. Tolerate a by-workspace failure (object OR []). const [summaryRes, costRes, statsRes] = await Promise.all([ adapter.fetch('/api/cost/summary').then(r => r.json()).catch(() => null), adapter.fetch('/api/cost/by-workspace').then(r => r.json()).catch(() => null), adapter.fetch('/api/events/stats').then(r => r.json()).catch(() => ({})), ]); - // by-workspace returns { workspaces, totalCost } (TEAMS) — older callers - // expected a bare array; accept both, default to empty when gated off. + // by-workspace returns { workspaces, totalCost } — older callers + // expected a bare array; accept both, default to empty on failure. const wsRows: Array> = Array.isArray(costRes) ? costRes : Array.isArray(costRes?.workspaces) ? costRes.workspaces : []; @@ -267,7 +267,7 @@ const TelemetryApp = () => {
)} - {/* By workspace (TEAMS) */} + {/* By workspace */} {data.byWorkspace.length > 0 && (

By workspace

diff --git a/apps/web/src/components/os/apps/WorkspaceDesktopApp.tsx b/apps/web/src/components/os/apps/WorkspaceDesktopApp.tsx index 20ee2af..df7a70c 100644 --- a/apps/web/src/components/os/apps/WorkspaceDesktopApp.tsx +++ b/apps/web/src/components/os/apps/WorkspaceDesktopApp.tsx @@ -21,7 +21,7 @@ * └──────────────────────────────────────┴───────────────────────┘ * * Reuse: consumes adapter.getWorkspaceState / getWorkspaceContext / - * getWorkspaceActivity / getTeamMembers (the Phase-1 contract surface) and + * getWorkspaceActivity (the Phase-1 contract surface) and * useRoomState for the live agents-running indicator. Other tabs (Chat, * Memory, Timeline, Settings, Research, Artifacts) are integrator-embedded; * this shell owns the header, tab routing, Overview canvas, and right panel. @@ -34,14 +34,12 @@ import { useState, useEffect, useMemo, useCallback, useRef } from 'react'; import { motion, useReducedMotion } from 'framer-motion'; import { LayoutGrid, MessageSquare, FileBox, Brain, - Users, WifiOff, ShieldAlert, ChevronRight, + WifiOff, ShieldAlert, ChevronRight, FileText, SearchX, RefreshCw, } from 'lucide-react'; -import { tierSatisfies, TIER_LABELS } from '@waggle/shared'; import { adapter } from '@/lib/adapter'; import { SPRING } from '@/lib/motion/tokens'; import { workspaceHeroAvatarId, workspaceHeroNameId, heroMorphEnabled } from '@/lib/motion/hero-morph'; -import { useShell } from '@/providers/ShellContext'; import { useRoomState } from '@/hooks/useRoomState'; import { useRevalidateOnError } from '@/hooks/useRevalidateOnError'; import MemoryCenterTab from './memory/MemoryCenterTab'; @@ -60,13 +58,13 @@ import type { // The 8 PRD §12.2 tabs (Settings included). The shell renders Overview // itself; the other tabs are embedded by the integrator (Chat / Memory / // Timeline / Settings have hosts; Research / Artifacts are interim panels). -// Warm-Hive (SCREENS §03): the calm 6-tab bar. `tasks` stays a valid id (so +// Warm-Hive (SCREENS §03): the calm 5-tab bar. `tasks` stays a valid id (so // /workspaces/:id/tasks still deep-links the full TasksTab + the Overview "Up // next" card can route to it) but is NOT shown in the bar — Research / Timeline // / Settings are dropped (their URLs fall back to Overview, see WorkspaceRoute). export type WorkspaceTabId = | 'overview' | 'chat' | 'memory' | 'artifacts' - | 'files' | 'team' | 'tasks'; + | 'files' | 'tasks'; interface WorkspaceTabDef { id: WorkspaceTabId; @@ -80,17 +78,8 @@ const TABS: readonly WorkspaceTabDef[] = [ { id: 'memory', label: 'Memory', icon: Brain }, { id: 'artifacts', label: 'Artifacts', icon: FileBox }, { id: 'files', label: 'Files', icon: FileText }, - { id: 'team', label: 'Team', icon: Users }, ] as const; -// ── Member view-model (from adapter.getTeamMembers) ────────────────────── -interface WorkspaceMember { - id: string; - name: string; - status: string; - avatar?: string; -} - interface WorkspaceDesktopAppProps { workspaceId: string; workspaceName: string; @@ -121,13 +110,6 @@ interface WorkspaceDesktopAppProps { // ── Small presentational helpers ───────────────────────────────────────── -function initialsOf(name: string): string { - const parts = name.trim().split(/\s+/).filter(Boolean); - if (parts.length === 0) return '?'; - if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase(); - return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); -} - function relativeTime(iso?: string): string { if (!iso) return ''; const t = Date.parse(iso); @@ -268,31 +250,12 @@ function UpNextCard({ state, onOpenTab }: { state: WorkspaceStateView | null; on ); } -function TeamCard({ members }: { members: WorkspaceMember[] }) { - if (members.length === 0) return null; - return ( -
- Team -
    - {members.slice(0, 6).map((m) => ( -
  • - {initialsOf(m.name)} - {m.name} - {m.status && {m.status}} -
  • - ))} -
-
- ); -} - function OverviewTab({ - ctx, state, artifacts, members, agentsRunning, onOpenTab, + ctx, state, artifacts, agentsRunning, onOpenTab, }: { ctx: WorkspaceContext | null; state: WorkspaceStateView | null; artifacts: ArtifactRow[]; - members: WorkspaceMember[]; agentsRunning: number; onOpenTab: (tab: WorkspaceTabId) => void; }) { @@ -313,7 +276,6 @@ function OverviewTab({
-
); @@ -358,7 +320,6 @@ const WorkspaceDesktopApp = ({ const [ctx, setCtx] = useState(null); const [state, setState] = useState(null); const [activity, setActivity] = useState([]); - const [members, setMembers] = useState([]); const [artifacts, setArtifacts] = useState([]); const [loading, setLoading] = useState(true); // Distinguish a hard fetch failure (offline) from a permission denial and @@ -374,12 +335,6 @@ const WorkspaceDesktopApp = ({ const retry = useCallback(() => setReloadKey((k) => k + 1), []); useRevalidateOnError(errorKind === 'offline', retry); - // Team tab tier gate: Solo users see the upsell, Team users the real roster. - // `?? 'FREE'` keeps existing useShell test mocks (which don't stub billingTier) - // green and fail-closed to the upsell. - const { billingTier, tierResolved } = useShell(); - const isTeam = tierSatisfies(billingTier ?? 'FREE', 'TEAMS'); - // Live agents-running indicator for THIS workspace (reuse Room SSE state). const { workspaceMap } = useRoomState(); const agentsRunning = useMemo( @@ -460,7 +415,7 @@ const WorkspaceDesktopApp = ({ return; } - // State / activity / members / artifacts are best-effort — each one + // State / activity / artifacts are best-effort — each one // empties gracefully without taking down the screen. try { const s = await adapter.getWorkspaceState(workspaceId); @@ -472,14 +427,6 @@ const WorkspaceDesktopApp = ({ if (!cancelled) setActivity(Array.isArray(a?.events) ? a.events : []); } catch { if (!cancelled) setActivity([]); } - // getTeamMembers() returns the GLOBAL team roster, not a per-workspace - // membership list — the UI is labelled "Team members" accordingly. - // TODO(Phase 5/S10): workspace-scoped members endpoint. - try { - const m = await adapter.getTeamMembers(); - if (!cancelled) setMembers(Array.isArray(m) ? m : []); - } catch { if (!cancelled) setMembers([]); } - // Interim "artifacts" = the workspace file registry (S05 owns the real // Artifact entity; until then we surface files/documents read-only). try { @@ -521,7 +468,6 @@ const WorkspaceDesktopApp = ({ : tab.id === 'memory' ? ctx?.stats?.memoryCount : tab.id === 'artifacts' ? (artifacts.length || undefined) : tab.id === 'files' ? ctx?.stats?.fileCount - : tab.id === 'team' ? (members.length || undefined) : undefined; return ( -
- ) : members.length === 0 ? ( - - ) : ( -
    - {members.map(m => ( -
  • - {initialsOf(m.name)} - {m.name} - {m.status && {m.status}} -
  • - ))} -
- )} -
- )}
diff --git a/apps/web/src/components/os/apps/mcp/AddCustomMcpForm.tsx b/apps/web/src/components/os/apps/mcp/AddCustomMcpForm.tsx index b101ec6..318bdab 100644 --- a/apps/web/src/components/os/apps/mcp/AddCustomMcpForm.tsx +++ b/apps/web/src/components/os/apps/mcp/AddCustomMcpForm.tsx @@ -1,9 +1,8 @@ /** * AddCustomMcpForm — the S08 Custom tab (UX-Refactor Phase 4B). Registers an - * arbitrary stdio MCP server via POST /api/mcps (tier-gated server-side, B5): + * arbitrary stdio MCP server via POST /api/mcps: * `{ name, command, args[], env{}, workspaceId? }`. 400 (validation / - * injection-scan) and 409 (duplicate) render inline; the tier 403 routes - * through the global UpgradeModal handler. + * injection-scan) and 409 (duplicate) render inline. */ import { useEffect, useState } from 'react'; import { Loader2, Plus } from 'lucide-react'; @@ -62,7 +61,7 @@ const AddCustomMcpForm = ({ onAdded }: AddCustomMcpFormProps) => { if (res.id) { setName(''); setCommand(''); setArgsText(''); setEnvText(''); setWorkspaceId(''); onAdded(res.id); - } else if (res.error && res.error !== 'TIER_INSUFFICIENT') { + } else if (res.error) { // 400 validation / injection-scan rejection or 409 duplicate. setError(res.error); } @@ -78,8 +77,7 @@ const AddCustomMcpForm = ({ onAdded }: AddCustomMcpFormProps) => {

Add a custom MCP server

- Registers a local stdio server (command + args). Teams governance can manage shared use; - Solo can run local servers on this device. + Registers a local stdio server (command + args) that runs on this device.

diff --git a/apps/web/src/components/os/apps/skills/SkillBuilder.tsx b/apps/web/src/components/os/apps/skills/SkillBuilder.tsx index 66997e1..f27017a 100644 --- a/apps/web/src/components/os/apps/skills/SkillBuilder.tsx +++ b/apps/web/src/components/os/apps/skills/SkillBuilder.tsx @@ -28,8 +28,6 @@ import { adapter } from '@/lib/adapter'; interface SkillBuilderProps { onCreated: (name: string) => void; onCancel: () => void; - /** Shared 403→UpgradeModal routing (server gate may land later). */ - onTierError: (err: unknown, name: string) => boolean; } /** Backend SKILL_FAMILIES 7-set (skills.ts) — NOT the narrower SkillPack union. */ @@ -57,7 +55,7 @@ export function appendIoSections(content: string, inputs: string[], outputs: str return `${content.trimEnd()}\n${section('Inputs', inputs)}${section('Outputs', outputs)}`; } -const SkillBuilder = ({ onCreated, onCancel, onTierError }: SkillBuilderProps) => { +const SkillBuilder = ({ onCreated, onCancel }: SkillBuilderProps) => { const [step, setStep] = useState(0); // Identity const [name, setName] = useState(''); @@ -138,9 +136,7 @@ const SkillBuilder = ({ onCreated, onCancel, onTierError }: SkillBuilderProps) = } onCreated(skillName); } catch (err) { - if (!onTierError(err, skillName)) { - setError(err instanceof Error ? err.message : 'Failed to create skill'); - } + setError(err instanceof Error ? err.message : 'Failed to create skill'); } finally { setBusy(false); } diff --git a/apps/web/src/components/os/auth/ClerkAuthForm.tsx b/apps/web/src/components/os/auth/ClerkAuthForm.tsx index 557fe9d..17ef0a5 100644 --- a/apps/web/src/components/os/auth/ClerkAuthForm.tsx +++ b/apps/web/src/components/os/auth/ClerkAuthForm.tsx @@ -14,7 +14,6 @@ */ import { useState } from 'react'; import { SignIn, SignUp } from '@clerk/clerk-react'; -import EnterpriseCTA from './EnterpriseCTA'; type Mode = 'signin' | 'signup'; @@ -49,8 +48,6 @@ export default function ClerkAuthForm() { {mode === 'signin' ? 'Create an account' : 'Sign in'}

- - ); } diff --git a/apps/web/src/components/os/auth/EnterpriseCTA.tsx b/apps/web/src/components/os/auth/EnterpriseCTA.tsx deleted file mode 100644 index d8b41d9..0000000 --- a/apps/web/src/components/os/auth/EnterpriseCTA.tsx +++ /dev/null @@ -1,24 +0,0 @@ -/** - * EnterpriseCTA — PR7b Auth (design §2d, D15). The SSO/enterprise panel as a custom - * "Talk to sales → KVARK/Teams" CTA. NOT a live SAML/SCIM form: those are - * Teams/KVARK/Clerk-Enterprise features, so rendering a working-looking SAML form would - * be a fabrication (F11 / recon 03 §5.5). This is the KVARK funnel. - */ -export default function EnterpriseCTA() { - return ( -
-

- SAML, SCIM provisioning, and audit logs are available on{' '} - Teams and KVARK. -

- - Talk to sales → - -
- ); -} diff --git a/apps/web/src/components/os/billing/PlanCards.tsx b/apps/web/src/components/os/billing/PlanCards.tsx deleted file mode 100644 index 31d99c4..0000000 --- a/apps/web/src/components/os/billing/PlanCards.tsx +++ /dev/null @@ -1,180 +0,0 @@ -/** - * PlanCards — warm-Hive PR7a Billing (design screen 14 "Plans" state). - * - * The 2-card Plans grid (Solo · free / Team · most-popular) + the Monthly|Annual - * −20% cycle toggle, themed to the warm tokens (PR1). Prices are DISPLAY COPY from - * `tiers.ts` (D10) — the *charged* amount is whatever Stripe renders on the hosted - * Checkout page; this UI never asserts the real charge. Choosing a plan hands off to - * hosted Stripe Checkout via `onChoose` (D5) — no in-app card capture. - * - * The toggle resolves a real `billingPeriod` that threads to the annual Stripe price - * (D8/F9) — it is NOT a cosmetic `× 0.8` client number. - */ -import { useState } from 'react'; -import { Check } from 'lucide-react'; - -type CheckoutTier = 'TEAMS'; -type BillingPeriod = 'monthly' | 'annual'; - -interface PlanDef { - /** Canonical tier id this card maps to (FREE has no checkout). */ - tier: 'FREE' | CheckoutTier; - name: string; - priceMonthly: string; - priceAnnual: string; - unitMonthly: string; - unitAnnual: string; - tagline: string; - features: readonly string[]; - popular?: boolean; -} - -/** Display copy only (D10) — mirrors `billing.html` + `tiers.ts` doc prices. */ -const PLANS: readonly PlanDef[] = [ - { - tier: 'FREE', - name: 'Solo', - priceMonthly: '$0', - priceAnnual: '$0', - unitMonthly: '/ forever', - unitAnnual: '/ forever', - tagline: 'Everything one person needs — free, forever.', - features: ['Personal memory graph', 'Unlimited workspaces & connectors', 'Marketplace skills & connectors', 'Self-evolving skills', 'All major LLMs + local'], - }, - { - tier: 'TEAMS', - name: 'Team', - priceMonthly: '$49', - priceAnnual: '$39', - unitMonthly: '/ seat / mo', - unitAnnual: '/ seat · yearly', - tagline: 'Shared memory without losing privacy.', - features: ['Everything in Solo', 'Sync across devices', 'Shared team memory', 'WaggleDance multi-agent', 'SSO & role-based access'], - popular: true, - }, -]; - -/** Upgrade ordering. TRIAL collapses to the Solo (FREE) entry-point for the "current" - * marker; a legacy PRO value maps to 0 so it reads as the Solo tier. */ -const RANK: Record = { FREE: 0, TRIAL: 0, PRO: 0, TEAMS: 1, ENTERPRISE: 2 }; - -interface PlanCardsProps { - /** Resolved current tier (caller must only render this on a resolved tier — F7). */ - currentTier: string; - /** Hand off to hosted Stripe Checkout for an upgrade. */ - onChoose: (tier: CheckoutTier, period: BillingPeriod) => void; - /** Stripe not configured (503) — render CTAs as a disabled honest state (F8). */ - disabled?: boolean; -} - -export default function PlanCards({ currentTier, onChoose, disabled = false }: PlanCardsProps) { - const [period, setPeriod] = useState('monthly'); - const currentRank = RANK[currentTier] ?? 0; - - return ( -
- {/* Monthly | Annual −20% cycle toggle */} -
-
- {(['monthly', 'annual'] as const).map((p) => ( - - ))} -
-
- - {/* 2-card plans grid */} -
- {PLANS.map((plan) => { - const planRank = RANK[plan.tier]; - // A TRIAL user is not on the Free plan — the honest "Trial — everything - // unlocked" badge lives above the grid, so no card claims to be "current". - const isCurrent = planRank === currentRank && currentTier !== 'TRIAL'; - const isUpgrade = planRank > currentRank && plan.tier !== 'FREE'; - const price = period === 'annual' ? plan.priceAnnual : plan.priceMonthly; - const unit = period === 'annual' ? plan.unitAnnual : plan.unitMonthly; - - return ( -
- {plan.popular && ( - - Most popular - - )} - {isCurrent && ( - - Current - - )} - -
{plan.name}
-
- {price} - {unit} -
-
{plan.tagline}
- -
    - {plan.features.map((f) => ( -
  • - - {f} -
  • - ))} -
- - {isUpgrade ? ( - - ) : ( -
- {isCurrent ? 'Your plan' : 'Included'} -
- )} -
- ); - })} -
-
- ); -} diff --git a/apps/web/src/components/os/overlays/CommandCenter.tsx b/apps/web/src/components/os/overlays/CommandCenter.tsx index 8e8e2c8..fb48ff5 100644 --- a/apps/web/src/components/os/overlays/CommandCenter.tsx +++ b/apps/web/src/components/os/overlays/CommandCenter.tsx @@ -505,9 +505,6 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata if (res.ok) { toast({ title: 'Done', description: action.label }); onClose(); - } else if (res.status === 403) { - // The global adapter handler already raised the UpgradeModal — just close. - onClose(); } else { toast({ title: 'Action failed', description: action.label, variant: 'destructive' }); } @@ -521,13 +518,6 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata // ── Tier 1: dispatch a resolved intent onto the existing execution paths. ── const handleResolvedAction = useCallback((res: InterpretResult) => { - if (res.kind === 'tier_gated') { - window.dispatchEvent(new CustomEvent('waggle:tier-insufficient', { - detail: { required: res.requiredTier, actual: res.actualTier, message: res.message }, - })); - onClose(); - return; - } if (res.kind !== 'action' || !res.action) return; const action = res.action; if (action.navigate) { @@ -636,7 +626,7 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata {/* ── Tier 1: Ask Waggle (NL intent) — sits above Tier 0 results, never replacing them. Renders interpreting / resolved action / - clarify / upgrade / decline. ── */} + clarify / decline. ── */} {(interpreting || interpret) && ( handleResolvedAction(interpret)} /> )} - {!interpreting && interpret?.kind === 'tier_gated' && ( - handleResolvedAction(interpret)} - className="flex items-center gap-3 rounded-lg px-3 py-2 text-sm aria-selected:bg-[var(--honey-glow,rgba(229,160,0,0.08))]" - > - -
- - Upgrade to {interpret.requiredTier} to do this - - - {interpret.capability} - -
- - {interpret.requiredTier} - -
- )} - {!interpreting && interpret?.kind === 'clarify' && (

{interpret.question}

diff --git a/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx b/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx index 39568b8..024012c 100644 --- a/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx +++ b/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx @@ -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 { @@ -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 ( - - -
- e.stopPropagation()}> -
- {/* 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. */} - -
-
- - - ); - } - const virtualPath = defaultVirtualPath(name); // Non-blocking dup-name warning: two "Research Hub"s are indistinguishable in diff --git a/apps/web/src/components/os/overlays/TrialExpiredModal.tsx b/apps/web/src/components/os/overlays/TrialExpiredModal.tsx deleted file mode 100644 index d770932..0000000 --- a/apps/web/src/components/os/overlays/TrialExpiredModal.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import { motion, AnimatePresence } from 'framer-motion'; -import { Crown, Users, Check, X, ArrowRight } from 'lucide-react'; -import { useFocusTrap } from '@/hooks/useFocusTrap'; - -interface TrialExpiredModalProps { - open: boolean; - onDismiss: () => void; - onUpgrade: (tier: 'TEAMS') => void; -} - -// Solo (free) keeps every personal capability — the trial only ever gated the -// collaboration/governance layer, so those are the only things "lost". -const KEEP_FEATURES = [ - 'Memory & Harvest — unlimited, forever', - 'Unlimited workspaces & connectors', - 'Marketplace skills & connectors', - 'Self-evolving skills', - 'All built-in agents', - 'PDF & advanced exports', -]; - -const LOSE_FEATURES = [ - 'Shared team workspaces', - 'Sync across devices', - 'Team skill library', - 'Team governance & audit', - 'SSO & role-based access', -]; - -export default function TrialExpiredModal({ open, onDismiss, onUpgrade }: TrialExpiredModalProps) { - // A11y (WCAG 2.1.1/2.4.3): Escape closes, Tab is trapped, focus moves in on - // open and restores on close. Replaces the prior Escape-only handler. - const dialogRef = useFocusTrap(open, onDismiss); - - return ( - - {open && ( - -