feat: Add dashboard chat integration and MCP server
Major changes: - Dashboard: WebSocket-based chat with session management - Dashboard: New chat components (ChatPane, ChatInput, ModeToggle) - Dashboard: Enhanced UI with parallel coordinates chart - MCP Server: New atomizer-tools server for Claude integration - Extractors: Enhanced Zernike OPD extractor - Reports: Improved report generator New studies (configs and scripts only): - M1 Mirror: Cost reduction campaign studies - Simple Beam, Simple Bracket, UAV Arm studies Note: Large iteration data (2_iterations/, best_design_archive/) excluded via .gitignore - kept on local Gitea only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
50
mcp-server/atomizer-tools/src/utils/paths.ts
Normal file
50
mcp-server/atomizer-tools/src/utils/paths.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Path utilities for Atomizer MCP server
|
||||
*/
|
||||
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname, resolve } from 'path';
|
||||
|
||||
// Get directory of current file
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// Atomizer root directory
|
||||
export const ATOMIZER_ROOT = resolve(__dirname, '../../../../..');
|
||||
|
||||
// Key directories
|
||||
export const STUDIES_DIR = resolve(ATOMIZER_ROOT, 'studies');
|
||||
export const OPTIMIZATION_ENGINE_DIR = resolve(ATOMIZER_ROOT, 'optimization_engine');
|
||||
export const DOCS_DIR = resolve(ATOMIZER_ROOT, 'docs');
|
||||
|
||||
// Python configuration
|
||||
export const PYTHON_PATH = process.env.ATOMIZER_PYTHON_PATH ||
|
||||
'C:/Users/antoi/anaconda3/envs/atomizer/python.exe';
|
||||
|
||||
// Mode from environment
|
||||
export const ATOMIZER_MODE = (process.env.ATOMIZER_MODE || 'user') as 'user' | 'power';
|
||||
|
||||
// Check if a path is within Atomizer root (security)
|
||||
export function isPathAllowed(path: string): boolean {
|
||||
const resolved = resolve(path);
|
||||
return resolved.startsWith(ATOMIZER_ROOT);
|
||||
}
|
||||
|
||||
// Get study directory
|
||||
export function getStudyDir(studyName: string): string {
|
||||
return resolve(STUDIES_DIR, studyName);
|
||||
}
|
||||
|
||||
// Get study database path
|
||||
export function getStudyDbPath(studyName: string): string {
|
||||
return resolve(getStudyDir(studyName), '3_results', 'study.db');
|
||||
}
|
||||
|
||||
// Get study config path
|
||||
export function getStudyConfigPath(studyName: string): string {
|
||||
const setupConfig = resolve(getStudyDir(studyName), '1_setup', 'optimization_config.json');
|
||||
const rootConfig = resolve(getStudyDir(studyName), 'optimization_config.json');
|
||||
|
||||
// Check which exists - prefer 1_setup/
|
||||
return setupConfig; // Let caller handle if it doesn't exist
|
||||
}
|
||||
Reference in New Issue
Block a user