diff --git a/apps/web/.env.example b/apps/web/.env.example index 58830b4..7e62e16 100644 --- a/apps/web/.env.example +++ b/apps/web/.env.example @@ -2,13 +2,11 @@ # Copy to .env.local and fill in the real values. # NEVER commit .env.local — it is gitignored. -# PostHog cloud analytics — project "Default project" id 161685, org "Egzakta" -# Required for DAY0-04 (≥ 5 distinct onboarding_complete in 24h post-launch). -# The REAL phc_* key is pasted into apps/web/.env.local at Wave 1 / P2b -# and is BAKED INTO THE TAURI BUNDLE at P4-win compile time — if missing -# at build moment, the shipped binary has PostHog as a permanent no-op. -# Local SQLite telemetry (packages/core/src/telemetry.ts) continues alongside. -VITE_POSTHOG_KEY=phc_REPLACE_ME +# PostHog product analytics, opt-in only (docs/oss/adr/0006-opt-in-analytics.md). +# Leave unset for builds from source: without a key nothing is sent and the +# consent dialog never appears. Release builds get the key from the build +# environment; Vite reads it at build time, so it cannot be added afterwards. +# VITE_POSTHOG_KEY= # PR7b Auth — Clerk publishable key (shared instance with apps/www). Public-safe by # design (ships in the client bundle); the SECRET key is server-side only and is NOT diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx index 64c97bd..a4db485 100644 --- a/apps/web/src/App.tsx +++ b/apps/web/src/App.tsx @@ -26,9 +26,7 @@ const McpsRoute = lazy(() => import("@/routes/McpsRoute")); const MarketplaceRoute = lazy(() => import("@/routes/MarketplaceRoute")); const LauncherRoute = lazy(() => import("@/routes/LauncherRoute")); const RoomRoute = lazy(() => import("@/routes/RoomRoute")); -const WaggleDanceRoute = lazy(() => import("@/routes/WaggleDanceRoute")); const ApprovalsRoute = lazy(() => import("@/routes/ApprovalsRoute")); -const TeamRoute = lazy(() => import("@/routes/TeamRoute")); const SettingsRoute = lazy(() => import("@/routes/SettingsRoute")); const VaultRoute = lazy(() => import("@/routes/VaultRoute")); const ProfileRoute = lazy(() => import("@/routes/ProfileRoute")); @@ -145,15 +143,12 @@ const App = () => ( )} /> )} /> )} /> - )} /> )} /> {/* ── Extend ── */} )} /> )} /> )} /> )} /> - {/* ── Team (route registered; no nav entry — team mode is not shipped, ADR-0003) ── */} - )} /> {/* ── System (§9.4: System surfaces nest under /settings/*) ── */} )} /> )} /> diff --git a/apps/web/src/components/os/AppShell.tsx b/apps/web/src/components/os/AppShell.tsx index 765ead8..0a8476f 100644 --- a/apps/web/src/components/os/AppShell.tsx +++ b/apps/web/src/components/os/AppShell.tsx @@ -15,7 +15,7 @@ import { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'; import { AnimatePresence } from 'framer-motion'; import { Navigate, useLocation, useNavigate } from 'react-router-dom'; -import { Home, MessageSquare, Brain, ListTodo, Library, Network, Plug, Shield } from 'lucide-react'; +import { Home, MessageSquare, Brain, ListTodo, Library, Plug, Shield } from 'lucide-react'; import wallpaperDark from '@/assets/wallpaper.jpg'; import wallpaperLight from '@/assets/wallpaper-light.jpg'; import BootScreen from './BootScreen'; @@ -28,6 +28,7 @@ import { stashDeepLink } from '@/lib/app-deeplink'; import { writeLoginBriefingDismissed, writeLoginBriefingLastDismissedAt, readLoginBriefingDismissed, readSkipBriefingParam } from '@/lib/login-briefing'; import { prefetchBriefing, computeAwayDays, BRIEFING_ABSENCE_DAYS } from '@/lib/briefing-source'; import { homeCacheExists } from '@/lib/home-cache'; +import { shouldAskAnalyticsConsent } from '@/lib/analytics-consent'; import { resolveReturningUserOnboarding, isOnboardingStatusKnownSync } from '@/hooks/useOnboarding'; import { shouldShowCoachMarks, readOnboardedThisSession, readForceTour, clearForceTour } from '@/lib/coach-marks-gate'; import { matchNavRoute, queryString, routeFor, routeForSearchResult } from '@/lib/routes'; @@ -37,7 +38,6 @@ import { buildCommandCatalog, type CatalogCommand } from '@/lib/command-catalog' import { ShellProvider, useShell } from '@/providers/ShellContext'; import { seedChat, useChatWidgetState } from '@/hooks/useChatWidgetState'; import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts'; -import { useWaggleDance } from '@/hooks/useWaggleDance'; import { useBumpSessionCount } from '@/hooks/useDockLabels'; import { useDockNudge } from '@/hooks/useDockNudge'; import { useToast } from '@/hooks/use-toast'; @@ -56,6 +56,7 @@ 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 AnalyticsConsentDialog = lazy(() => import('./overlays/AnalyticsConsentDialog')); const deferredShellElement = (element: ReactNode) => ( {element} @@ -129,12 +130,10 @@ const ShellLayout = () => { contextRailTarget, setContextRailTarget, } = useShell(); - const { allSignals: waggleSignals } = useWaggleDance(); const overlaysRef = useRef(ov); useEffect(() => { overlaysRef.current = ov; }, [ov]); - const waggleUnacknowledged = waggleSignals.filter(s => !s.acknowledged).length; // W2A: no implicit workspaces[0] fallback — the chrome shows a workspace only // when one was explicitly selected. Sidebar/StatusBar accept null names; the // Chat spine item opens the WorkspaceSwitcher when there is no real selection. @@ -189,6 +188,9 @@ const ShellLayout = () => { const { entry: activeChatEntry, setPersona: setActiveChatPersona } = useChatWidgetState(effectiveActiveWorkspaceId ?? 'local-default'); + // ADR-0006: ask about analytics once per launch until the user chooses. + const [askAnalyticsConsent, setAskAnalyticsConsent] = useState(shouldAskAnalyticsConsent); + // User display name for the sidebar user row (PR1 LOW #2). Best-effort via the // existing identity surface; re-fetched on connect-settle because the first // call can race the session-token attach and 401 → name:null. Falls back to @@ -372,9 +374,7 @@ const ShellLayout = () => { const briefingAwayDays = useMemo(() => computeAwayDays(workspaces), [workspaces]); // Five-place spine + a power-tier "Pinned" group. Chat resolves to the active - // workspace's chat tab (routeFor falls back to /home with no workspace). The - // Agents & tasks badge surfaces unacknowledged coordination signals for now; - // PR3 refines it to the real pending-approvals/tasks count. + // workspace's chat tab (routeFor falls back to /home with no workspace). const isPro = currentTier === 'power' || currentTier === 'admin'; const spine: SidebarNavItem[] = useMemo(() => [ { key: 'home', label: 'Home', icon: Home, to: '/home', match: ['/home'] }, @@ -392,13 +392,12 @@ const ShellLayout = () => { onClick: navigateToActiveChat, }, { key: 'memory', label: 'Memory', icon: Brain, to: '/memory', match: ['/memory'] }, - { key: 'agents', label: 'Agents', icon: ListTodo, to: '/agents', match: ['/agents', '/automations'], badge: waggleUnacknowledged || undefined }, + { key: 'agents', label: 'Agents', icon: ListTodo, to: '/agents', match: ['/agents', '/automations'] }, { key: 'library', label: 'Library', icon: Library, to: '/artifacts', match: ['/artifacts', '/files', '/skills'] }, - ], [effectiveActiveWorkspaceId, navigateToActiveChat, waggleUnacknowledged]); + ], [effectiveActiveWorkspaceId, navigateToActiveChat]); const pinned: SidebarNavItem[] = useMemo(() => { if (!isPro) return []; 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'] }, ]; @@ -417,11 +416,21 @@ const ShellLayout = () => { } }, [navigate, ov]); + // ADR-0006: the analytics question (only when the build has a PostHog key and + // the user has not chosen yet). On first launch it comes BEFORE the wizard + // mounts: the wizard maps a window-level Escape to Skip, so the two must not + // be open together, and asking first lets the one PostHog event + // (onboarding_complete) be sent if the user allows it. + const analyticsConsentDialog = askAnalyticsConsent && deferredShellElement( + setAskAnalyticsConsent(false)} /> + ); + // FR #33: when the onboarding wizard is active, render ONLY the wizard — // no nav, no canvas, no overlays (§1.2 OnboardingWizard row: full-screen // takeover at the layout level, any URL). Hooks above keep running so // completion re-renders with workspaces/personas already populated. if (!onboardingState.completed) { + if (analyticsConsentDialog) return analyticsConsentDialog; return deferredShellElement( { const anyModalOpen = ov.showGlobalSearch || ov.showCreateWorkspace || ov.showPersonaSwitcher || ov.showWorkspaceSwitcher || ov.showNotifications || ov.showKeyboardHelp || - ov.showSpawnAgent; + ov.showSpawnAgent || askAnalyticsConsent; return (
@@ -574,7 +583,7 @@ const ShellLayout = () => { Lane H item 4: additionally require a ≥7-day absence — otherwise the home hero's recall strip is the catch-up, and this modal stays closed. */} {onboardingState.completed && onboardingState.tooltipsDismissed && ov.showLoginBriefing - && briefingLanding === 'armed' && location.pathname.startsWith('/home') && !offline + && !askAnalyticsConsent && briefingLanding === 'armed' && location.pathname.startsWith('/home') && !offline && briefingAwayDays >= BRIEFING_ABSENCE_DAYS && ( deferredShellElement( { {contextRailTarget && deferredShellElement( setContextRailTarget(null)} /> )} + {analyticsConsentDialog}
); }; diff --git a/apps/web/src/components/os/RouteTransition.test.tsx b/apps/web/src/components/os/RouteTransition.test.tsx index 98596bc..1529bc7 100644 --- a/apps/web/src/components/os/RouteTransition.test.tsx +++ b/apps/web/src/components/os/RouteTransition.test.tsx @@ -65,7 +65,7 @@ describe('routeGroupKey — keys on the top segment only', () => { describe('routeAnnouncement — the polite-live-region label', () => { it('labels known surfaces', () => { expect(routeAnnouncement('/memory')).toBe('Memory'); - expect(routeAnnouncement('/waggle-dance')).toBe('Agent swarm'); + expect(routeAnnouncement('/approvals')).toBe('Approvals'); expect(routeAnnouncement('/workspaces/abc/chat')).toBe('Workspaces'); }); diff --git a/apps/web/src/components/os/apps/AgentsApp.tsx b/apps/web/src/components/os/apps/AgentsApp.tsx index 9c68852..3880c9e 100644 --- a/apps/web/src/components/os/apps/AgentsApp.tsx +++ b/apps/web/src/components/os/apps/AgentsApp.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Bot, Plus, Search, AlertCircle, RefreshCw, LibraryBig, ChevronRight, Network, ArrowRight } from 'lucide-react'; +import { Bot, Plus, Search, AlertCircle, RefreshCw, LibraryBig, ChevronRight } from 'lucide-react'; import { Input } from '@/components/ui/input'; import BeeLoader from '@/components/ui/BeeLoader'; import { adapter } from '@/lib/adapter'; @@ -291,36 +291,6 @@ const AgentsApp = ({ workspaces, activeWorkspaceId }: AgentsAppProps) => { - {/* Promoted swarm CTA (PR6b §16 / D19) — the waggle-dance entry, - surfaced as a prominent honey banner instead of a buried link. - Navigates to the existing /waggle-dance route. */} -
- -
- {/* List */}
{/* A post-action reload failure must be visible even when a stale diff --git a/apps/web/src/components/os/apps/AllWorkspacesApp.test.tsx b/apps/web/src/components/os/apps/AllWorkspacesApp.test.tsx index ec9430d..7d8c46d 100644 --- a/apps/web/src/components/os/apps/AllWorkspacesApp.test.tsx +++ b/apps/web/src/components/os/apps/AllWorkspacesApp.test.tsx @@ -3,7 +3,7 @@ * Pins the contract: * - renders a grid card per workspace (name + real stats) * - the search box filters by name - * - the storage-type pills filter (All / Virtual / Local / Team) + * - the storage-type pills filter (All / Virtual / Local) * - a zero-workspace visit shows the create-first empty state (D16) * - NO-FABRICATION: a workspace with undefined memoryCount renders NO memory * chip (W2B: not even a filler "—"), never an invented number (PR3/PR3.5) diff --git a/apps/web/src/components/os/apps/AllWorkspacesApp.tsx b/apps/web/src/components/os/apps/AllWorkspacesApp.tsx index f9e2ce6..830a72e 100644 --- a/apps/web/src/components/os/apps/AllWorkspacesApp.tsx +++ b/apps/web/src/components/os/apps/AllWorkspacesApp.tsx @@ -80,7 +80,6 @@ const STORAGE_FILTERS: { id: StorageFilter; label: string; dot?: string }[] = [ { id: 'all', label: 'All' }, { id: 'virtual', label: 'Virtual', dot: 'var(--intel)' }, { id: 'local', label: 'Local', dot: 'var(--honey)' }, - { id: 'team', label: 'Team', dot: 'var(--healthy)' }, ]; /** Storage badge: Local=honey, Virtual=intel, Team=healthy (design §04). */ diff --git a/apps/web/src/components/os/apps/ApprovalsApp.tsx b/apps/web/src/components/os/apps/ApprovalsApp.tsx index 80e60df..affd249 100644 --- a/apps/web/src/components/os/apps/ApprovalsApp.tsx +++ b/apps/web/src/components/os/apps/ApprovalsApp.tsx @@ -8,9 +8,8 @@ * 2. Grants — persistent "always allow" decisions. Revoke individually * or clear the whole list. * - * This is the trust control surface for enterprise buyers. Every decision - * the user has made about agent autonomy lives here, visible and - * reversible. + * This is the trust control surface: every decision the user has made + * about agent autonomy lives here, visible and reversible. */ import { useState, useEffect, useCallback } from 'react'; diff --git a/apps/web/src/components/os/apps/BenchmarkApp.tsx b/apps/web/src/components/os/apps/BenchmarkApp.tsx index e5d5462..63ee23e 100644 --- a/apps/web/src/components/os/apps/BenchmarkApp.tsx +++ b/apps/web/src/components/os/apps/BenchmarkApp.tsx @@ -41,7 +41,7 @@ const CAPABILITY_MATRIX: ReadonlyArray<{ capability: string; marks: readonly Mar { capability: 'Self-evolving skills', marks: ['Y', 'N', 'N', 'N', 'P', 'N'] }, { capability: 'Skills shared across agents/workspaces', marks: ['Y', 'P', 'P', 'N', 'P', 'N'] }, { capability: 'Multi-agent swarm', marks: ['Y', 'P', 'N', 'P', 'P', 'Y'] }, - { capability: 'Native desktop app · Win + Mac', marks: ['Y', 'N', 'N', 'P', 'N', 'N'] }, + { capability: 'Native desktop app · Windows, macOS, Linux', marks: ['Y', 'N', 'N', 'P', 'N', 'N'] }, { capability: 'Audit-ready / EU AI Act', marks: ['Y', 'P', 'P', 'P', 'N', 'N'] }, { capability: 'Deep coding in the terminal', marks: ['P', 'Y', 'Y', 'P', 'P', 'Y'] }, ]; diff --git a/apps/web/src/components/os/apps/ChatApp.tsx b/apps/web/src/components/os/apps/ChatApp.tsx index b196267..6d89a9c 100644 --- a/apps/web/src/components/os/apps/ChatApp.tsx +++ b/apps/web/src/components/os/apps/ChatApp.tsx @@ -26,13 +26,6 @@ import { import { useToast } from '@/hooks/use-toast'; import { DUR } from '@/lib/motion/tokens'; -export interface TeamMember { - id: string; - name: string; - status: string; - avatar?: string; -} - type AutonomyLevel = 'normal' | 'trusted' | 'yolo'; interface ChatAppProps { @@ -49,7 +42,6 @@ interface ChatAppProps { currentModel?: string; onModelChange?: (model: string) => void; availableModels?: string[]; - teamPresence?: TeamMember[]; sessions?: { id: string; title: string; messageCount?: number; lastActive?: string }[]; activeSessionId?: string | null; onSelectSession?: (id: string) => void; @@ -557,7 +549,6 @@ const ChatApp = ({ messages, isLoading, onSendMessage, onClearHistory, pendingApproval, onApprove, currentPersona, onPersonaChange, currentModel, onModelChange, availableModels, - teamPresence, sessions, activeSessionId, onSelectSession, onNewSession, workspaceId, templateId, storageType, autonomyLevel = 'normal', autonomyExpiresAt = null, onAutonomyChange, @@ -612,19 +603,12 @@ const ChatApp = ({ const modelPickerRef = useRef(null); // M-21 / UX-6: observe the agent strip (round-6 fix 1: relocated from the // deleted header row to the composer) to decide whether the informational - // chips (storage badge, team presence) should fold into a ⋯ overflow menu. + // chips (storage badge) should fold into a ⋯ overflow menu. const stripRef = useRef(null); const overflowRef = useRef(null); const stripWidth = useContainerWidth(stripRef); const isStripCompact = shouldCollapseChatHeader(stripWidth); - // R9 Lane D: presence is meaningful only for OTHER people in the room. The - // team endpoint returns the current user as `{ id: 'local', name: 'You' }` - // in solo/offline mode, which rendered as an anonymous floating 'Y' avatar on - // the composer strip. Drop the self entry so a lone user sees no presence chip - // and real teammates still surface. - const roomPresence = (teamPresence ?? []).filter(m => m.id !== 'local' && m.name !== 'You'); - // M-28 / ENG-7: suggested next-actions extracted from the most // recent assistant message. Empty array → no chips. Hidden while // the assistant is still streaming to avoid flickering chips as @@ -1573,7 +1557,7 @@ const ChatApp = ({ - {/* M-21 / UX-6: storage + team presence render inline at full + {/* M-21 / UX-6: the storage badge renders inline at full width, or behind a ⋯ overflow menu when the strip is too narrow. Interactive controls (persona, autonomy, model) stay always visible. */} @@ -1590,37 +1574,9 @@ const ChatApp = ({ )} - {/* Team presence — round-7 fix 2b: the bare avatar chip was - unlabeled (a floating 'Y'), so the whole cluster is now one - strip pill with a native title naming who's here. */} - {!isStripCompact && roomPresence.length > 0 && ( -
m.name).join(', ')}`} - > -
- {roomPresence.slice(0, 4).map(m => ( -
- - {m.avatar ? : null} - {m.name[0]} - -
-
- ))} -
- {roomPresence.length > 4 && ( - +{roomPresence.length - 4} - )} -
- )} - {/* ⋯ overflow menu — only rendered in compact mode and only when there's at least one informational chip to show. */} - {isStripCompact && (storageType || roomPresence.length > 0) && ( + {isStripCompact && storageType && (
)} - {roomPresence.length > 0 && ( -
-

In this room

-
- {roomPresence.map(m => ( -
- - {m.avatar ? : null} - {m.name[0]} - - {m.name} - -
- ))} -
-
- )}
)}
@@ -1674,7 +1613,7 @@ const ChatApp = ({
{/* Round-7 fix 2a: subtle divider between the context cluster - (sessions · persona · Memory · presence) and the control + (sessions · persona · Memory) and the control cluster (autonomy · model · profile). */} {/* Phase B.5: autonomy toggle — only render when the parent wired a handler */} diff --git a/apps/web/src/components/os/apps/ChatWindowInstance.tsx b/apps/web/src/components/os/apps/ChatWindowInstance.tsx index 2a9a83e..939435e 100644 --- a/apps/web/src/components/os/apps/ChatWindowInstance.tsx +++ b/apps/web/src/components/os/apps/ChatWindowInstance.tsx @@ -5,7 +5,6 @@ import { useToast } from '@/hooks/use-toast'; import { adapter } from '@/lib/adapter'; import { formatModelLabel } from '@/lib/model-label'; import ChatApp from './ChatApp'; -import type { TeamMember } from './ChatApp'; type AutonomyLevel = 'normal' | 'trusted' | 'yolo'; @@ -104,7 +103,6 @@ const ChatWindowInstance = ({ }); const [availableModels, setAvailableModels] = useState([]); - const [teamPresence, setTeamPresence] = useState([]); const { toast } = useToast(); @@ -202,25 +200,11 @@ const ChatWindowInstance = ({ if (!currentLanded) fetchCurrentModel(); }, 2000); - // Fetch team members for presence display - const fetchTeam = async () => { - try { - const members = await adapter.getTeamMembers(); - if (cancelled) return; - setTeamPresence(members.filter(m => m.status === 'online')); - } catch (err) { - console.error('[ChatWindowInstance] fetch team failed:', err); - if (!cancelled) setTeamPresence([]); - } - }; - fetchTeam(); - const teamInterval = setInterval(fetchTeam, 10000); const refreshModelsOnFocus = () => { void fetchModels(); }; window.addEventListener('focus', refreshModelsOnFocus); return () => { cancelled = true; window.removeEventListener('focus', refreshModelsOnFocus); - clearInterval(teamInterval); clearInterval(retryInterval); }; }, []); @@ -273,7 +257,6 @@ const ChatWindowInstance = ({ currentModel={currentModel} onModelChange={handleModelChange} availableModels={availableModels} - teamPresence={teamPresence} sessions={displaySessions} activeSessionId={activeSessionId} onSelectSession={setActiveSessionId} diff --git a/apps/web/src/components/os/apps/FilesAppTabs.tsx b/apps/web/src/components/os/apps/FilesAppTabs.tsx index 8115133..aa45d00 100644 --- a/apps/web/src/components/os/apps/FilesAppTabs.tsx +++ b/apps/web/src/components/os/apps/FilesAppTabs.tsx @@ -1,7 +1,7 @@ /** - * FilesAppTabs — P16 three-tab layout wrapper around FilesApp. + * FilesAppTabs — P16 tab layout wrapper around FilesApp. * - * Adds a "Virtual | Local | Team" tab strip above the existing FilesApp + * Adds a "Virtual | Local" tab strip above the existing FilesApp * shell. Each tab remounts FilesApp with a different `storageType`; the * remount intentionally resets per-storage navigation state (currentPath, * selection, preview) so flipping back to Virtual doesn't carry a local diff --git a/apps/web/src/components/os/apps/LauncherApp.test.tsx b/apps/web/src/components/os/apps/LauncherApp.test.tsx index 1ad4e7f..68bc052 100644 --- a/apps/web/src/components/os/apps/LauncherApp.test.tsx +++ b/apps/web/src/components/os/apps/LauncherApp.test.tsx @@ -7,6 +7,10 @@ * * These tests assert the toggle wiring and that Variation B carries the * static explainer content WITHOUT fabricating a live recall. + * + * Agent hooks, the explainer and Waggle Room tasks are hidden in v1 by the + * memory feature map (ADR-0002). Most suites switch them on to keep the hidden + * code covered; the "v1 memory features" suite checks the default. */ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { render, screen, waitFor, cleanup, fireEvent, within } from '@testing-library/react'; @@ -24,6 +28,9 @@ const mocks = vi.hoisted(() => ({ })); vi.mock('@/lib/adapter', () => ({ adapter: mocks.adapter, default: vi.fn() })); +const features = vi.hoisted(() => ({ enabled: true })); +vi.mock('@/lib/memory-features', () => ({ hasMemoryFeature: () => features.enabled })); + import LauncherApp, { resetLauncherRouteCache } from './LauncherApp'; const detectionResp = { @@ -43,6 +50,7 @@ const detectionResp = { }; beforeEach(() => { + features.enabled = true; resetLauncherRouteCache(); mocks.adapter.detectTools.mockResolvedValue(detectionResp); mocks.adapter.getToolProcesses.mockResolvedValue({ processes: [] }); @@ -670,3 +678,36 @@ describe('LauncherApp · hook cohort (#3)', () => { expect(screen.queryByText(/hooks are not supported for Claude Desktop yet/i)).not.toBeInTheDocument(); }); }); + +describe('LauncherApp · v1 memory features (ADR-0002)', () => { + it('hides hook controls, the memory-sharing explainer and Room tasks; launch stays', async () => { + features.enabled = false; + mocks.adapter.detectTools.mockResolvedValue({ + platform: 'darwin', + detectedAt: '2026-07-11T00:00:00.000Z', + tools: [ + { + id: 'codex', + displayName: 'Codex CLI', + installed: true, + installedPath: '/usr/local/bin/codex', + version: '0.144.1', + hooksInstalled: true, + hookPointerPath: '/home/.codex/hooks', + capabilities: { interactiveLaunch: true, headlessTask: true, structuredProgress: true, resumable: true }, + permissionModes: ['read-only', 'workspace-write', 'native'], + }, + ], + }); + + render(); + + expect(await screen.findByText('Codex CLI')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: /^launch$/i })).toBeInTheDocument(); + expect(screen.queryByRole('tablist', { name: /launcher view/i })).not.toBeInTheDocument(); + expect(screen.queryByText(/hooks active/i)).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /install hooks|uninstall hooks|^verify$/i })).not.toBeInTheDocument(); + expect(screen.queryByText(/launch only|hook management is not supported/i)).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /run task/i })).not.toBeInTheDocument(); + }); +}); diff --git a/apps/web/src/components/os/apps/LauncherApp.tsx b/apps/web/src/components/os/apps/LauncherApp.tsx index 4b0cbda..7dc1495 100644 --- a/apps/web/src/components/os/apps/LauncherApp.tsx +++ b/apps/web/src/components/os/apps/LauncherApp.tsx @@ -30,6 +30,7 @@ import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { ScrollArea } from '@/components/ui/scroll-area'; import { adapter } from '@/lib/adapter'; +import { hasMemoryFeature } from '@/lib/memory-features'; import { createSurfaceCache } from '@/lib/surface-cache'; import { promptArgsForTool, @@ -291,6 +292,10 @@ const hookActionDetails = ( const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: LauncherAppProps = {}) => { const [view, setView] = useState('a'); + // ADR-0002: agent memory hooks and Waggle Room are hidden in v1 (memory + // feature map). Launch, watch and stop stay. + const hooksShown = hasMemoryFeature('agentHooks'); + const roomShown = hasMemoryFeature('room'); const cachedDetection = launcherRouteCache.read('tools'); const [detection, setDetection] = useState(cachedDetection ?? null); const [loading, setLoading] = useState(() => !launcherRouteCache.hasResolved('tools')); @@ -596,6 +601,7 @@ const LauncherApp = ({ activeWorkspaceId, workspaces = [], onOpenRoom }: Launche )}
+ {hooksShown && (
))}
+ )} {view === 'a' && ( - {toolCanRunCapturedTask(tool) && ( + {roomShown && toolCanRunCapturedTask(tool) && ( + {hasMemoryFeature('importHistory') && ( + )} {/* Encrypted Backup/Restore */}
diff --git a/apps/web/src/components/os/apps/StorageApp.tsx b/apps/web/src/components/os/apps/StorageApp.tsx index 59ee36c..d7d6ffa 100644 --- a/apps/web/src/components/os/apps/StorageApp.tsx +++ b/apps/web/src/components/os/apps/StorageApp.tsx @@ -19,7 +19,7 @@ * Source fidelity: docs/design_handoff_waggle_app/design-files/screens/storage.html (view-a) */ import { useEffect, useState } from 'react'; -import { Cloud, HardDrive, Server, ShieldCheck, Folder, FileText, Loader2 } from 'lucide-react'; +import { Cloud, HardDrive, ShieldCheck, Folder, FileText, Loader2 } from 'lucide-react'; import type { ElementType } from 'react'; import type { FileEntry, StorageType, Workspace } from '@/lib/types'; import { adapter } from '@/lib/adapter'; @@ -66,16 +66,6 @@ const STORAGE_TYPE_CARDS: readonly StorageTypeCard[] = [ accent: 'var(--honey)', wash: 'var(--honey-wash)', }, - { - type: 'team', - icon: Server, - title: 'Team', - where: 'shared, synced', - blurb: 'A shared memory + file space for a team — same workspace, role-based access, synced across seats.', - privacy: 'Shared with team', - accent: 'var(--healthy)', - wash: 'var(--healthy-wash)', - }, ]; const STORAGE_LIVE_LABEL: Record = { @@ -246,12 +236,12 @@ const StorageApp = ({ workspaceId, workspaceName, workspace }: StorageAppProps) )} - {/* Three ways a workspace can live */} + {/* Two ways a workspace can live */}
- Three ways a workspace can live + Two ways a workspace can live
-
+
{STORAGE_TYPE_CARDS.map(card => { const active = card.type === storageType; const Icon = card.icon; diff --git a/apps/web/src/components/os/apps/TeamGovernanceApp.tsx b/apps/web/src/components/os/apps/TeamGovernanceApp.tsx deleted file mode 100644 index bd203f1..0000000 --- a/apps/web/src/components/os/apps/TeamGovernanceApp.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { Shield, Lock, Users, Crown } from 'lucide-react'; - -const TeamGovernanceApp = () => { - return ( -
-
- - -
-

Team Governance

-

- Fine-grained permissions, role-based access, and audit controls for your team. -

-
-
- -
-

Role-Based Access

-

Owner, Admin, Member, Viewer

-
-
-
- -
-

Tool Governance

-

Per-role tool allow/deny lists

-
-
-
- -
-

Audit Trail

-

Full action history per member

-
-
-
-
-

Available on Teams ($49/mo per seat) and Enterprise tiers

-
-
- ); -}; - -export default TeamGovernanceApp; diff --git a/apps/web/src/components/os/apps/UserProfileApp.tsx b/apps/web/src/components/os/apps/UserProfileApp.tsx index 2361a94..8b14c7a 100644 --- a/apps/web/src/components/os/apps/UserProfileApp.tsx +++ b/apps/web/src/components/os/apps/UserProfileApp.tsx @@ -7,6 +7,7 @@ import { } from 'lucide-react'; import { Input } from '@/components/ui/input'; import { adapter } from '@/lib/adapter'; +import { hasMemoryFeature } from '@/lib/memory-features'; interface IdentitySuggestion { field: 'name' | 'role' | 'company' | 'industry' | 'bio'; @@ -272,7 +273,7 @@ const UserProfileApp = () => { so the user sees "here's what we learned" before seeing the blank inputs. Each row: label + value + confidence dot + accept / dismiss. Block auto-hides when all are handled. */} - {suggestions.length > 0 && ( + {hasMemoryFeature('importHistory') && suggestions.length > 0 && (
diff --git a/apps/web/src/components/os/apps/WaggleDanceApp.tsx b/apps/web/src/components/os/apps/WaggleDanceApp.tsx deleted file mode 100644 index b953bf1..0000000 --- a/apps/web/src/components/os/apps/WaggleDanceApp.tsx +++ /dev/null @@ -1,209 +0,0 @@ -import { useMemo, useState } from 'react'; -import { Zap, Eye, ArrowRightLeft, Lightbulb, AlertTriangle, Radio, RefreshCw, Check, Send } from 'lucide-react'; -import { useWaggleDance } from '@/hooks/useWaggleDance'; -import { Button } from '@/components/ui/button'; -import { Badge } from '@/components/ui/badge'; -import { ScrollArea } from '@/components/ui/scroll-area'; -import type { WaggleSignal } from '@/lib/types'; -import { sortSignalsForDisplay } from '@/lib/waggle-signals'; -import { DATE_LOCALE } from '@/lib/date-locale'; - -type TypeConfigEntry = { icon: React.ElementType; color: string; label: string }; - -const typeConfig: Record = { - discovery: { icon: Eye, color: 'text-amber-400', label: 'Discovery' }, - handoff: { icon: ArrowRightLeft, color: 'text-sky-400', label: 'Handoff' }, - insight: { icon: Lightbulb, color: 'text-emerald-400', label: 'Insight' }, - alert: { icon: AlertTriangle, color: 'text-rose-400', label: 'Alert' }, - coordination: { icon: Radio, color: 'text-violet-400', label: 'Coordination' }, -}; - -const FALLBACK_TYPE_CONFIG: TypeConfigEntry = { - icon: Zap, - color: 'text-muted-foreground', - label: 'Activity', -}; - -function getTypeConfig(type: string): TypeConfigEntry { - const known = (typeConfig as Record)[type]; - return known ?? { ...FALLBACK_TYPE_CONFIG, label: type }; -} - -const filterTypes: (WaggleSignal['type'] | 'all')[] = ['all', 'discovery', 'handoff', 'insight', 'alert', 'coordination']; - -const WaggleDanceApp = () => { - const { signals, allSignals, loading, error, filter, setFilter, refresh, acknowledge } = useWaggleDance(); - const [selectedSignal, setSelectedSignal] = useState(null); - // M-41 / P18 — unacknowledged first, severity desc, then recency. - const orderedSignals = useMemo(() => sortSignalsForDisplay(signals), [signals]); - - const unacknowledgedCount = allSignals.filter(s => !s.acknowledged).length; - - return ( -
- {/* Header */} -
-
- - Waggle Dance - {unacknowledgedCount > 0 && ( - - {unacknowledgedCount} - - )} -
- -
- - {/* Filter tabs */} -
- {filterTypes.map(t => { - const cfg = t === 'all' ? null : typeConfig[t]; - const Icon = cfg?.icon; - return ( - - ); - })} -
- - {/* Content */} -
- {/* Signal list */} - -
- {loading && signals.length === 0 && ( -
Loading signals…
- )} - {/* P7/D15 B5: the hook already tracks `error` — a load failure must - not masquerade as "no signals yet". */} - {!loading && error && signals.length === 0 && ( -
- -

Couldn't load signals

-

The Waggle Dance feed is unreachable — this is a load error, not an empty feed.

- -
- )} - {!loading && !error && signals.length === 0 && ( -
- -

No waggle dance signals yet

-

Signals appear when agents share findings across workspaces

-
- )} - {orderedSignals.map(signal => { - const cfg = getTypeConfig(signal.type); - const Icon = cfg.icon; - const isSelected = selectedSignal?.id === signal.id; - return ( - - ); - })} -
-
- - {/* Detail pane */} - {selectedSignal && ( -
-
-
- {(() => { - const cfg = getTypeConfig(selectedSignal.type); - const Icon = cfg.icon; - return ; - })()} - {getTypeConfig(selectedSignal.type).label} - {selectedSignal.priority && selectedSignal.priority !== 'normal' && selectedSignal.priority !== 'low' && ( - - {selectedSignal.priority.toUpperCase()} - - )} -
-

{selectedSignal.title}

-

{selectedSignal.content}

- -
-
Source: {selectedSignal.sourceWorkspaceName || selectedSignal.sourceWorkspaceId}
- {selectedSignal.sourceUser &&
User: {selectedSignal.sourceUser}
} - {selectedSignal.sourceAgentId &&
Agent: {selectedSignal.sourceAgentId}
} - {selectedSignal.targetWorkspaceId &&
Target: {selectedSignal.targetWorkspaceId}
} -
Time: {new Date(selectedSignal.timestamp).toLocaleString(DATE_LOCALE)}
-
- - {selectedSignal.metadata && Object.keys(selectedSignal.metadata).length > 0 && ( -
-

Metadata

-
-                    {JSON.stringify(selectedSignal.metadata, null, 2)}
-                  
-
- )} -
-
- {!selectedSignal.acknowledged && ( - - )} - -
-
- )} -
-
- ); -}; - -export default WaggleDanceApp; diff --git a/apps/web/src/components/os/apps/agents/AgentBuilder.tsx b/apps/web/src/components/os/apps/agents/AgentBuilder.tsx index 6f6417a..e2b8ace 100644 --- a/apps/web/src/components/os/apps/agents/AgentBuilder.tsx +++ b/apps/web/src/components/os/apps/agents/AgentBuilder.tsx @@ -19,7 +19,7 @@ import type { AgentType, AutonomyLevel, ConnectorDefinition, Scope } from '@wagg * before Create. Elevated selections (connectors / MCP servers) route * through the ApprovalModal before the create fires (§17.3). * - * Create is FREE-tier (no gate — agents generate memory, CLAUDE.md §1). + * Create has no gate: agents generate memory. * v1 deliberate omissions (rendered honestly, not silently): * - no per-tool grants — tools derive from persona + skills (the create * contract carries no tools field); diff --git a/apps/web/src/components/os/apps/files/files-tabs.test.ts b/apps/web/src/components/os/apps/files/files-tabs.test.ts index 64ec85d..daf87ec 100644 --- a/apps/web/src/components/os/apps/files/files-tabs.test.ts +++ b/apps/web/src/components/os/apps/files/files-tabs.test.ts @@ -2,8 +2,8 @@ import { describe, it, expect } from 'vitest'; import { initialTabFor, FILES_TAB_ORDER } from './files-tabs'; describe('FILES_TAB_ORDER', () => { - it('is virtual → local → team in that order', () => { - expect(FILES_TAB_ORDER).toEqual(['virtual', 'local', 'team']); + it('is virtual → local in that order (no Team tab, ADR-0003)', () => { + expect(FILES_TAB_ORDER).toEqual(['virtual', 'local']); }); }); @@ -11,7 +11,10 @@ describe('initialTabFor', () => { it("returns the workspace's configured storageType when it's one of the known tabs", () => { expect(initialTabFor('virtual')).toBe('virtual'); expect(initialTabFor('local')).toBe('local'); - expect(initialTabFor('team')).toBe('team'); + }); + + it("opens a legacy team workspace on 'virtual'", () => { + expect(initialTabFor('team')).toBe('virtual'); }); it("falls back to 'virtual' when storageType is undefined", () => { diff --git a/apps/web/src/components/os/apps/files/files-tabs.ts b/apps/web/src/components/os/apps/files/files-tabs.ts index 48105c3..cffe7cc 100644 --- a/apps/web/src/components/os/apps/files/files-tabs.ts +++ b/apps/web/src/components/os/apps/files/files-tabs.ts @@ -10,16 +10,15 @@ import type { StorageType } from '@/lib/types'; * through. See FilesAppTabs.tsx for the key-based remount. */ -export const FILES_TAB_ORDER: StorageType[] = ['virtual', 'local', 'team']; +export const FILES_TAB_ORDER: StorageType[] = ['virtual', 'local']; /** * Pick the initial tab for the Files app when it opens. Preference order: * 1. The workspace's configured storageType (if set) * 2. 'virtual' — always available, safe default * - * 'team' would be valid in the config but we never default to it on open - * because a team workspace without a connected team server has nothing to - * show; the tab strip lets the user switch manually. + * A legacy 'team' workspace opens on 'virtual': team storage needs a team + * server, and team mode is not part of the community edition (ADR-0003). */ export function initialTabFor( configured: StorageType | undefined, diff --git a/apps/web/src/components/os/overlays/AnalyticsConsentDialog.tsx b/apps/web/src/components/os/overlays/AnalyticsConsentDialog.tsx new file mode 100644 index 0000000..caf21dd --- /dev/null +++ b/apps/web/src/components/os/overlays/AnalyticsConsentDialog.tsx @@ -0,0 +1,83 @@ +/** + * AnalyticsConsentDialog — the first-run analytics question (ADR-0006). + * + * AppShell mounts it only when the build carries a PostHog key and the user + * has not chosen yet (`shouldAskAnalyticsConsent`). "Allow" and "Don't allow" + * store the choice. Escape closes the dialog without storing anything: nothing + * is sent, and the question comes back on the next launch. + * + * The list of what is sent mirrors the events in `@/lib/posthog`. + */ + +import { BarChart3 } from 'lucide-react'; +import { adapter } from '@/lib/adapter'; +import { setAnalyticsConsent, type AnalyticsConsent } from '@/lib/analytics-consent'; +import { useFocusTrap } from '@/hooks/useFocusTrap'; + +interface AnalyticsConsentDialogProps { + /** Called after a choice is made or the dialog is dismissed. */ + onClose: () => void; +} + +const buttonClass = + 'px-4 py-2 rounded-xl border border-border/50 bg-secondary/40 text-sm font-display font-semibold text-foreground hover:bg-secondary/70 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60'; + +export default function AnalyticsConsentDialog({ onClose }: AnalyticsConsentDialogProps) { + const dialogRef = useFocusTrap(true, onClose); + + const choose = (choice: AnalyticsConsent) => { + void setAnalyticsConsent(choice); + // The Settings toggle drives the local usage log and PostHog together; + // keep the local log in step with this first answer. + void adapter.toggleTelemetry(choice === 'granted').catch(() => {}); + onClose(); + }; + + return ( +
+ + ); +} diff --git a/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx b/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx index 024012c..a8ecf9c 100644 --- a/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx +++ b/apps/web/src/components/os/overlays/CreateWorkspaceDialog.tsx @@ -1,6 +1,6 @@ import { useState, useCallback, useEffect, useRef } from 'react'; import { - X, Plus, Users, Cloud, HardDrive, Server, FolderOpen, Folder, + X, Plus, Users, Cloud, HardDrive, FolderOpen, Folder, FolderPlus, ChevronRight, Home, Check, Loader2, LayoutTemplate, Sparkles, Info, Wand2, Target, Microscope, Code, Megaphone, Rocket, Scale, Building, FileText, Laptop, PenLine, BarChart3, @@ -43,7 +43,7 @@ interface CreateWorkspaceDialogProps { open: boolean; onClose: () => void; onCreate: (data: { - name: string; group: string; persona?: string; agentGroupId?: string; shared?: boolean; + name: string; group: string; persona?: string; agentGroupId?: string; storageType?: StorageType; storagePath?: string; templateId?: string; }) => void; } @@ -54,7 +54,6 @@ const GROUPS = [...STANDARD_GROUPS]; const STORAGE_OPTIONS: { type: StorageType; label: string; desc: string; icon: React.ElementType; color: string }[] = [ { type: 'virtual', label: 'Virtual', desc: 'Server-managed storage', icon: Cloud, color: 'text-violet-400' }, { type: 'local', label: 'Local', desc: 'Local disk directory', icon: HardDrive, color: 'text-emerald-400' }, - { type: 'team', label: 'Team', desc: 'Remote S3/MinIO storage', icon: Server, color: 'text-sky-400' }, ]; /** Icon map for known template IDs */ @@ -730,7 +729,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo const [name, setName] = useState(''); const [group, setGroup] = useState('Personal'); const [selectedPersona, setSelectedPersona] = useState(); - const [shared, setShared] = useState(false); const [storageType, setStorageType] = useState('virtual'); const [storagePath, setStoragePath] = useState(''); const [showFolderPicker, setShowFolderPicker] = useState(false); @@ -801,11 +799,10 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo name: name.trim(), group, persona: agentMode === 'single' ? selectedPersona : undefined, agentGroupId: agentMode === 'group' ? selectedGroupId : undefined, - shared, storageType, storagePath: storagePath.trim() || undefined, templateId: selectedTemplate || undefined, }); - setName(''); setGroup('Personal'); setSelectedPersona(undefined); setShared(false); + setName(''); setGroup('Personal'); setSelectedPersona(undefined); setStorageType('virtual'); setStoragePath(''); setSelectedTemplate(null); setShowTemplateOptions(false); setTemplateSearch(''); setCategoryFilter('all'); setShowAgentOptions(false); setAgentMode('single'); setSelectedGroupId(undefined); @@ -1105,7 +1102,7 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo {/* ── Storage Type ── */}
-
+
{STORAGE_OPTIONS.map(opt => (
@@ -1267,22 +1263,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
}
- {/* Share toggle */} -
-
- -
-

Share with team

-

Make visible to all team members

-
-
- -
-
diff --git a/apps/web/src/components/os/overlays/KeyboardShortcutsHelp.tsx b/apps/web/src/components/os/overlays/KeyboardShortcutsHelp.tsx index deba4d2..ff448b1 100644 --- a/apps/web/src/components/os/overlays/KeyboardShortcutsHelp.tsx +++ b/apps/web/src/components/os/overlays/KeyboardShortcutsHelp.tsx @@ -18,7 +18,6 @@ const shortcuts = [ { keys: ['Ctrl', 'Shift', '6'], action: 'Events' }, { keys: ['Ctrl', 'Shift', '7'], action: 'Settings' }, { keys: ['Ctrl', 'Shift', '8'], action: 'Skills' }, - { keys: ['Ctrl', 'Shift', '9'], action: 'Agent Swarm' }, ]}, { category: 'Quick Actions', items: [ { keys: ['Ctrl', 'K'], action: 'Global Search' }, diff --git a/apps/web/src/components/os/overlays/LoginBriefing.tsx b/apps/web/src/components/os/overlays/LoginBriefing.tsx index 44d2880..f9ae8fb 100644 --- a/apps/web/src/components/os/overlays/LoginBriefing.tsx +++ b/apps/web/src/components/os/overlays/LoginBriefing.tsx @@ -346,16 +346,14 @@ const LoginBriefing = ({ onDismiss, onOpenWorkspace }: LoginBriefingProps) => {
{ws.name} - {/* FR #27: tooltip clarifies what the Personal/Team - tag means. Personal workspaces are private to the - account; Team workspaces are - shared. Without this hint the colored chip reads + {/* FR #27: tooltip clarifies what the group tag + means. Without this hint the colored chip reads as decorative metadata. */} {ws.group} diff --git a/apps/web/src/components/os/overlays/OnboardingWizard.tsx b/apps/web/src/components/os/overlays/OnboardingWizard.tsx index 6702c5f..cdb9cdb 100644 --- a/apps/web/src/components/os/overlays/OnboardingWizard.tsx +++ b/apps/web/src/components/os/overlays/OnboardingWizard.tsx @@ -3,6 +3,7 @@ import { motion, AnimatePresence, MotionConfig, useReducedMotion } from 'framer- import beeMascot from '@/assets/personas/general-purpose.png'; import { adapter } from '@/lib/adapter'; import { captureOnboardingComplete } from '@/lib/posthog'; +import { hasMemoryFeature } from '@/lib/memory-features'; import { useOfflineStatus } from '@/hooks/useOfflineStatus'; import type { OnboardingState } from '@/hooks/useOnboarding'; import type { UserProfile, ClassifiedHarvestItem } from '@/lib/types'; @@ -49,6 +50,17 @@ const LAST_INDEX = STEP_NAMES.length - 1; const FIRST_NAV_INDEX = stepIndex('who-are-you'); const LAST_NAV_INDEX = stepIndex('first-task'); +/** ADR-0002: history import is hidden in v1 (memory feature map), so its step + * is skipped. It keeps its index, so a persisted `state.step` still resolves. */ +const isStepShown = (name: StepName): boolean => + name !== 'memory-import' || hasMemoryFeature('importHistory'); +/** Nearest shown step from `from`, walking forward (1) or back (-1). */ +const shownStepFrom = (from: number, dir: 1 | -1): number => { + let i = from; + while (i > 0 && i < LAST_INDEX && !isStepShown(STEP_NAMES[i])) i += dir; + return i; +}; + const DEFAULT_FIRST_MESSAGE = 'Hello! What can you help me with?'; /* ─── Main Component (shell) ─── */ @@ -57,7 +69,7 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis // `state.step` (5-7) that no longer maps to the re-keyed 5-step chain. Clamp // into [0, LAST_INDEX] so resume always lands on a renderable step rather // than a blank screen. `?forceWizard=true` already resets step to 0. - const [step, setStep] = useState(() => Math.min(Math.max(state.step, 0), LAST_INDEX)); + const [step, setStep] = useState(() => shownStepFrom(Math.min(Math.max(state.step, 0), LAST_INDEX), 1)); const autoTimer = useRef | undefined>(undefined); const offline = useOfflineStatus(); const reduceMotion = useReducedMotion(); @@ -191,8 +203,9 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis finally { setImporting(false); } }; - /* ── Claude Code auto-detect on mount ── */ + /* ── Claude Code auto-detect on mount (only when the import step is shown) ── */ useEffect(() => { + if (!isStepShown('memory-import')) return; let cancelled = false; (async () => { try { @@ -277,10 +290,15 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis const progressPct = LAST_INDEX > 0 ? (step / LAST_INDEX) * 100 : 0; // Nav chrome (Back + "Step N of M" + dots) spans who-are-you → first-task, so // each interactive step has a distinct counter/dot fill (template = 4 of 5, - // first-task = 5 of 5) instead of two identical "Step 4 of 4" screens. + // first-task = 5 of 5) instead of two identical "Step 4 of 4" screens. A + // hidden step (isStepShown) gets no dot and no number. const showNavChrome = step >= FIRST_NAV_INDEX; - const navTotal = LAST_NAV_INDEX - FIRST_NAV_INDEX + 1; - const navCurrent = step - FIRST_NAV_INDEX + 1; + const navSteps = STEP_NAMES + .map((name, index) => ({ name, index })) + .filter(({ name, index }) => index >= FIRST_NAV_INDEX && index <= LAST_NAV_INDEX && isStepShown(name)) + .map(({ index }) => index); + const navTotal = navSteps.length; + const navCurrent = navSteps.indexOf(step) + 1; const recommendedId = recommendTemplateId(profile.workType, profile.role); return ( @@ -358,7 +376,7 @@ const OnboardingWizard = ({ serverBaseUrl, state, onUpdate, onComplete, onDismis