@wonderwhy-er/desktop-commander 0.3.1-alpha.1 → 0.3.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/LICENSE +20 -20
- package/README.md +1152 -1152
- package/dist/bootstrap.js +0 -0
- package/dist/command-manager.js +0 -0
- package/dist/config-field-definitions.js +0 -0
- package/dist/config-manager.js +0 -0
- package/dist/config-recovery.js +0 -0
- package/dist/config.js +0 -0
- package/dist/custom-stdio.js +0 -0
- package/dist/data/onboarding-prompts.json +70 -70
- package/dist/error-handlers.js +0 -0
- package/dist/handlers/filesystem-handlers.js +2 -2
- package/dist/index.js +0 -0
- package/dist/npm-scripts/remote.js +25 -23
- package/dist/remote-device/desktop-commander-integration.d.ts +1 -0
- package/dist/remote-device/device.js +14 -2
- package/dist/remote-device/realtime-health-telemetry.d.ts +35 -0
- package/dist/remote-device/realtime-health-telemetry.js +110 -0
- package/dist/remote-device/remote-channel.d.ts +66 -55
- package/dist/remote-device/remote-channel.js +336 -389
- package/dist/remote-device/rollouts.d.ts +48 -0
- package/dist/remote-device/rollouts.js +105 -0
- package/dist/remote-device/scripts/blocking-offline-update.js +135 -133
- package/dist/search-manager.js +0 -0
- package/dist/server.js +581 -712
- package/dist/setup-claude-server.js +942 -942
- package/dist/terminal-manager.js +0 -0
- package/dist/tools/edit.js +2 -2
- package/dist/tools/fuzzySearch.js +9 -9
- package/dist/tools/improved-process-tools.js +10 -10
- package/dist/tools/pdf/extract-images.js +3 -7
- package/dist/tools/pdf/lib/pdf2md.js +28 -33
- package/dist/tools/pdf/utils.d.ts +10 -0
- package/dist/tools/pdf/utils.js +11 -0
- package/dist/tools/prompts.js +1 -1
- package/dist/tools/schemas.d.ts +0 -10
- package/dist/tools/schemas.js +0 -8
- package/dist/track-installation.js +387 -387
- package/dist/types.js +0 -0
- package/dist/ui/config-editor/config-editor-runtime.js +53 -53
- package/dist/ui/config-editor/index.html +13 -13
- package/dist/ui/config-editor/src/app.js +30 -30
- package/dist/ui/config-editor/src/array-modal.js +32 -32
- package/dist/ui/config-editor/styles.css +586 -586
- package/dist/ui/contracts.d.ts +27 -0
- package/dist/ui/contracts.js +36 -0
- package/dist/ui/file-preview/index.html +16 -16
- package/dist/ui/file-preview/preview-runtime.js +190 -182
- package/dist/ui/file-preview/src/app.js +8 -8
- package/dist/ui/file-preview/src/components/html-renderer.js +4 -2
- package/dist/ui/file-preview/src/document-layout.js +31 -31
- package/dist/ui/file-preview/src/document-outline.js +8 -8
- package/dist/ui/file-preview/src/markdown/conflict-dialog.js +33 -33
- package/dist/ui/file-preview/src/markdown/controller.js +9 -9
- package/dist/ui/file-preview/src/markdown/editor.js +31 -31
- package/dist/ui/file-preview/styles.css +1630 -1630
- package/dist/ui/resources.js +11 -4
- package/dist/uninstall-claude-server.js +745 -745
- package/dist/utils/files/binary.js +4 -4
- package/dist/utils/files/excel.js +3 -3
- package/dist/utils/files/text.d.ts +7 -0
- package/dist/utils/files/text.js +40 -21
- package/dist/utils/lazy-package.d.ts +5 -3
- package/dist/utils/lazy-package.js +6 -4
- package/dist/utils/system-info.d.ts +1 -0
- package/dist/utils/system-info.js +110 -97
- package/dist/utils/terminal-timestamps.d.ts +2 -0
- package/dist/utils/terminal-timestamps.js +18 -0
- package/dist/utils/usageTracker.d.ts +0 -39
- package/dist/utils/usageTracker.js +16 -176
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/node_modules/@desktop-commander/telemetry-contract/README.md +56 -56
- package/node_modules/@desktop-commander/telemetry-contract/package.json +32 -32
- package/node_modules/@desktop-commander/telemetry-contract/transport.d.ts +38 -38
- package/node_modules/@desktop-commander/telemetry-contract/transport.js +164 -164
- package/package.json +24 -15
- package/vendor/telemetry-contract/README.md +56 -56
- package/vendor/telemetry-contract/package.json +32 -32
- package/vendor/telemetry-contract/transport.d.ts +38 -38
- package/vendor/telemetry-contract/transport.js +164 -164
- package/vendor/telemetry-contract/transport.test.js +39 -39
package/dist/terminal-manager.js
CHANGED
|
File without changes
|
package/dist/tools/edit.js
CHANGED
|
@@ -153,8 +153,8 @@ export async function performSearchReplace(filePath, block, expectedReplacements
|
|
|
153
153
|
let warningMessage = "";
|
|
154
154
|
if (maxLines > MAX_LINES) {
|
|
155
155
|
const problemText = searchLines > replaceLines ? 'search text' : 'replacement text';
|
|
156
|
-
warningMessage = `\n\nWARNING: The ${problemText} has ${maxLines} lines (maximum: ${MAX_LINES}).
|
|
157
|
-
|
|
156
|
+
warningMessage = `\n\nWARNING: The ${problemText} has ${maxLines} lines (maximum: ${MAX_LINES}).
|
|
157
|
+
|
|
158
158
|
RECOMMENDATION: For large search/replace operations, consider breaking them into smaller chunks with fewer lines.`;
|
|
159
159
|
}
|
|
160
160
|
await writeFile(filePath, newContent);
|
|
@@ -11,15 +11,15 @@ export const FUZZY_SEARCH_TIMEOUT_MS = 30000;
|
|
|
11
11
|
* worker would boot the whole server per search. Kept as an eval'd snippet so
|
|
12
12
|
* the worker needs no separate file to ship alongside the compiled output.
|
|
13
13
|
*/
|
|
14
|
-
const WORKER_CODE = `
|
|
15
|
-
const { workerData, parentPort } = require('worker_threads');
|
|
16
|
-
import(workerData.moduleUrl)
|
|
17
|
-
.then((m) => {
|
|
18
|
-
parentPort.postMessage({ ok: true, ...m.runFuzzySearch(workerData.text, workerData.query) });
|
|
19
|
-
})
|
|
20
|
-
.catch((err) => {
|
|
21
|
-
parentPort.postMessage({ ok: false, error: String(err && err.stack || err) });
|
|
22
|
-
});
|
|
14
|
+
const WORKER_CODE = `
|
|
15
|
+
const { workerData, parentPort } = require('worker_threads');
|
|
16
|
+
import(workerData.moduleUrl)
|
|
17
|
+
.then((m) => {
|
|
18
|
+
parentPort.postMessage({ ok: true, ...m.runFuzzySearch(workerData.text, workerData.query) });
|
|
19
|
+
})
|
|
20
|
+
.catch((err) => {
|
|
21
|
+
parentPort.postMessage({ ok: false, error: String(err && err.stack || err) });
|
|
22
|
+
});
|
|
23
23
|
`;
|
|
24
24
|
const CORE_MODULE_URL = new URL('./fuzzySearchCore.js', import.meta.url).href;
|
|
25
25
|
/**
|
|
@@ -160,16 +160,16 @@ export async function startProcess(args, maxWaitMs = MAX_PROCESS_WAIT_MS) {
|
|
|
160
160
|
return {
|
|
161
161
|
content: [{
|
|
162
162
|
type: "text",
|
|
163
|
-
text: `Node.js session started with PID ${virtualPid} (MCP server execution)
|
|
164
|
-
|
|
165
|
-
IMPORTANT: Each interact_with_process call runs as a FRESH script.
|
|
166
|
-
State is NOT preserved between calls. Include ALL code in ONE call:
|
|
167
|
-
- imports, file reading, processing, and output together.
|
|
168
|
-
|
|
169
|
-
Available libraries:
|
|
170
|
-
- ExcelJS for Excel files: import ExcelJS from 'exceljs'
|
|
171
|
-
- All Node.js built-ins: fs, path, http, crypto, etc.
|
|
172
|
-
|
|
163
|
+
text: `Node.js session started with PID ${virtualPid} (MCP server execution)
|
|
164
|
+
|
|
165
|
+
IMPORTANT: Each interact_with_process call runs as a FRESH script.
|
|
166
|
+
State is NOT preserved between calls. Include ALL code in ONE call:
|
|
167
|
+
- imports, file reading, processing, and output together.
|
|
168
|
+
|
|
169
|
+
Available libraries:
|
|
170
|
+
- ExcelJS for Excel files: import ExcelJS from 'exceljs'
|
|
171
|
+
- All Node.js built-ins: fs, path, http, crypto, etc.
|
|
172
|
+
|
|
173
173
|
🔄 Ready for code - send complete self-contained script via interact_with_process.`
|
|
174
174
|
}],
|
|
175
175
|
structuredContent: { pid: virtualPid, status: 'waiting_for_input' },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LazyPackage } from '../../utils/lazy-package.js';
|
|
2
|
+
import { closePdfDocument } from './utils.js';
|
|
2
3
|
// import(): unpdf is an ES module only. If it fails, Node keeps it failed until a restart.
|
|
3
|
-
export const unpdfPackage = new LazyPackage('unpdf', 'PDF reading support', () => import('unpdf'));
|
|
4
|
+
export const unpdfPackage = new LazyPackage('unpdf', 'PDF reading support', () => import('unpdf'), true);
|
|
4
5
|
/**
|
|
5
6
|
* Optimized image extraction from PDF using unpdf's built-in extractImages method
|
|
6
7
|
* @param pdfBuffer PDF file as Uint8Array
|
|
@@ -75,12 +76,7 @@ export async function extractImagesFromPdf(pdfBuffer, pageNumbers, compressionOp
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
catch (e) { /* Ignore cleanup errors */ }
|
|
78
|
-
|
|
79
|
-
if (typeof pdfDocument.destroy === 'function') {
|
|
80
|
-
await pdfDocument.destroy();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch (e) { /* Ignore cleanup errors */ }
|
|
79
|
+
await closePdfDocument(pdfDocument);
|
|
84
80
|
}
|
|
85
81
|
return pageResults;
|
|
86
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
import { LazyPackage } from '../../../utils/lazy-package.js';
|
|
3
|
-
import { generatePageNumbers } from '../utils.js';
|
|
3
|
+
import { closePdfDocument, generatePageNumbers } from '../utils.js';
|
|
4
4
|
import { extractImagesFromPdf } from '../extract-images.js';
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
export const pdf2mdPackage = new LazyPackage('@opendocsg/pdf2md', 'PDF reading support', () => {
|
|
@@ -35,33 +35,33 @@ export async function pdf2md(pdfBuffer, pageNumbers = []) {
|
|
|
35
35
|
const { parse, makeTransformations, transform } = pdf2mdPackage.load();
|
|
36
36
|
const result = await parse(pdfBuffer);
|
|
37
37
|
const { fonts, pages, pdfDocument } = result;
|
|
38
|
-
// Calculate which pages to process
|
|
39
|
-
const allPages = Array.isArray(pageNumbers) && pageNumbers.length === 0;
|
|
40
|
-
const filterPageNumbers = Array.isArray(pageNumbers) ?
|
|
41
|
-
pageNumbers :
|
|
42
|
-
generatePageNumbers(pageNumbers.offset, pageNumbers.length, pages.length);
|
|
43
|
-
// Filter and transform pages
|
|
44
|
-
const pagesToProcess = allPages ?
|
|
45
|
-
pages :
|
|
46
|
-
pages.filter((_, index) => filterPageNumbers.includes(index + 1));
|
|
47
|
-
const pageNumberMap = allPages ?
|
|
48
|
-
pages.map((_, index) => index + 1) :
|
|
49
|
-
filterPageNumbers.filter(pageNum => pageNum >= 1 && pageNum <= pages.length);
|
|
50
|
-
const transformations = makeTransformations(fonts.map);
|
|
51
|
-
const parseResult = transform(pagesToProcess, transformations);
|
|
52
|
-
// Extract images
|
|
53
|
-
const imagesByPage = await extractImagesFromPdf(pdfBuffer, pageNumberMap, { format: 'webp', quality: 85 });
|
|
54
|
-
// Create pages without images for now
|
|
55
|
-
const processedPages = parseResult.pages.map((page, index) => {
|
|
56
|
-
const pageNumber = pageNumberMap[index];
|
|
57
|
-
return {
|
|
58
|
-
pageNumber,
|
|
59
|
-
text: page.items.join('\n') + '\n',
|
|
60
|
-
images: imagesByPage[pageNumber] || [],
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
const metadata = extractMetadata(result);
|
|
64
38
|
try {
|
|
39
|
+
// Calculate which pages to process
|
|
40
|
+
const allPages = Array.isArray(pageNumbers) && pageNumbers.length === 0;
|
|
41
|
+
const filterPageNumbers = Array.isArray(pageNumbers) ?
|
|
42
|
+
pageNumbers :
|
|
43
|
+
generatePageNumbers(pageNumbers.offset, pageNumbers.length, pages.length);
|
|
44
|
+
// Filter and transform pages
|
|
45
|
+
const pagesToProcess = allPages ?
|
|
46
|
+
pages :
|
|
47
|
+
pages.filter((_, index) => filterPageNumbers.includes(index + 1));
|
|
48
|
+
const pageNumberMap = allPages ?
|
|
49
|
+
pages.map((_, index) => index + 1) :
|
|
50
|
+
filterPageNumbers.filter(pageNum => pageNum >= 1 && pageNum <= pages.length);
|
|
51
|
+
const transformations = makeTransformations(fonts.map);
|
|
52
|
+
const parseResult = transform(pagesToProcess, transformations);
|
|
53
|
+
// Extract images
|
|
54
|
+
const imagesByPage = await extractImagesFromPdf(pdfBuffer, pageNumberMap, { format: 'webp', quality: 85 });
|
|
55
|
+
// Create pages without images for now
|
|
56
|
+
const processedPages = parseResult.pages.map((page, index) => {
|
|
57
|
+
const pageNumber = pageNumberMap[index];
|
|
58
|
+
return {
|
|
59
|
+
pageNumber,
|
|
60
|
+
text: page.items.join('\n') + '\n',
|
|
61
|
+
images: imagesByPage[pageNumber] || [],
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
const metadata = extractMetadata(result);
|
|
65
65
|
return { pages: processedPages, metadata };
|
|
66
66
|
}
|
|
67
67
|
finally {
|
|
@@ -72,12 +72,7 @@ export async function pdf2md(pdfBuffer, pageNumbers = []) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
catch (e) { }
|
|
75
|
-
|
|
76
|
-
if (typeof pdfDocument.destroy === 'function') {
|
|
77
|
-
await pdfDocument.destroy();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (e) { }
|
|
75
|
+
await closePdfDocument(pdfDocument);
|
|
81
76
|
}
|
|
82
77
|
}
|
|
83
78
|
}
|
|
@@ -10,3 +10,13 @@ export declare const normalizePageIndexes: (pageIndexes: number[], pageCount: nu
|
|
|
10
10
|
* @returns Array of page numbers (empty when the offset is past the last page or length is 0)
|
|
11
11
|
*/
|
|
12
12
|
export declare function generatePageNumbers(offset: number, length: number, totalPages: number): number[];
|
|
13
|
+
/**
|
|
14
|
+
* Close a PDF document opened with unpdf, so pdf.js frees what it holds for it
|
|
15
|
+
* @param pdfDocument The document, closed through its loading task: unpdf 1.8's
|
|
16
|
+
* document has no destroy() of its own (1.4's only calls loadingTask.destroy())
|
|
17
|
+
*/
|
|
18
|
+
export declare function closePdfDocument(pdfDocument: {
|
|
19
|
+
loadingTask: {
|
|
20
|
+
destroy(): Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
}): Promise<void>;
|
package/dist/tools/pdf/utils.js
CHANGED
|
@@ -32,3 +32,14 @@ export function generatePageNumbers(offset, length, totalPages) {
|
|
|
32
32
|
// Preallocate array for speed
|
|
33
33
|
return Array.from({ length: count }, (_, i) => safeStart + i);
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Close a PDF document opened with unpdf, so pdf.js frees what it holds for it
|
|
37
|
+
* @param pdfDocument The document, closed through its loading task: unpdf 1.8's
|
|
38
|
+
* document has no destroy() of its own (1.4's only calls loadingTask.destroy())
|
|
39
|
+
*/
|
|
40
|
+
export async function closePdfDocument(pdfDocument) {
|
|
41
|
+
try {
|
|
42
|
+
await pdfDocument.loadingTask.destroy();
|
|
43
|
+
}
|
|
44
|
+
catch (e) { /* Ignore cleanup errors */ }
|
|
45
|
+
}
|
package/dist/tools/prompts.js
CHANGED
|
@@ -224,7 +224,7 @@ function formatPromptsListResponse(prompts, category) {
|
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
response += `Say "Try #3" or "Let's do #1" to start any example.\n\n`;
|
|
227
|
-
response += `<INSTRUCTION>Output options for user exactly as provided without missing numbers.
|
|
227
|
+
response += `<INSTRUCTION>Output options for user exactly as provided without missing numbers.
|
|
228
228
|
Its important so user can choose an options by entering number only. Also do not forget new lines between numbers for easy reading</INSTRUCTION>\n\n`;
|
|
229
229
|
// AI reference mapping (do not show to user):
|
|
230
230
|
response += `<!-- AI_PROMPT_MAP: `;
|
package/dist/tools/schemas.d.ts
CHANGED
|
@@ -407,16 +407,6 @@ export declare const StopSearchArgsSchema: z.ZodObject<{
|
|
|
407
407
|
sessionId: string;
|
|
408
408
|
}>;
|
|
409
409
|
export declare const ListSearchesArgsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
410
|
-
export declare const GetPromptsArgsSchema: z.ZodObject<{
|
|
411
|
-
action: z.ZodEnum<["get_prompt"]>;
|
|
412
|
-
promptId: z.ZodString;
|
|
413
|
-
}, "strip", z.ZodTypeAny, {
|
|
414
|
-
action: "get_prompt";
|
|
415
|
-
promptId: string;
|
|
416
|
-
}, {
|
|
417
|
-
action: "get_prompt";
|
|
418
|
-
promptId: string;
|
|
419
|
-
}>;
|
|
420
410
|
export declare const GetRecentToolCallsArgsSchema: z.ZodObject<{
|
|
421
411
|
maxResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
422
412
|
toolName: z.ZodOptional<z.ZodString>;
|
package/dist/tools/schemas.js
CHANGED
|
@@ -196,13 +196,6 @@ export const StopSearchArgsSchema = z.object({
|
|
|
196
196
|
sessionId: z.string(),
|
|
197
197
|
});
|
|
198
198
|
export const ListSearchesArgsSchema = z.object({});
|
|
199
|
-
// Prompts tool schema - SIMPLIFIED (only get_prompt action)
|
|
200
|
-
export const GetPromptsArgsSchema = z.object({
|
|
201
|
-
action: z.enum(['get_prompt']),
|
|
202
|
-
promptId: z.string(),
|
|
203
|
-
// Disabled to check if it makes sense or should be removed or changed
|
|
204
|
-
// anonymous_user_use_case: z.string().optional(),
|
|
205
|
-
});
|
|
206
199
|
// Tool history schema
|
|
207
200
|
export const GetRecentToolCallsArgsSchema = z.object({
|
|
208
201
|
maxResults: z.number().min(1).max(1000).optional().default(50),
|
|
@@ -245,6 +238,5 @@ export const toolArgSchemas = {
|
|
|
245
238
|
get_usage_stats: GetUsageStatsArgsSchema,
|
|
246
239
|
get_recent_tool_calls: GetRecentToolCallsArgsSchema,
|
|
247
240
|
give_feedback_to_desktop_commander: GiveFeedbackArgsSchema,
|
|
248
|
-
get_prompts: GetPromptsArgsSchema,
|
|
249
241
|
track_ui_event: TrackUiEventArgsSchema,
|
|
250
242
|
};
|