@roxybrowser/openapi 1.0.3 → 1.0.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,380 @@
1
+ /**
2
+ * Error Analysis Utility
3
+ *
4
+ * Provides intelligent error analysis, categorization, and troubleshooting guidance
5
+ */
6
+ import { RoxyApiError, ROXY_ERROR_MAP, NETWORK_ERROR_PATTERNS, ConfigError, BrowserCreationError, } from '../types.js';
7
+ export class ErrorAnalyzer {
8
+ /**
9
+ * Analyze a single error and provide detailed insights
10
+ */
11
+ static analyzeError(error) {
12
+ if (error instanceof RoxyApiError) {
13
+ return this.analyzeRoxyApiError(error);
14
+ }
15
+ if (error instanceof ConfigError) {
16
+ return this.analyzeConfigError(error);
17
+ }
18
+ if (error instanceof BrowserCreationError) {
19
+ return this.analyzeBrowserCreationError(error);
20
+ }
21
+ // Generic error analysis
22
+ return this.analyzeGenericError(error);
23
+ }
24
+ /**
25
+ * Analyze RoxyBrowser API errors
26
+ */
27
+ static analyzeRoxyApiError(error) {
28
+ const baseResult = {
29
+ category: error.category,
30
+ severity: error.severity,
31
+ description: error.errorInfo?.description || error.message,
32
+ chineseDescription: error.errorInfo?.chineseMsg || '未知错误',
33
+ troubleshooting: error.getTroubleshootingSteps(),
34
+ retryable: error.isRetryable(),
35
+ suggestedActions: [],
36
+ relatedErrors: [],
37
+ };
38
+ if (error.isRetryable()) {
39
+ baseResult.retryStrategy = error.getRetryStrategy();
40
+ }
41
+ // Add specific suggestions based on error type
42
+ baseResult.suggestedActions = this.generateSuggestedActions(error);
43
+ baseResult.relatedErrors = this.findRelatedErrors(error.code);
44
+ return baseResult;
45
+ }
46
+ /**
47
+ * Analyze configuration errors
48
+ */
49
+ static analyzeConfigError(error) {
50
+ return {
51
+ category: 'configuration',
52
+ severity: 'high',
53
+ description: 'Configuration error - invalid or missing settings',
54
+ chineseDescription: '配置错误 - 配置无效或缺失',
55
+ troubleshooting: [
56
+ 'Check environment variables (ROXY_API_KEY, ROXY_API_HOST)',
57
+ 'Verify RoxyBrowser application settings',
58
+ 'Ensure all required configuration is provided',
59
+ 'Check configuration file syntax and format',
60
+ ],
61
+ retryable: false,
62
+ suggestedActions: [
63
+ 'Review configuration setup',
64
+ 'Check environment variable spelling',
65
+ 'Restart application after fixing configuration',
66
+ ],
67
+ };
68
+ }
69
+ /**
70
+ * Analyze browser creation errors
71
+ */
72
+ static analyzeBrowserCreationError(error) {
73
+ const hasPartialResults = error.partialResults && error.partialResults.length > 0;
74
+ return {
75
+ category: 'browser',
76
+ severity: hasPartialResults ? 'medium' : 'high',
77
+ description: 'Browser creation failed - configuration or resource issue',
78
+ chineseDescription: '浏览器创建失败 - 配置或资源问题',
79
+ troubleshooting: [
80
+ 'Verify workspace and project IDs exist',
81
+ 'Check browser configuration parameters',
82
+ 'Ensure sufficient system resources',
83
+ 'Validate proxy settings if used',
84
+ 'Check for conflicting browser instances',
85
+ ],
86
+ retryable: true,
87
+ retryStrategy: {
88
+ shouldRetry: true,
89
+ delayMs: 2000,
90
+ maxRetries: 2,
91
+ },
92
+ suggestedActions: hasPartialResults ? [
93
+ 'Retry with failed configurations only',
94
+ 'Reduce batch size',
95
+ 'Check specific error details for each failure',
96
+ ] : [
97
+ 'Validate all configuration parameters',
98
+ 'Check system resources',
99
+ 'Try creating browsers one at a time',
100
+ ],
101
+ };
102
+ }
103
+ /**
104
+ * Analyze generic errors
105
+ */
106
+ static analyzeGenericError(error) {
107
+ // Check for network error patterns
108
+ const networkPattern = NETWORK_ERROR_PATTERNS.find(pattern => pattern.pattern.test(error.message));
109
+ if (networkPattern) {
110
+ return {
111
+ category: 'network',
112
+ severity: 'high',
113
+ description: networkPattern.description,
114
+ chineseDescription: '网络连接错误',
115
+ troubleshooting: networkPattern.troubleshooting,
116
+ retryable: true,
117
+ retryStrategy: {
118
+ shouldRetry: true,
119
+ delayMs: 3000,
120
+ maxRetries: 3,
121
+ },
122
+ suggestedActions: [
123
+ 'Check network connectivity',
124
+ 'Verify service availability',
125
+ 'Try again after a brief wait',
126
+ ],
127
+ };
128
+ }
129
+ return {
130
+ category: 'unknown',
131
+ severity: 'medium',
132
+ description: error.message || 'Unknown error occurred',
133
+ chineseDescription: '未知错误',
134
+ troubleshooting: [
135
+ 'Check application logs for more details',
136
+ 'Verify system status',
137
+ 'Try the operation again',
138
+ ],
139
+ retryable: true,
140
+ retryStrategy: {
141
+ shouldRetry: true,
142
+ delayMs: 1000,
143
+ maxRetries: 1,
144
+ },
145
+ suggestedActions: [
146
+ 'Review error message for clues',
147
+ 'Check system resources',
148
+ 'Contact support if issue persists',
149
+ ],
150
+ };
151
+ }
152
+ /**
153
+ * Generate context-specific suggested actions
154
+ */
155
+ static generateSuggestedActions(error) {
156
+ const actions = [];
157
+ switch (error.code) {
158
+ case 401:
159
+ actions.push('Copy API key from RoxyBrowser settings', 'Set ROXY_API_KEY environment variable', 'Restart the MCP server');
160
+ break;
161
+ case 404:
162
+ actions.push('Use roxy_list_workspaces to find valid workspace IDs', 'Use roxy_list_browsers to find valid browser IDs', 'Check if resources were deleted');
163
+ break;
164
+ case 409:
165
+ actions.push('Close conflicting browser instances', 'Use roxy_close_browsers tool', 'Wait a moment and try again');
166
+ break;
167
+ case 500:
168
+ actions.push('Check RoxyBrowser application status', 'Restart RoxyBrowser if needed', 'Check system resources');
169
+ break;
170
+ case 408:
171
+ case 504:
172
+ actions.push('Increase timeout settings', 'Reduce batch operation size', 'Check network connectivity');
173
+ break;
174
+ }
175
+ return actions;
176
+ }
177
+ /**
178
+ * Find related error codes that might have similar causes
179
+ */
180
+ static findRelatedErrors(errorCode) {
181
+ const related = [];
182
+ // Group related errors
183
+ const authErrors = [401, 403];
184
+ const networkErrors = [408, 502, 503, 504];
185
+ const resourceErrors = [404, 409];
186
+ if (authErrors.includes(errorCode)) {
187
+ related.push(...authErrors.filter(code => code !== errorCode).map(code => `Error ${code}`));
188
+ }
189
+ else if (networkErrors.includes(errorCode)) {
190
+ related.push(...networkErrors.filter(code => code !== errorCode).map(code => `Error ${code}`));
191
+ }
192
+ else if (resourceErrors.includes(errorCode)) {
193
+ related.push(...resourceErrors.filter(code => code !== errorCode).map(code => `Error ${code}`));
194
+ }
195
+ return related;
196
+ }
197
+ /**
198
+ * Analyze multiple errors to find patterns and provide batch insights
199
+ */
200
+ static analyzeBatchErrors(errors) {
201
+ const analysis = {
202
+ totalErrors: errors.length,
203
+ errorsByCategory: {},
204
+ errorsBySeverity: {},
205
+ commonPatterns: [],
206
+ recommendations: [],
207
+ retryableCount: 0,
208
+ criticalCount: 0,
209
+ };
210
+ const errorMessages = [];
211
+ const errorCodes = [];
212
+ // Analyze each error
213
+ for (const error of errors) {
214
+ const result = this.analyzeError(error);
215
+ // Count by category
216
+ analysis.errorsByCategory[result.category] = (analysis.errorsByCategory[result.category] || 0) + 1;
217
+ // Count by severity
218
+ analysis.errorsBySeverity[result.severity] = (analysis.errorsBySeverity[result.severity] || 0) + 1;
219
+ // Track retryable and critical errors
220
+ if (result.retryable)
221
+ analysis.retryableCount++;
222
+ if (result.severity === 'critical')
223
+ analysis.criticalCount++;
224
+ errorMessages.push(error.message);
225
+ if (error instanceof RoxyApiError) {
226
+ errorCodes.push(error.code);
227
+ }
228
+ }
229
+ // Find common patterns
230
+ analysis.commonPatterns = this.findCommonPatterns(errorMessages, errorCodes);
231
+ // Generate recommendations
232
+ analysis.recommendations = this.generateBatchRecommendations(analysis);
233
+ return analysis;
234
+ }
235
+ /**
236
+ * Find common patterns in error messages and codes
237
+ */
238
+ static findCommonPatterns(messages, codes) {
239
+ const patterns = [];
240
+ // Count error codes
241
+ const codeCount = {};
242
+ const codeMessages = {};
243
+ codes.forEach((code, index) => {
244
+ codeCount[code] = (codeCount[code] || 0) + 1;
245
+ if (!codeMessages[code])
246
+ codeMessages[code] = [];
247
+ codeMessages[code].push(messages[index]);
248
+ });
249
+ // Add significant error code patterns
250
+ Object.entries(codeCount).forEach(([code, count]) => {
251
+ if (count >= 2) {
252
+ const errorInfo = ROXY_ERROR_MAP[parseInt(code)];
253
+ patterns.push({
254
+ pattern: errorInfo ? `${errorInfo.name} (${code})` : `Error Code ${code}`,
255
+ count,
256
+ affectedItems: codeMessages[parseInt(code)].slice(0, 3), // Show first 3 examples
257
+ });
258
+ }
259
+ });
260
+ // Look for common message patterns
261
+ const commonKeywords = ['timeout', 'connection', 'authentication', 'not found', 'conflict'];
262
+ commonKeywords.forEach(keyword => {
263
+ const matchingMessages = messages.filter(msg => msg.toLowerCase().includes(keyword.toLowerCase()));
264
+ if (matchingMessages.length >= 2) {
265
+ patterns.push({
266
+ pattern: `Messages containing "${keyword}"`,
267
+ count: matchingMessages.length,
268
+ affectedItems: matchingMessages.slice(0, 3),
269
+ });
270
+ }
271
+ });
272
+ return patterns.sort((a, b) => b.count - a.count);
273
+ }
274
+ /**
275
+ * Generate batch-level recommendations
276
+ */
277
+ static generateBatchRecommendations(analysis) {
278
+ const recommendations = [];
279
+ // Critical errors
280
+ if (analysis.criticalCount > 0) {
281
+ recommendations.push('🚨 Critical errors detected - immediate attention required');
282
+ }
283
+ // Authentication issues
284
+ if (analysis.errorsByCategory.authentication > 0) {
285
+ recommendations.push('🔑 Authentication issues detected - check API key and permissions');
286
+ }
287
+ // Network issues
288
+ if (analysis.errorsByCategory.network > 0) {
289
+ recommendations.push('🌐 Network issues detected - check connectivity and proxy settings');
290
+ }
291
+ // High retry rate
292
+ if (analysis.retryableCount > analysis.totalErrors * 0.7) {
293
+ recommendations.push('🔄 Many errors are retryable - consider implementing automatic retry');
294
+ }
295
+ // Browser conflicts
296
+ if (analysis.errorsByCategory.browser > 0) {
297
+ recommendations.push('🖥️ Browser-related issues detected - check resource availability and conflicts');
298
+ }
299
+ // Configuration issues
300
+ if (analysis.errorsByCategory.configuration > 0) {
301
+ recommendations.push('⚙️ Configuration issues detected - review settings and parameters');
302
+ }
303
+ return recommendations;
304
+ }
305
+ /**
306
+ * Format error analysis for display to user/AI
307
+ */
308
+ static formatErrorForDisplay(error) {
309
+ const analysis = this.analyzeError(error);
310
+ let formatted = `## 错误分析 / Error Analysis\n\n`;
311
+ formatted += `**错误类型 / Category**: ${analysis.category}\n`;
312
+ formatted += `**严重程度 / Severity**: ${analysis.severity}\n`;
313
+ formatted += `**描述 / Description**: ${analysis.description}\n`;
314
+ formatted += `**中文说明**: ${analysis.chineseDescription}\n\n`;
315
+ if (analysis.troubleshooting.length > 0) {
316
+ formatted += `### 故障排除步骤 / Troubleshooting Steps\n`;
317
+ analysis.troubleshooting.forEach((step, index) => {
318
+ formatted += `${index + 1}. ${step}\n`;
319
+ });
320
+ formatted += '\n';
321
+ }
322
+ if (analysis.suggestedActions.length > 0) {
323
+ formatted += `### 建议操作 / Suggested Actions\n`;
324
+ analysis.suggestedActions.forEach((action, index) => {
325
+ formatted += `${index + 1}. ${action}\n`;
326
+ });
327
+ formatted += '\n';
328
+ }
329
+ if (analysis.retryable && analysis.retryStrategy) {
330
+ formatted += `### 重试策略 / Retry Strategy\n`;
331
+ formatted += `- **可重试 / Retryable**: ✅ Yes\n`;
332
+ formatted += `- **延迟 / Delay**: ${analysis.retryStrategy.delayMs}ms\n`;
333
+ formatted += `- **最大重试次数 / Max Retries**: ${analysis.retryStrategy.maxRetries}\n\n`;
334
+ }
335
+ else {
336
+ formatted += `### 重试策略 / Retry Strategy\n`;
337
+ formatted += `- **可重试 / Retryable**: ❌ No\n\n`;
338
+ }
339
+ if (analysis.relatedErrors && analysis.relatedErrors.length > 0) {
340
+ formatted += `### 相关错误 / Related Errors\n`;
341
+ formatted += `${analysis.relatedErrors.join(', ')}\n\n`;
342
+ }
343
+ return formatted;
344
+ }
345
+ /**
346
+ * Format batch analysis for display
347
+ */
348
+ static formatBatchAnalysisForDisplay(analysis) {
349
+ let formatted = `## 批量错误分析 / Batch Error Analysis\n\n`;
350
+ formatted += `**总错误数 / Total Errors**: ${analysis.totalErrors}\n`;
351
+ formatted += `**可重试错误 / Retryable Errors**: ${analysis.retryableCount}\n`;
352
+ formatted += `**严重错误 / Critical Errors**: ${analysis.criticalCount}\n\n`;
353
+ if (Object.keys(analysis.errorsByCategory).length > 0) {
354
+ formatted += `### 错误分类统计 / Error Categories\n`;
355
+ Object.entries(analysis.errorsByCategory).forEach(([category, count]) => {
356
+ formatted += `- **${category}**: ${count}\n`;
357
+ });
358
+ formatted += '\n';
359
+ }
360
+ if (analysis.commonPatterns.length > 0) {
361
+ formatted += `### 常见错误模式 / Common Patterns\n`;
362
+ analysis.commonPatterns.forEach((pattern, index) => {
363
+ formatted += `${index + 1}. **${pattern.pattern}** (${pattern.count} occurrences)\n`;
364
+ if (pattern.affectedItems.length > 0) {
365
+ formatted += ` Examples: ${pattern.affectedItems.slice(0, 2).join(', ')}\n`;
366
+ }
367
+ });
368
+ formatted += '\n';
369
+ }
370
+ if (analysis.recommendations.length > 0) {
371
+ formatted += `### 建议 / Recommendations\n`;
372
+ analysis.recommendations.forEach((rec, index) => {
373
+ formatted += `${index + 1}. ${rec}\n`;
374
+ });
375
+ formatted += '\n';
376
+ }
377
+ return formatted;
378
+ }
379
+ }
380
+ //# sourceMappingURL=error-analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-analyzer.js","sourceRoot":"","sources":["../../src/utils/error-analyzer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EAEZ,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAgCrB,MAAM,OAAO,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAY;QAC9B,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,KAAK,YAAY,oBAA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AC,GAAG,EAAE,KAAK,EAAE,EAAE;gBAC9C,SAAS,IAAI,GAAG,KAAK,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;YACxC,CAAC,CAAC,CAAC;YACH,SAAS,IAAI,IAAI,CAAC;QACpB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roxybrowser/openapi",
3
- "version": "1.0.3",
3
+ "version": "1.0.4-beta.0",
4
4
  "description": "MCP server for RoxyBrowser automation - manage browser instances and get CDP endpoints",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,7 +15,8 @@
15
15
  "start": "node lib/index.js",
16
16
  "dev": "tsc --watch",
17
17
  "clean": "npx rimraf lib",
18
- "npm-publish": "npm run clean && npm run build && npm publish"
18
+ "npm-publish": "npm run clean && npm version patch --no-git-tag-version && npm run build && npm publish",
19
+ "publish:beta": "npm version prerelease --preid=beta --no-git-tag-version && npm run build && npm publish --tag beta"
19
20
  },
20
21
  "keywords": [
21
22
  "mcp",
@@ -32,7 +33,7 @@
32
33
  "author": "RoxyBrowser",
33
34
  "license": "MIT",
34
35
  "dependencies": {
35
- "@modelcontextprotocol/sdk": "^1.18.0"
36
+ "@modelcontextprotocol/sdk": "^1.18.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/node": "^22.0.0",
@@ -1,48 +0,0 @@
1
- /**
2
- * Browser Template Manager
3
- *
4
- * Provides predefined browser templates for common use cases
5
- */
6
- import { BrowserTemplate, BrowserTemplateType, BrowserCreateConfig, ProxyInfo } from '../types.js';
7
- export declare class TemplateManager {
8
- private static templates;
9
- /**
10
- * Get available template names and descriptions
11
- */
12
- static getAvailableTemplates(): Array<{
13
- name: BrowserTemplateType;
14
- description: string;
15
- }>;
16
- /**
17
- * Get template configuration by name
18
- */
19
- static getTemplate(templateName: BrowserTemplateType): BrowserTemplate | null;
20
- /**
21
- * Get template configuration merged with custom overrides
22
- */
23
- static getTemplateConfig(templateName: BrowserTemplateType, customConfig?: Partial<BrowserCreateConfig>): Partial<BrowserCreateConfig>;
24
- /**
25
- * Create a custom template
26
- */
27
- static createCustomTemplate(name: string, description: string, config: Partial<BrowserCreateConfig>): BrowserTemplate;
28
- /**
29
- * Get template optimized for specific proxy configuration
30
- */
31
- static getTemplateForProxy(templateName: BrowserTemplateType, proxyInfo: ProxyInfo): Partial<BrowserCreateConfig>;
32
- /**
33
- * Get template optimized for specific country/region
34
- */
35
- static getTemplateForRegion(templateName: BrowserTemplateType, countryCode: string, language?: string): Partial<BrowserCreateConfig>;
36
- /**
37
- * Get regional settings by country code
38
- */
39
- private static getRegionalSettings;
40
- /**
41
- * Validate template configuration
42
- */
43
- static validateTemplate(template: BrowserTemplate): {
44
- valid: boolean;
45
- errors: string[];
46
- };
47
- }
48
- //# sourceMappingURL=template-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-manager.d.ts","sourceRoot":"","sources":["../../src/browser/template-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EAEV,MAAM,aAAa,CAAC;AAErB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,SAAS,CAqLtB;IAEF;;OAEG;IACH,MAAM,CAAC,qBAAqB,IAAI,KAAK,CAAC;QAAE,IAAI,EAAE,mBAAmB,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAOzF;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,mBAAmB,GAAG,eAAe,GAAG,IAAI;IAI7E;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,YAAY,EAAE,mBAAmB,EACjC,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAC1C,OAAO,CAAC,mBAAmB,CAAC;IAsC/B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,IAAI,EAA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