@wonderwhy-er/desktop-commander 0.2.5 → 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.
Files changed (113) hide show
  1. package/dist/index-dxt.js +10 -47
  2. package/dist/server.js +6 -0
  3. package/dist/tools/filesystem.js +37 -4
  4. package/dist/utils/usageTracker.js +8 -5
  5. package/dist/version.d.ts +1 -1
  6. package/dist/version.js +1 -1
  7. package/package.json +2 -1
  8. package/dist/REPLSessionManager.d.ts +0 -109
  9. package/dist/REPLSessionManager.js +0 -364
  10. package/dist/REPLSessionManager.test.d.ts +0 -1
  11. package/dist/REPLSessionManager.test.js +0 -75
  12. package/dist/client/replClient.d.ts +0 -63
  13. package/dist/client/replClient.js +0 -217
  14. package/dist/client/sshClient.d.ts +0 -82
  15. package/dist/client/sshClient.js +0 -200
  16. package/dist/command-manager.js.map +0 -1
  17. package/dist/config-manager.js.map +0 -1
  18. package/dist/config.js.map +0 -1
  19. package/dist/custom-stdio.js.map +0 -1
  20. package/dist/error-handlers.js.map +0 -1
  21. package/dist/handlers/command-handlers.d.ts +0 -13
  22. package/dist/handlers/command-handlers.js +0 -43
  23. package/dist/handlers/edit-search-handlers.js.map +0 -1
  24. package/dist/handlers/filesystem-handlers.js.map +0 -1
  25. package/dist/handlers/fuzzy-search-log-handlers.d.ts +0 -13
  26. package/dist/handlers/fuzzy-search-log-handlers.js +0 -179
  27. package/dist/handlers/index.js.map +0 -1
  28. package/dist/handlers/process-handlers.js.map +0 -1
  29. package/dist/handlers/repl-handlers.d.ts +0 -21
  30. package/dist/handlers/repl-handlers.js +0 -37
  31. package/dist/handlers/replCommandHandler.d.ts +0 -125
  32. package/dist/handlers/replCommandHandler.js +0 -255
  33. package/dist/handlers/replCommandHandler.test.d.ts +0 -1
  34. package/dist/handlers/replCommandHandler.test.js +0 -103
  35. package/dist/handlers/terminal-handlers.js.map +0 -1
  36. package/dist/index-with-startup-detection.d.ts +0 -5
  37. package/dist/index-with-startup-detection.js +0 -180
  38. package/dist/index.js.map +0 -1
  39. package/dist/logging.d.ts +0 -2
  40. package/dist/logging.js +0 -28
  41. package/dist/polyform-license-src/edit/edit.d.ts +0 -15
  42. package/dist/polyform-license-src/edit/edit.js +0 -163
  43. package/dist/polyform-license-src/edit/fuzzySearch.d.ts +0 -30
  44. package/dist/polyform-license-src/edit/fuzzySearch.js +0 -121
  45. package/dist/polyform-license-src/edit/handlers.d.ts +0 -16
  46. package/dist/polyform-license-src/edit/handlers.js +0 -24
  47. package/dist/polyform-license-src/edit/index.d.ts +0 -12
  48. package/dist/polyform-license-src/edit/index.js +0 -13
  49. package/dist/polyform-license-src/edit/schemas.d.ts +0 -25
  50. package/dist/polyform-license-src/edit/schemas.js +0 -16
  51. package/dist/polyform-license-src/index.d.ts +0 -9
  52. package/dist/polyform-license-src/index.js +0 -10
  53. package/dist/repl-manager.d.ts +0 -73
  54. package/dist/repl-manager.js +0 -407
  55. package/dist/replIntegration.d.ts +0 -14
  56. package/dist/replIntegration.js +0 -27
  57. package/dist/sandbox/index.d.ts +0 -9
  58. package/dist/sandbox/index.js +0 -50
  59. package/dist/sandbox/mac-sandbox.d.ts +0 -19
  60. package/dist/sandbox/mac-sandbox.js +0 -174
  61. package/dist/server.js.map +0 -1
  62. package/dist/setup.log +0 -32
  63. package/dist/terminal-manager.js.map +0 -1
  64. package/dist/tools/client.d.ts +0 -10
  65. package/dist/tools/client.js +0 -13
  66. package/dist/tools/command-block.d.ts +0 -18
  67. package/dist/tools/command-block.js +0 -62
  68. package/dist/tools/config.js.map +0 -1
  69. package/dist/tools/debug-path.d.ts +0 -1
  70. package/dist/tools/debug-path.js +0 -44
  71. package/dist/tools/edit.js.map +0 -1
  72. package/dist/tools/enhanced-read-output.js +0 -69
  73. package/dist/tools/enhanced-send-input.js +0 -111
  74. package/dist/tools/environment.d.ts +0 -55
  75. package/dist/tools/environment.js +0 -65
  76. package/dist/tools/execute.d.ts +0 -10
  77. package/dist/tools/execute.js +0 -158
  78. package/dist/tools/execute.js.map +0 -1
  79. package/dist/tools/filesystem-fixed.d.ts +0 -22
  80. package/dist/tools/filesystem-fixed.js +0 -176
  81. package/dist/tools/filesystem.js.map +0 -1
  82. package/dist/tools/fuzzySearch.js.map +0 -1
  83. package/dist/tools/mime-types.js.map +0 -1
  84. package/dist/tools/pdf-reader.d.ts +0 -13
  85. package/dist/tools/pdf-reader.js +0 -214
  86. package/dist/tools/process.js.map +0 -1
  87. package/dist/tools/progress.d.ts +0 -20
  88. package/dist/tools/progress.js +0 -59
  89. package/dist/tools/repl.d.ts +0 -21
  90. package/dist/tools/repl.js +0 -217
  91. package/dist/tools/schemas.js.map +0 -1
  92. package/dist/tools/search.js.map +0 -1
  93. package/dist/tools/send-input.d.ts +0 -2
  94. package/dist/tools/send-input.js +0 -45
  95. package/dist/types.js.map +0 -1
  96. package/dist/utils/capture.js.map +0 -1
  97. package/dist/utils/early-logger.d.ts +0 -4
  98. package/dist/utils/early-logger.js +0 -35
  99. package/dist/utils/fuzzySearchLogger.js.map +0 -1
  100. package/dist/utils/lineEndingHandler.js.map +0 -1
  101. package/dist/utils/lineEndingHandler_optimized.d.ts +0 -21
  102. package/dist/utils/lineEndingHandler_optimized.js +0 -77
  103. package/dist/utils/mcp-logger.d.ts +0 -30
  104. package/dist/utils/mcp-logger.js +0 -59
  105. package/dist/utils/smithery-detector.d.ts +0 -94
  106. package/dist/utils/smithery-detector.js +0 -292
  107. package/dist/utils/startup-detector.d.ts +0 -65
  108. package/dist/utils/startup-detector.js +0 -390
  109. package/dist/utils/trackTools.js.map +0 -1
  110. package/dist/utils/withTimeout.js.map +0 -1
  111. package/dist/utils.d.ts +0 -26
  112. package/dist/utils.js +0 -227
  113. package/dist/version.js.map +0 -1
@@ -1,121 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- import { distance } from 'fastest-levenshtein';
10
- import { capture } from '../../utils.js';
11
- /**
12
- * Recursively finds the closest match to a query string within text using fuzzy matching
13
- * @param text The text to search within
14
- * @param query The query string to find
15
- * @param start Start index in the text (default: 0)
16
- * @param end End index in the text (default: text.length)
17
- * @param parentDistance Best distance found so far (default: Infinity)
18
- * @returns Object with start and end indices, matched value, and Levenshtein distance
19
- */
20
- export function recursiveFuzzyIndexOf(text, query, start = 0, end = null, parentDistance = Infinity, depth = 0) {
21
- // For debugging and performance tracking purposes
22
- if (depth === 0) {
23
- const startTime = performance.now();
24
- const result = recursiveFuzzyIndexOf(text, query, start, end, parentDistance, depth + 1);
25
- const executionTime = performance.now() - startTime;
26
- // Capture detailed metrics for the recursive search for in-depth analysis
27
- capture('fuzzy_search_recursive_metrics', {
28
- execution_time_ms: executionTime,
29
- text_length: text.length,
30
- query_length: query.length,
31
- result_distance: result.distance
32
- });
33
- return result;
34
- }
35
- if (end === null)
36
- end = text.length;
37
- // For small text segments, use iterative approach
38
- if (end - start <= 2 * query.length) {
39
- return iterativeReduction(text, query, start, end, parentDistance);
40
- }
41
- let midPoint = start + Math.floor((end - start) / 2);
42
- let leftEnd = Math.min(end, midPoint + query.length); // Include query length to cover overlaps
43
- let rightStart = Math.max(start, midPoint - query.length); // Include query length to cover overlaps
44
- // Calculate distance for current segments
45
- let leftDistance = distance(text.substring(start, leftEnd), query);
46
- let rightDistance = distance(text.substring(rightStart, end), query);
47
- let bestDistance = Math.min(leftDistance, parentDistance, rightDistance);
48
- // If parent distance is already the best, use iterative approach
49
- if (parentDistance === bestDistance) {
50
- return iterativeReduction(text, query, start, end, parentDistance);
51
- }
52
- // Recursively search the better half
53
- if (leftDistance < rightDistance) {
54
- return recursiveFuzzyIndexOf(text, query, start, leftEnd, bestDistance, depth + 1);
55
- }
56
- else {
57
- return recursiveFuzzyIndexOf(text, query, rightStart, end, bestDistance, depth + 1);
58
- }
59
- }
60
- /**
61
- * Iteratively refines the best match by reducing the search area
62
- * @param text The text to search within
63
- * @param query The query string to find
64
- * @param start Start index in the text
65
- * @param end End index in the text
66
- * @param parentDistance Best distance found so far
67
- * @returns Object with start and end indices, matched value, and Levenshtein distance
68
- */
69
- function iterativeReduction(text, query, start, end, parentDistance) {
70
- const startTime = performance.now();
71
- let iterations = 0;
72
- let bestDistance = parentDistance;
73
- let bestStart = start;
74
- let bestEnd = end;
75
- // Improve start position
76
- let nextDistance = distance(text.substring(bestStart + 1, bestEnd), query);
77
- while (nextDistance < bestDistance) {
78
- bestDistance = nextDistance;
79
- bestStart++;
80
- const smallerString = text.substring(bestStart + 1, bestEnd);
81
- nextDistance = distance(smallerString, query);
82
- iterations++;
83
- }
84
- // Improve end position
85
- nextDistance = distance(text.substring(bestStart, bestEnd - 1), query);
86
- while (nextDistance < bestDistance) {
87
- bestDistance = nextDistance;
88
- bestEnd--;
89
- const smallerString = text.substring(bestStart, bestEnd - 1);
90
- nextDistance = distance(smallerString, query);
91
- iterations++;
92
- }
93
- const executionTime = performance.now() - startTime;
94
- // Capture metrics for the iterative refinement phase
95
- capture('fuzzy_search_iterative_metrics', {
96
- execution_time_ms: executionTime,
97
- iterations: iterations,
98
- segment_length: end - start,
99
- query_length: query.length,
100
- final_distance: bestDistance
101
- });
102
- return {
103
- start: bestStart,
104
- end: bestEnd,
105
- value: text.substring(bestStart, bestEnd),
106
- distance: bestDistance
107
- };
108
- }
109
- /**
110
- * Calculates the similarity ratio between two strings
111
- * @param a First string
112
- * @param b Second string
113
- * @returns Similarity ratio (0-1)
114
- */
115
- export function getSimilarityRatio(a, b) {
116
- const maxLength = Math.max(a.length, b.length);
117
- if (maxLength === 0)
118
- return 1; // Both strings are empty
119
- const levenshteinDistance = distance(a, b);
120
- return 1 - (levenshteinDistance / maxLength);
121
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- import { ServerResult } from '../../types.js';
10
- /**
11
- * Handle edit_block command with enhanced functionality
12
- * - Supports multiple replacements
13
- * - Validates expected replacements count
14
- * - Provides detailed error messages
15
- */
16
- export declare function handleEnhancedEditBlock(args: unknown): Promise<ServerResult>;
@@ -1,24 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- import { performSearchReplace } from './edit.js';
10
- import { EditBlockArgsSchema } from './schemas.js';
11
- /**
12
- * Handle edit_block command with enhanced functionality
13
- * - Supports multiple replacements
14
- * - Validates expected replacements count
15
- * - Provides detailed error messages
16
- */
17
- export async function handleEnhancedEditBlock(args) {
18
- const parsed = EditBlockArgsSchema.parse(args);
19
- const searchReplace = {
20
- search: parsed.old_string,
21
- replace: parsed.new_string
22
- };
23
- return performSearchReplace(parsed.file_path, searchReplace, parsed.expected_replacements);
24
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- export * from './edit.js';
10
- export * from './fuzzySearch.js';
11
- export * from './handlers.js';
12
- export * from './schemas.js';
@@ -1,13 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- // Export all enhanced edit functionality
10
- export * from './edit.js';
11
- export * from './fuzzySearch.js';
12
- export * from './handlers.js';
13
- export * from './schemas.js';
@@ -1,25 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- import { z } from 'zod';
10
- export declare const EditBlockArgsSchema: z.ZodObject<{
11
- file_path: z.ZodString;
12
- old_string: z.ZodString;
13
- new_string: z.ZodString;
14
- expected_replacements: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
15
- }, "strip", z.ZodTypeAny, {
16
- file_path: string;
17
- old_string: string;
18
- new_string: string;
19
- expected_replacements: number;
20
- }, {
21
- file_path: string;
22
- old_string: string;
23
- new_string: string;
24
- expected_replacements?: number | undefined;
25
- }>;
@@ -1,16 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- import { z } from 'zod';
10
- // Enhanced edit block schema with separate parameters for clarity
11
- export const EditBlockArgsSchema = z.object({
12
- file_path: z.string(),
13
- old_string: z.string(),
14
- new_string: z.string(),
15
- expected_replacements: z.number().optional().default(1),
16
- });
@@ -1,9 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- export * from './edit/index.js';
@@ -1,10 +0,0 @@
1
- /**
2
- * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0
3
- *
4
- * Copyright (c) 2025 Desktope Commander MCP Contributors
5
- *
6
- * This file is licensed under the PolyForm Small Business License 1.0.0
7
- * See the LICENSE file in the /src/polyform directory for the full license text.
8
- */
9
- // Export all PolyForm-licensed functionality
10
- export * from './edit/index.js';
@@ -1,73 +0,0 @@
1
- /**
2
- * Execution result from a REPL command
3
- */
4
- interface REPLExecutionResult {
5
- success: boolean;
6
- output: string | null;
7
- error?: string;
8
- timeout: boolean;
9
- }
10
- /**
11
- * Options for executing code in a REPL
12
- */
13
- interface REPLExecuteOptions {
14
- timeout?: number;
15
- waitForPrompt?: boolean;
16
- ignoreErrors?: boolean;
17
- multiline?: boolean;
18
- }
19
- /**
20
- * Manager for REPL (Read-Eval-Print Loop) sessions
21
- * Provides a higher-level API for working with interactive programming environments
22
- */
23
- export declare class REPLManager {
24
- private sessions;
25
- private readonly languageConfigs;
26
- /**
27
- * Calculate an appropriate timeout based on code complexity
28
- */
29
- private calculateTimeout;
30
- /**
31
- * Detect when a REPL is ready for input by looking for prompt patterns
32
- */
33
- private isReadyForInput;
34
- /**
35
- * Detect errors in REPL output
36
- */
37
- private detectErrors;
38
- /**
39
- * Create a new REPL session for the specified language
40
- */
41
- createSession(language: string, timeout?: number): Promise<number>;
42
- /**
43
- * Send and read REPL output with a timeout
44
- * This combines sending input and reading output in a single operation
45
- */
46
- sendAndReadREPL(pid: number, input: string, options?: REPLExecuteOptions): Promise<REPLExecutionResult>;
47
- /**
48
- * Execute a code block in a REPL session
49
- */
50
- executeCode(pid: number, code: string, options?: REPLExecuteOptions): Promise<REPLExecutionResult>;
51
- /**
52
- * Terminate a REPL session
53
- */
54
- terminateSession(pid: number): Promise<boolean>;
55
- /**
56
- * List all active REPL sessions
57
- */
58
- listSessions(): Array<{
59
- pid: number;
60
- language: string;
61
- runtime: number;
62
- }>;
63
- /**
64
- * Get information about a specific REPL session
65
- */
66
- getSessionInfo(pid: number): {
67
- pid: number;
68
- language: string;
69
- runtime: number;
70
- } | null;
71
- }
72
- export declare const replManager: REPLManager;
73
- export {};