@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
|
@@ -56,10 +56,10 @@ export class BinaryFileHandler {
|
|
|
56
56
|
*/
|
|
57
57
|
getBinaryInstructions(filePath) {
|
|
58
58
|
const fileName = path.basename(filePath);
|
|
59
|
-
return `Cannot read binary file as text: ${fileName}
|
|
60
|
-
|
|
61
|
-
Use start_process + interact_with_process to analyze binary files with appropriate tools (Node.js or Python libraries, command-line utilities, etc.).
|
|
62
|
-
|
|
59
|
+
return `Cannot read binary file as text: ${fileName}
|
|
60
|
+
|
|
61
|
+
Use start_process + interact_with_process to analyze binary files with appropriate tools (Node.js or Python libraries, command-line utilities, etc.).
|
|
62
|
+
|
|
63
63
|
The read_file tool only handles text files, images, and Excel files.`;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -37,9 +37,9 @@ export class ExcelFileHandler {
|
|
|
37
37
|
: `\n[No rows returned: row ${firstRow} is past the end (${totalRows} rows total). Use offset/length to paginate.]`;
|
|
38
38
|
const sheetHasSpace = /\s/.test(sheetName);
|
|
39
39
|
const exampleSheet = sheetHasSpace ? sheetName : 'Sheet1';
|
|
40
|
-
const content = `[Sheet: '${sheetName}' from ${path}]${paginationInfo}
|
|
41
|
-
[To MODIFY cells: use edit_block with range param, e.g., edit_block(path, {range: "${exampleSheet}!E5", content: [[newValue]]}). read_file accepts the same range form, or pass sheet + range separately.]
|
|
42
|
-
|
|
40
|
+
const content = `[Sheet: '${sheetName}' from ${path}]${paginationInfo}
|
|
41
|
+
[To MODIFY cells: use edit_block with range param, e.g., edit_block(path, {range: "${exampleSheet}!E5", content: [[newValue]]}). read_file accepts the same range form, or pass sheet + range separately.]
|
|
42
|
+
|
|
43
43
|
${JSON.stringify(data)}`;
|
|
44
44
|
return {
|
|
45
45
|
content,
|
|
@@ -57,6 +57,13 @@ export declare class TextFileHandler implements FileHandler {
|
|
|
57
57
|
* very end ends the last line instead of starting another.
|
|
58
58
|
*/
|
|
59
59
|
private findLastLinesStart;
|
|
60
|
+
/**
|
|
61
|
+
* Run `readLines` on a readline over `filePath`, then close the file before
|
|
62
|
+
* returning, whether the read finished, stopped early or failed. rl.close()
|
|
63
|
+
* alone closes the line reader, not the file stream under it, so a read
|
|
64
|
+
* that stopped early kept the file open until the process exited.
|
|
65
|
+
*/
|
|
66
|
+
private withLineReader;
|
|
60
67
|
/**
|
|
61
68
|
* Read from end using readline with circular buffer
|
|
62
69
|
*/
|
package/dist/utils/files/text.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* search/replace logic should be moved here. See comment in src/tools/edit.ts.
|
|
14
14
|
*/
|
|
15
15
|
import fs from "fs/promises";
|
|
16
|
+
import { once } from 'events';
|
|
16
17
|
import { createReadStream } from 'fs';
|
|
17
18
|
import { createInterface } from 'readline';
|
|
18
19
|
// TODO: Centralize these constants with filesystem.ts to avoid silent drift
|
|
@@ -298,22 +299,43 @@ export class TextFileHandler {
|
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
301
|
/**
|
|
301
|
-
*
|
|
302
|
+
* Run `readLines` on a readline over `filePath`, then close the file before
|
|
303
|
+
* returning, whether the read finished, stopped early or failed. rl.close()
|
|
304
|
+
* alone closes the line reader, not the file stream under it, so a read
|
|
305
|
+
* that stopped early kept the file open until the process exited.
|
|
302
306
|
*/
|
|
303
|
-
async
|
|
307
|
+
async withLineReader(filePath, options, readLines) {
|
|
308
|
+
const input = createReadStream(filePath, options);
|
|
309
|
+
// Settles once the file is closed: on 'close', or on 'error', which a
|
|
310
|
+
// file stream emits after closing its file
|
|
311
|
+
const closed = once(input, 'close').catch(() => { });
|
|
304
312
|
const rl = createInterface({
|
|
305
|
-
input
|
|
313
|
+
input,
|
|
306
314
|
crlfDelay: Infinity
|
|
307
315
|
});
|
|
316
|
+
try {
|
|
317
|
+
await readLines(rl);
|
|
318
|
+
}
|
|
319
|
+
finally {
|
|
320
|
+
rl.close();
|
|
321
|
+
input.destroy();
|
|
322
|
+
await closed;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Read from end using readline with circular buffer
|
|
327
|
+
*/
|
|
328
|
+
async readFromEndWithReadline(filePath, requestedLines, mimeType, includeStatusMessage = true, fileTotalLines, signal, encoding, start) {
|
|
308
329
|
const buffer = new Array(requestedLines);
|
|
309
330
|
let bufferIndex = 0;
|
|
310
331
|
let totalLines = 0;
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
332
|
+
await this.withLineReader(filePath, { signal, encoding, start }, async (rl) => {
|
|
333
|
+
for await (const line of rl) {
|
|
334
|
+
buffer[bufferIndex] = line;
|
|
335
|
+
bufferIndex = (bufferIndex + 1) % requestedLines;
|
|
336
|
+
totalLines++;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
317
339
|
let result;
|
|
318
340
|
if (totalLines >= requestedLines) {
|
|
319
341
|
result = [
|
|
@@ -334,21 +356,18 @@ export class TextFileHandler {
|
|
|
334
356
|
* that byte, where line `startLine` begins.
|
|
335
357
|
*/
|
|
336
358
|
async readFromStartWithReadline(filePath, offset, length, mimeType, includeStatusMessage = true, fileTotalLines, signal, encoding, start, startLine = 0) {
|
|
337
|
-
const rl = createInterface({
|
|
338
|
-
input: createReadStream(filePath, { signal, encoding, start }),
|
|
339
|
-
crlfDelay: Infinity
|
|
340
|
-
});
|
|
341
359
|
const result = [];
|
|
342
360
|
let lineNumber = startLine;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
result.
|
|
361
|
+
await this.withLineReader(filePath, { signal, encoding, start }, async (rl) => {
|
|
362
|
+
for await (const line of rl) {
|
|
363
|
+
if (lineNumber >= offset && result.length < length) {
|
|
364
|
+
result.push(line);
|
|
365
|
+
}
|
|
366
|
+
if (result.length >= length)
|
|
367
|
+
break;
|
|
368
|
+
lineNumber++;
|
|
346
369
|
}
|
|
347
|
-
|
|
348
|
-
break;
|
|
349
|
-
lineNumber++;
|
|
350
|
-
}
|
|
351
|
-
rl.close();
|
|
370
|
+
});
|
|
352
371
|
if (includeStatusMessage) {
|
|
353
372
|
const statusMessage = this.generateEnhancedStatusMessage(result.length, offset, fileTotalLines, false);
|
|
354
373
|
const content = `${statusMessage}\n\n${result.join('\n')}`;
|
|
@@ -7,17 +7,19 @@
|
|
|
7
7
|
* (preloadFileSupport() in utils/files/factory.ts), and until one is loaded the
|
|
8
8
|
* calls that need it answer at once that it is still loading. preload() loads
|
|
9
9
|
* it on a later turn of the event loop, so a call that starts it answers
|
|
10
|
-
* first. `error` says why the last preload failed.
|
|
11
|
-
* import()
|
|
10
|
+
* first. `error` says why the last preload failed. Callers that load with
|
|
11
|
+
* import() can mark failures as requiring a restart, because Node caches a
|
|
12
|
+
* failed dynamic import.
|
|
12
13
|
*/
|
|
13
14
|
export declare class LazyPackage<T> {
|
|
14
15
|
readonly name: string;
|
|
15
16
|
readonly support: string;
|
|
16
17
|
readonly load: () => T;
|
|
18
|
+
readonly restartAfterFailure: boolean;
|
|
17
19
|
loaded: boolean;
|
|
18
20
|
error?: string;
|
|
19
21
|
needsRestart: boolean;
|
|
20
22
|
private running?;
|
|
21
|
-
constructor(name: string, support: string, load: () => T);
|
|
23
|
+
constructor(name: string, support: string, load: () => T, restartAfterFailure?: boolean);
|
|
22
24
|
preload(): Promise<void>;
|
|
23
25
|
}
|
|
@@ -8,14 +8,16 @@ import { logger } from './logger.js';
|
|
|
8
8
|
* (preloadFileSupport() in utils/files/factory.ts), and until one is loaded the
|
|
9
9
|
* calls that need it answer at once that it is still loading. preload() loads
|
|
10
10
|
* it on a later turn of the event loop, so a call that starts it answers
|
|
11
|
-
* first. `error` says why the last preload failed.
|
|
12
|
-
* import()
|
|
11
|
+
* first. `error` says why the last preload failed. Callers that load with
|
|
12
|
+
* import() can mark failures as requiring a restart, because Node caches a
|
|
13
|
+
* failed dynamic import.
|
|
13
14
|
*/
|
|
14
15
|
export class LazyPackage {
|
|
15
|
-
constructor(name, support, load) {
|
|
16
|
+
constructor(name, support, load, restartAfterFailure = false) {
|
|
16
17
|
this.name = name;
|
|
17
18
|
this.support = support;
|
|
18
19
|
this.load = load;
|
|
20
|
+
this.restartAfterFailure = restartAfterFailure;
|
|
19
21
|
this.loaded = false;
|
|
20
22
|
this.needsRestart = false;
|
|
21
23
|
}
|
|
@@ -30,7 +32,7 @@ export class LazyPackage {
|
|
|
30
32
|
}
|
|
31
33
|
catch (error) {
|
|
32
34
|
this.error = error instanceof Error ? error.message : String(error);
|
|
33
|
-
this.needsRestart =
|
|
35
|
+
this.needsRestart = this.restartAfterFailure;
|
|
34
36
|
logger.error(`Loading ${this.name} failed: ${this.error}`);
|
|
35
37
|
}
|
|
36
38
|
finally {
|
|
@@ -167,6 +167,7 @@ function discoverContainerMounts(isContainer) {
|
|
|
167
167
|
containerPath: mountPoint,
|
|
168
168
|
type: 'bind',
|
|
169
169
|
readOnly: isReadOnly,
|
|
170
|
+
verifiedMount: true,
|
|
170
171
|
description: `Mounted directory: ${path.basename(mountPoint)}`
|
|
171
172
|
});
|
|
172
173
|
}
|
|
@@ -194,7 +195,8 @@ function discoverContainerMounts(isContainer) {
|
|
|
194
195
|
containerPath: itemPath,
|
|
195
196
|
type: 'bind',
|
|
196
197
|
readOnly: false,
|
|
197
|
-
|
|
198
|
+
verifiedMount: false,
|
|
199
|
+
description: `Candidate folder under /mnt: ${item}`
|
|
198
200
|
});
|
|
199
201
|
}
|
|
200
202
|
}
|
|
@@ -231,7 +233,8 @@ function discoverContainerMounts(isContainer) {
|
|
|
231
233
|
containerPath: itemPath,
|
|
232
234
|
type: 'bind',
|
|
233
235
|
readOnly: false,
|
|
234
|
-
|
|
236
|
+
verifiedMount: false,
|
|
237
|
+
description: `Candidate folder under /home: ${item}`
|
|
235
238
|
});
|
|
236
239
|
}
|
|
237
240
|
}
|
|
@@ -535,28 +538,28 @@ export function getOSSpecificGuidance(systemInfo) {
|
|
|
535
538
|
docker.containerType === 'lxc' ? 'LXC CONTAINER' :
|
|
536
539
|
docker.containerType === 'systemd-nspawn' ? 'SYSTEMD-NSPAWN CONTAINER' :
|
|
537
540
|
'CONTAINER';
|
|
538
|
-
guidance += `
|
|
539
|
-
|
|
541
|
+
guidance += `
|
|
542
|
+
|
|
540
543
|
🐳 ${containerTypeLabel} ENVIRONMENT DETECTED:`;
|
|
541
544
|
if (docker.containerType === 'kubernetes') {
|
|
542
|
-
guidance += `
|
|
545
|
+
guidance += `
|
|
543
546
|
This Desktop Commander instance is running inside a Kubernetes pod.`;
|
|
544
547
|
// Add Kubernetes-specific info
|
|
545
548
|
if (docker.containerEnvironment?.kubernetesNamespace) {
|
|
546
|
-
guidance += `
|
|
549
|
+
guidance += `
|
|
547
550
|
Namespace: ${docker.containerEnvironment.kubernetesNamespace}`;
|
|
548
551
|
}
|
|
549
552
|
if (docker.containerEnvironment?.kubernetesPod) {
|
|
550
|
-
guidance += `
|
|
553
|
+
guidance += `
|
|
551
554
|
Pod: ${docker.containerEnvironment.kubernetesPod}`;
|
|
552
555
|
}
|
|
553
556
|
if (docker.containerEnvironment?.kubernetesNode) {
|
|
554
|
-
guidance += `
|
|
557
|
+
guidance += `
|
|
555
558
|
Node: ${docker.containerEnvironment.kubernetesNode}`;
|
|
556
559
|
}
|
|
557
560
|
}
|
|
558
561
|
else if (docker.containerType === 'docker') {
|
|
559
|
-
guidance += `
|
|
562
|
+
guidance += `
|
|
560
563
|
This Desktop Commander instance is running inside a Docker container.`;
|
|
561
564
|
if (docker.orchestrator === 'docker-compose') {
|
|
562
565
|
guidance += ` (Docker Compose)`;
|
|
@@ -566,80 +569,81 @@ This Desktop Commander instance is running inside a Docker container.`;
|
|
|
566
569
|
}
|
|
567
570
|
}
|
|
568
571
|
else {
|
|
569
|
-
guidance += `
|
|
572
|
+
guidance += `
|
|
570
573
|
This Desktop Commander instance is running inside a ${docker.containerType || 'container'} environment.`;
|
|
571
574
|
}
|
|
572
575
|
if (docker.mountPoints.length > 0) {
|
|
573
|
-
guidance += `
|
|
574
|
-
|
|
575
|
-
AVAILABLE
|
|
576
|
+
guidance += `
|
|
577
|
+
|
|
578
|
+
AVAILABLE MOUNT LOCATIONS:`;
|
|
576
579
|
for (const mount of docker.mountPoints) {
|
|
577
580
|
const access = mount.readOnly ? '(read-only)' : '(read-write)';
|
|
578
|
-
|
|
579
|
-
|
|
581
|
+
const verification = mount.verifiedMount ? '[verified mount]' : '[unverified candidate]';
|
|
582
|
+
guidance += `
|
|
583
|
+
- ${mount.containerPath} ${access} ${verification} - ${mount.description}`;
|
|
580
584
|
}
|
|
581
|
-
guidance += `
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
PATH TRANSLATION IN DOCKER:
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
Windows: "C:\\projects\\data\\file.txt" → "/home/projects/data/file.txt"
|
|
591
|
-
Linux/Mac: "/Users/john/projects/data/file.txt" → "/home/projects/data/file.txt"
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
585
|
+
guidance += `
|
|
586
|
+
|
|
587
|
+
Entries marked [verified mount] are suitable for persistent file work.
|
|
588
|
+
Entries marked [unverified candidate] are inferred from common container paths and may not persist.
|
|
589
|
+
Files outside verified mounts may be lost when the container stops.
|
|
590
|
+
|
|
591
|
+
PATH TRANSLATION IN DOCKER:
|
|
592
|
+
Host paths may require translation to their corresponding container paths:
|
|
593
|
+
|
|
594
|
+
Windows: "C:\\projects\\data\\file.txt" → "/home/projects/data/file.txt"
|
|
595
|
+
Linux/Mac: "/Users/john/projects/data/file.txt" → "/home/projects/data/file.txt"
|
|
596
|
+
|
|
597
|
+
Typical translation removes the drive letter or user prefix, keeps the full folder structure, and maps it under /home/.
|
|
598
|
+
|
|
595
599
|
NOTE: Desktop Commander Docker installer mounts host folders to /home/[folder-name].`;
|
|
596
600
|
}
|
|
597
601
|
else {
|
|
598
|
-
guidance += `
|
|
599
|
-
|
|
600
|
-
⚠️ WARNING: No mounted directories detected.
|
|
601
|
-
Files created outside mounted volumes will be lost when the container stops.
|
|
602
|
-
|
|
602
|
+
guidance += `
|
|
603
|
+
|
|
604
|
+
⚠️ WARNING: No mounted directories detected.
|
|
605
|
+
Files created outside mounted volumes will be lost when the container stops.
|
|
606
|
+
Persistent file work requires a mounted directory, available through the Docker installer or a -v mount.
|
|
603
607
|
Desktop Commander Docker installer typically mounts folders to /home/[folder-name].`;
|
|
604
608
|
}
|
|
605
609
|
if (docker.containerEnvironment?.containerName) {
|
|
606
|
-
guidance += `
|
|
610
|
+
guidance += `
|
|
607
611
|
Container: ${docker.containerEnvironment.containerName}`;
|
|
608
612
|
}
|
|
609
613
|
}
|
|
610
614
|
if (isWindows) {
|
|
611
|
-
guidance += `
|
|
612
|
-
|
|
613
|
-
WINDOWS-SPECIFIC TROUBLESHOOTING:
|
|
614
|
-
- If Node.js/Python commands fail with "not recognized" errors:
|
|
615
|
-
*
|
|
616
|
-
* PowerShell may have execution policy restrictions for some tools
|
|
617
|
-
* CMD typically has better compatibility with development tools
|
|
618
|
-
*
|
|
619
|
-
- Windows services and processes use different commands (Get-Process vs ps)
|
|
620
|
-
- Package managers: choco, winget, scoop instead of apt/brew
|
|
621
|
-
- Environment variables: $env:VAR instead of $VAR
|
|
615
|
+
guidance += `
|
|
616
|
+
|
|
617
|
+
WINDOWS-SPECIFIC TROUBLESHOOTING:
|
|
618
|
+
- If Node.js/Python commands fail with "not recognized" errors:
|
|
619
|
+
* Alternative shells include "cmd" and "powershell.exe"
|
|
620
|
+
* PowerShell may have execution policy restrictions for some tools
|
|
621
|
+
* CMD typically has better compatibility with development tools
|
|
622
|
+
* defaultShell can be changed with set_config_value if needed
|
|
623
|
+
- Windows services and processes use different commands (Get-Process vs ps)
|
|
624
|
+
- Package managers: choco, winget, scoop instead of apt/brew
|
|
625
|
+
- Environment variables: $env:VAR instead of $VAR
|
|
622
626
|
- File permissions work differently than Unix systems`;
|
|
623
627
|
}
|
|
624
628
|
else if (systemInfo.isMacOS) {
|
|
625
|
-
guidance += `
|
|
626
|
-
|
|
627
|
-
MACOS-SPECIFIC NOTES:
|
|
628
|
-
- Package manager: brew (Homebrew) is commonly used
|
|
629
|
-
- Python 3 might be 'python3' command, not 'python'
|
|
630
|
-
- Some GNU tools have different names (e.g., gsed instead of sed)
|
|
631
|
-
- System Integrity Protection (SIP) may block certain operations
|
|
632
|
-
-
|
|
633
|
-
-
|
|
629
|
+
guidance += `
|
|
630
|
+
|
|
631
|
+
MACOS-SPECIFIC NOTES:
|
|
632
|
+
- Package manager: brew (Homebrew) is commonly used
|
|
633
|
+
- Python 3 might be 'python3' command, not 'python'
|
|
634
|
+
- Some GNU tools have different names (e.g., gsed instead of sed)
|
|
635
|
+
- System Integrity Protection (SIP) may block certain operations
|
|
636
|
+
- The 'open' command opens files and applications from the terminal
|
|
637
|
+
- mdfind (Spotlight) provides fast exact filename searches`;
|
|
634
638
|
}
|
|
635
639
|
else {
|
|
636
|
-
guidance += `
|
|
637
|
-
|
|
638
|
-
LINUX-SPECIFIC NOTES:
|
|
639
|
-
- Package managers vary by distro: apt, yum, dnf, pacman, zypper
|
|
640
|
-
- Python 3 might be 'python3' command, not 'python'
|
|
641
|
-
- Standard Unix shell tools available (grep, awk, sed, etc.)
|
|
642
|
-
- File permissions and ownership important for many operations
|
|
640
|
+
guidance += `
|
|
641
|
+
|
|
642
|
+
LINUX-SPECIFIC NOTES:
|
|
643
|
+
- Package managers vary by distro: apt, yum, dnf, pacman, zypper
|
|
644
|
+
- Python 3 might be 'python3' command, not 'python'
|
|
645
|
+
- Standard Unix shell tools available (grep, awk, sed, etc.)
|
|
646
|
+
- File permissions and ownership important for many operations
|
|
643
647
|
- Systemd services common on modern distributions`;
|
|
644
648
|
}
|
|
645
649
|
return guidance;
|
|
@@ -654,44 +658,44 @@ export function getDevelopmentToolGuidance(systemInfo) {
|
|
|
654
658
|
? `Node.js: v${nodeInfo.version} (${nodeInfo.path})${nodeInfo.npmVersion ? ` | npm: v${nodeInfo.npmVersion}` : ''}`
|
|
655
659
|
: 'Node.js: Not detected';
|
|
656
660
|
// Add process environment info
|
|
657
|
-
const envInfo = `
|
|
658
|
-
Current Process Environment:
|
|
659
|
-
- Node: v${processInfo.versions.node}
|
|
660
|
-
- V8: v${processInfo.versions.v8}
|
|
661
|
-
- Architecture: ${processInfo.arch}
|
|
662
|
-
- Platform: ${processInfo.platform}
|
|
661
|
+
const envInfo = `
|
|
662
|
+
Current Process Environment:
|
|
663
|
+
- Node: v${processInfo.versions.node}
|
|
664
|
+
- V8: v${processInfo.versions.v8}
|
|
665
|
+
- Architecture: ${processInfo.arch}
|
|
666
|
+
- Platform: ${processInfo.platform}
|
|
663
667
|
- Process ID: ${processInfo.pid}`;
|
|
664
668
|
if (isWindows) {
|
|
665
|
-
return `
|
|
666
|
-
COMMON WINDOWS DEVELOPMENT TOOLS:
|
|
667
|
-
- ${nodeGuidance}
|
|
668
|
-
- Python: May be 'python' or 'py' command, check both
|
|
669
|
-
- Git: Git Bash provides Unix-like environment
|
|
670
|
-
- WSL: Windows Subsystem for Linux available for Unix tools
|
|
671
|
-
- Visual Studio tools: cl, msbuild for C++ compilation
|
|
672
|
-
|
|
669
|
+
return `
|
|
670
|
+
COMMON WINDOWS DEVELOPMENT TOOLS:
|
|
671
|
+
- ${nodeGuidance}
|
|
672
|
+
- Python: May be 'python' or 'py' command, check both
|
|
673
|
+
- Git: Git Bash provides Unix-like environment
|
|
674
|
+
- WSL: Windows Subsystem for Linux available for Unix tools
|
|
675
|
+
- Visual Studio tools: cl, msbuild for C++ compilation
|
|
676
|
+
|
|
673
677
|
${envInfo}`;
|
|
674
678
|
}
|
|
675
679
|
else if (isMacOS) {
|
|
676
|
-
return `
|
|
677
|
-
COMMON MACOS DEVELOPMENT TOOLS:
|
|
678
|
-
- Xcode Command Line Tools: Required for many development tools
|
|
679
|
-
- Homebrew: Primary package manager for development tools
|
|
680
|
-
- ${nodeGuidance}
|
|
681
|
-
- Python: Usually python3, check if python points to Python 2
|
|
682
|
-
- Ruby: System Ruby available, rbenv/rvm for version management
|
|
683
|
-
|
|
680
|
+
return `
|
|
681
|
+
COMMON MACOS DEVELOPMENT TOOLS:
|
|
682
|
+
- Xcode Command Line Tools: Required for many development tools
|
|
683
|
+
- Homebrew: Primary package manager for development tools
|
|
684
|
+
- ${nodeGuidance}
|
|
685
|
+
- Python: Usually python3, check if python points to Python 2
|
|
686
|
+
- Ruby: System Ruby available, rbenv/rvm for version management
|
|
687
|
+
|
|
684
688
|
${envInfo}`;
|
|
685
689
|
}
|
|
686
690
|
else {
|
|
687
|
-
return `
|
|
688
|
-
COMMON LINUX DEVELOPMENT TOOLS:
|
|
689
|
-
- Package managers: Install tools via distribution package manager
|
|
690
|
-
- Python: Usually python3, python may point to Python 2
|
|
691
|
-
- ${nodeGuidance}
|
|
692
|
-
- Build tools: gcc, make typically available or easily installed
|
|
693
|
-
- Container tools: docker, podman common for development
|
|
694
|
-
|
|
691
|
+
return `
|
|
692
|
+
COMMON LINUX DEVELOPMENT TOOLS:
|
|
693
|
+
- Package managers: Install tools via distribution package manager
|
|
694
|
+
- Python: Usually python3, python may point to Python 2
|
|
695
|
+
- ${nodeGuidance}
|
|
696
|
+
- Build tools: gcc, make typically available or easily installed
|
|
697
|
+
- Container tools: docker, podman common for development
|
|
698
|
+
|
|
695
699
|
${envInfo}`;
|
|
696
700
|
}
|
|
697
701
|
}
|
|
@@ -699,16 +703,25 @@ ${envInfo}`;
|
|
|
699
703
|
* Get path guidance (simplified since paths are normalized)
|
|
700
704
|
*/
|
|
701
705
|
export function getPathGuidance(systemInfo) {
|
|
702
|
-
let guidance = `
|
|
706
|
+
let guidance = `Absolute paths are the most reliable because they do not depend on the current working directory. Paths are automatically normalized regardless of slash direction.`;
|
|
703
707
|
if (systemInfo.docker.isContainer && systemInfo.docker.mountPoints.length > 0) {
|
|
704
708
|
const containerLabel = systemInfo.docker.containerType === 'kubernetes' ? 'KUBERNETES' :
|
|
705
709
|
systemInfo.docker.containerType === 'docker' ? 'DOCKER' :
|
|
706
710
|
systemInfo.docker.containerType === 'podman' ? 'PODMAN' :
|
|
707
711
|
'CONTAINER';
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
+
const verifiedMounts = systemInfo.docker.mountPoints.filter(m => m.verifiedMount).map(m => m.containerPath);
|
|
713
|
+
const unverifiedCandidates = systemInfo.docker.mountPoints.filter(m => !m.verifiedMount).map(m => m.containerPath);
|
|
714
|
+
if (verifiedMounts.length > 0) {
|
|
715
|
+
guidance += `
|
|
716
|
+
|
|
717
|
+
🐳 ${containerLabel}: Verified mounts for persistent file operations: ${verifiedMounts.join(', ')}.
|
|
718
|
+
Files outside verified mounts may not persist after the container stops.`;
|
|
719
|
+
}
|
|
720
|
+
if (unverifiedCandidates.length > 0) {
|
|
721
|
+
guidance += `
|
|
722
|
+
|
|
723
|
+
🐳 ${containerLabel}: Unverified mount candidates: ${unverifiedCandidates.join(', ')}. These paths are inferred from common container directories and may not persist.`;
|
|
724
|
+
}
|
|
712
725
|
}
|
|
713
726
|
return guidance;
|
|
714
727
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { formatWithOptions } from 'node:util';
|
|
2
|
+
/** Prefix human-readable console output only; stdout also carries MCP JSON-RPC. */
|
|
3
|
+
export function startTerminalTimestamps() {
|
|
4
|
+
const methods = ['log', 'info', 'warn', 'error', 'debug'];
|
|
5
|
+
const originals = methods.map((method) => [method, console[method]]);
|
|
6
|
+
for (const [method, original] of originals) {
|
|
7
|
+
console[method] = (...args) => {
|
|
8
|
+
const time = new Date().toTimeString().slice(0, 8);
|
|
9
|
+
const stream = method === 'warn' || method === 'error' ? process.stderr : process.stdout;
|
|
10
|
+
const message = formatWithOptions({ colors: stream.isTTY === true }, ...args);
|
|
11
|
+
original.call(console, message.split('\n').map((line) => line ? `[${time}] ${line}` : line).join('\n'));
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return () => {
|
|
15
|
+
for (const [method, original] of originals)
|
|
16
|
+
console[method] = original;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -16,11 +16,6 @@ export interface ToolUsageStats {
|
|
|
16
16
|
lastFeedbackPromptDate?: string;
|
|
17
17
|
feedbackAttempts?: number;
|
|
18
18
|
}
|
|
19
|
-
export interface OnboardingState {
|
|
20
|
-
promptsUsed: boolean;
|
|
21
|
-
attemptsShown: number;
|
|
22
|
-
lastShownAt: number;
|
|
23
|
-
}
|
|
24
19
|
export interface UsageSession {
|
|
25
20
|
sessionStart: number;
|
|
26
21
|
lastActivity: number;
|
|
@@ -85,41 +80,7 @@ declare class UsageTracker {
|
|
|
85
80
|
* Get usage summary for debugging/admin purposes
|
|
86
81
|
*/
|
|
87
82
|
getUsageSummary(): Promise<string>;
|
|
88
|
-
/**
|
|
89
|
-
* Get onboarding state from config
|
|
90
|
-
*/
|
|
91
|
-
getOnboardingState(): Promise<OnboardingState>;
|
|
92
|
-
/**
|
|
93
|
-
* Save onboarding state to config
|
|
94
|
-
*/
|
|
95
|
-
saveOnboardingState(state: OnboardingState): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Check if user should see onboarding invitation - SIMPLE VERSION
|
|
98
|
-
*/
|
|
99
|
-
shouldShowOnboarding(): Promise<boolean>;
|
|
100
|
-
/**
|
|
101
|
-
* Get onboarding message for new users - DIRECT 5-OPTION LIST (V2)
|
|
102
|
-
*/
|
|
103
|
-
getOnboardingMessage(): Promise<{
|
|
104
|
-
variant: string;
|
|
105
|
-
message: string;
|
|
106
|
-
}>;
|
|
107
|
-
/**
|
|
108
|
-
* Mark that onboarding message was shown - SIMPLE VERSION
|
|
109
|
-
*/
|
|
110
|
-
markOnboardingShown(variant: string): Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* Mark that user used prompts after seeing onboarding invitation - SIMPLE VERSION
|
|
113
|
-
*/
|
|
114
|
-
markOnboardingPromptsUsed(): Promise<void>;
|
|
115
|
-
/**
|
|
116
|
-
* Mark that user has used a specific prompt (for analytics)
|
|
117
|
-
*/
|
|
118
83
|
markPromptUsed(promptId: string, category: string): Promise<void>;
|
|
119
|
-
/**
|
|
120
|
-
* Reset onboarding state for testing purposes - SIMPLE VERSION
|
|
121
|
-
*/
|
|
122
|
-
resetOnboardingState(): Promise<void>;
|
|
123
84
|
}
|
|
124
85
|
export declare const usageTracker: UsageTracker;
|
|
125
86
|
export {};
|