@wonderwhy-er/desktop-commander 0.3.5-alpha.0 → 0.3.5-alpha.1
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/remote-device/device.js +4 -13
- package/dist/remote-device/remote-channel.d.ts +5 -0
- package/dist/remote-device/remote-channel.js +21 -4
- package/dist/remote-device/transport-telemetry.d.ts +10 -10
- package/dist/remote-device/transport-telemetry.js +10 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +36 -33
|
@@ -659,8 +659,6 @@ export class MCPDevice {
|
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
661
|
const observation = { callId: call_id, deviceId: this.deviceId, userId: this.remoteChannel.user?.id, toolName: tool_name };
|
|
662
|
-
// Count every targeted delivery, including duplicates, before the local claim.
|
|
663
|
-
observeTransport({ stage: 'device_call_received', ...observation });
|
|
664
662
|
console.log(`🔧 Received tool call ${call_id}: ${tool_name} ${JSON.stringify(tool_args)} metadata: ${JSON.stringify(metadata)}`);
|
|
665
663
|
// Claim locally first so duplicate deliveries cannot execute a call twice
|
|
666
664
|
// in this process, even if the database claim below fails open.
|
|
@@ -669,8 +667,6 @@ export class MCPDevice {
|
|
|
669
667
|
return;
|
|
670
668
|
}
|
|
671
669
|
this.rememberCallId(call_id);
|
|
672
|
-
// Running the tool and saving its result fail separately: only a tool
|
|
673
|
-
// that didn't run is "tool_call_failed"
|
|
674
670
|
let result;
|
|
675
671
|
try {
|
|
676
672
|
// DB claim second — keeps the row state machine honest, gives
|
|
@@ -713,20 +709,15 @@ export class MCPDevice {
|
|
|
713
709
|
}
|
|
714
710
|
catch (error) {
|
|
715
711
|
console.error(`❌ Tool call ${tool_name} failed:`, error.message);
|
|
716
|
-
observeTransport({ stage: '
|
|
712
|
+
observeTransport({ stage: 'tool_call_completed', outcome: 'failed', ...observation });
|
|
717
713
|
await this.reportToolCallFailure(call_id, tool_name, error, metadata.origin_instance);
|
|
718
714
|
return;
|
|
719
715
|
}
|
|
720
716
|
console.log(`✅ Tool call ${tool_name} completed:\r\n ${JSON.stringify(result)}`);
|
|
721
|
-
|
|
722
|
-
|
|
717
|
+
const outcome = result?.isError === true ? 'failed' : 'success';
|
|
718
|
+
observeTransport({ stage: 'tool_call_completed', outcome, ...observation });
|
|
723
719
|
try {
|
|
724
|
-
|
|
725
|
-
await this.remoteChannel.updateCallResult(call_id, 'completed', result, null, metadata.origin_instance);
|
|
726
|
-
}
|
|
727
|
-
finally {
|
|
728
|
-
observeTransport({ stage: 'tool_call_completed', ...observation });
|
|
729
|
-
}
|
|
720
|
+
await this.remoteChannel.updateCallResult(call_id, 'completed', result, null, metadata.origin_instance);
|
|
730
721
|
}
|
|
731
722
|
catch (error) {
|
|
732
723
|
console.error(`❌ Tool call ${tool_name} failed:`, error.message);
|
|
@@ -20,6 +20,11 @@ export interface AuthSession {
|
|
|
20
20
|
export declare class ChannelUnreachableError extends Error {
|
|
21
21
|
constructor(message: string);
|
|
22
22
|
}
|
|
23
|
+
export type BroadcastDoorbell = {
|
|
24
|
+
call_id: string;
|
|
25
|
+
device_id: string;
|
|
26
|
+
user_id?: string;
|
|
27
|
+
};
|
|
23
28
|
interface DeviceData {
|
|
24
29
|
user_id: string;
|
|
25
30
|
device_name: string;
|
|
@@ -805,8 +805,14 @@ export class RemoteChannel {
|
|
|
805
805
|
if (this.shuttingDown || this.sessionLost || this.handlingSignedOut) {
|
|
806
806
|
return;
|
|
807
807
|
}
|
|
808
|
-
observeTransport({
|
|
809
|
-
|
|
808
|
+
observeTransport({
|
|
809
|
+
stage: 'received_from_backend',
|
|
810
|
+
callId: payload?.call_id,
|
|
811
|
+
payload,
|
|
812
|
+
deviceId: this.deviceId,
|
|
813
|
+
userId: this.user?.id,
|
|
814
|
+
transport: 'broadcast',
|
|
815
|
+
});
|
|
810
816
|
if (this.isMqttExecutionEnabled()) {
|
|
811
817
|
console.debug(`[DEBUG] Broadcast doorbell for call ${payload?.call_id} observed only; MQTT runs calls`);
|
|
812
818
|
return;
|
|
@@ -1476,6 +1482,13 @@ export class RemoteChannel {
|
|
|
1476
1482
|
console.debug(`[DEBUG] Updating call result: ${callId} status=${status}` +
|
|
1477
1483
|
(result !== null ? ` resultBytes=~${JSON.stringify(updateData.result)?.length ?? 0}` : ''));
|
|
1478
1484
|
}
|
|
1485
|
+
// The write triggers Broadcast, and the channel identity can change before it returns.
|
|
1486
|
+
const broadcastObservation = {
|
|
1487
|
+
callId,
|
|
1488
|
+
deviceId: this.deviceId,
|
|
1489
|
+
userId: this.user?.id,
|
|
1490
|
+
timestampUtc: new Date().toISOString(),
|
|
1491
|
+
};
|
|
1479
1492
|
const { error } = await this.client
|
|
1480
1493
|
.from('mcp_remote_calls')
|
|
1481
1494
|
.update(updateData)
|
|
@@ -1493,9 +1506,13 @@ export class RemoteChannel {
|
|
|
1493
1506
|
}
|
|
1494
1507
|
}
|
|
1495
1508
|
else {
|
|
1496
|
-
|
|
1509
|
+
const hasResultDoorbell = originInstance && (status === 'completed' || status === 'failed');
|
|
1510
|
+
const mqttEnabled = rolloutManager.get('MQTT_TRANSPORT_ENABLED');
|
|
1497
1511
|
console.debug('[DEBUG] Call result updated successfully:', callId);
|
|
1498
|
-
if (
|
|
1512
|
+
if (hasResultDoorbell && !mqttEnabled) {
|
|
1513
|
+
observeTransport({ ...broadcastObservation, stage: 'publish_from_device', transport: 'broadcast' });
|
|
1514
|
+
}
|
|
1515
|
+
else if (hasResultDoorbell && mqttEnabled) {
|
|
1499
1516
|
// The write already triggers Broadcast in shadow mode; MQTT must never delay it.
|
|
1500
1517
|
void this.publishMqttResult(callId, originInstance).catch(() => { });
|
|
1501
1518
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
payload: any;
|
|
4
|
-
deviceId: string | null;
|
|
5
|
-
} | {
|
|
1
|
+
import type { BroadcastDoorbell } from './remote-channel.js';
|
|
2
|
+
type TransportObservation = {
|
|
6
3
|
stage: string;
|
|
7
4
|
callId: string;
|
|
5
|
+
payload?: BroadcastDoorbell;
|
|
8
6
|
deviceId: string | null | undefined;
|
|
7
|
+
userId: string | undefined;
|
|
8
|
+
transport?: 'broadcast' | 'mqtt';
|
|
9
|
+
outcome?: 'success' | 'failed';
|
|
10
|
+
timestampUtc?: string;
|
|
9
11
|
toolName?: string;
|
|
10
12
|
operation?: string;
|
|
11
13
|
operationId?: string;
|
|
12
14
|
/** Who claimed the call (call_claimed): MQTT, Broadcast, or the scan for waiting calls. */
|
|
13
15
|
claimedBy?: 'mqtt' | 'broadcast' | 'recovery';
|
|
14
|
-
}) & {
|
|
15
|
-
userId: string | undefined;
|
|
16
|
-
transport?: 'broadcast' | 'mqtt';
|
|
17
16
|
};
|
|
18
17
|
/** Record a device transport checkpoint without affecting command handling. */
|
|
19
18
|
export declare function observeTransport(input: TransportObservation): {
|
|
@@ -21,13 +20,14 @@ export declare function observeTransport(input: TransportObservation): {
|
|
|
21
20
|
source_process_id: `${string}-${string}-${string}-${string}-${string}`;
|
|
22
21
|
schema_version: number;
|
|
23
22
|
timestamp_utc: string;
|
|
24
|
-
claimed_by?: "
|
|
23
|
+
claimed_by?: "broadcast" | "mqtt" | "recovery" | undefined;
|
|
25
24
|
operation_id?: string | undefined;
|
|
26
25
|
operation?: string | undefined;
|
|
27
26
|
tool_name?: string | undefined;
|
|
28
27
|
notification_id?: string | undefined;
|
|
29
28
|
attempt_number?: number | undefined;
|
|
30
|
-
|
|
29
|
+
outcome?: "success" | "failed" | undefined;
|
|
30
|
+
transport?: "broadcast" | "mqtt" | undefined;
|
|
31
31
|
call_id: string;
|
|
32
32
|
device_id: string;
|
|
33
33
|
stage: string;
|
|
@@ -5,38 +5,33 @@ const PROCESS_ID = randomUUID();
|
|
|
5
5
|
/** Record a device transport checkpoint without affecting command handling. */
|
|
6
6
|
export function observeTransport(input) {
|
|
7
7
|
try {
|
|
8
|
-
const timestamp_utc = new Date().toISOString();
|
|
9
|
-
const
|
|
10
|
-
const callId = receipt ? input.payload?.call_id : input.callId;
|
|
11
|
-
const deviceId = input.deviceId;
|
|
12
|
-
const userId = input.userId;
|
|
8
|
+
const timestamp_utc = input.timestampUtc ?? new Date().toISOString();
|
|
9
|
+
const { callId, deviceId, userId, payload } = input;
|
|
13
10
|
if (typeof input.stage !== 'string' || !input.stage)
|
|
14
11
|
return null;
|
|
15
12
|
if (typeof callId !== 'string' || !ID.test(callId) ||
|
|
16
13
|
typeof deviceId !== 'string' || !ID.test(deviceId) ||
|
|
17
14
|
typeof userId !== 'string' || !ID.test(userId))
|
|
18
15
|
return null;
|
|
19
|
-
if (
|
|
20
|
-
(
|
|
16
|
+
if (payload && (payload.call_id !== callId || payload.device_id !== deviceId ||
|
|
17
|
+
(payload.user_id !== undefined && payload.user_id !== userId)))
|
|
21
18
|
return null;
|
|
22
19
|
const observationId = randomUUID();
|
|
23
|
-
|
|
24
|
-
if (!receipt) {
|
|
25
|
-
operationId = input.stage === 'operation_start' ? observationId : input.operationId;
|
|
26
|
-
}
|
|
20
|
+
const operationId = input.stage === 'operation_start' ? observationId : input.operationId;
|
|
27
21
|
const event = {
|
|
28
22
|
call_id: callId,
|
|
29
23
|
device_id: deviceId,
|
|
30
24
|
stage: input.stage,
|
|
31
25
|
...(input.transport === 'broadcast' || input.transport === 'mqtt' ? { transport: input.transport } : {}),
|
|
32
|
-
...(input.
|
|
26
|
+
...(input.outcome === 'success' || input.outcome === 'failed' ? { outcome: input.outcome } : {}),
|
|
27
|
+
...(input.stage === 'received_from_backend' && input.transport === 'broadcast' ? {
|
|
33
28
|
notification_id: `${callId}:broadcast:1`, attempt_number: 1,
|
|
34
29
|
} : {}),
|
|
35
|
-
...(
|
|
30
|
+
...(typeof input.toolName === 'string' && input.toolName.length > 0 &&
|
|
36
31
|
input.toolName.length <= 128 ? { tool_name: input.toolName } : {}),
|
|
37
|
-
...(
|
|
32
|
+
...(typeof input.operation === 'string' && input.operation ? { operation: input.operation } : {}),
|
|
38
33
|
...(typeof operationId === 'string' && operationId ? { operation_id: operationId } : {}),
|
|
39
|
-
...(
|
|
34
|
+
...(input.claimedBy ? { claimed_by: input.claimedBy } : {}),
|
|
40
35
|
observation_id: observationId,
|
|
41
36
|
source_process_id: PROCESS_ID,
|
|
42
37
|
schema_version: 1,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.3.5-alpha.
|
|
1
|
+
export declare const VERSION = "0.3.5-alpha.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.3.5-alpha.
|
|
1
|
+
export const VERSION = '0.3.5-alpha.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderwhy-er/desktop-commander",
|
|
3
|
-
"version": "0.3.5-alpha.
|
|
3
|
+
"version": "0.3.5-alpha.1",
|
|
4
4
|
"description": "MCP server for terminal operations and file editing",
|
|
5
5
|
"mcpName": "io.github.wonderwhy-er/desktop-commander",
|
|
6
6
|
"license": "MIT",
|
|
@@ -95,65 +95,65 @@
|
|
|
95
95
|
"file-operations"
|
|
96
96
|
],
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@modelcontextprotocol/sdk": "^1.32.
|
|
99
|
-
"@opendocsg/pdf2md": "0.3.
|
|
98
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
99
|
+
"@opendocsg/pdf2md": "0.3.6",
|
|
100
100
|
"@supabase/supabase-js": "^2.89.0",
|
|
101
|
-
"@tiptap/core": "^3.
|
|
102
|
-
"@tiptap/extension-image": "^3.
|
|
103
|
-
"@tiptap/extension-table": "^3.
|
|
104
|
-
"@tiptap/extension-table-cell": "^3.
|
|
105
|
-
"@tiptap/extension-table-header": "^3.
|
|
106
|
-
"@tiptap/extension-table-row": "^3.
|
|
107
|
-
"@tiptap/pm": "^3.
|
|
108
|
-
"@tiptap/starter-kit": "^3.
|
|
109
|
-
"@vscode/ripgrep": "^1.
|
|
101
|
+
"@tiptap/core": "^3.35.0",
|
|
102
|
+
"@tiptap/extension-image": "^3.35.0",
|
|
103
|
+
"@tiptap/extension-table": "^3.35.0",
|
|
104
|
+
"@tiptap/extension-table-cell": "^3.35.0",
|
|
105
|
+
"@tiptap/extension-table-header": "^3.35.0",
|
|
106
|
+
"@tiptap/extension-table-row": "^3.35.0",
|
|
107
|
+
"@tiptap/pm": "^3.35.0",
|
|
108
|
+
"@tiptap/starter-kit": "^3.35.0",
|
|
109
|
+
"@vscode/ripgrep": "^1.18.0",
|
|
110
110
|
"cross-fetch": "^4.1.0",
|
|
111
111
|
"exceljs": "^4.4.0",
|
|
112
112
|
"fastest-levenshtein": "^1.0.16",
|
|
113
|
-
"glob": "^
|
|
114
|
-
"highlight.js": "^11.
|
|
113
|
+
"glob": "^14.0.6",
|
|
114
|
+
"highlight.js": "^11.12.0",
|
|
115
115
|
"isbinaryfile": "^5.0.4",
|
|
116
|
-
"markdown-it": "^14.
|
|
116
|
+
"markdown-it": "^14.3.3",
|
|
117
117
|
"md-to-pdf": "^5.2.5",
|
|
118
|
-
"mqtt": "5.16.
|
|
119
|
-
"node-forge": "1.4.
|
|
120
|
-
"open": "^
|
|
118
|
+
"mqtt": "5.16.1",
|
|
119
|
+
"node-forge": "1.4.4",
|
|
120
|
+
"open": "^11.0.4",
|
|
121
121
|
"pdf-lib": "^1.17.1",
|
|
122
|
-
"pizzip": "^3.
|
|
122
|
+
"pizzip": "^3.3.0",
|
|
123
123
|
"proper-lockfile": "^4.1.2",
|
|
124
124
|
"remark": "^15.0.1",
|
|
125
125
|
"remark-gfm": "^4.0.1",
|
|
126
126
|
"remark-parse": "^11.0.0",
|
|
127
127
|
"sharp": "^0.35.5",
|
|
128
128
|
"tiptap-markdown": "^0.9.0",
|
|
129
|
-
"unbash": "6.0.
|
|
129
|
+
"unbash": "6.0.5",
|
|
130
130
|
"unified": "^11.0.5",
|
|
131
|
-
"unpdf": "~1.
|
|
131
|
+
"unpdf": "~1.9.1",
|
|
132
132
|
"zod": "^3.24.1",
|
|
133
|
-
"zod-to-json-schema": "^3.
|
|
133
|
+
"zod-to-json-schema": "^3.25.2"
|
|
134
134
|
},
|
|
135
135
|
"optionalDependencies": {
|
|
136
136
|
"caffeinate": "^1.0.1"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
|
-
"@anthropic-ai/mcpb": "^1.2
|
|
140
|
-
"@modelcontextprotocol/ext-apps": "^1.
|
|
141
|
-
"@types/node": "^20.
|
|
139
|
+
"@anthropic-ai/mcpb": "^2.1.2",
|
|
140
|
+
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
141
|
+
"@types/node": "^20.19.43",
|
|
142
142
|
"@types/node-forge": "1.3.14",
|
|
143
143
|
"@types/proper-lockfile": "^4.1.4",
|
|
144
144
|
"aedes": "0.51.3",
|
|
145
145
|
"c8": "^12.0.0",
|
|
146
146
|
"commander": "^13.1.0",
|
|
147
|
-
"esbuild": "^0.
|
|
147
|
+
"esbuild": "^0.28.2",
|
|
148
148
|
"js-tiktoken": "^1.0.21",
|
|
149
|
-
"jsdom": "^
|
|
149
|
+
"jsdom": "^26.1.0",
|
|
150
150
|
"nexe": "^5.0.0-beta.4",
|
|
151
|
-
"nodemon": "^3.
|
|
152
|
-
"shx": "^0.
|
|
151
|
+
"nodemon": "^3.1.14",
|
|
152
|
+
"shx": "^0.4.0",
|
|
153
153
|
"ts-node": "^10.9.2",
|
|
154
|
-
"tsx": "^4.
|
|
155
|
-
"typescript": "^
|
|
156
|
-
"ws": "^8.
|
|
154
|
+
"tsx": "^4.23.15",
|
|
155
|
+
"typescript": "^6.0.3",
|
|
156
|
+
"ws": "^8.23.0"
|
|
157
157
|
},
|
|
158
158
|
"overrides": {
|
|
159
159
|
"md-to-pdf": {
|
|
@@ -163,6 +163,9 @@
|
|
|
163
163
|
"uuid": "^11.1.1"
|
|
164
164
|
},
|
|
165
165
|
"proxy-addr": "^2.0.8",
|
|
166
|
-
"argparse": "^2.0.1"
|
|
166
|
+
"argparse": "^2.0.1",
|
|
167
|
+
"nodemon": {
|
|
168
|
+
"minimatch": "11.0.9"
|
|
169
|
+
}
|
|
167
170
|
}
|
|
168
171
|
}
|