@wonderwhy-er/desktop-commander 0.2.6 → 0.2.7
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.
- package/dist/index-dxt.js +10 -47
- package/dist/server.js +6 -0
- package/dist/tools/filesystem.js +37 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/dist/REPLSessionManager.d.ts +0 -109
- package/dist/REPLSessionManager.js +0 -364
- package/dist/REPLSessionManager.test.d.ts +0 -1
- package/dist/REPLSessionManager.test.js +0 -75
- package/dist/client/replClient.d.ts +0 -63
- package/dist/client/replClient.js +0 -217
- package/dist/client/sshClient.d.ts +0 -82
- package/dist/client/sshClient.js +0 -200
- package/dist/command-manager.js.map +0 -1
- package/dist/config-manager.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/custom-stdio.js.map +0 -1
- package/dist/error-handlers.js.map +0 -1
- package/dist/handlers/command-handlers.d.ts +0 -13
- package/dist/handlers/command-handlers.js +0 -43
- package/dist/handlers/edit-search-handlers.js.map +0 -1
- package/dist/handlers/filesystem-handlers.js.map +0 -1
- package/dist/handlers/fuzzy-search-log-handlers.d.ts +0 -13
- package/dist/handlers/fuzzy-search-log-handlers.js +0 -179
- package/dist/handlers/index.js.map +0 -1
- package/dist/handlers/process-handlers.js.map +0 -1
- package/dist/handlers/repl-handlers.d.ts +0 -21
- package/dist/handlers/repl-handlers.js +0 -37
- package/dist/handlers/replCommandHandler.d.ts +0 -125
- package/dist/handlers/replCommandHandler.js +0 -255
- package/dist/handlers/replCommandHandler.test.d.ts +0 -1
- package/dist/handlers/replCommandHandler.test.js +0 -103
- package/dist/handlers/terminal-handlers.js.map +0 -1
- package/dist/index-with-startup-detection.d.ts +0 -5
- package/dist/index-with-startup-detection.js +0 -180
- package/dist/index.js.map +0 -1
- package/dist/logging.d.ts +0 -2
- package/dist/logging.js +0 -28
- package/dist/polyform-license-src/edit/edit.d.ts +0 -15
- package/dist/polyform-license-src/edit/edit.js +0 -163
- package/dist/polyform-license-src/edit/fuzzySearch.d.ts +0 -30
- package/dist/polyform-license-src/edit/fuzzySearch.js +0 -121
- package/dist/polyform-license-src/edit/handlers.d.ts +0 -16
- package/dist/polyform-license-src/edit/handlers.js +0 -24
- package/dist/polyform-license-src/edit/index.d.ts +0 -12
- package/dist/polyform-license-src/edit/index.js +0 -13
- package/dist/polyform-license-src/edit/schemas.d.ts +0 -25
- package/dist/polyform-license-src/edit/schemas.js +0 -16
- package/dist/polyform-license-src/index.d.ts +0 -9
- package/dist/polyform-license-src/index.js +0 -10
- package/dist/repl-manager.d.ts +0 -73
- package/dist/repl-manager.js +0 -407
- package/dist/replIntegration.d.ts +0 -14
- package/dist/replIntegration.js +0 -27
- package/dist/sandbox/index.d.ts +0 -9
- package/dist/sandbox/index.js +0 -50
- package/dist/sandbox/mac-sandbox.d.ts +0 -19
- package/dist/sandbox/mac-sandbox.js +0 -174
- package/dist/server.js.map +0 -1
- package/dist/setup.log +0 -32
- package/dist/terminal-manager.js.map +0 -1
- package/dist/tools/client.d.ts +0 -10
- package/dist/tools/client.js +0 -13
- package/dist/tools/command-block.d.ts +0 -18
- package/dist/tools/command-block.js +0 -62
- package/dist/tools/config.js.map +0 -1
- package/dist/tools/debug-path.d.ts +0 -1
- package/dist/tools/debug-path.js +0 -44
- package/dist/tools/edit.js.map +0 -1
- package/dist/tools/enhanced-read-output.js +0 -69
- package/dist/tools/enhanced-send-input.js +0 -111
- package/dist/tools/environment.d.ts +0 -55
- package/dist/tools/environment.js +0 -65
- package/dist/tools/execute.d.ts +0 -10
- package/dist/tools/execute.js +0 -158
- package/dist/tools/execute.js.map +0 -1
- package/dist/tools/filesystem-fixed.d.ts +0 -22
- package/dist/tools/filesystem-fixed.js +0 -176
- package/dist/tools/filesystem.js.map +0 -1
- package/dist/tools/fuzzySearch.js.map +0 -1
- package/dist/tools/mime-types.js.map +0 -1
- package/dist/tools/pdf-reader.d.ts +0 -13
- package/dist/tools/pdf-reader.js +0 -214
- package/dist/tools/process.js.map +0 -1
- package/dist/tools/progress.d.ts +0 -20
- package/dist/tools/progress.js +0 -59
- package/dist/tools/repl.d.ts +0 -21
- package/dist/tools/repl.js +0 -217
- package/dist/tools/schemas.js.map +0 -1
- package/dist/tools/search.js.map +0 -1
- package/dist/tools/send-input.d.ts +0 -2
- package/dist/tools/send-input.js +0 -45
- package/dist/types.js.map +0 -1
- package/dist/utils/capture.js.map +0 -1
- package/dist/utils/early-logger.d.ts +0 -4
- package/dist/utils/early-logger.js +0 -35
- package/dist/utils/fuzzySearchLogger.js.map +0 -1
- package/dist/utils/lineEndingHandler.js.map +0 -1
- package/dist/utils/lineEndingHandler_optimized.d.ts +0 -21
- package/dist/utils/lineEndingHandler_optimized.js +0 -77
- package/dist/utils/mcp-logger.d.ts +0 -30
- package/dist/utils/mcp-logger.js +0 -59
- package/dist/utils/smithery-detector.d.ts +0 -94
- package/dist/utils/smithery-detector.js +0 -292
- package/dist/utils/startup-detector.d.ts +0 -65
- package/dist/utils/startup-detector.js +0 -390
- package/dist/utils/trackTools.js.map +0 -1
- package/dist/utils/withTimeout.js.map +0 -1
- package/dist/utils.d.ts +0 -26
- package/dist/utils.js +0 -227
- package/dist/version.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzySearchLogger.js","sourceRoot":"","sources":["../../src/utils/fuzzySearchLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAqBpB,MAAM,iBAAiB;IAInB;QAFQ,gBAAW,GAAG,KAAK,CAAC;QAGxB,2CAA2C;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,+BAA+B,CAAC,CAAC;QACxE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAA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,CAAC,CAAC,MAAM,CAAC;IACpF,MAAM,QAAQ,GAAG,UAAU,GAAG,CAAC,CAAC;IAEhC,OAAO;QACH,KAAK;QACL,KAAK,EAAE,KAAK;QACZ,QAAQ;KACX,CAAC;AACN,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Line ending types
|
|
3
|
-
*/
|
|
4
|
-
export type LineEndingStyle = '\r\n' | '\n' | '\r';
|
|
5
|
-
/**
|
|
6
|
-
* Detect the line ending style used in a file - Optimized version
|
|
7
|
-
* This algorithm uses early termination for maximum performance
|
|
8
|
-
*/
|
|
9
|
-
export declare function detectLineEnding(content: string): LineEndingStyle;
|
|
10
|
-
/**
|
|
11
|
-
* Normalize line endings to match the target style
|
|
12
|
-
*/
|
|
13
|
-
export declare function normalizeLineEndings(text: string, targetLineEnding: LineEndingStyle): string;
|
|
14
|
-
/**
|
|
15
|
-
* Analyze line ending usage in content
|
|
16
|
-
*/
|
|
17
|
-
export declare function analyzeLineEndings(content: string): {
|
|
18
|
-
style: LineEndingStyle;
|
|
19
|
-
count: number;
|
|
20
|
-
hasMixed: boolean;
|
|
21
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detect the line ending style used in a file - Optimized version
|
|
3
|
-
* This algorithm uses early termination for maximum performance
|
|
4
|
-
*/
|
|
5
|
-
export function detectLineEnding(content) {
|
|
6
|
-
for (let i = 0; i < content.length; i++) {
|
|
7
|
-
if (content[i] === '\r') {
|
|
8
|
-
if (i + 1 < content.length && content[i + 1] === '\n') {
|
|
9
|
-
return '\r\n';
|
|
10
|
-
}
|
|
11
|
-
return '\r';
|
|
12
|
-
}
|
|
13
|
-
if (content[i] === '\n') {
|
|
14
|
-
return '\n';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// Default to system line ending if no line endings found
|
|
18
|
-
return process.platform === 'win32' ? '\r\n' : '\n';
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Normalize line endings to match the target style
|
|
22
|
-
*/
|
|
23
|
-
export function normalizeLineEndings(text, targetLineEnding) {
|
|
24
|
-
// First normalize to LF
|
|
25
|
-
let normalized = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
|
|
26
|
-
// Then convert to target
|
|
27
|
-
if (targetLineEnding === '\r\n') {
|
|
28
|
-
return normalized.replace(/\n/g, '\r\n');
|
|
29
|
-
}
|
|
30
|
-
else if (targetLineEnding === '\r') {
|
|
31
|
-
return normalized.replace(/\n/g, '\r');
|
|
32
|
-
}
|
|
33
|
-
return normalized;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Analyze line ending usage in content
|
|
37
|
-
*/
|
|
38
|
-
export function analyzeLineEndings(content) {
|
|
39
|
-
let crlfCount = 0;
|
|
40
|
-
let lfCount = 0;
|
|
41
|
-
let crCount = 0;
|
|
42
|
-
// Count line endings
|
|
43
|
-
for (let i = 0; i < content.length; i++) {
|
|
44
|
-
if (content[i] === '\r') {
|
|
45
|
-
if (i + 1 < content.length && content[i + 1] === '\n') {
|
|
46
|
-
crlfCount++;
|
|
47
|
-
i++; // Skip the LF
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
crCount++;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else if (content[i] === '\n') {
|
|
54
|
-
lfCount++;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Determine predominant style
|
|
58
|
-
const total = crlfCount + lfCount + crCount;
|
|
59
|
-
let style;
|
|
60
|
-
if (crlfCount > lfCount && crlfCount > crCount) {
|
|
61
|
-
style = '\r\n';
|
|
62
|
-
}
|
|
63
|
-
else if (lfCount > crCount) {
|
|
64
|
-
style = '\n';
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
style = '\r';
|
|
68
|
-
}
|
|
69
|
-
// Check for mixed line endings
|
|
70
|
-
const usedStyles = [crlfCount > 0, lfCount > 0, crCount > 0].filter(Boolean).length;
|
|
71
|
-
const hasMixed = usedStyles > 1;
|
|
72
|
-
return {
|
|
73
|
-
style,
|
|
74
|
-
count: total,
|
|
75
|
-
hasMixed
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import '../types.js';
|
|
2
|
-
export type LogLevel = "emergency" | "alert" | "critical" | "error" | "warning" | "notice" | "info" | "debug";
|
|
3
|
-
/**
|
|
4
|
-
* MCP-compatible logger that sends log messages via JSON-RPC notifications
|
|
5
|
-
* Falls back to stderr if transport is not available
|
|
6
|
-
*/
|
|
7
|
-
export declare class McpLogger {
|
|
8
|
-
private component;
|
|
9
|
-
constructor(component?: string);
|
|
10
|
-
private logMessage;
|
|
11
|
-
emergency(message: string, data?: any): void;
|
|
12
|
-
alert(message: string, data?: any): void;
|
|
13
|
-
critical(message: string, data?: any): void;
|
|
14
|
-
error(message: string, data?: any): void;
|
|
15
|
-
warning(message: string, data?: any): void;
|
|
16
|
-
notice(message: string, data?: any): void;
|
|
17
|
-
info(message: string, data?: any): void;
|
|
18
|
-
debug(message: string, data?: any): void;
|
|
19
|
-
warn(message: string, data?: any): void;
|
|
20
|
-
logInfo(message: string, data?: any): void;
|
|
21
|
-
toolCall(toolName: string, args: any, result?: any, error?: Error): void;
|
|
22
|
-
}
|
|
23
|
-
export declare const logger: McpLogger;
|
|
24
|
-
export declare const mcpConsole: {
|
|
25
|
-
log: (message: string, data?: any) => void;
|
|
26
|
-
info: (message: string, data?: any) => void;
|
|
27
|
-
warn: (message: string, data?: any) => void;
|
|
28
|
-
error: (message: string, data?: any) => void;
|
|
29
|
-
debug: (message: string, data?: any) => void;
|
|
30
|
-
};
|
package/dist/utils/mcp-logger.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// src/utils/mcp-logger.ts
|
|
2
|
-
import '../types.js'; // Import for global types
|
|
3
|
-
/**
|
|
4
|
-
* MCP-compatible logger that sends log messages via JSON-RPC notifications
|
|
5
|
-
* Falls back to stderr if transport is not available
|
|
6
|
-
*/
|
|
7
|
-
export class McpLogger {
|
|
8
|
-
constructor(component = 'desktop-commander') {
|
|
9
|
-
this.component = component;
|
|
10
|
-
}
|
|
11
|
-
logMessage(level, message, data) {
|
|
12
|
-
if (global.mcpTransport?.sendLog) {
|
|
13
|
-
// Send via MCP JSON-RPC notification
|
|
14
|
-
global.mcpTransport.sendLog(level, `[${this.component}] ${message}`, data);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
// Fallback to stderr
|
|
18
|
-
const timestamp = new Date().toISOString();
|
|
19
|
-
const dataStr = data ? ` - ${JSON.stringify(data)}` : '';
|
|
20
|
-
process.stderr.write(`${timestamp} [${level.toUpperCase()}] [${this.component}] ${message}${dataStr}\n`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
emergency(message, data) { this.logMessage('emergency', message, data); }
|
|
24
|
-
alert(message, data) { this.logMessage('alert', message, data); }
|
|
25
|
-
critical(message, data) { this.logMessage('critical', message, data); }
|
|
26
|
-
error(message, data) { this.logMessage('error', message, data); }
|
|
27
|
-
warning(message, data) { this.logMessage('warning', message, data); }
|
|
28
|
-
notice(message, data) { this.logMessage('notice', message, data); }
|
|
29
|
-
info(message, data) { this.logMessage('info', message, data); }
|
|
30
|
-
debug(message, data) { this.logMessage('debug', message, data); }
|
|
31
|
-
// Convenience methods
|
|
32
|
-
warn(message, data) { this.warning(message, data); }
|
|
33
|
-
logInfo(message, data) { this.info(message, data); }
|
|
34
|
-
// Tool execution logging
|
|
35
|
-
toolCall(toolName, args, result, error) {
|
|
36
|
-
const logData = {
|
|
37
|
-
tool: toolName,
|
|
38
|
-
args,
|
|
39
|
-
...(result && { result }),
|
|
40
|
-
...(error && { error: error.message, stack: error.stack })
|
|
41
|
-
};
|
|
42
|
-
if (error) {
|
|
43
|
-
this.error(`Tool ${toolName} failed`, logData);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.debug(`Tool ${toolName} executed`, logData);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Create a global logger instance
|
|
51
|
-
export const logger = new McpLogger('desktop-commander');
|
|
52
|
-
// Create convenience functions that mimic console methods
|
|
53
|
-
export const mcpConsole = {
|
|
54
|
-
log: (message, data) => logger.info(message, data),
|
|
55
|
-
info: (message, data) => logger.info(message, data),
|
|
56
|
-
warn: (message, data) => logger.warning(message, data),
|
|
57
|
-
error: (message, data) => logger.error(message, data),
|
|
58
|
-
debug: (message, data) => logger.debug(message, data),
|
|
59
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smithery CLI Detection Module
|
|
3
|
-
*
|
|
4
|
-
* Detects when a Node.js MCP server is being run through Smithery CLI
|
|
5
|
-
* which acts as a proxy/wrapper around MCP servers.
|
|
6
|
-
*/
|
|
7
|
-
export interface SmitheryDetectionInfo {
|
|
8
|
-
isSmithery: boolean;
|
|
9
|
-
confidence: number;
|
|
10
|
-
evidence: string[];
|
|
11
|
-
details: {
|
|
12
|
-
sessionId?: string;
|
|
13
|
-
analyticsEnabled?: boolean;
|
|
14
|
-
clientType?: string;
|
|
15
|
-
connectionType?: 'stdio' | 'http' | 'streamable-http';
|
|
16
|
-
qualifiedName?: string;
|
|
17
|
-
profile?: string;
|
|
18
|
-
runtimeEnvironment?: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export declare class SmitheryDetector {
|
|
22
|
-
private static instance;
|
|
23
|
-
private _detectionInfo;
|
|
24
|
-
private constructor();
|
|
25
|
-
static getInstance(): SmitheryDetector;
|
|
26
|
-
/**
|
|
27
|
-
* Get Smithery detection information (cached after first call)
|
|
28
|
-
*/
|
|
29
|
-
getSmitheryInfo(): SmitheryDetectionInfo;
|
|
30
|
-
/**
|
|
31
|
-
* Force re-detection (useful for testing)
|
|
32
|
-
*/
|
|
33
|
-
forceRedetect(): SmitheryDetectionInfo;
|
|
34
|
-
private detectSmithery;
|
|
35
|
-
/**
|
|
36
|
-
* Check for Smithery-specific environment variables
|
|
37
|
-
*/
|
|
38
|
-
private checkSmitheryEnvironmentVars;
|
|
39
|
-
/**
|
|
40
|
-
* Check process arguments for Smithery patterns
|
|
41
|
-
*/
|
|
42
|
-
private checkProcessArguments;
|
|
43
|
-
/**
|
|
44
|
-
* Check parent process for Smithery CLI
|
|
45
|
-
*/
|
|
46
|
-
private checkParentProcess;
|
|
47
|
-
/**
|
|
48
|
-
* Check for Smithery runtime environment patterns
|
|
49
|
-
*/
|
|
50
|
-
private checkRuntimeEnvironment;
|
|
51
|
-
/**
|
|
52
|
-
* Check for analytics and session indicators
|
|
53
|
-
*/
|
|
54
|
-
private checkAnalyticsIndicators;
|
|
55
|
-
/**
|
|
56
|
-
* Check for MCP transport patterns that indicate Smithery
|
|
57
|
-
*/
|
|
58
|
-
private checkTransportPatterns;
|
|
59
|
-
/**
|
|
60
|
-
* Check stdio patterns that suggest Smithery proxying
|
|
61
|
-
*/
|
|
62
|
-
private checkStdioPatterns;
|
|
63
|
-
/**
|
|
64
|
-
* Check if running through Smithery (convenience method)
|
|
65
|
-
*/
|
|
66
|
-
isSmithery(): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Get the client type if running through Smithery
|
|
69
|
-
*/
|
|
70
|
-
getClientType(): string | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* Get the connection type if running through Smithery
|
|
73
|
-
*/
|
|
74
|
-
getConnectionType(): string | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* Get analytics status if running through Smithery
|
|
77
|
-
*/
|
|
78
|
-
isAnalyticsEnabled(): boolean | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* Get session ID if running through Smithery
|
|
81
|
-
*/
|
|
82
|
-
getSessionId(): string | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* Get server qualified name if running through Smithery
|
|
85
|
-
*/
|
|
86
|
-
getQualifiedName(): string | undefined;
|
|
87
|
-
}
|
|
88
|
-
export declare const smitheryDetector: SmitheryDetector;
|
|
89
|
-
export declare const getSmitheryInfo: () => SmitheryDetectionInfo;
|
|
90
|
-
export declare const isSmithery: () => boolean;
|
|
91
|
-
export declare const getSmitheryClientType: () => string | undefined;
|
|
92
|
-
export declare const getSmitheryConnectionType: () => string | undefined;
|
|
93
|
-
export declare const getSmitherySessionId: () => string | undefined;
|
|
94
|
-
export declare const isSmitheryAnalyticsEnabled: () => boolean | undefined;
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smithery CLI Detection Module
|
|
3
|
-
*
|
|
4
|
-
* Detects when a Node.js MCP server is being run through Smithery CLI
|
|
5
|
-
* which acts as a proxy/wrapper around MCP servers.
|
|
6
|
-
*/
|
|
7
|
-
import { platform } from 'os';
|
|
8
|
-
export class SmitheryDetector {
|
|
9
|
-
constructor() {
|
|
10
|
-
this._detectionInfo = null;
|
|
11
|
-
}
|
|
12
|
-
static getInstance() {
|
|
13
|
-
if (!SmitheryDetector.instance) {
|
|
14
|
-
SmitheryDetector.instance = new SmitheryDetector();
|
|
15
|
-
}
|
|
16
|
-
return SmitheryDetector.instance;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Get Smithery detection information (cached after first call)
|
|
20
|
-
*/
|
|
21
|
-
getSmitheryInfo() {
|
|
22
|
-
if (!this._detectionInfo) {
|
|
23
|
-
this._detectionInfo = this.detectSmithery();
|
|
24
|
-
}
|
|
25
|
-
return this._detectionInfo;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Force re-detection (useful for testing)
|
|
29
|
-
*/
|
|
30
|
-
forceRedetect() {
|
|
31
|
-
this._detectionInfo = this.detectSmithery();
|
|
32
|
-
return this._detectionInfo;
|
|
33
|
-
}
|
|
34
|
-
detectSmithery() {
|
|
35
|
-
const result = {
|
|
36
|
-
isSmithery: false,
|
|
37
|
-
confidence: 0,
|
|
38
|
-
evidence: [],
|
|
39
|
-
details: {}
|
|
40
|
-
};
|
|
41
|
-
// Method 1: Check for Smithery-specific environment variables
|
|
42
|
-
this.checkSmitheryEnvironmentVars(result);
|
|
43
|
-
// Method 2: Check process arguments for Smithery patterns
|
|
44
|
-
this.checkProcessArguments(result);
|
|
45
|
-
// Method 3: Check parent process for Smithery CLI
|
|
46
|
-
this.checkParentProcess(result);
|
|
47
|
-
// Method 4: Check for Smithery runtime environment patterns
|
|
48
|
-
this.checkRuntimeEnvironment(result);
|
|
49
|
-
// Method 5: Check for analytics/session indicators
|
|
50
|
-
this.checkAnalyticsIndicators(result);
|
|
51
|
-
// Method 6: Check for MCP SDK transport patterns
|
|
52
|
-
this.checkTransportPatterns(result);
|
|
53
|
-
// Method 7: Check stdio patterns
|
|
54
|
-
this.checkStdioPatterns(result);
|
|
55
|
-
// Set final determination
|
|
56
|
-
result.isSmithery = result.confidence >= 30;
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Check for Smithery-specific environment variables
|
|
61
|
-
*/
|
|
62
|
-
checkSmitheryEnvironmentVars(result) {
|
|
63
|
-
const smitheryEnvVars = [
|
|
64
|
-
'SMITHERY_SESSION_ID',
|
|
65
|
-
'SMITHERY_API_KEY',
|
|
66
|
-
'SMITHERY_CLIENT',
|
|
67
|
-
'SMITHERY_PROFILE',
|
|
68
|
-
'SMITHERY_ANALYTICS',
|
|
69
|
-
'SMITHERY_RUNTIME',
|
|
70
|
-
'REGISTRY_ENDPOINT',
|
|
71
|
-
'ANALYTICS_ENDPOINT'
|
|
72
|
-
];
|
|
73
|
-
for (const envVar of smitheryEnvVars) {
|
|
74
|
-
if (process.env[envVar]) {
|
|
75
|
-
result.confidence += 40;
|
|
76
|
-
result.evidence.push(`Smithery environment variable: ${envVar}`);
|
|
77
|
-
// Extract specific details
|
|
78
|
-
switch (envVar) {
|
|
79
|
-
case 'SMITHERY_SESSION_ID':
|
|
80
|
-
result.details.sessionId = process.env[envVar];
|
|
81
|
-
break;
|
|
82
|
-
case 'SMITHERY_CLIENT':
|
|
83
|
-
result.details.clientType = process.env[envVar];
|
|
84
|
-
break;
|
|
85
|
-
case 'SMITHERY_PROFILE':
|
|
86
|
-
result.details.profile = process.env[envVar];
|
|
87
|
-
break;
|
|
88
|
-
case 'SMITHERY_ANALYTICS':
|
|
89
|
-
result.details.analyticsEnabled = process.env[envVar] === 'true';
|
|
90
|
-
break;
|
|
91
|
-
case 'SMITHERY_RUNTIME':
|
|
92
|
-
result.details.runtimeEnvironment = process.env[envVar];
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Check for Smithery endpoints
|
|
98
|
-
if (process.env.REGISTRY_ENDPOINT?.includes('smithery')) {
|
|
99
|
-
result.confidence += 30;
|
|
100
|
-
result.evidence.push('Smithery registry endpoint detected');
|
|
101
|
-
}
|
|
102
|
-
if (process.env.ANALYTICS_ENDPOINT?.includes('smithery')) {
|
|
103
|
-
result.confidence += 25;
|
|
104
|
-
result.evidence.push('Smithery analytics endpoint detected');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Check process arguments for Smithery patterns
|
|
109
|
-
*/
|
|
110
|
-
checkProcessArguments(result) {
|
|
111
|
-
const args = process.argv.join(' ');
|
|
112
|
-
// Check for common Smithery CLI patterns
|
|
113
|
-
const smitheryPatterns = [
|
|
114
|
-
/smithery[\s\/\\]cli/i,
|
|
115
|
-
/@smithery[\s\/\\]cli/i,
|
|
116
|
-
/npx.*@smithery/i,
|
|
117
|
-
/smithery.*run/i,
|
|
118
|
-
/smithery.*install/i
|
|
119
|
-
];
|
|
120
|
-
for (const pattern of smitheryPatterns) {
|
|
121
|
-
if (pattern.test(args)) {
|
|
122
|
-
result.confidence += 35;
|
|
123
|
-
result.evidence.push(`Smithery CLI pattern in arguments: ${pattern.source}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Check for typical Smithery command structure
|
|
127
|
-
if (args.includes('--config') && args.includes('--client')) {
|
|
128
|
-
result.confidence += 20;
|
|
129
|
-
result.evidence.push('Smithery-style CLI arguments detected');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Check parent process for Smithery CLI
|
|
134
|
-
*/
|
|
135
|
-
checkParentProcess(result) {
|
|
136
|
-
try {
|
|
137
|
-
if (platform() === 'darwin' || platform() === 'linux') {
|
|
138
|
-
const { execSync } = require('child_process');
|
|
139
|
-
const ppid = process.ppid;
|
|
140
|
-
if (ppid) {
|
|
141
|
-
// Get parent process command line
|
|
142
|
-
const parentCmd = execSync(`ps -p ${ppid} -o command=`, {
|
|
143
|
-
encoding: 'utf8',
|
|
144
|
-
timeout: 1000
|
|
145
|
-
}).trim();
|
|
146
|
-
if (parentCmd.includes('smithery') || parentCmd.includes('@smithery/cli')) {
|
|
147
|
-
result.confidence += 50;
|
|
148
|
-
result.evidence.push(`Parent process is Smithery CLI: ${parentCmd}`);
|
|
149
|
-
}
|
|
150
|
-
if (parentCmd.includes('node') && parentCmd.includes('npx')) {
|
|
151
|
-
result.confidence += 15;
|
|
152
|
-
result.evidence.push('Parent process shows npx execution pattern');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
// Ignore errors, parent process detection is best-effort
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Check for Smithery runtime environment patterns
|
|
163
|
-
*/
|
|
164
|
-
checkRuntimeEnvironment(result) {
|
|
165
|
-
// Check working directory for Smithery artifacts
|
|
166
|
-
const cwd = process.cwd();
|
|
167
|
-
if (cwd.includes('.smithery') || cwd.includes('smithery-cli')) {
|
|
168
|
-
result.confidence += 25;
|
|
169
|
-
result.evidence.push('Working directory indicates Smithery environment');
|
|
170
|
-
}
|
|
171
|
-
// Check for typical Smithery PATH modifications
|
|
172
|
-
const path = process.env.PATH || '';
|
|
173
|
-
if (path.includes('smithery') || path.includes('.smithery')) {
|
|
174
|
-
result.confidence += 20;
|
|
175
|
-
result.evidence.push('PATH contains Smithery directories');
|
|
176
|
-
}
|
|
177
|
-
// Check for Smithery-injected NODE_OPTIONS or similar
|
|
178
|
-
if (process.env.NODE_OPTIONS?.includes('smithery')) {
|
|
179
|
-
result.confidence += 30;
|
|
180
|
-
result.evidence.push('NODE_OPTIONS indicates Smithery runtime');
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Check for analytics and session indicators
|
|
185
|
-
*/
|
|
186
|
-
checkAnalyticsIndicators(result) {
|
|
187
|
-
// Check for UUID v7 pattern in environment (Smithery uses uuidv7 for sessions)
|
|
188
|
-
const envVars = Object.keys(process.env);
|
|
189
|
-
for (const key of envVars) {
|
|
190
|
-
const value = process.env[key] || '';
|
|
191
|
-
// UUID v7 pattern: 8-4-4-4-12 hex characters starting with timestamp
|
|
192
|
-
if (/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value)) {
|
|
193
|
-
result.confidence += 25;
|
|
194
|
-
result.evidence.push(`UUID v7 session ID pattern detected: ${key}`);
|
|
195
|
-
result.details.sessionId = value;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
// Check for Smithery analytics patterns
|
|
199
|
-
if (process.env.SMITHERY_ANALYTICS_CONSENT) {
|
|
200
|
-
result.confidence += 20;
|
|
201
|
-
result.evidence.push('Smithery analytics consent setting detected');
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Check for MCP transport patterns that indicate Smithery
|
|
206
|
-
*/
|
|
207
|
-
checkTransportPatterns(result) {
|
|
208
|
-
// Check for environment variables that suggest MCP transport through Smithery
|
|
209
|
-
if (process.env.MCP_TRANSPORT_TYPE) {
|
|
210
|
-
result.confidence += 15;
|
|
211
|
-
result.evidence.push('MCP transport type specification detected');
|
|
212
|
-
result.details.connectionType = process.env.MCP_TRANSPORT_TYPE;
|
|
213
|
-
}
|
|
214
|
-
// Check for Smithery's specific transport configurations
|
|
215
|
-
if (process.env.SMITHERY_CONNECTION_TYPE) {
|
|
216
|
-
result.confidence += 35;
|
|
217
|
-
result.evidence.push('Smithery connection type detected');
|
|
218
|
-
result.details.connectionType = process.env.SMITHERY_CONNECTION_TYPE;
|
|
219
|
-
}
|
|
220
|
-
// Check for server qualification patterns
|
|
221
|
-
if (process.env.SMITHERY_QUALIFIED_NAME || process.env.MCP_SERVER_NAME) {
|
|
222
|
-
result.confidence += 30;
|
|
223
|
-
result.evidence.push('MCP server qualification detected');
|
|
224
|
-
result.details.qualifiedName = process.env.SMITHERY_QUALIFIED_NAME || process.env.MCP_SERVER_NAME;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Check stdio patterns that suggest Smithery proxying
|
|
229
|
-
*/
|
|
230
|
-
checkStdioPatterns(result) {
|
|
231
|
-
// Check if stdin/stdout are being piped in a way consistent with Smithery
|
|
232
|
-
if (!process.stdin.isTTY && !process.stdout.isTTY) {
|
|
233
|
-
result.confidence += 10;
|
|
234
|
-
result.evidence.push('Non-TTY stdio suggests proxied execution');
|
|
235
|
-
}
|
|
236
|
-
// Check for JSON-RPC message patterns in environment
|
|
237
|
-
if (process.env.MCP_JSONRPC_VERSION) {
|
|
238
|
-
result.confidence += 15;
|
|
239
|
-
result.evidence.push('JSON-RPC version specification detected');
|
|
240
|
-
}
|
|
241
|
-
// Check for Smithery's specific stdio handling
|
|
242
|
-
if (process.env.SMITHERY_STDIO_BUFFER_SIZE || process.env.SMITHERY_MESSAGE_TIMEOUT) {
|
|
243
|
-
result.confidence += 25;
|
|
244
|
-
result.evidence.push('Smithery stdio configuration detected');
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Check if running through Smithery (convenience method)
|
|
249
|
-
*/
|
|
250
|
-
isSmithery() {
|
|
251
|
-
return this.getSmitheryInfo().isSmithery;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Get the client type if running through Smithery
|
|
255
|
-
*/
|
|
256
|
-
getClientType() {
|
|
257
|
-
return this.getSmitheryInfo().details.clientType;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Get the connection type if running through Smithery
|
|
261
|
-
*/
|
|
262
|
-
getConnectionType() {
|
|
263
|
-
return this.getSmitheryInfo().details.connectionType;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Get analytics status if running through Smithery
|
|
267
|
-
*/
|
|
268
|
-
isAnalyticsEnabled() {
|
|
269
|
-
return this.getSmitheryInfo().details.analyticsEnabled;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Get session ID if running through Smithery
|
|
273
|
-
*/
|
|
274
|
-
getSessionId() {
|
|
275
|
-
return this.getSmitheryInfo().details.sessionId;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get server qualified name if running through Smithery
|
|
279
|
-
*/
|
|
280
|
-
getQualifiedName() {
|
|
281
|
-
return this.getSmitheryInfo().details.qualifiedName;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
// Singleton instance
|
|
285
|
-
export const smitheryDetector = SmitheryDetector.getInstance();
|
|
286
|
-
// Convenience functions
|
|
287
|
-
export const getSmitheryInfo = () => smitheryDetector.getSmitheryInfo();
|
|
288
|
-
export const isSmithery = () => smitheryDetector.isSmithery();
|
|
289
|
-
export const getSmitheryClientType = () => smitheryDetector.getClientType();
|
|
290
|
-
export const getSmitheryConnectionType = () => smitheryDetector.getConnectionType();
|
|
291
|
-
export const getSmitherySessionId = () => smitheryDetector.getSessionId();
|
|
292
|
-
export const isSmitheryAnalyticsEnabled = () => smitheryDetector.isAnalyticsEnabled();
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Production-Ready Startup Detection Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides a lightweight, production-ready way to detect
|
|
5
|
-
* how a Node.js application was started. Perfect for logging, analytics,
|
|
6
|
-
* or conditional behavior based on startup method.
|
|
7
|
-
*/
|
|
8
|
-
export interface StartupInfo {
|
|
9
|
-
method: 'npm-run' | 'npx' | 'docker' | 'node-direct' | 'ci-cd' | 'smithery' | 'unknown';
|
|
10
|
-
confidence: number;
|
|
11
|
-
details: {
|
|
12
|
-
npmScript?: string;
|
|
13
|
-
ciPlatform?: string;
|
|
14
|
-
dockerContainer?: boolean;
|
|
15
|
-
smitheryClient?: string;
|
|
16
|
-
smitheryConnection?: string;
|
|
17
|
-
smitherySession?: string;
|
|
18
|
-
evidence: string[];
|
|
19
|
-
};
|
|
20
|
-
environment: 'development' | 'production' | 'ci' | 'container' | 'smithery' | 'unknown';
|
|
21
|
-
}
|
|
22
|
-
export declare class StartupDetector {
|
|
23
|
-
private static instance;
|
|
24
|
-
private _startupInfo;
|
|
25
|
-
private constructor();
|
|
26
|
-
static getInstance(): StartupDetector;
|
|
27
|
-
/**
|
|
28
|
-
* Get startup information (cached after first call)
|
|
29
|
-
*/
|
|
30
|
-
getStartupInfo(): StartupInfo;
|
|
31
|
-
/**
|
|
32
|
-
* Force re-detection (useful for testing)
|
|
33
|
-
*/
|
|
34
|
-
forceRedetect(): StartupInfo;
|
|
35
|
-
private detectStartupMethod;
|
|
36
|
-
private detectNpmRun;
|
|
37
|
-
private detectNpx;
|
|
38
|
-
private detectDocker;
|
|
39
|
-
private detectCiCd;
|
|
40
|
-
private detectDirectNode;
|
|
41
|
-
private detectSmithery;
|
|
42
|
-
private detectEnvironment;
|
|
43
|
-
/**
|
|
44
|
-
* Get a simple string representation of how the app was started
|
|
45
|
-
*/
|
|
46
|
-
getStartupMethodString(): string;
|
|
47
|
-
/**
|
|
48
|
-
* Check if running in a specific environment
|
|
49
|
-
*/
|
|
50
|
-
isEnvironment(env: StartupInfo['environment']): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Check if running via a specific method
|
|
53
|
-
*/
|
|
54
|
-
isMethod(method: StartupInfo['method']): boolean;
|
|
55
|
-
}
|
|
56
|
-
export declare const startupDetector: StartupDetector;
|
|
57
|
-
export declare const getStartupInfo: () => StartupInfo;
|
|
58
|
-
export declare const getStartupMethod: () => string;
|
|
59
|
-
export declare const isProduction: () => boolean;
|
|
60
|
-
export declare const isDevelopment: () => boolean;
|
|
61
|
-
export declare const isDocker: () => boolean;
|
|
62
|
-
export declare const isCi: () => boolean;
|
|
63
|
-
export declare const isSmithery: () => boolean;
|
|
64
|
-
export declare const getSmitheryClient: () => string | undefined;
|
|
65
|
-
export declare const getSmitheryConnection: () => string | undefined;
|