@wonderwhy-er/desktop-commander 0.2.51 → 0.3.1-alpha.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.
- package/README.md +14 -24
- package/dist/command-manager.d.ts +7 -2
- package/dist/command-manager.js +16 -11
- package/dist/config-manager.d.ts +49 -3
- package/dist/config-manager.js +329 -87
- package/dist/config-recovery.d.ts +28 -0
- package/dist/config-recovery.js +81 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +9 -0
- package/dist/handlers/filesystem-handlers.d.ts +1 -1
- package/dist/handlers/filesystem-handlers.js +26 -16
- package/dist/handlers/search-answers.d.ts +58 -0
- package/dist/handlers/search-answers.js +172 -0
- package/dist/handlers/search-handlers.js +4 -92
- package/dist/index.js +14 -7
- package/dist/npm-scripts/remote.js +32 -4
- package/dist/remote-device/broadcast-analytics.d.ts +28 -0
- package/dist/remote-device/broadcast-analytics.js +41 -0
- package/dist/remote-device/desktop-commander-integration.d.ts +20 -0
- package/dist/remote-device/desktop-commander-integration.js +121 -40
- package/dist/remote-device/device-authenticator.d.ts +13 -1
- package/dist/remote-device/device-authenticator.js +87 -47
- package/dist/remote-device/device.d.ts +14 -0
- package/dist/remote-device/device.js +244 -51
- package/dist/remote-device/mqtt-enrollment.d.ts +16 -0
- package/dist/remote-device/mqtt-enrollment.js +162 -0
- package/dist/remote-device/mqtt-transport.d.ts +44 -0
- package/dist/remote-device/mqtt-transport.js +197 -0
- package/dist/remote-device/remote-channel.d.ts +64 -3
- package/dist/remote-device/remote-channel.js +317 -48
- package/dist/remote-device/scripts/blocking-offline-update.js +106 -69
- package/dist/remote-device/transport-analytics.d.ts +29 -0
- package/dist/remote-device/transport-analytics.js +44 -0
- package/dist/remote-device/transport-telemetry.d.ts +32 -0
- package/dist/remote-device/transport-telemetry.js +48 -0
- package/dist/search-manager.d.ts +239 -27
- package/dist/search-manager.js +746 -312
- package/dist/server.js +77 -92
- package/dist/terminal-manager.d.ts +138 -21
- package/dist/terminal-manager.js +300 -215
- package/dist/tools/config.d.ts +1 -1
- package/dist/tools/config.js +21 -70
- package/dist/tools/edit.js +12 -4
- package/dist/tools/filesystem.d.ts +30 -6
- package/dist/tools/filesystem.js +246 -140
- package/dist/tools/improved-process-tools.d.ts +9 -3
- package/dist/tools/improved-process-tools.js +171 -68
- package/dist/tools/pdf/extract-images.d.ts +2 -0
- package/dist/tools/pdf/extract-images.js +4 -1
- package/dist/tools/pdf/index.d.ts +5 -3
- package/dist/tools/pdf/index.js +4 -3
- package/dist/tools/pdf/lib/pdf2md.d.ts +8 -1
- package/dist/tools/pdf/lib/pdf2md.js +12 -5
- package/dist/tools/pdf/manipulations.d.ts +12 -1
- package/dist/tools/pdf/manipulations.js +17 -4
- package/dist/tools/pdf/markdown.d.ts +96 -0
- package/dist/tools/pdf/markdown.js +485 -20
- package/dist/tools/pdf/utils.d.ts +2 -2
- package/dist/tools/pdf/utils.js +4 -4
- package/dist/tools/process.js +8 -5
- package/dist/tools/schemas.d.ts +1 -1
- package/dist/tools/schemas.js +15 -6
- package/dist/tools/search.d.ts +32 -0
- package/dist/tools/search.js +202 -0
- package/dist/types.d.ts +1 -1
- package/dist/ui/config-editor/config-editor-runtime.js +6 -6
- package/dist/ui/config-editor/src/app.js +2 -15
- package/dist/utils/ab-test.js +27 -9
- package/dist/utils/atomic-write.d.ts +14 -0
- package/dist/utils/atomic-write.js +80 -0
- package/dist/utils/capture.d.ts +17 -1
- package/dist/utils/capture.js +177 -68
- package/dist/utils/exit-process.d.ts +24 -0
- package/dist/utils/exit-process.js +31 -0
- package/dist/utils/feature-flags.js +2 -1
- package/dist/utils/files/base.d.ts +3 -1
- package/dist/utils/files/docx.d.ts +3 -0
- package/dist/utils/files/docx.js +24 -9
- package/dist/utils/files/excel.d.ts +10 -0
- package/dist/utils/files/excel.js +93 -33
- package/dist/utils/files/factory.d.ts +22 -1
- package/dist/utils/files/factory.js +59 -4
- package/dist/utils/files/image.d.ts +12 -4
- package/dist/utils/files/image.js +19 -8
- package/dist/utils/files/index.d.ts +5 -3
- package/dist/utils/files/index.js +4 -3
- package/dist/utils/files/pdf.js +18 -36
- package/dist/utils/files/text.d.ts +21 -5
- package/dist/utils/files/text.js +90 -86
- package/dist/utils/internal-facts.d.ts +3 -0
- package/dist/utils/internal-facts.js +23 -0
- package/dist/utils/lazy-package.d.ts +23 -0
- package/dist/utils/lazy-package.js +42 -0
- package/dist/utils/open-browser.js +2 -1
- package/dist/utils/process-detection.d.ts +24 -5
- package/dist/utils/process-detection.js +199 -89
- package/dist/utils/process-tree.d.ts +14 -0
- package/dist/utils/process-tree.js +223 -0
- package/dist/utils/rename.d.ts +9 -0
- package/dist/utils/rename.js +74 -0
- package/dist/utils/ripgrep-resolver.js +9 -14
- package/dist/utils/shell.d.ts +42 -0
- package/dist/utils/shell.js +187 -0
- package/dist/utils/system-info.js +9 -7
- package/dist/utils/trackTools.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/node_modules/@desktop-commander/telemetry-contract/README.md +56 -0
- package/node_modules/@desktop-commander/telemetry-contract/package.json +32 -0
- package/node_modules/@desktop-commander/telemetry-contract/transport.d.ts +38 -0
- package/node_modules/@desktop-commander/telemetry-contract/transport.js +164 -0
- package/package.json +8 -2
- package/vendor/telemetry-contract/README.md +56 -0
- package/vendor/telemetry-contract/package.json +32 -0
- package/vendor/telemetry-contract/transport.d.ts +38 -0
- package/vendor/telemetry-contract/transport.js +164 -0
- package/vendor/telemetry-contract/transport.test.js +39 -0
package/README.md
CHANGED
|
@@ -17,19 +17,6 @@ Work with code and text, run processes, and automate tasks, going far beyond oth
|
|
|
17
17
|
<img width="380" height="200" src="https://glama.ai/mcp/servers/zempur9oh4/badge" alt="Desktop Commander MCP" />
|
|
18
18
|
</a>
|
|
19
19
|
|
|
20
|
-
## 🖥️ Try the Desktop Commander App (Beta)
|
|
21
|
-
|
|
22
|
-
**Want a better experience?** The Desktop Commander App gives you everything the MCP server does, plus:
|
|
23
|
-
|
|
24
|
-
- **Use any AI model** — Claude, GPT-4.5, Gemini 2.5, or any model you prefer
|
|
25
|
-
- **See file changes live** — visual file previews as AI edits your files
|
|
26
|
-
- **Add custom MCPs and context** — extend with your own tools, no config files
|
|
27
|
-
- **Coming soon** — skills system, dictation, background scheduled tasks, and more
|
|
28
|
-
|
|
29
|
-
**👉 [Download the App](https://desktopcommander.app/#download)** (macOS & Windows)
|
|
30
|
-
|
|
31
|
-
> The MCP server below still works great with Claude Desktop and other MCP clients — the app is for those who want a dedicated, polished experience.
|
|
32
|
-
|
|
33
20
|
## Table of Contents
|
|
34
21
|
- [Features](#features)
|
|
35
22
|
- [How to install](#how-to-install)
|
|
@@ -470,21 +457,24 @@ Or add to `.qwen/settings.json` (project) or `~/.qwen/settings.json` (global). S
|
|
|
470
457
|
<details>
|
|
471
458
|
<summary><b>ChatGPT / Claude Web (Remote MCP)</b></summary>
|
|
472
459
|
|
|
473
|
-
Use Desktop Commander from **ChatGPT**, **Claude web**, and other AI services
|
|
460
|
+
Use Desktop Commander from **ChatGPT**, **Claude web**, and other AI services while commands still execute on your computer.
|
|
461
|
+
|
|
462
|
+
Start the Remote Device:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
npx @wonderwhy-er/desktop-commander@latest remote
|
|
466
|
+
```
|
|
474
467
|
|
|
475
|
-
|
|
468
|
+
On first run, complete browser authentication, then connect your AI at **[mcp.desktopcommander.app](https://mcp.desktopcommander.app)**.
|
|
476
469
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
3. Your AI sends commands through the cloud to your device
|
|
481
|
-
4. Commands execute locally, results return to your AI
|
|
482
|
-
5. **You stay in control** — stop anytime with `Ctrl+C`
|
|
470
|
+
- Stop the local device temporarily with `Ctrl+C`
|
|
471
|
+
- See available CLI options with `npx @wonderwhy-er/desktop-commander@latest remote --help`
|
|
472
|
+
- See **[Remote MCP setup, logout/revocation, CLI reference, and troubleshooting](src/remote-device/README.md)**
|
|
483
473
|
|
|
484
474
|
### Security
|
|
485
475
|
|
|
486
|
-
- ✅ Device only
|
|
487
|
-
- ✅ Commands execute under your user permissions
|
|
476
|
+
- ✅ The Remote Device only accepts commands while it is running
|
|
477
|
+
- ✅ Commands execute locally under your user permissions
|
|
488
478
|
- ✅ Secure OAuth authentication and encrypted communication channel
|
|
489
479
|
|
|
490
480
|
</details>
|
|
@@ -823,7 +813,7 @@ Locations:
|
|
|
823
813
|
|
|
824
814
|
### Remote calls and server-side retention
|
|
825
815
|
|
|
826
|
-
Calls executed through Remote Desktop Commander are still handled by the local MCP server and use the same local history files above. The Remote Desktop Commander service
|
|
816
|
+
Calls executed through Remote Desktop Commander are still handled by the local MCP server and use the same local history files above. The Remote Desktop Commander service temporarily stores tool arguments and results in `mcp_remote_calls` so calls can be routed and completed. Terminal rows are automatically swept shortly after completion (eligible for deletion after one minute, with a one-hour creation-time backstop), so they are not kept as a long-term historical server-side audit trail.
|
|
827
817
|
|
|
828
818
|
These local history files are also separate from Desktop Commander's optional telemetry. The files themselves are not uploaded as telemetry. See [Data Collection & Privacy](#data-collection--privacy) and [PRIVACY.md](PRIVACY.md) for telemetry details.
|
|
829
819
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
declare class CommandManager {
|
|
2
2
|
getBaseCommand(command: string): string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The command name of each command in a command line (chained, piped, in $(), ...).
|
|
5
|
+
* asTyped: each first word as typed instead of its base name, for telemetry,
|
|
6
|
+
* which then replaces a path whole (a base name alone can't be told from one).
|
|
7
|
+
*/
|
|
8
|
+
extractCommands(commandString: string, asTyped?: boolean): string[];
|
|
9
|
+
extractBaseCommand(commandStr: string, asTyped?: boolean): string | null;
|
|
5
10
|
validateCommand(command: string): Promise<boolean>;
|
|
6
11
|
}
|
|
7
12
|
export declare const commandManager: CommandManager;
|
package/dist/command-manager.js
CHANGED
|
@@ -5,7 +5,12 @@ class CommandManager {
|
|
|
5
5
|
getBaseCommand(command) {
|
|
6
6
|
return command.split(' ')[0].toLowerCase().trim();
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The command name of each command in a command line (chained, piped, in $(), ...).
|
|
10
|
+
* asTyped: each first word as typed instead of its base name, for telemetry,
|
|
11
|
+
* which then replaces a path whole (a base name alone can't be told from one).
|
|
12
|
+
*/
|
|
13
|
+
extractCommands(commandString, asTyped = false) {
|
|
9
14
|
try {
|
|
10
15
|
// Trim any leading/trailing whitespace
|
|
11
16
|
commandString = commandString.trim();
|
|
@@ -59,7 +64,7 @@ class CommandManager {
|
|
|
59
64
|
}
|
|
60
65
|
if (j <= commandString.length && openParens === 0) {
|
|
61
66
|
const subContent = commandString.substring(i + 2, j - 1);
|
|
62
|
-
const subCommands = this.extractCommands(subContent);
|
|
67
|
+
const subCommands = this.extractCommands(subContent, asTyped);
|
|
63
68
|
commands.push(...subCommands);
|
|
64
69
|
i = j - 1;
|
|
65
70
|
if (!inQuote) {
|
|
@@ -80,7 +85,7 @@ class CommandManager {
|
|
|
80
85
|
}
|
|
81
86
|
if (j < commandString.length) {
|
|
82
87
|
const subContent = commandString.substring(i + 1, j);
|
|
83
|
-
const subCommands = this.extractCommands(subContent);
|
|
88
|
+
const subCommands = this.extractCommands(subContent, asTyped);
|
|
84
89
|
commands.push(...subCommands);
|
|
85
90
|
i = j;
|
|
86
91
|
if (!inQuote) {
|
|
@@ -113,7 +118,7 @@ class CommandManager {
|
|
|
113
118
|
if (j <= commandString.length && openParens === 0) {
|
|
114
119
|
const subshellContent = commandString.substring(i + 1, j - 1);
|
|
115
120
|
// Recursively extract commands from the subshell
|
|
116
|
-
const subCommands = this.extractCommands(subshellContent);
|
|
121
|
+
const subCommands = this.extractCommands(subshellContent, asTyped);
|
|
117
122
|
commands.push(...subCommands);
|
|
118
123
|
// Move position past the subshell
|
|
119
124
|
i = j - 1;
|
|
@@ -126,7 +131,7 @@ class CommandManager {
|
|
|
126
131
|
if (commandString.startsWith(separator, i)) {
|
|
127
132
|
// We found a separator - extract the command before it
|
|
128
133
|
if (currentCmd.trim()) {
|
|
129
|
-
const baseCommand = this.extractBaseCommand(currentCmd.trim());
|
|
134
|
+
const baseCommand = this.extractBaseCommand(currentCmd.trim(), asTyped);
|
|
130
135
|
if (baseCommand)
|
|
131
136
|
commands.push(baseCommand);
|
|
132
137
|
}
|
|
@@ -143,7 +148,7 @@ class CommandManager {
|
|
|
143
148
|
}
|
|
144
149
|
// Don't forget to add the last command
|
|
145
150
|
if (currentCmd.trim()) {
|
|
146
|
-
const baseCommand = this.extractBaseCommand(currentCmd.trim());
|
|
151
|
+
const baseCommand = this.extractBaseCommand(currentCmd.trim(), asTyped);
|
|
147
152
|
if (baseCommand)
|
|
148
153
|
commands.push(baseCommand);
|
|
149
154
|
}
|
|
@@ -155,12 +160,12 @@ class CommandManager {
|
|
|
155
160
|
capture('server_request_error', {
|
|
156
161
|
error: 'Error extracting commands'
|
|
157
162
|
});
|
|
158
|
-
const baseCmd = this.extractBaseCommand(commandString);
|
|
163
|
+
const baseCmd = this.extractBaseCommand(commandString, asTyped);
|
|
159
164
|
return baseCmd ? [baseCmd] : [];
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
|
-
// This extracts the actual command name from a command string
|
|
163
|
-
extractBaseCommand(commandStr) {
|
|
167
|
+
// This extracts the actual command name from a command string (asTyped: see extractCommands)
|
|
168
|
+
extractBaseCommand(commandStr, asTyped = false) {
|
|
164
169
|
try {
|
|
165
170
|
// Remove environment variables (patterns like KEY=value)
|
|
166
171
|
const withoutEnvVars = commandStr.replace(/\w+=\S+\s*/g, '').trim();
|
|
@@ -193,12 +198,12 @@ class CommandManager {
|
|
|
193
198
|
const inner = firstToken.slice(2, -1).trim();
|
|
194
199
|
if (inner) {
|
|
195
200
|
const innerTokens = inner.split(/\s+/);
|
|
196
|
-
return path.basename(innerTokens[0]).toLowerCase();
|
|
201
|
+
return (asTyped ? innerTokens[0] : path.basename(innerTokens[0])).toLowerCase();
|
|
197
202
|
}
|
|
198
203
|
return null;
|
|
199
204
|
}
|
|
200
205
|
// strip path prefix so /usr/bin/sudo gets caught as "sudo"
|
|
201
|
-
const baseName = path.basename(firstToken);
|
|
206
|
+
const baseName = asTyped ? firstToken : path.basename(firstToken);
|
|
202
207
|
return baseName.toLowerCase();
|
|
203
208
|
}
|
|
204
209
|
catch (error) {
|
package/dist/config-manager.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ declare class ConfigManager {
|
|
|
28
28
|
private pendingMutations;
|
|
29
29
|
private watcher;
|
|
30
30
|
private reloadTimer;
|
|
31
|
+
private failedSaves;
|
|
32
|
+
private saveRetry;
|
|
33
|
+
private heldRecoveryEvents;
|
|
31
34
|
constructor();
|
|
32
35
|
/**
|
|
33
36
|
* Initialize configuration - load from disk or create default.
|
|
@@ -35,6 +38,18 @@ declare class ConfigManager {
|
|
|
35
38
|
* normal writes so two processes starting together cannot clobber each other.
|
|
36
39
|
*/
|
|
37
40
|
init(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Reads config.json at start. A missing one is created (a first run), a corrupt
|
|
43
|
+
* one is recovered, and one written before the welcome page existed is marked
|
|
44
|
+
* as an existing install. If it can't be read, recovered or saved, the session
|
|
45
|
+
* starts without saving it.
|
|
46
|
+
*/
|
|
47
|
+
private loadStartupConfig;
|
|
48
|
+
/**
|
|
49
|
+
* Starts the session on `config` and leaves config.json as it is. `warning`
|
|
50
|
+
* tells the user why; saves are tried again every HELD_SAVE_RETRY_MS.
|
|
51
|
+
*/
|
|
52
|
+
private startWithoutSaving;
|
|
38
53
|
/**
|
|
39
54
|
* Alias for init() to maintain backward compatibility
|
|
40
55
|
*/
|
|
@@ -44,12 +59,33 @@ declare class ConfigManager {
|
|
|
44
59
|
*/
|
|
45
60
|
private getDefaultConfig;
|
|
46
61
|
private readConfigFromDisk;
|
|
62
|
+
/**
|
|
63
|
+
* Recovers a corrupt config.json; the caller holds the config lock. It is backed
|
|
64
|
+
* up once, then rewritten as buildRecoveredConfig(). Returns the config now on disk.
|
|
65
|
+
*/
|
|
66
|
+
private recoverCorruptConfig;
|
|
67
|
+
/** Sends a recovery event. Telemetry reads the config, so events from before init() is done wait for it. */
|
|
68
|
+
private reportRecovery;
|
|
69
|
+
private emitCorruptConfigTelemetry;
|
|
47
70
|
private writeConfigAtomically;
|
|
71
|
+
/** config.json's text, or null when there is none */
|
|
72
|
+
private readConfigText;
|
|
48
73
|
private acquireConfigLock;
|
|
74
|
+
/** Runs `fn` holding the config lock; `lockLost()` tells whether the lock was lost meanwhile. */
|
|
75
|
+
private withConfigLock;
|
|
76
|
+
/**
|
|
77
|
+
* Read config.json, apply `mutate`, write it back, all under the cross-process
|
|
78
|
+
* lock. If the lock was lost, or config.json changed, before the write
|
|
79
|
+
* committed, nothing was written: it runs again under a new lock, so the
|
|
80
|
+
* change lands on what the other process saved.
|
|
81
|
+
*/
|
|
49
82
|
private performConfigMutation;
|
|
83
|
+
private mutateLockedConfig;
|
|
50
84
|
private queueMutation;
|
|
51
85
|
/** Non-blocking, coalesced persistence for high-frequency state updates. */
|
|
52
86
|
scheduleSave(): void;
|
|
87
|
+
/** Saves the queued changes in `ms`; until then scheduleSave() waits for it */
|
|
88
|
+
private retrySaves;
|
|
53
89
|
private startConfigWatcher;
|
|
54
90
|
private reloadConfigFromDisk;
|
|
55
91
|
/**
|
|
@@ -60,9 +96,19 @@ declare class ConfigManager {
|
|
|
60
96
|
* Get a specific configuration value
|
|
61
97
|
*/
|
|
62
98
|
getValue(key: string): Promise<any>;
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Set a specific configuration value and wait until it is saved: the data is
|
|
101
|
+
* flushed to disk before the rename; the folder flush after it is best effort.
|
|
102
|
+
* With holdIfNotSaved, a value whose save fails is still in effect, and is
|
|
103
|
+
* queued to be saved with later writes (the call still rejects).
|
|
104
|
+
*/
|
|
105
|
+
setValue(key: string, value: any, options?: {
|
|
106
|
+
holdIfNotSaved?: boolean;
|
|
107
|
+
}): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Update one value under the cross-process lock and return it once saved: the
|
|
110
|
+
* data is flushed to disk before the rename; the folder flush after it is best effort.
|
|
111
|
+
*/
|
|
66
112
|
updateValue(key: string, updater: (current: any) => any): Promise<any>;
|
|
67
113
|
/**
|
|
68
114
|
* Set a value without waiting on disk. The queued operation is applied to the
|