Major refactor: Multi-user Chrome MCP extension with remote server architecture
This commit is contained in:
@@ -17,11 +17,13 @@ export const ICONS = {
|
||||
// Timeouts and Delays (in milliseconds)
|
||||
export const TIMEOUTS = {
|
||||
DEFAULT_WAIT: 1000,
|
||||
NETWORK_CAPTURE_MAX: 30000,
|
||||
NETWORK_CAPTURE_IDLE: 3000,
|
||||
NETWORK_CAPTURE_MAX: 60000, // Increased from 30000
|
||||
NETWORK_CAPTURE_IDLE: 5000, // Increased from 3000
|
||||
SCREENSHOT_DELAY: 100,
|
||||
KEYBOARD_DELAY: 50,
|
||||
CLICK_DELAY: 100,
|
||||
REMOTE_SERVER_CONNECTION: 45000, // Increased from 30000ms to 45000ms for more reliable connections
|
||||
TOOL_EXECUTION: 60000, // New timeout for tool execution
|
||||
} as const;
|
||||
|
||||
// Limits and Thresholds
|
||||
|
35
app/chrome-extension/common/env-config.ts
Normal file
35
app/chrome-extension/common/env-config.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Environment Configuration
|
||||
* Centralized environment variable handling for Chrome Extension
|
||||
*/
|
||||
|
||||
// Get environment variables with fallbacks
|
||||
const REMOTE_SERVER_HOST = import.meta.env.VITE_REMOTE_SERVER_HOST || '127.0.0.1';
|
||||
const REMOTE_SERVER_PORT = import.meta.env.VITE_REMOTE_SERVER_PORT || '3001';
|
||||
|
||||
// Debug logging for environment variables
|
||||
console.log('Environment Config Loaded:', {
|
||||
VITE_REMOTE_SERVER_HOST: import.meta.env.VITE_REMOTE_SERVER_HOST,
|
||||
VITE_REMOTE_SERVER_PORT: import.meta.env.VITE_REMOTE_SERVER_PORT,
|
||||
REMOTE_SERVER_HOST,
|
||||
REMOTE_SERVER_PORT,
|
||||
});
|
||||
|
||||
// Remote Server Configuration
|
||||
export const REMOTE_SERVER_CONFIG = {
|
||||
HOST: REMOTE_SERVER_HOST,
|
||||
PORT: REMOTE_SERVER_PORT,
|
||||
WS_URL: `ws://${REMOTE_SERVER_HOST}:${REMOTE_SERVER_PORT}/chrome`,
|
||||
HTTP_URL: `http://${REMOTE_SERVER_HOST}:${REMOTE_SERVER_PORT}/mcp`,
|
||||
} as const;
|
||||
|
||||
// Default connection settings
|
||||
export const DEFAULT_CONNECTION_CONFIG = {
|
||||
serverUrl: REMOTE_SERVER_CONFIG.WS_URL,
|
||||
reconnectInterval: 3000, // Reduced from 5000ms to 3000ms for faster reconnection
|
||||
maxReconnectAttempts: 999999, // Effectively unlimited for persistent connections
|
||||
} as const;
|
||||
|
||||
// Export individual values for backward compatibility
|
||||
export const DEFAULT_SERVER_URL = REMOTE_SERVER_CONFIG.WS_URL;
|
||||
export const DEFAULT_HTTP_URL = REMOTE_SERVER_CONFIG.HTTP_URL;
|
@@ -22,3 +22,15 @@ export const createErrorResponse = (
|
||||
isError: true,
|
||||
};
|
||||
};
|
||||
|
||||
export const createSuccessResponse = (data: any): ToolResult => {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: typeof data === 'string' ? data : JSON.stringify(data, null, 2),
|
||||
},
|
||||
],
|
||||
isError: false,
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user