@wonderwhy-er/desktop-commander 0.2.1 ā 0.2.3
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 +69 -9
- package/dist/command-manager.js.map +1 -0
- package/dist/config-manager.js.map +1 -0
- package/dist/config.js.map +1 -0
- package/dist/custom-stdio.js.map +1 -0
- package/dist/error-handlers.js.map +1 -0
- package/dist/handlers/edit-search-handlers.js.map +1 -0
- package/dist/handlers/filesystem-handlers.js +2 -4
- package/dist/handlers/filesystem-handlers.js.map +1 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/process-handlers.js.map +1 -0
- package/dist/handlers/terminal-handlers.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/server.js +41 -25
- package/dist/server.js.map +1 -0
- package/dist/setup-claude-server.js +44 -36
- package/dist/terminal-manager.d.ts +7 -1
- package/dist/terminal-manager.js +9 -1
- package/dist/terminal-manager.js.map +1 -0
- package/dist/tools/config.js.map +1 -0
- package/dist/tools/edit.js +17 -12
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/execute.js +65 -4
- package/dist/tools/execute.js.map +1 -0
- package/dist/tools/filesystem.d.ts +10 -0
- package/dist/tools/filesystem.js +290 -41
- package/dist/tools/filesystem.js.map +1 -0
- package/dist/tools/fuzzySearch.js.map +1 -0
- package/dist/tools/improved-process-tools.d.ts +24 -0
- package/dist/tools/improved-process-tools.js +312 -0
- package/dist/tools/mime-types.js.map +1 -0
- package/dist/tools/process.js.map +1 -0
- package/dist/tools/schemas.d.ts +6 -3
- package/dist/tools/schemas.js +2 -2
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/capture.d.ts +2 -0
- package/dist/utils/capture.js +17 -8
- package/dist/utils/capture.js.map +1 -0
- package/dist/utils/fuzzySearchLogger.js.map +1 -0
- package/dist/utils/lineEndingHandler.js.map +1 -0
- package/dist/utils/process-detection.d.ts +23 -0
- package/dist/utils/process-detection.js +150 -0
- package/dist/utils/system-info.d.ts +30 -0
- package/dist/utils/system-info.js +146 -0
- package/dist/utils/trackTools.js.map +1 -0
- package/dist/utils/withTimeout.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { terminalManager } from '../terminal-manager.js';
|
|
2
|
+
import { commandManager } from '../command-manager.js';
|
|
3
|
+
import { StartProcessArgsSchema, ReadProcessOutputArgsSchema, InteractWithProcessArgsSchema, ForceTerminateArgsSchema } from './schemas.js';
|
|
4
|
+
import { capture } from "../utils/capture.js";
|
|
5
|
+
import { analyzeProcessState, cleanProcessOutput, formatProcessStateMessage } from '../utils/process-detection.js';
|
|
6
|
+
import { getSystemInfo } from '../utils/system-info.js';
|
|
7
|
+
/**
|
|
8
|
+
* Start a new process (renamed from execute_command)
|
|
9
|
+
* Includes early detection of process waiting for input
|
|
10
|
+
*/
|
|
11
|
+
export async function startProcess(args) {
|
|
12
|
+
const parsed = StartProcessArgsSchema.safeParse(args);
|
|
13
|
+
if (!parsed.success) {
|
|
14
|
+
capture('server_start_process_failed');
|
|
15
|
+
return {
|
|
16
|
+
content: [{ type: "text", text: `Error: Invalid arguments for start_process: ${parsed.error}` }],
|
|
17
|
+
isError: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const commands = commandManager.extractCommands(parsed.data.command).join(', ');
|
|
22
|
+
capture('server_start_process', {
|
|
23
|
+
command: commandManager.getBaseCommand(parsed.data.command),
|
|
24
|
+
commands: commands
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
capture('server_start_process', {
|
|
29
|
+
command: commandManager.getBaseCommand(parsed.data.command)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const isAllowed = await commandManager.validateCommand(parsed.data.command);
|
|
33
|
+
if (!isAllowed) {
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: "text", text: `Error: Command not allowed: ${parsed.data.command}` }],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const result = await terminalManager.executeCommand(parsed.data.command, parsed.data.timeout_ms, parsed.data.shell);
|
|
40
|
+
if (result.pid === -1) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: "text", text: result.output }],
|
|
43
|
+
isError: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// Analyze the process state to detect if it's waiting for input
|
|
47
|
+
const processState = analyzeProcessState(result.output, result.pid);
|
|
48
|
+
// Get system info for shell information
|
|
49
|
+
const systemInfo = getSystemInfo();
|
|
50
|
+
const shellUsed = parsed.data.shell || systemInfo.defaultShell;
|
|
51
|
+
let statusMessage = '';
|
|
52
|
+
if (processState.isWaitingForInput) {
|
|
53
|
+
statusMessage = `\nš ${formatProcessStateMessage(processState, result.pid)}`;
|
|
54
|
+
}
|
|
55
|
+
else if (processState.isFinished) {
|
|
56
|
+
statusMessage = `\nā
${formatProcessStateMessage(processState, result.pid)}`;
|
|
57
|
+
}
|
|
58
|
+
else if (result.isBlocked) {
|
|
59
|
+
statusMessage = '\nā³ Process is running. Use read_process_output to get more output.';
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
content: [{
|
|
63
|
+
type: "text",
|
|
64
|
+
text: `Process started with PID ${result.pid} (shell: ${shellUsed})\nInitial output:\n${result.output}${statusMessage}`
|
|
65
|
+
}],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Read output from a running process (renamed from read_output)
|
|
70
|
+
* Includes early detection of process waiting for input
|
|
71
|
+
*/
|
|
72
|
+
export async function readProcessOutput(args) {
|
|
73
|
+
const parsed = ReadProcessOutputArgsSchema.safeParse(args);
|
|
74
|
+
if (!parsed.success) {
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: `Error: Invalid arguments for read_process_output: ${parsed.error}` }],
|
|
77
|
+
isError: true,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const { pid, timeout_ms = 5000 } = parsed.data;
|
|
81
|
+
const session = terminalManager.getSession(pid);
|
|
82
|
+
if (!session) {
|
|
83
|
+
return {
|
|
84
|
+
content: [{ type: "text", text: `No active session found for PID ${pid}` }],
|
|
85
|
+
isError: true,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
let output = "";
|
|
89
|
+
let timeoutReached = false;
|
|
90
|
+
let earlyExit = false;
|
|
91
|
+
let processState;
|
|
92
|
+
try {
|
|
93
|
+
const outputPromise = new Promise((resolve) => {
|
|
94
|
+
const initialOutput = terminalManager.getNewOutput(pid);
|
|
95
|
+
if (initialOutput && initialOutput.length > 0) {
|
|
96
|
+
resolve(initialOutput);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let resolved = false;
|
|
100
|
+
let interval = null;
|
|
101
|
+
let timeout = null;
|
|
102
|
+
const cleanup = () => {
|
|
103
|
+
if (interval)
|
|
104
|
+
clearInterval(interval);
|
|
105
|
+
if (timeout)
|
|
106
|
+
clearTimeout(timeout);
|
|
107
|
+
};
|
|
108
|
+
const resolveOnce = (value, isTimeout = false) => {
|
|
109
|
+
if (resolved)
|
|
110
|
+
return;
|
|
111
|
+
resolved = true;
|
|
112
|
+
cleanup();
|
|
113
|
+
timeoutReached = isTimeout;
|
|
114
|
+
resolve(value);
|
|
115
|
+
};
|
|
116
|
+
interval = setInterval(() => {
|
|
117
|
+
const newOutput = terminalManager.getNewOutput(pid);
|
|
118
|
+
if (newOutput && newOutput.length > 0) {
|
|
119
|
+
const currentOutput = output + newOutput;
|
|
120
|
+
const state = analyzeProcessState(currentOutput, pid);
|
|
121
|
+
// Early exit if process is clearly waiting for input
|
|
122
|
+
if (state.isWaitingForInput) {
|
|
123
|
+
earlyExit = true;
|
|
124
|
+
processState = state;
|
|
125
|
+
resolveOnce(newOutput);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
output = currentOutput;
|
|
129
|
+
// Continue collecting if still running
|
|
130
|
+
if (!state.isFinished) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
// Process finished
|
|
134
|
+
processState = state;
|
|
135
|
+
resolveOnce(newOutput);
|
|
136
|
+
}
|
|
137
|
+
}, 200); // Check every 200ms
|
|
138
|
+
timeout = setTimeout(() => {
|
|
139
|
+
const finalOutput = terminalManager.getNewOutput(pid) || "";
|
|
140
|
+
resolveOnce(finalOutput, true);
|
|
141
|
+
}, timeout_ms);
|
|
142
|
+
});
|
|
143
|
+
const newOutput = await outputPromise;
|
|
144
|
+
output += newOutput;
|
|
145
|
+
// Analyze final state if not already done
|
|
146
|
+
if (!processState) {
|
|
147
|
+
processState = analyzeProcessState(output, pid);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
return {
|
|
152
|
+
content: [{ type: "text", text: `Error reading output: ${error}` }],
|
|
153
|
+
isError: true,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
// Format response based on what we detected
|
|
157
|
+
let statusMessage = '';
|
|
158
|
+
if (earlyExit && processState?.isWaitingForInput) {
|
|
159
|
+
statusMessage = `\nš ${formatProcessStateMessage(processState, pid)}`;
|
|
160
|
+
}
|
|
161
|
+
else if (processState?.isFinished) {
|
|
162
|
+
statusMessage = `\nā
${formatProcessStateMessage(processState, pid)}`;
|
|
163
|
+
}
|
|
164
|
+
else if (timeoutReached) {
|
|
165
|
+
statusMessage = '\nā±ļø Timeout reached - process may still be running';
|
|
166
|
+
}
|
|
167
|
+
const responseText = output || 'No new output available';
|
|
168
|
+
return {
|
|
169
|
+
content: [{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: `${responseText}${statusMessage}`
|
|
172
|
+
}],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Interact with a running process (renamed from send_input)
|
|
177
|
+
* Automatically detects when process is ready and returns output
|
|
178
|
+
*/
|
|
179
|
+
export async function interactWithProcess(args) {
|
|
180
|
+
const parsed = InteractWithProcessArgsSchema.safeParse(args);
|
|
181
|
+
if (!parsed.success) {
|
|
182
|
+
capture('server_interact_with_process_failed', {
|
|
183
|
+
error: 'Invalid arguments'
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
content: [{ type: "text", text: `Error: Invalid arguments for interact_with_process: ${parsed.error}` }],
|
|
187
|
+
isError: true,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const { pid, input, timeout_ms = 8000, wait_for_prompt = true } = parsed.data;
|
|
191
|
+
try {
|
|
192
|
+
capture('server_interact_with_process', {
|
|
193
|
+
pid: pid,
|
|
194
|
+
inputLength: input.length
|
|
195
|
+
});
|
|
196
|
+
const success = terminalManager.sendInputToProcess(pid, input);
|
|
197
|
+
if (!success) {
|
|
198
|
+
return {
|
|
199
|
+
content: [{ type: "text", text: `Error: Failed to send input to process ${pid}. The process may have exited or doesn't accept input.` }],
|
|
200
|
+
isError: true,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// If not waiting for response, return immediately
|
|
204
|
+
if (!wait_for_prompt) {
|
|
205
|
+
return {
|
|
206
|
+
content: [{
|
|
207
|
+
type: "text",
|
|
208
|
+
text: `ā
Input sent to process ${pid}. Use read_process_output to get the response.`
|
|
209
|
+
}],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// Smart waiting with process state detection
|
|
213
|
+
let output = "";
|
|
214
|
+
let attempts = 0;
|
|
215
|
+
const maxAttempts = Math.ceil(timeout_ms / 200);
|
|
216
|
+
let processState;
|
|
217
|
+
while (attempts < maxAttempts) {
|
|
218
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
219
|
+
const newOutput = terminalManager.getNewOutput(pid);
|
|
220
|
+
if (newOutput && newOutput.length > 0) {
|
|
221
|
+
output += newOutput;
|
|
222
|
+
// Analyze current state
|
|
223
|
+
processState = analyzeProcessState(output, pid);
|
|
224
|
+
// Exit early if we detect the process is waiting for input
|
|
225
|
+
if (processState.isWaitingForInput) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
// Also exit if process finished
|
|
229
|
+
if (processState.isFinished) {
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
attempts++;
|
|
234
|
+
}
|
|
235
|
+
// Clean and format output
|
|
236
|
+
const cleanOutput = cleanProcessOutput(output, input);
|
|
237
|
+
const timeoutReached = attempts >= maxAttempts;
|
|
238
|
+
// Determine final state
|
|
239
|
+
if (!processState) {
|
|
240
|
+
processState = analyzeProcessState(output, pid);
|
|
241
|
+
}
|
|
242
|
+
let statusMessage = '';
|
|
243
|
+
if (processState.isWaitingForInput) {
|
|
244
|
+
statusMessage = `\nš ${formatProcessStateMessage(processState, pid)}`;
|
|
245
|
+
}
|
|
246
|
+
else if (processState.isFinished) {
|
|
247
|
+
statusMessage = `\nā
${formatProcessStateMessage(processState, pid)}`;
|
|
248
|
+
}
|
|
249
|
+
else if (timeoutReached) {
|
|
250
|
+
statusMessage = '\nā±ļø Response may be incomplete (timeout reached)';
|
|
251
|
+
}
|
|
252
|
+
if (cleanOutput.trim().length === 0 && !timeoutReached) {
|
|
253
|
+
return {
|
|
254
|
+
content: [{
|
|
255
|
+
type: "text",
|
|
256
|
+
text: `ā
Input executed in process ${pid}.\n(No output produced)${statusMessage}`
|
|
257
|
+
}],
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
content: [{
|
|
262
|
+
type: "text",
|
|
263
|
+
text: `ā
Input executed in process ${pid}:\n\n${cleanOutput}${statusMessage}`
|
|
264
|
+
}],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
269
|
+
capture('server_interact_with_process_error', {
|
|
270
|
+
error: errorMessage
|
|
271
|
+
});
|
|
272
|
+
return {
|
|
273
|
+
content: [{ type: "text", text: `Error interacting with process: ${errorMessage}` }],
|
|
274
|
+
isError: true,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Force terminate a process
|
|
280
|
+
*/
|
|
281
|
+
export async function forceTerminate(args) {
|
|
282
|
+
const parsed = ForceTerminateArgsSchema.safeParse(args);
|
|
283
|
+
if (!parsed.success) {
|
|
284
|
+
return {
|
|
285
|
+
content: [{ type: "text", text: `Error: Invalid arguments for force_terminate: ${parsed.error}` }],
|
|
286
|
+
isError: true,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
const success = terminalManager.forceTerminate(parsed.data.pid);
|
|
290
|
+
return {
|
|
291
|
+
content: [{
|
|
292
|
+
type: "text",
|
|
293
|
+
text: success
|
|
294
|
+
? `Successfully initiated termination of session ${parsed.data.pid}`
|
|
295
|
+
: `No active session found for PID ${parsed.data.pid}`
|
|
296
|
+
}],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* List active sessions
|
|
301
|
+
*/
|
|
302
|
+
export async function listSessions() {
|
|
303
|
+
const sessions = terminalManager.listActiveSessions();
|
|
304
|
+
return {
|
|
305
|
+
content: [{
|
|
306
|
+
type: "text",
|
|
307
|
+
text: sessions.length === 0
|
|
308
|
+
? 'No active sessions'
|
|
309
|
+
: sessions.map(s => `PID: ${s.pid}, Blocked: ${s.isBlocked}, Runtime: ${Math.round(s.runtime / 1000)}s`).join('\n')
|
|
310
|
+
}],
|
|
311
|
+
};
|
|
312
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mime-types.js","sourceRoot":"","sources":["../../src/tools/mime-types.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,C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AAC;IAED,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mCAAmC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;SACxF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YAC7H,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -13,23 +13,26 @@ export declare const SetConfigValueArgsSchema: z.ZodObject<{
|
|
|
13
13
|
export declare const ListProcessesArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
14
14
|
export declare const ExecuteCommandArgsSchema: z.ZodObject<{
|
|
15
15
|
command: z.ZodString;
|
|
16
|
-
timeout_ms: z.
|
|
16
|
+
timeout_ms: z.ZodNumber;
|
|
17
17
|
shell: z.ZodOptional<z.ZodString>;
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
19
|
command: string;
|
|
20
|
-
timeout_ms
|
|
20
|
+
timeout_ms: number;
|
|
21
21
|
shell?: string | undefined;
|
|
22
22
|
}, {
|
|
23
23
|
command: string;
|
|
24
|
-
timeout_ms
|
|
24
|
+
timeout_ms: number;
|
|
25
25
|
shell?: string | undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export declare const ReadOutputArgsSchema: z.ZodObject<{
|
|
28
28
|
pid: z.ZodNumber;
|
|
29
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
29
30
|
}, "strip", z.ZodTypeAny, {
|
|
30
31
|
pid: number;
|
|
32
|
+
timeout_ms?: number | undefined;
|
|
31
33
|
}, {
|
|
32
34
|
pid: number;
|
|
35
|
+
timeout_ms?: number | undefined;
|
|
33
36
|
}>;
|
|
34
37
|
export declare const ForceTerminateArgsSchema: z.ZodObject<{
|
|
35
38
|
pid: z.ZodNumber;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
console.error("Loading schemas.ts");
|
|
3
2
|
// Config tools schemas
|
|
4
3
|
export const GetConfigArgsSchema = z.object({});
|
|
5
4
|
export const SetConfigValueArgsSchema = z.object({
|
|
@@ -11,11 +10,12 @@ export const ListProcessesArgsSchema = z.object({});
|
|
|
11
10
|
// Terminal tools schemas
|
|
12
11
|
export const ExecuteCommandArgsSchema = z.object({
|
|
13
12
|
command: z.string(),
|
|
14
|
-
timeout_ms: z.number()
|
|
13
|
+
timeout_ms: z.number(),
|
|
15
14
|
shell: z.string().optional(),
|
|
16
15
|
});
|
|
17
16
|
export const ReadOutputArgsSchema = z.object({
|
|
18
17
|
pid: z.number(),
|
|
18
|
+
timeout_ms: z.number().optional(),
|
|
19
19
|
});
|
|
20
20
|
export const ForceTerminateArgsSchema = z.object({
|
|
21
21
|
pid: z.number(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAEpC,uBAAuB;AACvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEhD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,GAAG,EAAE,CAAC,CAAC,MAAM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,CAAC;4BACH,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,yCAAyC;oBACzC,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iCAAiC;QACnC,CAAC;IACH,CAAC;IAED,MAAM,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAQvC;IACC,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,kBAAkB,CAAC;YACvB,GAAG,OAAO;YACV,WAAW,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC;SAC9C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/utils/capture.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ export declare function sanitizeError(error: any): {
|
|
|
12
12
|
* @param event Event name
|
|
13
13
|
* @param properties Optional event properties
|
|
14
14
|
*/
|
|
15
|
+
export declare const captureBase: (captureURL: string, event: string, properties?: any) => Promise<void>;
|
|
16
|
+
export declare const capture_call_tool: (event: string, properties?: any) => Promise<void>;
|
|
15
17
|
export declare const capture: (event: string, properties?: any) => Promise<void>;
|
package/dist/utils/capture.js
CHANGED
|
@@ -10,11 +10,6 @@ try {
|
|
|
10
10
|
catch {
|
|
11
11
|
// Continue without version info if not available
|
|
12
12
|
}
|
|
13
|
-
// Configuration
|
|
14
|
-
const GA_MEASUREMENT_ID = 'G-NGGDNL0K4L'; // Replace with your GA4 Measurement ID
|
|
15
|
-
const GA_API_SECRET = '5M0mC--2S_6t94m8WrI60A'; // Replace with your GA4 API Secret
|
|
16
|
-
const GA_BASE_URL = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
17
|
-
const GA_DEBUG_BASE_URL = `https://www.google-analytics.com/debug/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
18
13
|
// Will be initialized when needed
|
|
19
14
|
let uniqueUserId = 'unknown';
|
|
20
15
|
// Function to get or create a persistent UUID
|
|
@@ -70,12 +65,12 @@ export function sanitizeError(error) {
|
|
|
70
65
|
* @param event Event name
|
|
71
66
|
* @param properties Optional event properties
|
|
72
67
|
*/
|
|
73
|
-
export const
|
|
68
|
+
export const captureBase = async (captureURL, event, properties) => {
|
|
74
69
|
try {
|
|
75
70
|
// Check if telemetry is enabled in config (defaults to true if not set)
|
|
76
71
|
const telemetryEnabled = await configManager.getValue('telemetryEnabled');
|
|
77
72
|
// If telemetry is explicitly disabled or GA credentials are missing, don't send
|
|
78
|
-
if (telemetryEnabled === false || !
|
|
73
|
+
if (telemetryEnabled === false || !captureURL) {
|
|
79
74
|
return;
|
|
80
75
|
}
|
|
81
76
|
// Get or create the client ID if not already initialized
|
|
@@ -145,7 +140,7 @@ export const capture = async (event, properties) => {
|
|
|
145
140
|
'Content-Length': Buffer.byteLength(postData)
|
|
146
141
|
}
|
|
147
142
|
};
|
|
148
|
-
const req = https.request(
|
|
143
|
+
const req = https.request(captureURL, options, (res) => {
|
|
149
144
|
// Response handling (optional)
|
|
150
145
|
let data = '';
|
|
151
146
|
res.on('data', (chunk) => {
|
|
@@ -173,3 +168,17 @@ export const capture = async (event, properties) => {
|
|
|
173
168
|
// Silently fail - we don't want analytics issues to break functionality
|
|
174
169
|
}
|
|
175
170
|
};
|
|
171
|
+
export const capture_call_tool = async (event, properties) => {
|
|
172
|
+
const GA_MEASUREMENT_ID = 'G-35YKFM782B'; // Replace with your GA4 Measurement ID
|
|
173
|
+
const GA_API_SECRET = 'qM5VNk6aQy6NN5s-tCppZw'; // Replace with your GA4 API Secret
|
|
174
|
+
const GA_BASE_URL = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
175
|
+
const GA_DEBUG_BASE_URL = `https://www.google-analytics.com/debug/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
176
|
+
return await captureBase(GA_BASE_URL, event, properties);
|
|
177
|
+
};
|
|
178
|
+
export const capture = async (event, properties) => {
|
|
179
|
+
const GA_MEASUREMENT_ID = 'G-NGGDNL0K4L'; // Replace with your GA4 Measurement ID
|
|
180
|
+
const GA_API_SECRET = '5M0mC--2S_6t94m8WrI60A'; // Replace with your GA4 API Secret
|
|
181
|
+
const GA_BASE_URL = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
182
|
+
const GA_DEBUG_BASE_URL = `https://www.google-analytics.com/debug/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
183
|
+
return await captureBase(GA_BASE_URL, event, properties);
|
|
184
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/utils/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,IAAI,OAAO,GAAG,SAAS,CAAC;AACxB,IAAI,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IACpD,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;AACpC,CAAC;AAAC,MAAM,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,OAAO,EAAE,CAAC;YACd,CAAC;QACL,CAAC;aAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC7B,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;IAED,8BAA8B;IAC9B,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5C,IAAI,KAAsB,CAAC;IAE3B,IAAI,SAAS,GAAG,OAAO,IAAI,SAAS,GAAG,OAAO,EAAE,CAAC;QAC7C,KAAK,GAAG,MAAM,CAAC;IACnB,CAAC;SAAM,IAAI,OAAO,GAAG,OAAO,EAAE,CAAC;QAC3B,KAAK,GAAG,IAAI,CAAC;IACjB,CAAC;SAAM,CAAC;QACJ,KAAK,GAAG,IAAI,CAAC;IACjB,CAAC;IAED,+BAA+B;IAC/B,MAAM,UAAU,GAAG,CAAC,SAAS,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REPL and Process State Detection Utilities
|
|
3
|
+
* Detects when processes are waiting for input vs finished vs running
|
|
4
|
+
*/
|
|
5
|
+
export interface ProcessState {
|
|
6
|
+
isWaitingForInput: boolean;
|
|
7
|
+
isFinished: boolean;
|
|
8
|
+
isRunning: boolean;
|
|
9
|
+
detectedPrompt?: string;
|
|
10
|
+
lastOutput: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Analyze process output to determine current state
|
|
14
|
+
*/
|
|
15
|
+
export declare function analyzeProcessState(output: string, pid?: number): ProcessState;
|
|
16
|
+
/**
|
|
17
|
+
* Clean output by removing prompts and input echoes
|
|
18
|
+
*/
|
|
19
|
+
export declare function cleanProcessOutput(output: string, inputSent?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format process state for user display
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatProcessStateMessage(state: ProcessState, pid: number): string;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REPL and Process State Detection Utilities
|
|
3
|
+
* Detects when processes are waiting for input vs finished vs running
|
|
4
|
+
*/
|
|
5
|
+
// Common REPL prompt patterns
|
|
6
|
+
const REPL_PROMPTS = {
|
|
7
|
+
python: ['>>> ', '... '],
|
|
8
|
+
node: ['> ', '... '],
|
|
9
|
+
r: ['> ', '+ '],
|
|
10
|
+
julia: ['julia> ', ' '], // julia continuation is spaces
|
|
11
|
+
shell: ['$ ', '# ', '% ', 'bash-', 'zsh-'],
|
|
12
|
+
mysql: ['mysql> ', ' -> '],
|
|
13
|
+
postgres: ['=# ', '-# '],
|
|
14
|
+
redis: ['redis> '],
|
|
15
|
+
mongo: ['> ', '... ']
|
|
16
|
+
};
|
|
17
|
+
// Error patterns that indicate completion (even with errors)
|
|
18
|
+
const ERROR_COMPLETION_PATTERNS = [
|
|
19
|
+
/Error:/i,
|
|
20
|
+
/Exception:/i,
|
|
21
|
+
/Traceback/i,
|
|
22
|
+
/SyntaxError/i,
|
|
23
|
+
/NameError/i,
|
|
24
|
+
/TypeError/i,
|
|
25
|
+
/ValueError/i,
|
|
26
|
+
/ReferenceError/i,
|
|
27
|
+
/Uncaught/i,
|
|
28
|
+
/at Object\./i, // Node.js stack traces
|
|
29
|
+
/^\s*\^/m // Syntax error indicators
|
|
30
|
+
];
|
|
31
|
+
// Process completion indicators
|
|
32
|
+
const COMPLETION_INDICATORS = [
|
|
33
|
+
/Process finished/i,
|
|
34
|
+
/Command completed/i,
|
|
35
|
+
/\[Process completed\]/i,
|
|
36
|
+
/Program terminated/i,
|
|
37
|
+
/Exit code:/i
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Analyze process output to determine current state
|
|
41
|
+
*/
|
|
42
|
+
export function analyzeProcessState(output, pid) {
|
|
43
|
+
if (!output || output.trim().length === 0) {
|
|
44
|
+
return {
|
|
45
|
+
isWaitingForInput: false,
|
|
46
|
+
isFinished: false,
|
|
47
|
+
isRunning: true,
|
|
48
|
+
lastOutput: output
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const lines = output.split('\n');
|
|
52
|
+
const lastLine = lines[lines.length - 1] || '';
|
|
53
|
+
const lastFewLines = lines.slice(-3).join('\n');
|
|
54
|
+
// Check for REPL prompts (waiting for input)
|
|
55
|
+
const allPrompts = Object.values(REPL_PROMPTS).flat();
|
|
56
|
+
const detectedPrompt = allPrompts.find(prompt => lastLine.endsWith(prompt) || lastLine.includes(prompt));
|
|
57
|
+
if (detectedPrompt) {
|
|
58
|
+
return {
|
|
59
|
+
isWaitingForInput: true,
|
|
60
|
+
isFinished: false,
|
|
61
|
+
isRunning: true,
|
|
62
|
+
detectedPrompt,
|
|
63
|
+
lastOutput: output
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Check for completion indicators
|
|
67
|
+
const hasCompletionIndicator = COMPLETION_INDICATORS.some(pattern => pattern.test(output));
|
|
68
|
+
if (hasCompletionIndicator) {
|
|
69
|
+
return {
|
|
70
|
+
isWaitingForInput: false,
|
|
71
|
+
isFinished: true,
|
|
72
|
+
isRunning: false,
|
|
73
|
+
lastOutput: output
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// Check for error completion (errors usually end with prompts, but let's be thorough)
|
|
77
|
+
const hasErrorCompletion = ERROR_COMPLETION_PATTERNS.some(pattern => pattern.test(lastFewLines));
|
|
78
|
+
if (hasErrorCompletion) {
|
|
79
|
+
// Errors can indicate completion, but check if followed by prompt
|
|
80
|
+
if (detectedPrompt) {
|
|
81
|
+
return {
|
|
82
|
+
isWaitingForInput: true,
|
|
83
|
+
isFinished: false,
|
|
84
|
+
isRunning: true,
|
|
85
|
+
detectedPrompt,
|
|
86
|
+
lastOutput: output
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return {
|
|
91
|
+
isWaitingForInput: false,
|
|
92
|
+
isFinished: true,
|
|
93
|
+
isRunning: false,
|
|
94
|
+
lastOutput: output
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Default: process is running, not clearly waiting or finished
|
|
99
|
+
return {
|
|
100
|
+
isWaitingForInput: false,
|
|
101
|
+
isFinished: false,
|
|
102
|
+
isRunning: true,
|
|
103
|
+
lastOutput: output
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Clean output by removing prompts and input echoes
|
|
108
|
+
*/
|
|
109
|
+
export function cleanProcessOutput(output, inputSent) {
|
|
110
|
+
let cleaned = output;
|
|
111
|
+
// Remove input echo if provided
|
|
112
|
+
if (inputSent) {
|
|
113
|
+
const inputLines = inputSent.split('\n');
|
|
114
|
+
inputLines.forEach(line => {
|
|
115
|
+
if (line.trim()) {
|
|
116
|
+
cleaned = cleaned.replace(new RegExp(`^${escapeRegExp(line.trim())}\\s*\n?`, 'm'), '');
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Remove common prompt patterns from output
|
|
121
|
+
cleaned = cleaned.replace(/^>>>\s*/gm, ''); // Python >>>
|
|
122
|
+
cleaned = cleaned.replace(/^>\s*/gm, ''); // Node.js/Shell >
|
|
123
|
+
cleaned = cleaned.replace(/^\.{3}\s*/gm, ''); // Python ...
|
|
124
|
+
cleaned = cleaned.replace(/^\+\s*/gm, ''); // R +
|
|
125
|
+
// Remove trailing prompts
|
|
126
|
+
cleaned = cleaned.replace(/\n>>>\s*$/, '');
|
|
127
|
+
cleaned = cleaned.replace(/\n>\s*$/, '');
|
|
128
|
+
cleaned = cleaned.replace(/\n\+\s*$/, '');
|
|
129
|
+
return cleaned.trim();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Escape special regex characters
|
|
133
|
+
*/
|
|
134
|
+
function escapeRegExp(string) {
|
|
135
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Format process state for user display
|
|
139
|
+
*/
|
|
140
|
+
export function formatProcessStateMessage(state, pid) {
|
|
141
|
+
if (state.isWaitingForInput) {
|
|
142
|
+
return `Process ${pid} is waiting for input${state.detectedPrompt ? ` (detected: "${state.detectedPrompt.trim()}")` : ''}`;
|
|
143
|
+
}
|
|
144
|
+
else if (state.isFinished) {
|
|
145
|
+
return `Process ${pid} has finished execution`;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return `Process ${pid} is running`;
|
|
149
|
+
}
|
|
150
|
+
}
|