Free Motion Capture for Everyone πβ¨
TypeScript
check point
jonmatthis096306501b7b
diff --git a/freemocap-ui-old/src/layout/BaseContentRouter.tsx b/freemocap-ui-old/src/layout/BaseContentRouter.tsxindex 7903c0f1..cb1eca53 100644--- a/freemocap-ui-old/src/layout/BaseContentRouter.tsx+++ b/freemocap-ui-old/src/layout/BaseContentRouter.tsx@@ -4,7 +4,7 @@ import { CamerasPage } from '@/pages/CamerasPage';import VideosPage from '@/pages/VideosPage';import WelcomePage from '@/pages/WelcomePage';import { Viewport3dPage } from '@/pages/Viewport3dPage';-import { SettingsPage } from '@/pages/SettingsPage';+import { SettingsPage } from "@/pages/SettingsPage";export const BaseContentRouter: React.FC = () => {return (diff --git a/freemocap-ui/electron/main/api.ts b/freemocap-ui/electron/main/api.tsindex edca8f6e..4079c2a1 100644--- a/freemocap-ui/electron/main/api.ts+++ b/freemocap-ui/electron/main/api.ts@@ -21,6 +21,55 @@ autoUpdater.allowDowngrade = false;const t = initTRPC.create({transformer: superjson, // Handles Date/undefined/etc serialization});+// Helper function to check if a directory contains video files+function hasVideoFiles(dirPath: string): boolean {+ if (!fs.existsSync(dirPath)) {+ return false;+ }++ try {+ const entries = fs.readdirSync(dirPath);+ const videoExtensions = ['.mp4', '.avi', '.mov', '.mkv', '.wmv', '.flv', '.webm'];++ return entries.some(entry => {+ const fullPath = path.join(dirPath, entry);+ const stats = fs.statSync(fullPath);++ if (stats.isFile()) {+ const ext = path.extname(entry).toLowerCase();+ return videoExtensions.includes(ext);+ }+ return false;+ });+ } catch (error) {+ console.error('Error checking for video files:', error);+ return false;+ }+}++// Helper function to find camera calibration TOML file+function findCameraCalibrationToml(dirPath: string): string | null {+ if (!fs.existsSync(dirPath)) {+ return null;+ }++ try {+ const entries = fs.readdirSync(dirPath);++ const calibrationFile = entries.find(entry => {+ const fullPath = path.join(dirPath, entry);+ const stats = fs.statSync(fullPath);++ return stats.isFile() &&+ entry.endsWith('_camera_calibration.toml');+ });++ return calibrationFile ? path.join(dirPath, calibrationFile) : null;+ } catch (error) {+ console.error('Error finding calibration TOML:', error);+ return null;+ }+}// Telemetry config lives in ~/freemocap_data/telemetry_config.jsonconst TELEMETRY_CONFIG_PATH = path.join(os.homedir(), 'freemocap_data', 'telemetry_config.json');@@ -131,6 +180,120 @@ export const api = t.router({});return result.canceled ? null : result.filePaths[0];}),+++ validateCalibrationDirectory: t.procedure+ .input(z.object({ directoryPath: z.string() }))+ .query(({ input }) => {+ const result = {+ exists: false,+ canRecord: false,+ canCalibrate: false,+ cameraCalibrationTomlPath: null as string | null,+ hasSynchronizedVideos: false,+ hasVideos: false,+ errorMessage: null as string | null,+ };++ try {+ result.exists = fs.existsSync(input.directoryPath);++ if (!result.exists) {+ result.canRecord = true;+ result.canCalibrate = false;+ return result;+ }++ const stats = fs.statSync(input.directoryPath);++ if (!stats.isDirectory()) {+ result.errorMessage = 'Path exists but is not a directory';+ return result;+ }++ const synchronizedVideosPath = path.join(input.directoryPath, 'synchronized_videos');+ result.hasSynchronizedVideos = fs.existsSync(synchronizedVideosPath) &&+ fs.statSync(synchronizedVideosPath).isDirectory();++ if (result.hasSynchronizedVideos) {+ result.hasVideos = hasVideoFiles(synchronizedVideosPath);+ }++ if (!result.hasVideos) {+ result.hasVideos = hasVideoFiles(input.directoryPath);+ }++ const entries = fs.readdirSync(input.directoryPath);+ result.canRecord = entries.length === 0 || !result.hasVideos;++ result.canCalibrate = result.hasVideos;++ result.cameraCalibrationTomlPath = findCameraCalibrationToml(input.directoryPath);++ return result;++ } catch (error) {+ console.error('Error validating calibration directory:', error);+ result.errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';+ return result;+ }+ }),++ validateMocapDirectory: t.procedure+ .input(z.object({ directoryPath: z.string() }))+ .query(({ input }) => {+ const result = {+ exists: false,+ canRecord: false,+ canProcess: false,+ cameraCalibrationTomlPath: null as string | null,+ hasSynchronizedVideos: false,+ hasVideos: false,+ errorMessage: null as string | null,+ };++ try {+ result.exists = fs.existsSync(input.directoryPath);++ if (!result.exists) {+ result.canRecord = true;+ result.canProcess = false;+ return result;+ }++ const stats = fs.statSync(input.directoryPath);++ if (!stats.isDirectory()) {+ result.errorMessage = 'Path exists but is not a directory';+ return result;+ }++ const synchronizedVideosPath = path.join(input.directoryPath, 'synchronized_videos');+ result.hasSynchronizedVideos = fs.existsSync(synchronizedVideosPath) &&+ fs.statSync(synchronizedVideosPath).isDirectory();++ if (result.hasSynchronizedVideos) {+ result.hasVideos = hasVideoFiles(synchronizedVideosPath);+ }++ if (!result.hasVideos) {+ result.hasVideos = hasVideoFiles(input.directoryPath);+ }++ const entries = fs.readdirSync(input.directoryPath);+ result.canRecord = !result.hasVideos;+ result.cameraCalibrationTomlPath = findCameraCalibrationToml(input.directoryPath);++ result.canProcess = result.hasVideos && result.cameraCalibrationTomlPath !== null;++ return result;++ } catch (error) {+ console.error('Error validating calibration directory:', error);+ result.errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';+ return result;+ }+ }),}),// Telemetry Settingsdiff --git a/freemocap-ui/package.json b/freemocap-ui/package.jsonindex 8231e18b..955b6e67 100644--- a/freemocap-ui/package.json+++ b/freemocap-ui/package.json@@ -27,6 +27,7 @@"@emotion/react": "^11.13.3","@emotion/styled": "^11.13.0","@fontsource/roboto": "^5.1.0",+ "@monaco-editor/react": "^4.7.0","@mui/icons-material": "^6.4.5","@mui/material": "^6.1.1","@mui/x-tree-view": "^7.29.1",@@ -39,11 +40,13 @@"d3": "^7.9.0","electron-updater": "^6.8.1","i18next-browser-languagedetector": "^8.2.1",+ "js-yaml": "^4.1.1","react-grid-layout": "^2.2.2","react-i18next": "^16.5.4","react-redux": "^9.1.2","react-resizable-panels": "^2.1.7","react-router-dom": "^6.26.2",+ "smol-toml": "^1.6.1","superjson": "^2.2.2","tree-kill": "^1.2.2","zod": "^4.1.5"diff --git a/freemocap-ui/public/freemocap-logo.png b/freemocap-ui/public/freemocap-logo.pngindex f8596e6f..965d70bd 100644Binary files a/freemocap-ui/public/freemocap-logo.png and b/freemocap-ui/public/freemocap-logo.png differdiff --git a/freemocap-ui/src/components/settings-editor/SettingsEditor.tsx b/freemocap-ui/src/components/settings-editor/SettingsEditor.tsxindex 16d67b9a..a3be8399 100644--- a/freemocap-ui/src/components/settings-editor/SettingsEditor.tsx+++ b/freemocap-ui/src/components/settings-editor/SettingsEditor.tsx@@ -31,7 +31,6 @@ import {} from '@/store/slices/mocap';import {calibrationConfigUpdated, updateCalibrationConfigOnServer } from '@/store/slices/calibration';import { ThemeMode } from '@/store/slices/theme/theme-types';-import { useServer } from '@/hooks/useServer';import {serialize,deserialize,@@ -41,6 +40,7 @@ import {FORMAT_MIME_TYPES,FORMAT_MONACO_LANGUAGES,} from './format-converters';+import {useServer} from "@/services";// ββ Aggregated settings shape (config-only, no runtime state) ββdiff --git a/freemocap-ui/src/layout/BaseContentRouter.tsx b/freemocap-ui/src/layout/BaseContentRouter.tsxindex 53df55b2..ed543398 100644--- a/freemocap-ui/src/layout/BaseContentRouter.tsx+++ b/freemocap-ui/src/layout/BaseContentRouter.tsx@@ -3,7 +3,7 @@ import {Navigate, Route, Routes} from 'react-router-dom';import {CamerasPage} from "@/pages/CamerasPage";import PlaybackPage from "@/pages/PlaybackPage";import WelcomePage from "@/pages/WelcomePage";-import SettingsPage from "@/pages/SettingsPage";+import { SettingsPage } from "@/pages/SettingsPage";import {Viewport3dPage} from "@/pages/Viewport3dPage";export const BaseContentRouter: React.FC = () => {diff --git a/freemocap-ui/src/pages/SettingsPage.tsx b/freemocap-ui/src/pages/SettingsPage.tsxindex 5872c475..13508c4a 100644--- a/freemocap-ui/src/pages/SettingsPage.tsx+++ b/freemocap-ui/src/pages/SettingsPage.tsx@@ -1,382 +1,1509 @@-import React, { useCallback } from "react";+import React, { useState, useCallback, useEffect } from 'react';import {- Box,- Chip,- Container,- Divider,- FormControl,- FormControlLabel,- InputLabel,- MenuItem,- Paper,- Select,- Switch,- ToggleButton,- ToggleButtonGroup,- Tooltip,- Typography,-} from "@mui/material";-import { useTheme } from "@mui/material/styles";-import type { SelectChangeEvent } from "@mui/material/Select";-import SmartToyIcon from "@mui/icons-material/SmartToy";-import VerifiedIcon from "@mui/icons-material/Verified";-import TranslateIcon from "@mui/icons-material/Translate";-import PaletteIcon from "@mui/icons-material/Palette";-import InfoIcon from "@mui/icons-material/Info";-import OpenInNewIcon from "@mui/icons-material/OpenInNew";-import {EXTERNAL_URLS} from "@/constants/external-urls";-import { useTranslation } from "react-i18next";-import { Footer } from "@/components/ui-components/Footer";-import { useAppDispatch, useAppSelector } from "@/store";-import { themeModeSet } from "@/store/slices/theme";+ Box,+ Typography,+ Switch,+ FormControlLabel,+ TextField,+ Slider,+ Select,+ MenuItem,+ FormControl,+ InputLabel,+ Paper,+ List,+ ListItemButton,+ ListItemIcon,+ ListItemText,+ Divider,+ Chip,+ Button,+ CircularProgress,+ Alert,+ Tooltip,+ LinearProgress,+ IconButton,+} from '@mui/material';+import { useTheme } from '@mui/material/styles';+import PaletteIcon from '@mui/icons-material/Palette';+import DnsIcon from '@mui/icons-material/Dns';+import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord';+import SquareFootIcon from '@mui/icons-material/SquareFoot';+import DirectionsRunIcon from '@mui/icons-material/DirectionsRun';+import CastConnectedIcon from '@mui/icons-material/CastConnected';+import ComputerIcon from '@mui/icons-material/Computer';+import MemoryIcon from '@mui/icons-material/Memory';+import SpeedIcon from '@mui/icons-material/Speed';+import StorageIcon from '@mui/icons-material/Storage';+import VideocamIcon from '@mui/icons-material/Videocam';+import CheckCircleIcon from '@mui/icons-material/CheckCircle';+import ErrorIcon from '@mui/icons-material/Error';+import WarningIcon from '@mui/icons-material/Warning';+import DownloadIcon from '@mui/icons-material/Download';+import RefreshIcon from '@mui/icons-material/Refresh';+import ArrowBackIcon from '@mui/icons-material/ArrowBack';+import CodeIcon from '@mui/icons-material/Code';+import { useNavigate } from 'react-router-dom';import {- localeChanged,- showTranslationIndicatorToggled,- selectLocale,- selectShowTranslationIndicator,-} from "@/store/slices/locale";+ useAppDispatch,+ useAppSelector,+ themeModeSet,+ themeModeToggled,+ recordingDirectoryChanged,+ useDelayStartToggled,+ delaySecondsChanged,+ useTimestampToggled,+ useIncrementToggled,+ baseNameChanged,+ recordingTagChanged,+ createSubfolderToggled,+ customSubfolderNameChanged,+ selectServerSettings,+} from '@/store';+import { ThemeMode } from '@/store/slices/theme/theme-types';+import { useCalibration } from '@/hooks/useCalibration';+import { useMocap } from '@/hooks/useMocap';+import {useElectronIPC, useServer} from '@/services';import {- SUPPORTED_LOCALES,- getTranslationSource,-} from "@/i18n";-import type { SupportedLocale } from "@/i18n";-import type { ThemeMode } from "@/store/slices/theme";-import * as Flags from "country-flag-icons/react/3x2";-import {CherokeeFlag} from "@/components/languages/custom-flag-icons/CherokeeFlag";-import { VersionChip } from "@/components/ui-components/VersionChip";--const FlagIcon: React.FC<{ countryCode: string }> = ({ countryCode }) => {- if (countryCode === "CHEROKEE") return <CherokeeFlag />;- const Flag = Flags[countryCode as keyof typeof Flags];- if (!Flag) return null;- return <Flag style={{ width: 20, height: 14, borderRadius: 2, flexShrink: 0 }} />;+ MediapipeModelComplexity,+ MEDIAPIPE_REALTIME_PRESET,+ MEDIAPIPE_POSTHOC_PRESET,+ DEFAULT_REALTIME_FILTER_CONFIG,+} from '@/store/slices/mocap';+import { SettingsEditor } from '@/components/settings-editor/SettingsEditor';++// ββ Section IDs ββ++type SectionId =+ | 'appearance'+ | 'connection'+ | 'recording'+ | 'calibration'+ | 'mocap'+ | 'vmc'+ | 'system'+ | 'editor';++interface SectionDef {+ id: SectionId;+ label: string;+ icon: React.ReactNode;+}++const SECTIONS: SectionDef[] = [+ { id: 'appearance', label: 'Appearance', icon: <PaletteIcon /> },+ { id: 'connection', label: 'Server Connection', icon: <DnsIcon /> },+ { id: 'recording', label: 'Recording', icon: <FiberManualRecordIcon /> },+ { id: 'calibration', label: 'Calibration', icon: <SquareFootIcon /> },+ { id: 'mocap', label: 'Motion Capture', icon: <DirectionsRunIcon /> },+ { id: 'vmc', label: 'VMC Output', icon: <CastConnectedIcon /> },+ { id: 'system', label: 'System Info', icon: <ComputerIcon /> },+ { id: 'editor', label: 'Raw Editor', icon: <CodeIcon /> },+];++// ββ Setup wizard types (mirrors electron-side types) ββ++interface CpuInfo { model: string; cores: number; threads: number; speedMhz: number }+interface RamInfo { totalGb: number; availableGb: number }+interface GpuInfo { name: string; vendor: string; vramMb: number | null; cudaAvailable: boolean; cudaVersion: string | null }+interface DiskInfo { path: string; totalGb: number; freeGb: number }+interface OsInfo { platform: string; release: string; arch: string; hostname: string }+type PerformanceTier = 'basic' | 'standard' | 'advanced' | 'pro';+interface PerformanceRecommendation {+ tier: PerformanceTier;+ label: string;+ description: string;+ maxCameras: number;+ maxResolution: string;+ realtimeTracking: boolean;+ warnings: string[];+}+interface SystemScanResult {+ cpu: CpuInfo;+ ram: RamInfo;+ gpus: GpuInfo[];+ disk: DiskInfo;+ os: OsInfo;+ recommendation: PerformanceRecommendation;+ scannedAt: string;+}++type DependencyStatus = 'installed' | 'missing' | 'outdated' | 'checking' | 'installing' | 'error';+interface DependencyInfo {+ id: string;+ name: string;+ description: string;+ required: boolean;+ status: DependencyStatus;+ version: string | null;+ installedPath: string | null;+ error: string | null;+}++const SYSTEM_SCAN_KEY = 'lastSystemScan';++const TIER_COLORS: Record<PerformanceTier, string> = {+ basic: '#ff9800',+ standard: '#2196f3',+ advanced: '#4caf50',+ pro: '#00e5ff',};-const SectionHeader: React.FC<{- icon: React.ReactNode;- title: string;-}> = ({ icon, title }) => {- const theme = useTheme();- return (- <Box- sx={{- display: "flex",- alignItems: "center",- gap: 1,- mb: 2,- mt: 1,- }}- >- <Box sx={{ color: theme.palette.primary.main, display: "flex" }}>- {icon}- </Box>- <Typography variant="h6" sx={{ fontSize: 15, fontWeight: 600 }}>- {title}- </Typography>- </Box>- );+const TIER_EMOJIS: Record<PerformanceTier, string> = {+ basic: 'π’',+ standard: 'π',+ advanced: 'π',+ pro: 'β‘',};-const SettingsPage: React.FC = () => {- const { t } = useTranslation();- const theme = useTheme();- const dispatch = useAppDispatch();- const isDark = theme.palette.mode === "dark";-- const currentLocale = useAppSelector(selectLocale);- const showTranslationIndicator = useAppSelector(- selectShowTranslationIndicator- );- const themeMode = useAppSelector((state) => state.theme.mode);- const translationSource = getTranslationSource(currentLocale);-- const handleLocaleChange = useCallback(- (event: SelectChangeEvent<string>) => {- dispatch(localeChanged(event.target.value as SupportedLocale));- },- [dispatch]- );-- const handleThemeChange = useCallback(- (- _event: React.MouseEvent<HTMLElement>,- newMode: string | null- ) => {- if (newMode !== null) {- dispatch(themeModeSet(newMode as ThemeMode));- }- },- [dispatch]- );-- const handleTranslationIndicatorToggle = useCallback(() => {- dispatch(showTranslationIndicatorToggled());- }, [dispatch]);-- const sourceLabel =- translationSource === "human-authored"- ? t("humanTranslated")- : translationSource === "human-validated"- ? t("humanValidated")- : t("aiTranslated");-- const sourceIcon =- translationSource === "ai-generated" ? (- <SmartToyIcon sx={{ fontSize: 14 }} />- ) : (- <VerifiedIcon sx={{ fontSize: 14 }} />+// ββ Shared layout components ββ++function SectionHeader({ title, description }: { title: string; description?: string }) {+ const theme = useTheme();+ return (+ <Box sx={{ mb: 3 }}>+ <Typography variant="h5" sx={{ fontWeight: 700, mb: 0.5 }}>+ {title}+ </Typography>+ {description && (+ <Typography variant="body2" sx={{ color: theme.palette.text.secondary }}>+ {description}+ </Typography>+ )}+ </Box>);+}- const sourceColor =- translationSource === "ai-generated"- ? "warning"- : translationSource === "human-validated"- ? "success"- : ("info" as const);-- return (- <Box- sx={{- flex: 1,- display: "flex",- flexDirection: "column",- height: "100%",- backgroundColor: isDark- ? theme.palette.background.default- : theme.palette.background.paper,- overflow: "auto",- }}- >- <Container maxWidth="sm" sx={{ py: 3, flex: 1 }}>- <Typography- variant="h5"- sx={{ fontWeight: 700, mb: 3 }}+function SettingRow({ label, description, children }: { label: string; description?: string; children: React.ReactNode }) {+ const theme = useTheme();+ return (+ <Box+ sx={{+ display: 'flex',+ alignItems: 'flex-start',+ justifyContent: 'space-between',+ py: 1.5,+ gap: 3,+ }}>- {t("settings")}- </Typography>+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Typography variant="body1" sx={{ fontWeight: 500 }}>+ {label}+ </Typography>+ {description && (+ <Typography variant="body2" sx={{ color: theme.palette.text.secondary, mt: 0.25 }}>+ {description}+ </Typography>+ )}+ </Box>+ <Box sx={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>+ {children}+ </Box>+ </Box>+ );+}- {/* Language & Localization */}+function SettingGroup({ title, children }: { title: string; children: React.ReactNode }) {+ const theme = useTheme();+ return (<Paper- elevation={isDark ? 2 : 1}- sx={{- p: 2.5,- mb: 2,- backgroundColor: isDark- ? theme.palette.background.paper- : "#fff",- }}+ elevation={0}+ sx={{+ border: `1px solid ${theme.palette.divider}`,+ borderRadius: 2,+ p: 2.5,+ mb: 2,+ }}>- <SectionHeader- icon={<TranslateIcon fontSize="small" />}- title={t("languageSettings")}- />-- <Box sx={{ display: "flex", flexDirection: "column", gap: 2 }}>- <Box- sx={{- display: "flex",- alignItems: "center",- gap: 2,- flexWrap: "wrap",- }}+ <Typography+ variant="overline"+ sx={{+ fontWeight: 700,+ color: theme.palette.text.secondary,+ letterSpacing: 1.2,+ mb: 1,+ display: 'block',+ }}>- <FormControl size="small" sx={{ minWidth: 180 }}>- <InputLabel id="settings-language-label">- {t("language")}- </InputLabel>- <Select- labelId="settings-language-label"- value={currentLocale}- label={t("language")}- onChange={handleLocaleChange}- sx={{ fontSize: 13 }}+ {title}+ </Typography>+ <Divider sx={{ mb: 1 }} />+ {children}+ </Paper>+ );+}++// ββ Section: Appearance ββ++function AppearanceSection() {+ const dispatch = useAppDispatch();+ const themeMode = useAppSelector(state => state.theme.mode);++ return (+ <>+ <SectionHeader+ title="Appearance"+ description="Customize how FreeMoCap looks."+ />+ <SettingGroup title="Theme">+ <SettingRow+ label="Dark Mode"+ description="Toggle between light and dark color schemes.">- {Object.entries(SUPPORTED_LOCALES).map(- ([code, { label, dir, flag }]) => (- <MenuItem key={code} value={code}>- <Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>- <FlagIcon countryCode={flag} />- <Typography- component="span"- sx={{ fontSize: 13, direction: dir }}- >- {label}- </Typography>- <Typography- component="span"- sx={{ fontSize: 11, color: "text.disabled", fontFamily: "monospace" }}- >- {code}- </Typography>- </Box>- </MenuItem>- )- )}- </Select>- </FormControl>-- {translationSource !== "human-authored" && (- <Tooltip- title={- translationSource === "ai-generated"- ? t("aiTranslatedTooltip")- : t("humanValidatedTooltip")- }- arrow+ <Switch+ checked={themeMode === 'dark'}+ onChange={() => dispatch(themeModeToggled())}+ />+ </SettingRow>+ <SettingRow+ label="Color Scheme"+ description="Choose your preferred theme.">- <Chip- icon={sourceIcon}- label={sourceLabel}- size="small"- color={sourceColor}- variant="outlined"- clickable- component="a"- href={EXTERNAL_URLS.TRANSLATION_LOCALES}- target="_blank"- rel="noopener noreferrer"- sx={{- height: 24,- fontSize: 11,- cursor: "pointer",- "& .MuiChip-icon": { fontSize: 14 },- }}- />- </Tooltip>- )}- </Box>+ <FormControl size="small" sx={{ minWidth: 140 }}>+ <Select+ value={themeMode}+ onChange={(e) => dispatch(themeModeSet(e.target.value as ThemeMode))}+ >+ <MenuItem value="dark">Dark</MenuItem>+ <MenuItem value="light">Light</MenuItem>+ </Select>+ </FormControl>+ </SettingRow>+ </SettingGroup>+ </>+ );+}++// ββ Section: Server Connection ββ++function ConnectionSection() {+ const { isConnected, connect, disconnect } = useServer();+ const theme = useTheme();++ return (+ <>+ <SectionHeader+ title="Server Connection"+ description="Connection to the FreeMoCap backend server."+ />+ <SettingGroup title="Status">+ <SettingRow+ label="Connection Status"+ description={`Current state: ${isConnected ? 'Connected' : 'Disconnected'}`}+ >+ <Chip+ label={isConnected ? 'Connected' : 'Disconnected'}+ color={isConnected ? 'success' : 'error'}+ size="small"+ variant="outlined"+ />+ </SettingRow>+ <SettingRow+ label="Server Address"+ description="Backend server URL (configured at build time)."+ >+ <Typography variant="body2" sx={{ fontFamily: 'monospace', color: theme.palette.text.secondary }}>+ localhost:53117+ </Typography>+ </SettingRow>+ <SettingRow label="Actions">+ <Box sx={{ display: 'flex', gap: 1 }}>+ <Button+ size="small"+ variant="outlined"+ onClick={connect}+ disabled={isConnected}+ >+ Connect+ </Button>+ <Button+ size="small"+ variant="outlined"+ color="error"+ onClick={disconnect}+ disabled={!isConnected}+ >+ Disconnect+ </Button>+ </Box>+ </SettingRow>+ </SettingGroup>+ </>+ );+}++// ββ Section: Recording ββ++function RecordingSection() {+ const dispatch = useAppDispatch();+ const recording = useAppSelector(state => state.recording);+ const { isElectron, api } = useElectronIPC();++ const handleBrowseDirectory = useCallback(async () => {+ if (!isElectron || !api) return;+ const result = await api.fileSystem.selectDirectory.query();+ if (result) {+ dispatch(recordingDirectoryChanged(result as string));+ }+ }, [dispatch, isElectron, api]);++ return (+ <>+ <SectionHeader+ title="Recording"+ description="Configure how recordings are saved and named."+ />+ <SettingGroup title="Storage">+ <SettingRow+ label="Recording Directory"+ description="Base folder for saving recordings."+ >+ <Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}>+ <TextField+ size="small"+ value={recording.recordingDirectory}+ onChange={(e) => dispatch(recordingDirectoryChanged(e.target.value))}+ sx={{ minWidth: 260 }}+ inputProps={{ style: { fontFamily: 'monospace', fontSize: 13 } }}+ />+ {isElectron && (+ <Button size="small" variant="outlined" onClick={handleBrowseDirectory}>+ Browse+ </Button>+ )}+ </Box>+ </SettingRow>+ <SettingRow+ label="Create Subfolder"+ description="Put each recording session in its own subfolder."+ >+ <Switch+ checked={recording.config.createSubfolder}+ onChange={(_, v) => dispatch(createSubfolderToggled(v))}+ />+ </SettingRow>+ {recording.config.createSubfolder && (+ <SettingRow+ label="Custom Subfolder Name"+ description="Leave blank for auto-generated timestamp name."+ >+ <TextField+ size="small"+ value={recording.config.customSubfolderName}+ onChange={(e) => dispatch(customSubfolderNameChanged(e.target.value))}+ placeholder="(auto)"+ sx={{ minWidth: 200 }}+ />+ </SettingRow>+ )}+ </SettingGroup>++ <SettingGroup title="Naming">+ <SettingRow+ label="Use Timestamp"+ description="Include timestamp in recording name."+ >+ <Switch+ checked={recording.config.useTimestamp}+ onChange={(_, v) => dispatch(useTimestampToggled(v))}+ />+ </SettingRow>+ <SettingRow+ label="Use Increment"+ description="Append an auto-incrementing number."+ >+ <Switch+ checked={recording.config.useIncrement}+ onChange={(_, v) => dispatch(useIncrementToggled(v))}+ />+ </SettingRow>+ {!recording.config.useTimestamp && (+ <SettingRow+ label="Base Name"+ description="Base name for recordings when not using timestamp."+ >+ <TextField+ size="small"+ value={recording.config.baseName}+ onChange={(e) => dispatch(baseNameChanged(e.target.value))}+ sx={{ minWidth: 200 }}+ />+ </SettingRow>+ )}+ <SettingRow+ label="Recording Tag"+ description="Optional tag appended to the recording name."+ >+ <TextField+ size="small"+ value={recording.config.recordingTag}+ onChange={(e) => dispatch(recordingTagChanged(e.target.value))}+ placeholder="(none)"+ sx={{ minWidth: 200 }}+ />+ </SettingRow>+ </SettingGroup>++ <SettingGroup title="Delay Start">+ <SettingRow+ label="Delay Before Recording"+ description="Add a countdown before recording starts."+ >+ <Switch+ checked={recording.config.useDelayStart}+ onChange={(_, v) => dispatch(useDelayStartToggled(v))}+ />+ </SettingRow>+ {recording.config.useDelayStart && (+ <SettingRow+ label="Delay Duration"+ description="Seconds to wait before recording begins."+ >+ <TextField+ size="small"+ type="number"+ value={recording.config.delaySeconds}+ onChange={(e) => dispatch(delaySecondsChanged(Number(e.target.value)))}+ inputProps={{ min: 1, max: 30 }}+ sx={{ width: 100 }}+ />+ </SettingRow>+ )}+ </SettingGroup>++ <SettingGroup title="Preview">+ <Box sx={{ fontFamily: 'monospace', fontSize: 13, opacity: 0.7, p: 1 }}>+ <Typography variant="caption" sx={{ display: 'block' }}>+ Recording name: <strong>{recording.computed.recordingName || '(empty)'}</strong>+ </Typography>+ <Typography variant="caption" sx={{ display: 'block' }}>+ Full path: <strong>{recording.computed.fullRecordingPath}</strong>+ </Typography>+ </Box>+ </SettingGroup>+ </>+ );+}++// ββ Section: Calibration ββ++function CalibrationSection() {+ const { config, updateCalibrationConfig, isLoading } = useCalibration();++ return (+ <>+ <SectionHeader+ title="Calibration"+ description="Camera calibration settings for multi-camera setups."+ />+ <SettingGroup title="ChArUco Board">+ <SettingRow+ label="X Squares"+ description="Number of squares along the X axis."+ >+ <TextField+ size="small"+ type="number"+ value={config.charucoBoardXSquares}+ onChange={(e) => updateCalibrationConfig({ charucoBoardXSquares: Number(e.target.value) })}+ inputProps={{ min: 2, max: 20 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ <SettingRow+ label="Y Squares"+ description="Number of squares along the Y axis."+ >+ <TextField+ size="small"+ type="number"+ value={config.charucoBoardYSquares}+ onChange={(e) => updateCalibrationConfig({ charucoBoardYSquares: Number(e.target.value) })}+ inputProps={{ min: 2, max: 20 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ <SettingRow+ label="Square Length (mm)"+ description="Physical size of each square on the board."+ >+ <TextField+ size="small"+ type="number"+ value={config.charucoSquareLength}+ onChange={(e) => updateCalibrationConfig({ charucoSquareLength: Number(e.target.value) })}+ inputProps={{ min: 1, step: 0.5 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ </SettingGroup>++ <SettingGroup title="Solver">+ <SettingRow+ label="Solver Method"+ description="Algorithm used to solve camera calibration."+ >+ <FormControl size="small" sx={{ minWidth: 140 }}>+ <Select+ value={config.solverMethod}+ onChange={(e) => updateCalibrationConfig({ solverMethod: e.target.value as 'anipose' | 'pyceres' })}+ disabled={isLoading}+ >+ <MenuItem value="anipose">Anipose</MenuItem>+ <MenuItem value="pyceres">PyCeres</MenuItem>+ </Select>+ </FormControl>+ </SettingRow>+ <SettingRow+ label="Use Ground Plane"+ description="Apply ground plane constraint to calibration."+ >+ <Switch+ checked={config.useGroundplane}+ onChange={(_, v) => updateCalibrationConfig({ useGroundplane: v })}+ disabled={isLoading}+ />+ </SettingRow>+ </SettingGroup>++ <SettingGroup title="Recording">+ <SettingRow+ label="Live Track ChArUco"+ description="Show ChArUco detection overlay while recording."+ >+ <Switch+ checked={config.liveTrackCharuco}+ onChange={(_, v) => updateCalibrationConfig({ liveTrackCharuco: v })}+ disabled={isLoading}+ />+ </SettingRow>+ <SettingRow+ label="Min Shared Views Per Camera"+ description="Minimum board observations shared between camera pairs."+ >+ <TextField+ size="small"+ type="number"+ value={config.minSharedViewsPerCamera}+ onChange={(e) => updateCalibrationConfig({ minSharedViewsPerCamera: Number(e.target.value) })}+ inputProps={{ min: 1, max: 200 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ <SettingRow+ label="Auto-Stop on Min View Count"+ description="Automatically stop recording when minimum views are reached."+ >+ <Switch+ checked={config.autoStopOnMinViewCount}+ onChange={(_, v) => updateCalibrationConfig({ autoStopOnMinViewCount: v })}+ disabled={isLoading}+ />+ </SettingRow>+ </SettingGroup>+ </>+ );+}++// ββ Section: Motion Capture ββ++const MODEL_COMPLEXITY_LABELS: Record<MediapipeModelComplexity, string> = {+ 0: 'Lite (fastest)',+ 1: 'Full (balanced)',+ 2: 'Heavy (most accurate)',+};++function MocapSection() {+ const {+ detectorConfig,+ skeletonFilterConfig,+ updateDetectorConfig,+ replaceDetectorConfig,+ updateSkeletonFilterConfig,+ replaceSkeletonFilterConfig,+ isLoading,+ } = useMocap();++ const detectPreset = useCallback(() => {+ if (+ detectorConfig.model_complexity === 0 &&+ !detectorConfig.enable_segmentation &&+ !detectorConfig.smooth_segmentation+ ) return 'realtime';+ if (+ detectorConfig.model_complexity === 2 &&+ detectorConfig.enable_segmentation &&+ detectorConfig.smooth_segmentation+ ) return 'posthoc';+ return 'custom';+ }, [detectorConfig]);++ const currentPreset = detectPreset();++ return (+ <>+ <SectionHeader+ title="Motion Capture"+ description="MediaPipe detector and skeleton filter configuration."+ />++ {/* Detector */}+ <SettingGroup title="MediaPipe Detector">+ <SettingRow+ label="Preset"+ description="Quick-select a tuned detector configuration."+ >+ <Box sx={{ display: 'flex', gap: 1 }}>+ <Chip+ label="Realtime"+ size="small"+ variant={currentPreset === 'realtime' ? 'filled' : 'outlined'}+ color={currentPreset === 'realtime' ? 'primary' : 'default'}+ onClick={() => replaceDetectorConfig({ ...MEDIAPIPE_REALTIME_PRESET })}+ disabled={isLoading}+ sx={{ cursor: 'pointer' }}+ />+ <Chip+ label="Posthoc"+ size="small"+ variant={currentPreset === 'posthoc' ? 'filled' : 'outlined'}+ color={currentPreset === 'posthoc' ? 'primary' : 'default'}+ onClick={() => replaceDetectorConfig({ ...MEDIAPIPE_POSTHOC_PRESET })}+ disabled={isLoading}+ sx={{ cursor: 'pointer' }}+ />+ {currentPreset === 'custom' && (+ <Chip label="Custom" size="small" variant="outlined" color="warning" />+ )}+ </Box>+ </SettingRow>+ <SettingRow+ label="Model Complexity"+ description="Controls accuracy vs. speed tradeoff."+ >+ <FormControl size="small" sx={{ minWidth: 180 }}>+ <Select+ value={detectorConfig.model_complexity}+ onChange={(e) => updateDetectorConfig({ model_complexity: e.target.value as MediapipeModelComplexity })}+ disabled={isLoading}+ >+ <MenuItem value={0}>{MODEL_COMPLEXITY_LABELS[0]}</MenuItem>+ <MenuItem value={1}>{MODEL_COMPLEXITY_LABELS[1]}</MenuItem>+ <MenuItem value={2}>{MODEL_COMPLEXITY_LABELS[2]}</MenuItem>+ </Select>+ </FormControl>+ </SettingRow>+ <SettingRow+ label={`Min Detection Confidence: ${detectorConfig.min_detection_confidence.toFixed(2)}`}+ description="Minimum score for initial pose detection."+ >+ <Slider+ value={detectorConfig.min_detection_confidence}+ onChange={(_, v) => updateDetectorConfig({ min_detection_confidence: v as number })}+ min={0} max={1} step={0.05} size="small"+ disabled={isLoading}+ sx={{ width: 180 }}+ />+ </SettingRow>+ <SettingRow+ label={`Min Tracking Confidence: ${detectorConfig.min_tracking_confidence.toFixed(2)}`}+ description="Minimum score for frame-to-frame tracking."+ >+ <Slider+ value={detectorConfig.min_tracking_confidence}+ onChange={(_, v) => updateDetectorConfig({ min_tracking_confidence: v as number })}+ min={0} max={1} step={0.05} size="small"+ disabled={isLoading}+ sx={{ width: 180 }}+ />+ </SettingRow>+ <SettingRow label="Smooth Landmarks">+ <Switch+ size="small"+ checked={detectorConfig.smooth_landmarks}+ onChange={(_, v) => updateDetectorConfig({ smooth_landmarks: v })}+ disabled={isLoading}+ />+ </SettingRow>+ <SettingRow label="Enable Segmentation">+ <Switch+ size="small"+ checked={detectorConfig.enable_segmentation}+ onChange={(_, v) => updateDetectorConfig({ enable_segmentation: v })}+ disabled={isLoading}+ />+ </SettingRow>+ <SettingRow label="Smooth Segmentation">+ <Switch+ size="small"+ checked={detectorConfig.smooth_segmentation}+ onChange={(_, v) => updateDetectorConfig({ smooth_segmentation: v })}+ disabled={isLoading || !detectorConfig.enable_segmentation}+ />+ </SettingRow>+ <SettingRow label="Refine Face Landmarks">+ <Switch+ size="small"+ checked={detectorConfig.refine_face_landmarks}+ onChange={(_, v) => updateDetectorConfig({ refine_face_landmarks: v })}+ disabled={isLoading}+ />+ </SettingRow>+ <SettingRow label="Static Image Mode">+ <Switch+ size="small"+ checked={detectorConfig.static_image_mode}+ onChange={(_, v) => updateDetectorConfig({ static_image_mode: v })}+ disabled={isLoading}+ />+ </SettingRow>+ </SettingGroup>++ {/* Skeleton Filter */}+ <SettingGroup title="Skeleton Filter">+ <Box sx={{ display: 'flex', justifyContent: 'flex-end', mb: 1 }}>+ <Button+ size="small"+ variant="text"+ onClick={() => replaceSkeletonFilterConfig({ ...DEFAULT_REALTIME_FILTER_CONFIG })}+ disabled={isLoading}+ >+ Reset Defaults+ </Button>+ </Box>- {translationSource === "ai-generated" && (- <Typography- variant="caption"- color="text.secondary"- sx={{ fontSize: 11 }}- >- {t("aiTranslatedTooltip")}{" "}- <Typography- component="a"- href={EXTERNAL_URLS.TRANSLATING_GUIDE}- target="_blank"- rel="noopener noreferrer"- variant="caption"- sx={{- fontSize: 11,- color: "primary.main",- textDecoration: "underline",- cursor: "pointer",- display: 'inline-flex',- alignItems: 'center',- gap: 0.3,- }}+ <SettingRow+ label="Height (meters)"+ description="Subject height for bone length estimation.">- {t("helpTranslate")} <OpenInNewIcon sx={{fontSize: 11}} />+ <TextField+ size="small"+ type="number"+ value={skeletonFilterConfig.height_meters}+ onChange={(e) => updateSkeletonFilterConfig({ height_meters: Number(e.target.value) })}+ inputProps={{ min: 0.5, max: 2.5, step: 0.01 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>++ <Typography variant="caption" sx={{ display: 'block', mt: 1, mb: 0.5, fontWeight: 600, opacity: 0.6 }}>+ ONE EURO FILTER</Typography>- </Typography>- )}+ <SettingRow label={`Min Cutoff: ${skeletonFilterConfig.min_cutoff.toFixed(2)}`}>+ <Slider+ value={skeletonFilterConfig.min_cutoff}+ onChange={(_, v) => updateSkeletonFilterConfig({ min_cutoff: v as number })}+ min={0.01} max={10} step={0.01} size="small"+ disabled={isLoading} sx={{ width: 180 }}+ />+ </SettingRow>+ <SettingRow label={`Beta: ${skeletonFilterConfig.beta.toFixed(3)}`}>+ <Slider+ value={skeletonFilterConfig.beta}+ onChange={(_, v) => updateSkeletonFilterConfig({ beta: v as number })}+ min={0} max={1} step={0.001} size="small"+ disabled={isLoading} sx={{ width: 180 }}+ />+ </SettingRow>+ <SettingRow label={`D Cutoff: ${skeletonFilterConfig.d_cutoff.toFixed(2)}`}>+ <Slider+ value={skeletonFilterConfig.d_cutoff}+ onChange={(_, v) => updateSkeletonFilterConfig({ d_cutoff: v as number })}+ min={0.01} max={10} step={0.01} size="small"+ disabled={isLoading} sx={{ width: 180 }}+ />+ </SettingRow>++ <Typography variant="caption" sx={{ display: 'block', mt: 1, mb: 0.5, fontWeight: 600, opacity: 0.6 }}>+ FABRIK IK+ </Typography>+ <SettingRow label={`Tolerance: ${skeletonFilterConfig.fabrik_tolerance.toFixed(4)}`}>+ <Slider+ value={skeletonFilterConfig.fabrik_tolerance}+ onChange={(_, v) => updateSkeletonFilterConfig({ fabrik_tolerance: v as number })}+ min={0.0001} max={0.1} step={0.0001} size="small"+ disabled={isLoading} sx={{ width: 180 }}+ />+ </SettingRow>+ <SettingRow label="Max Iterations">+ <TextField+ size="small"+ type="number"+ value={skeletonFilterConfig.fabrik_max_iterations}+ onChange={(e) => updateSkeletonFilterConfig({ fabrik_max_iterations: Number(e.target.value) })}+ inputProps={{ min: 1, max: 100 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>++ <Typography variant="caption" sx={{ display: 'block', mt: 1, mb: 0.5, fontWeight: 600, opacity: 0.6 }}>+ POINT GATING+ </Typography>+ <SettingRow label="Max Reprojection Error (px)">+ <TextField+ size="small"+ type="number"+ value={skeletonFilterConfig.max_reprojection_error_px}+ onChange={(e) => updateSkeletonFilterConfig({ max_reprojection_error_px: Number(e.target.value) })}+ inputProps={{ min: 0, step: 1 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ <SettingRow label="Max Velocity (m/s)">+ <TextField+ size="small"+ type="number"+ value={skeletonFilterConfig.max_velocity_m_per_s}+ onChange={(e) => updateSkeletonFilterConfig({ max_velocity_m_per_s: Number(e.target.value) })}+ inputProps={{ min: 0, step: 0.5 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ <SettingRow label="Max Rejected Streak">+ <TextField+ size="small"+ type="number"+ value={skeletonFilterConfig.max_rejected_streak}+ onChange={(e) => updateSkeletonFilterConfig({ max_rejected_streak: Number(e.target.value) })}+ inputProps={{ min: 0 }}+ disabled={isLoading}+ sx={{ width: 100 }}+ />+ </SettingRow>+ </SettingGroup>+ </>+ );+}++// ββ Section: VMC Output ββ++function VMCSection() {+ const { send, isConnected } = useServer();+ const settings = useAppSelector(selectServerSettings);++ const vmcEnabled = settings?.vmc?.enabled ?? false;+ const vmcHost = settings?.vmc?.host ?? '127.0.0.1';+ const vmcPort = settings?.vmc?.port ?? 39539;++ const patchVMC = useCallback(+ (patch: Record<string, unknown>) => {+ send({ message_type: 'settings/patch', patch: { vmc: patch } });+ },+ [send],+ );++ return (+ <>+ <SectionHeader+ title="VMC Output"+ description="Virtual Motion Capture protocol streaming settings."+ />+ <SettingGroup title="VMC Streaming">+ <SettingRow+ label="Enable VMC Output"+ description="Stream skeleton data via VMC protocol over UDP."+ >+ <Switch+ checked={vmcEnabled}+ onChange={() => patchVMC({ enabled: !vmcEnabled })}+ disabled={!isConnected}+ />+ </SettingRow>+ <SettingRow+ label="Host"+ description="Target IP address for VMC packets."+ >+ <TextField+ size="small"+ value={vmcHost}+ onChange={(e) => {+ const val = e.target.value.trim();+ if (val.length > 0) patchVMC({ host: val });+ }}+ disabled={!isConnected || !vmcEnabled}+ sx={{ width: 160 }}+ inputProps={{ style: { fontFamily: 'monospace', fontSize: 13 } }}+ />+ </SettingRow>+ <SettingRow+ label="Port"+ description="UDP port for VMC packets (default 39539)."+ >+ <TextField+ size="small"+ type="number"+ value={vmcPort}+ onChange={(e) => {+ const val = parseInt(e.target.value, 10);+ if (!isNaN(val) && val > 0 && val <= 65535) patchVMC({ port: val });+ }}+ disabled={!isConnected || !vmcEnabled}+ inputProps={{ min: 1, max: 65535 }}+ sx={{ width: 120 }}+ />+ </SettingRow>+ {!isConnected && (+ <Alert severity="info" sx={{ mt: 1 }}>+ Connect to the backend server to configure VMC settings.+ </Alert>+ )}+ </SettingGroup>+ </>+ );+}++// ββ Section: System Info ββ++function DependencyStatusIcon({ status }: { status: DependencyStatus }) {+ switch (status) {+ case 'installed':+ return <CheckCircleIcon sx={{ color: '#4caf50', fontSize: 20 }} />;+ case 'missing':+ return <ErrorIcon sx={{ color: '#f44336', fontSize: 20 }} />;+ case 'outdated':+ return <WarningIcon sx={{ color: '#ff9800', fontSize: 20 }} />;+ case 'checking':+ case 'installing':+ return <CircularProgress size={18} />;+ case 'error':+ return <ErrorIcon sx={{ color: '#f44336', fontSize: 20 }} />;+ }+}- <FormControlLabel- control={- <Switch- checked={showTranslationIndicator}- onChange={handleTranslationIndicatorToggle}- size="small"+function SystemSection() {+ const theme = useTheme();+ const { isElectron, api } = useElectronIPC();++ const [scanning, setScanning] = useState(false);+ const [scanResult, setScanResult] = useState<SystemScanResult | null>(null);+ const [dependencies, setDependencies] = useState<DependencyInfo[]>([]);+ const [installing, setInstalling] = useState<string | null>(null);++ const runScan = useCallback(async () => {+ if (!isElectron || !api) return;+ setScanning(true);+ try {+ const result = await api.system.scan.query();+ const typed = result as SystemScanResult;+ setScanResult(typed);+ await api.settings.set.mutate({ key: SYSTEM_SCAN_KEY, value: typed });+ } catch (err) {+ console.error('System scan failed:', err);+ } finally {+ setScanning(false);+ }+ }, [isElectron, api]);++ const detectDeps = useCallback(async () => {+ if (!isElectron || !api) return;+ try {+ const result = await api.dependencies.detectAll.query();+ setDependencies(result as DependencyInfo[]);+ } catch (err) {+ console.error('Dependency detection failed:', err);+ }+ }, [isElectron, api]);++ const installDep = useCallback(async (depId: string) => {+ if (!isElectron || !api) return;+ setInstalling(depId);+ try {+ const updated = await api.dependencies.install.mutate({ dependencyId: depId });+ setDependencies(prev =>+ prev.map(d => d.id === depId ? (updated as DependencyInfo) : d),+ );+ if (depId === 'uv') {+ const envInfo = await api.dependencies.detect.query({ dependencyId: 'python-env' });+ setDependencies(prev =>+ prev.map(d => d.id === 'python-env' ? (envInfo as DependencyInfo) : d),+ );+ }+ } catch (err) {+ console.error(`Failed to install ${depId}:`, err);+ setDependencies(prev =>+ prev.map(d =>+ d.id === depId+ ? { ...d, status: 'error' as DependencyStatus, error: err instanceof Error ? err.message : String(err) }+ : d,+ ),+ );+ } finally {+ setInstalling(null);+ }+ }, [isElectron, api]);++ // Load persisted scan on mount+ useEffect(() => {+ if (!isElectron || !api) return;+ api.settings.get.query({ key: SYSTEM_SCAN_KEY }).then(result => {+ if (result && typeof result === 'object' && 'cpu' in (result as object)) {+ setScanResult(result as SystemScanResult);+ }+ }).catch(() => { /* no persisted scan */ });+ }, [isElectron, api]);++ if (!isElectron) {+ return (+ <>+ <SectionHeader+ title="System Info"+ description="System scanning is only available in the desktop app."/>- }- label={- <Box>- <Typography variant="body2" sx={{ fontSize: 13 }}>- {t("showTranslationIndicator")}- </Typography>- <Typography- variant="caption"- color="text.secondary"- sx={{ fontSize: 11 }}- >- {t("showTranslationIndicatorDescription")}- </Typography>- </Box>- }+ <Alert severity="info">+ Connect to a running FreeMoCap server via the desktop app to view system information and manage dependencies.+ </Alert>+ </>+ );+ }++ const rec = scanResult?.recommendation;+ const tierColor = rec ? TIER_COLORS[rec.tier] : undefined;++ return (+ <>+ <SectionHeader+ title="System Info"+ description="Hardware information, performance tier, and dependency status."/>- </Box>- </Paper>- {/* Appearance */}- <Paper- elevation={isDark ? 2 : 1}- sx={{- p: 2.5,- mb: 2,- backgroundColor: isDark- ? theme.palette.background.paper- : "#fff",- }}- >- <SectionHeader- icon={<PaletteIcon fontSize="small" />}- title={t("appearance")}- />-- <Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>- <Typography variant="body2" sx={{ fontSize: 13 }}>- {t("themeMode")}- </Typography>- <ToggleButtonGroup- value={themeMode}- exclusive- onChange={handleThemeChange}- size="small"- sx={{- "& .MuiToggleButton-root": {- py: 0.5,- px: 2,- fontSize: 12,- },- "& .MuiToggleButton-root.Mui-selected": {- backgroundColor: theme.palette.primary.dark,- color: theme.palette.primary.contrastText,- "&:hover": {- backgroundColor: theme.palette.primary.light,- },- },- }}- >- <ToggleButton value="light">{t("lightMode")}</ToggleButton>- <ToggleButton value="dark">{t("darkMode")}</ToggleButton>- </ToggleButtonGroup>- </Box>- </Paper>+ {/* Performance Tier */}+ <SettingGroup title="Performance Tier">+ {scanning ? (+ <Box sx={{ textAlign: 'center', py: 4 }}>+ <CircularProgress size={40} />+ <Typography sx={{ mt: 1.5, color: theme.palette.text.secondary }}>+ Scanning your system...+ </Typography>+ </Box>+ ) : scanResult && rec ? (+ <>+ <Paper+ elevation={0}+ sx={{+ p: 2, mb: 2,+ border: `2px solid ${tierColor}`,+ borderRadius: 2,+ background: `${tierColor}11`,+ textAlign: 'center',+ }}+ >+ <Typography variant="h5" sx={{ fontWeight: 700, color: tierColor }}>+ {TIER_EMOJIS[rec.tier]} {rec.label} System+ </Typography>+ <Typography variant="body2" sx={{ mt: 0.5, color: theme.palette.text.secondary }}>+ {rec.description}+ </Typography>+ <Box sx={{ display: 'flex', justifyContent: 'center', gap: 1.5, mt: 1.5, flexWrap: 'wrap' }}>+ <Chip+ icon={<VideocamIcon />}+ label={`Up to ${rec.maxCameras} cameras`}+ size="small"+ sx={{ borderColor: tierColor, color: tierColor }}+ variant="outlined"+ />+ <Chip+ label={`${rec.maxResolution} max`}+ size="small"+ sx={{ borderColor: tierColor, color: tierColor }}+ variant="outlined"+ />+ {rec.realtimeTracking && (+ <Chip+ icon={<SpeedIcon />}+ label="Real-time tracking"+ size="small"+ sx={{ borderColor: tierColor, color: tierColor }}+ variant="outlined"+ />+ )}+ </Box>+ </Paper>++ {/* Hardware grid */}+ <Box sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1.5, mb: 2 }}>+ <Paper elevation={0} sx={{ p: 1.5, border: `1px solid ${theme.palette.divider}`, borderRadius: 1 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}>+ <MemoryIcon sx={{ fontSize: 18, color: theme.palette.text.secondary }} />+ <Typography variant="caption" sx={{ fontWeight: 600, color: theme.palette.text.secondary }}>CPU</Typography>+ </Box>+ <Typography variant="body2" sx={{ fontWeight: 500, fontSize: '0.8rem' }}>+ {scanResult.cpu.model}+ </Typography>+ <Typography variant="caption" sx={{ color: theme.palette.text.secondary }}>+ {scanResult.cpu.threads} threads Β· {scanResult.cpu.cores} cores Β· {scanResult.cpu.speedMhz} MHz+ </Typography>+ </Paper>++ <Paper elevation={0} sx={{ p: 1.5, border: `1px solid ${theme.palette.divider}`, borderRadius: 1 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}>+ <ComputerIcon sx={{ fontSize: 18, color: theme.palette.text.secondary }} />+ <Typography variant="caption" sx={{ fontWeight: 600, color: theme.palette.text.secondary }}>MEMORY</Typography>+ </Box>+ <Typography variant="body2" sx={{ fontWeight: 500 }}>+ {scanResult.ram.totalGb} GB total+ </Typography>+ <Typography variant="caption" sx={{ color: theme.palette.text.secondary }}>+ {scanResult.ram.availableGb} GB available+ </Typography>+ </Paper>++ <Paper elevation={0} sx={{ p: 1.5, border: `1px solid ${theme.palette.divider}`, borderRadius: 1 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}>+ <SpeedIcon sx={{ fontSize: 18, color: theme.palette.text.secondary }} />+ <Typography variant="caption" sx={{ fontWeight: 600, color: theme.palette.text.secondary }}>GPU</Typography>+ </Box>+ {scanResult.gpus.length > 0 ? scanResult.gpus.map((gpu, i) => (+ <Box key={i}>+ <Typography variant="body2" sx={{ fontWeight: 500, fontSize: '0.8rem' }}>+ {gpu.name}+ </Typography>+ <Typography variant="caption" sx={{ color: theme.palette.text.secondary }}>+ {gpu.vramMb ? `${Math.round(gpu.vramMb / 1024)} GB VRAM` : 'VRAM unknown'}+ {gpu.cudaAvailable ? ` Β· CUDA ${gpu.cudaVersion || 'β'}` : ''}+ </Typography>+ </Box>+ )) : (+ <Typography variant="body2" sx={{ color: theme.palette.text.disabled }}>+ No dedicated GPU detected+ </Typography>+ )}+ </Paper>++ <Paper elevation={0} sx={{ p: 1.5, border: `1px solid ${theme.palette.divider}`, borderRadius: 1 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}>+ <StorageIcon sx={{ fontSize: 18, color: theme.palette.text.secondary }} />+ <Typography variant="caption" sx={{ fontWeight: 600, color: theme.palette.text.secondary }}>DISK</Typography>+ </Box>+ <Typography variant="body2" sx={{ fontWeight: 500 }}>+ {scanResult.disk.freeGb} GB free+ </Typography>+ <Typography variant="caption" sx={{ color: theme.palette.text.secondary }}>+ of {scanResult.disk.totalGb} GB total+ </Typography>+ {scanResult.disk.freeGb > 0 && scanResult.disk.freeGb < 20 && (+ <LinearProgress+ variant="determinate"+ value={((scanResult.disk.totalGb - scanResult.disk.freeGb) / scanResult.disk.totalGb) * 100}+ color="warning"+ sx={{ mt: 0.5, height: 4, borderRadius: 1 }}+ />+ )}+ </Paper>+ </Box>++ {rec.warnings.length > 0 && (+ <Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.5, mb: 2 }}>+ {rec.warnings.map((w, i) => (+ <Alert key={i} severity="warning" sx={{ py: 0, fontSize: '0.75rem' }}>+ {w}+ </Alert>+ ))}+ </Box>+ )}+ </>+ ) : (+ <Box sx={{ textAlign: 'center', py: 3 }}>+ <Typography sx={{ color: theme.palette.text.secondary, mb: 1 }}>+ No system scan data available.+ </Typography>+ </Box>+ )}- {/* About */}+ <Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>+ <Button+ size="small"+ startIcon={scanning ? <CircularProgress size={14} /> : <RefreshIcon />}+ onClick={runScan}+ disabled={scanning}+ >+ {scanResult ? 'Rescan' : 'Scan System'}+ </Button>+ </Box>+ </SettingGroup>++ {/* Dependencies */}+ <SettingGroup title="Dependencies">+ {dependencies.length === 0 ? (+ <Box sx={{ textAlign: 'center', py: 3 }}>+ <Typography sx={{ color: theme.palette.text.secondary, mb: 1 }}>+ No dependency data loaded.+ </Typography>+ <Button size="small" startIcon={<RefreshIcon />} onClick={detectDeps}>+ Check Dependencies+ </Button>+ </Box>+ ) : (+ <>+ {dependencies.filter(d => d.required).length > 0 && (+ <Box sx={{ mb: 2 }}>+ <Typography variant="caption" sx={{ fontWeight: 700, color: theme.palette.text.secondary, mb: 0.5, display: 'block' }}>+ REQUIRED+ </Typography>+ {dependencies.filter(d => d.required).map(dep => (+ <DependencyRow+ key={dep.id}+ dep={dep}+ isInstalling={installing === dep.id}+ onInstall={() => installDep(dep.id)}+ />+ ))}+ </Box>+ )}+ {dependencies.filter(d => !d.required).length > 0 && (+ <Box>+ <Typography variant="caption" sx={{ fontWeight: 700, color: theme.palette.text.secondary, mb: 0.5, display: 'block' }}>+ OPTIONAL+ </Typography>+ {dependencies.filter(d => !d.required).map(dep => (+ <DependencyRow+ key={dep.id}+ dep={dep}+ isInstalling={installing === dep.id}+ onInstall={() => installDep(dep.id)}+ />+ ))}+ </Box>+ )}+ <Box sx={{ display: 'flex', justifyContent: 'flex-end', mt: 1 }}>+ <Button size="small" startIcon={<RefreshIcon />} onClick={detectDeps}>+ Recheck All+ </Button>+ </Box>+ </>+ )}+ </SettingGroup>+ </>+ );+}++function DependencyRow({ dep, isInstalling, onInstall }: { dep: DependencyInfo; isInstalling: boolean; onInstall: () => void }) {+ const theme = useTheme();+ const canInstall = dep.status === 'missing' || dep.status === 'outdated';+ const isCuda = dep.id === 'cuda';++ return (<Paper- elevation={isDark ? 2 : 1}- sx={{- p: 2.5,- mb: 2,- backgroundColor: isDark- ? theme.palette.background.paper- : "#fff",- }}+ elevation={0}+ sx={{+ p: 1.5, mb: 0.5,+ border: `1px solid ${theme.palette.divider}`,+ borderRadius: 1,+ display: 'flex',+ alignItems: 'center',+ gap: 1.5,+ }}>- <SectionHeader- icon={<InfoIcon fontSize="small" />}- title={t("about")}- />-- <Box sx={{ display: "flex", flexDirection: "column", gap: 1 }}>- <Typography variant="body2" sx={{ fontSize: 13 }}>- {t("appName")} β {t("welcomeSubtitle")}- </Typography>- <VersionChip variant="full" />- </Box>+ <DependencyStatusIcon status={isInstalling ? 'installing' : dep.status} />+ <Box sx={{ flex: 1, minWidth: 0 }}>+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>+ <Typography variant="body2" sx={{ fontWeight: 600 }}>+ {dep.name}+ </Typography>+ {dep.version && (+ <Chip label={dep.version} size="small" sx={{ height: 18, fontSize: '0.65rem' }} />+ )}+ {dep.required && (+ <Chip label="required" size="small" color="warning" variant="outlined" sx={{ height: 18, fontSize: '0.6rem' }} />+ )}+ </Box>+ <Typography variant="caption" sx={{ color: theme.palette.text.secondary }}>+ {dep.description}+ </Typography>+ {dep.error && (+ <Typography variant="caption" sx={{ display: 'block', color: theme.palette.error.main, mt: 0.25 }}>+ {dep.error}+ </Typography>+ )}+ {dep.installedPath && dep.status === 'installed' && (+ <Tooltip title={dep.installedPath}>+ <Typography+ variant="caption"+ sx={{+ display: 'block',+ color: theme.palette.text.disabled,+ fontSize: '0.6rem',+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ maxWidth: 300,+ }}+ >+ {dep.installedPath}+ </Typography>+ </Tooltip>+ )}+ </Box>+ {canInstall && !isCuda && (+ <Button+ size="small"+ variant="contained"+ startIcon={isInstalling ? <CircularProgress size={14} color="inherit" /> : <DownloadIcon />}+ onClick={onInstall}+ disabled={isInstalling}+ sx={{ textTransform: 'none', fontSize: '0.75rem', whiteSpace: 'nowrap' }}+ >+ {isInstalling ? 'Installing...' : dep.status === 'outdated' ? 'Update' : 'Install'}+ </Button>+ )}+ {canInstall && isCuda && (+ <Typography variant="caption" sx={{ color: theme.palette.text.disabled, fontStyle: 'italic' }}>+ Manual install+ </Typography>+ )}</Paper>- </Container>-- <Divider />- <Box component="footer" sx={{ p: 1 }}>- <Footer />- </Box>- </Box>- );+ );+}++// ββ Section: Raw Editor ββ++function EditorSection() {+ return (+ <Box sx={{ display: 'flex', flexDirection: 'column', height: '100%' }}>+ <SectionHeader+ title="Raw Editor"+ description="View and edit all settings as JSON, YAML, or TOML. Upload a file or edit directly, then apply."+ />+ <Box sx={{ flex: 1, minHeight: 0 }}>+ <SettingsEditor />+ </Box>+ </Box>+ );+}++// ββ Section Map ββ++const SECTION_RENDERERS: Record<SectionId, React.FC> = {+ appearance: AppearanceSection,+ connection: ConnectionSection,+ recording: RecordingSection,+ calibration: CalibrationSection,+ mocap: MocapSection,+ vmc: VMCSection,+ system: SystemSection,+ editor: EditorSection,};-export default SettingsPage;+// ββ Main Settings Page ββ++export const SettingsPage: React.FC = () => {+ const theme = useTheme();+ const navigate = useNavigate();+ const [activeSection, setActiveSection] = useState<SectionId>('appearance');++ const SectionContent = SECTION_RENDERERS[activeSection];++ return (+ <Box+ sx={{+ width: '100%',+ height: '100%',+ display: 'flex',+ backgroundColor: theme.palette.mode === 'dark'+ ? theme.palette.background.default+ : theme.palette.grey[50],+ overflow: 'hidden',+ }}+ >+ {/* Left navigation panel */}+ <Paper+ elevation={0}+ sx={{+ width: 240,+ minWidth: 240,+ height: '100%',+ borderRight: `1px solid ${theme.palette.divider}`,+ borderRadius: 0,+ display: 'flex',+ flexDirection: 'column',+ overflow: 'hidden',+ }}+ >+ {/* Settings header with back button */}+ <Box+ sx={{+ px: 2,+ py: 1.5,+ borderBottom: `1px solid ${theme.palette.divider}`,+ display: 'flex',+ alignItems: 'center',+ gap: 1,+ }}+ >+ <IconButton size="small" onClick={() => navigate('/')}>+ <ArrowBackIcon sx={{ fontSize: 18 }} />+ </IconButton>+ <Typography variant="h6" sx={{ fontWeight: 700, fontSize: '1.1rem' }}>+ Settings+ </Typography>+ </Box>++ {/* Section list */}+ <List+ sx={{+ flex: 1,+ overflowY: 'auto',+ py: 1,+ }}+ >+ {SECTIONS.map((section) => (+ <ListItemButton+ key={section.id}+ selected={activeSection === section.id}+ onClick={() => setActiveSection(section.id)}+ sx={{+ mx: 1,+ borderRadius: 1.5,+ mb: 0.25,+ py: 1,+ '&.Mui-selected': {+ backgroundColor: theme.palette.mode === 'dark'+ ? 'rgba(255, 255, 255, 0.08)'+ : 'rgba(0, 0, 0, 0.06)',+ '&:hover': {+ backgroundColor: theme.palette.mode === 'dark'+ ? 'rgba(255, 255, 255, 0.12)'+ : 'rgba(0, 0, 0, 0.09)',+ },+ },+ }}+ >+ <ListItemIcon sx={{ minWidth: 36, color: activeSection === section.id ? theme.palette.primary.main : theme.palette.text.secondary }}>+ {section.icon}+ </ListItemIcon>+ <ListItemText+ primary={section.label}+ primaryTypographyProps={{+ fontSize: '0.875rem',+ fontWeight: activeSection === section.id ? 600 : 400,+ }}+ />+ </ListItemButton>+ ))}+ </List>+ </Paper>++ {/* Right content area */}+ <Box+ sx={{+ flex: 1,+ height: '100%',+ overflowY: activeSection === 'editor' ? 'hidden' : 'auto',+ p: activeSection === 'editor' ? 2 : 4,+ maxWidth: activeSection === 'editor' ? undefined : 800,+ display: 'flex',+ flexDirection: 'column',+ }}+ >+ <SectionContent />+ </Box>+ </Box>+ );+};diff --git a/freemocap/core/calibration/calibration_task.py b/freemocap/core/calibration/calibration_task.pyindex 2ac8266c..753bb0cf 100644--- a/freemocap/core/calibration/calibration_task.py+++ b/freemocap/core/calibration/calibration_task.py@@ -27,7 +27,7 @@ from freemocap.core.calibration.shared.calibration_models import CharucoBoardDefCornerObservation, CalibrationResultfrom freemocap.core.calibration.shared.calibration_paths import get_last_successful_calibration_toml_pathfrom freemocap.core.calibration.shared.calibration_save import save_calibration_copies-from freemocap.core.calibration.shared.toml_mixin import numpy_to_python+from freemocap.utilities.toml_mixin import numpy_to_pythonfrom freemocap.core.mocap.mocap_helpers.charuco_model_from_observations import charuco_model_from_observationsfrom freemocap.core.pipeline.pipeline_configs import CalibrationPipelineConfig, CalibrationSolverMethodfrom freemocap.core.pipeline.posthoc.video_group_helper import VideoMetadata@@ -311,4 +311,4 @@ def run_calibration_task(logger.info(f"Posthoc calibration complete! Output saved to {recording_info.full_recording_path}"- )\ No newline at end of file+ )diff --git a/freemocap/core/calibration/shared/calibration_models.py b/freemocap/core/calibration/shared/calibration_models.pyindex 5f0757b3..9c18a74c 100644--- a/freemocap/core/calibration/shared/calibration_models.py+++ b/freemocap/core/calibration/shared/calibration_models.py@@ -14,7 +14,7 @@ from numpy.typing import NDArrayfrom pydantic import BaseModel, ConfigDict, field_validator, model_validatorfrom scipy.spatial.transform import Rotation-from freemocap.core.calibration.shared.toml_mixin import TomlMixin, numpy_to_python+from freemocap.utilities.toml_mixin import TomlMixin, numpy_to_python# =============================================================================diff --git a/freemocap/core/calibration/shared/camera_identity.py b/freemocap/core/calibration/shared/camera_to_video_identity_matcher.pysimilarity index 100%rename from freemocap/core/calibration/shared/camera_identity.pyrename to freemocap/core/calibration/shared/camera_to_video_identity_matcher.pydiff --git a/freemocap/core/mocap/mocap_task.py b/freemocap/core/mocap/posthoc_mocap_task.pysimilarity index 98%rename from freemocap/core/mocap/mocap_task.pyrename to freemocap/core/mocap/posthoc_mocap_task.pyindex 060b6284..5c24e0af 100644--- a/freemocap/core/mocap/mocap_task.py+++ b/freemocap/core/mocap/posthoc_mocap_task.py@@ -25,7 +25,7 @@ from freemocap.core.types.type_overloads import VideoIdStringlogger = logging.getLogger(__name__)-def run_mocap_task(+def run_post_mocap_aggregation_task(*,frame_observations: list[dict[VideoIdString, BaseObservation]],recording_info: RecordingInfo,diff --git a/freemocap/core/pipeline/pipeline_configs.py b/freemocap/core/pipeline/pipeline_configs.pyindex df670cb7..fb230408 100644--- a/freemocap/core/pipeline/pipeline_configs.py+++ b/freemocap/core/pipeline/pipeline_configs.py@@ -10,6 +10,7 @@ from pydantic import BaseModel, ConfigDict, Fieldfrom skellycam.core.camera.config.camera_config import CameraConfigsfrom skellycam.core.types.type_overloads import CameraIdStringfrom skellytracker.trackers.charuco_tracker.charuco_detector import CharucoDetectorConfig+from skellytracker.trackers.base_tracker.base_tracker_abcs import BaseDetectorConfigfrom skellytracker.trackers.mediapipe_tracker import MediapipeDetectorConfigfrom skellytracker.trackers.mediapipe_tracker.body.mediapipe_pose_config import MediapipePoseConfigfrom skellytracker.trackers.mediapipe_tracker.mediapipe_model_manager import MediapipePoseModelComplexity@@ -22,10 +23,9 @@ from freemocap.core.mocap.skeleton_dewiggler.realtime_skeleton_filter import Rea# Detector spec: the picklable union that video nodes use to create detectors# ----------------------------------------------------------------------------DetectorSpec = CharucoDetectorConfig | MediapipeDetectorConfig-def create_detector_from_spec(spec: DetectorSpec):+def create_detector_from_spec(spec: BaseDetectorConfig):"""Create a detector instance from a picklable spec.Called inside child processes β detector class imports are deferred@@ -43,7 +43,7 @@ def create_detector_from_spec(spec: DetectorSpec):raise TypeError(f"Unknown detector spec type: {type(spec).__name__}")-def create_annotator_from_spec(spec: DetectorSpec):+def create_annotator_from_spec(spec: BaseDetectorConfig):"""Create an image annotator matching the given detector spec.Called inside child processes for drawing detection results onto frames.@@ -158,4 +158,4 @@ class RealtimePipelineConfig(BaseModel):@classmethoddef from_camera_configs(cls, *, camera_configs: CameraConfigs) -> "RealtimePipelineConfig":- return cls(camera_configs=camera_configs)\ No newline at end of file+ return cls(camera_configs=camera_configs)diff --git a/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.py b/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.pyindex db873990..0fe15fd0 100644--- a/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.py+++ b/freemocap/core/pipeline/posthoc/posthoc_aggregation_node.py@@ -113,7 +113,7 @@ class PosthocAggregationNode(BaseNode):frame_number: {vid: None for vid in video_ids}for frame_number in frame_numbers}- got_all_by_frame: dict[FrameNumberInt, bool] = {fn: False for fn in frame_numbers}+ got_all_by_frame: dict[FrameNumberInt, bool] = {frame_number: False for frame_number in frame_numbers}received_count: int = 0try:@@ -148,7 +148,7 @@ class PosthocAggregationNode(BaseNode):if all(got_all_by_frame.values()):break- missing_frames = [fn for fn, complete in got_all_by_frame.items() if not complete]+ missing_frames = [frame_number for frame_number, complete in got_all_by_frame.items() if not complete]if missing_frames:raise RuntimeError(f"Pipeline {pipeline_id} ended with {len(missing_frames)} missing frames out of {total_expected}, "@@ -189,4 +189,4 @@ class PosthocAggregationNode(BaseNode):finally:logger.debug(f"PosthocAggregationNode [{pipeline_id}] exiting"- )\ No newline at end of file+ )diff --git a/freemocap/core/pipeline/posthoc/posthoc_pipeline.py b/freemocap/core/pipeline/posthoc/posthoc_pipeline.pyindex 744cf946..f99dee8e 100644--- a/freemocap/core/pipeline/posthoc/posthoc_pipeline.py+++ b/freemocap/core/pipeline/posthoc/posthoc_pipeline.py@@ -67,7 +67,7 @@ class PosthocPipeline:*,recording_info: RecordingInfo,detector_spec: DetectorSpec,- task_fn: PosthocAggregationNodeTaskFn,+ aggregation_task_fn: PosthocAggregationNodeTaskFn,worker_registry: WorkerRegistry,global_kill_flag: multiprocessing.Value,save_annotated_video: bool = True,@@ -78,7 +78,7 @@ class PosthocPipeline:Args:recording_info: Where to find the recorded videos.detector_spec: Which detector to run on each video frame.- task_fn: The processing function (with task_config pre-bound via+ aggregation_task_fn: The processing function (with task_config pre-bound viafunctools.partial) to call after all frames are collected.worker_registry: For creating managed processes.global_kill_flag: Shared app-wide kill flag.@@ -117,7 +117,7 @@ class PosthocPipeline:)aggregation_node = PosthocAggregationNode.create(- aggregation_task_fn=task_fn,+ aggregation_task_fn=aggregation_task_fn,video_metadata=video_group.video_metadata_by_id,pipeline_id=pipeline_id,recording_info=recording_info,@@ -168,4 +168,4 @@ class PosthocPipeline:node.shutdown()if self.aggregation_node.is_alive:self.aggregation_node.shutdown()- logger.debug(f"PosthocPipeline [{self.id}] shut down")\ No newline at end of file+ logger.debug(f"PosthocPipeline [{self.id}] shut down")diff --git a/freemocap/core/pipeline/posthoc/posthoc_pipeline_manager.py b/freemocap/core/pipeline/posthoc/posthoc_pipeline_manager.pyindex 10ab86b3..c680b658 100644--- a/freemocap/core/pipeline/posthoc/posthoc_pipeline_manager.py+++ b/freemocap/core/pipeline/posthoc/posthoc_pipeline_manager.py@@ -17,7 +17,7 @@ from skellycam.core.ipc.process_management.worker_registry import WorkerRegistryfrom skellycam.core.recorders.videos.recording_info import RecordingInfofrom freemocap.core.calibration.calibration_task import run_calibration_task-from freemocap.core.mocap.mocap_task import run_mocap_task+from freemocap.core.mocap.mocap_task import run_post_mocap_aggregation_taskfrom freemocap.core.pipeline.pipeline_configs import CalibrationPipelineConfig, MocapPipelineConfigfrom freemocap.core.pipeline.posthoc.posthoc_pipeline import PosthocPipelinefrom freemocap.core.types.type_overloads import PipelineIdString@@ -90,7 +90,7 @@ class PosthocPipelineManager:pipeline = PosthocPipeline.create(recording_info=recording_info,detector_spec=calibration_config.detector_spec,- task_fn=calibration_aggregation_task_fn,+ aggregation_task_fn=calibration_aggregation_task_fn,worker_registry=self.worker_registry,global_kill_flag=self.global_kill_flag,)@@ -110,14 +110,14 @@ class PosthocPipelineManager:recording_info: RecordingInfo,mocap_config: MocapPipelineConfig,) -> PosthocPipeline:- task_fn = functools.partial(- run_mocap_task,+ mocap_task_fn = functools.partial(+ run_post_mocap_aggregation_task,task_config=mocap_config,)pipeline = PosthocPipeline.create(recording_info=recording_info,detector_spec=mocap_config.detector,- task_fn=task_fn,+ aggregation_task_fn=mocap_task_fn,worker_registry=self.worker_registry,global_kill_flag=self.global_kill_flag,)@@ -146,4 +146,4 @@ class PosthocPipelineManager:for pipeline in self.pipelines.values():pipeline.shutdown()self.pipelines.clear()- logger.info("PosthocPipelineManager: all pipelines shut down")\ No newline at end of file+ logger.info("PosthocPipelineManager: all pipelines shut down")diff --git a/freemocap/core/pipeline/posthoc/video_group_helper.py b/freemocap/core/pipeline/posthoc/video_group_helper.pyindex 98d33a14..04f9d05a 100644--- a/freemocap/core/pipeline/posthoc/video_group_helper.py+++ b/freemocap/core/pipeline/posthoc/video_group_helper.py@@ -167,7 +167,6 @@ class VideoHelper(BaseModel):"""Read the next frame in sequence. If the last read frame is -1, reads frame 0. If the last read frame is the last frame, returns None.-Returns:Frame as numpy array"""@@ -175,6 +174,7 @@ class VideoHelper(BaseModel):if next_frame_number >= self.metadata.frame_count:return Nonereturn self.read_frame_number(next_frame_number)+def read_frame_number(self, frame_number: int) -> np.ndarray:"""Read a specific frame with caching and access pattern optimization.@@ -260,24 +260,24 @@ class VideoHelper(BaseModel):results = {}frames_to_read = []- for fn in frame_numbers:- cached = self.cache.get(fn)+ for frame_number in frame_numbers:+ cached = self.cache.get(frame_number)if cached is not None:- results[fn] = cached+ results[frame_number] = cachedelse:- frames_to_read.append(fn)+ frames_to_read.append(frame_number)if frames_to_read:# Sort for optimal readingframes_to_read.sort()# Read missing frames- for fn in frames_to_read:- frame = self.read_frame_number(fn)- results[fn] = frame+ for frame_number in frames_to_read:+ frame = self.read_frame_number(frame_number)+ results[frame_number] = frame# Return in original order- return [results[fn] for fn in frame_numbers]+ return [results[frame_number] for frame_number in frame_numbers]def get_frame_timestamp(self, frame_number: int) -> float:"""Get timestamp in seconds for a given frame number."""@@ -410,4 +410,4 @@ if __name__ == "__main__":# Get frame at timestampframe_at_5s = vh.get_frame_at_timestamp(5.0)- print(f"Frame at 5s shape: {frame_at_5s.shape}")\ No newline at end of file+ print(f"Frame at 5s shape: {frame_at_5s.shape}")diff --git a/freemocap/core/pipeline/posthoc/video_node.py b/freemocap/core/pipeline/posthoc/video_node.pyindex 74f1d32c..1c4243b6 100644--- a/freemocap/core/pipeline/posthoc/video_node.py+++ b/freemocap/core/pipeline/posthoc/video_node.py@@ -16,9 +16,10 @@ from pathlib import Pathimport cv2from skellycam.core.ipc.process_management.worker_registry import WorkerRegistry+from skellytracker.trackers.base_tracker.base_tracker_abcs import BaseDetectorConfigfrom freemocap.core.pipeline.base_node import BaseNode-from freemocap.core.pipeline.pipeline_configs import DetectorSpec, create_detector_from_spec, create_annotator_from_spec+from freemocap.core.pipeline.pipeline_configs import create_detector_from_spec, create_annotator_from_specfrom freemocap.core.pipeline.pipeline_ipc import PipelineIPCfrom freemocap.core.types.type_overloads import VideoIdString, TopicPublicationQueuefrom freemocap.pubsub.pubsub_manager import PubSubTopicManager@@ -40,7 +41,7 @@ class VideoNode(BaseNode):*,video_id: VideoIdString,video_path: Path,- detector_spec: DetectorSpec,+ detector_spec: BaseDetectorConfig,worker_registry: WorkerRegistry,ipc: PipelineIPC,pubsub: PubSubTopicManager,@@ -112,7 +113,7 @@ class VideoNode(BaseNode):*,video_id: VideoIdString,video_path: Path,- detector_spec: DetectorSpec,+ detector_spec: BaseDetectorConfig,ipc: PipelineIPC,video_output_pub: TopicPublicationQueue,shutdown_self_flag: multiprocessing.Value,@@ -221,4 +222,4 @@ class VideoNode(BaseNode):# Clean up the .prev file after we're done reading from itif prev_annotated_path is not None and prev_annotated_path.exists():prev_annotated_path.unlink()- logger.debug(f"VideoNode for {video_path.stem} exiting")\ No newline at end of file+ logger.debug(f"VideoNode for {video_path.stem} exiting")diff --git a/freemocap/core/calibration/shared/toml_mixin.py b/freemocap/utilities/toml_mixin.pysimilarity index 100%rename from freemocap/core/calibration/shared/toml_mixin.pyrename to freemocap/utilities/toml_mixin.py