@wonderwhy-er/desktop-commander 0.2.47 → 0.2.50
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 +35 -13
- package/dist/config-manager.d.ts +25 -35
- package/dist/config-manager.js +196 -95
- package/dist/npm-scripts/remote.js +35 -2
- package/dist/remote-device/desktop-commander-integration.d.ts +26 -0
- package/dist/remote-device/desktop-commander-integration.js +78 -4
- package/dist/remote-device/device.d.ts +10 -0
- package/dist/remote-device/device.js +95 -8
- package/dist/remote-device/remote-channel.d.ts +25 -17
- package/dist/remote-device/remote-channel.js +264 -77
- package/dist/server.js +6 -4
- package/dist/setup-claude-server.js +1 -1
- package/dist/terminal-manager.js +39 -0
- package/dist/tools/edit.js +13 -1
- package/dist/tools/process.d.ts +15 -1
- package/dist/tools/process.js +44 -13
- package/dist/uninstall-claude-server.js +0 -15
- package/dist/utils/files/text.d.ts +1 -0
- package/dist/utils/files/text.js +38 -8
- package/dist/utils/usageTracker.d.ts +0 -8
- package/dist/utils/usageTracker.js +52 -53
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
- package/dist/utils/mcp-ui.d.ts +0 -7
- package/dist/utils/mcp-ui.js +0 -22
package/dist/tools/process.js
CHANGED
|
@@ -3,22 +3,53 @@ import { promisify } from 'util';
|
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import { KillProcessArgsSchema } from './schemas.js';
|
|
5
5
|
const execAsync = promisify(exec);
|
|
6
|
+
/**
|
|
7
|
+
* Parse `tasklist /FO CSV /NH` output (#662). Fields per row, all quoted:
|
|
8
|
+
* [Image Name, PID, Session Name, Session#, Mem Usage]. CSV instead of the
|
|
9
|
+
* default table: image names can contain spaces and Mem Usage contains
|
|
10
|
+
* thousands separators, so positional whitespace splitting can't work.
|
|
11
|
+
* tasklist has no live per-process CPU%, so cpu is reported as n/a.
|
|
12
|
+
*/
|
|
13
|
+
export function parseWindowsTasklistCsv(stdout) {
|
|
14
|
+
return stdout.split(/\r?\n/)
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.map(line => {
|
|
17
|
+
const fields = (line.match(/"([^"]*)"/g) || []).map(f => f.slice(1, -1));
|
|
18
|
+
return {
|
|
19
|
+
pid: parseInt(fields[1], 10),
|
|
20
|
+
command: fields[0] ?? '',
|
|
21
|
+
cpu: 'n/a',
|
|
22
|
+
memory: fields[4] ?? '',
|
|
23
|
+
};
|
|
24
|
+
})
|
|
25
|
+
.filter(p => !Number.isNaN(p.pid));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse `ps aux` output: 11 whitespace-separated columns, COMMAND from
|
|
29
|
+
* column 10 onward (it can contain spaces, so it must be rejoined, not
|
|
30
|
+
* taken as the last token).
|
|
31
|
+
*/
|
|
32
|
+
export function parsePsAux(stdout) {
|
|
33
|
+
return stdout.split(/\r?\n/)
|
|
34
|
+
.slice(1)
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.map(line => {
|
|
37
|
+
const parts = line.trim().split(/\s+/);
|
|
38
|
+
return {
|
|
39
|
+
pid: parseInt(parts[1], 10),
|
|
40
|
+
command: parts.slice(10).join(' ') || parts[parts.length - 1],
|
|
41
|
+
cpu: parts[2],
|
|
42
|
+
memory: parts[3],
|
|
43
|
+
};
|
|
44
|
+
})
|
|
45
|
+
.filter(p => !Number.isNaN(p.pid));
|
|
46
|
+
}
|
|
6
47
|
export async function listProcesses() {
|
|
7
|
-
const
|
|
48
|
+
const isWindows = os.platform() === 'win32';
|
|
49
|
+
const command = isWindows ? 'tasklist /FO CSV /NH' : 'ps aux';
|
|
8
50
|
try {
|
|
9
51
|
const { stdout } = await execAsync(command);
|
|
10
|
-
const processes = stdout
|
|
11
|
-
.slice(1)
|
|
12
|
-
.filter(Boolean)
|
|
13
|
-
.map(line => {
|
|
14
|
-
const parts = line.split(/\s+/);
|
|
15
|
-
return {
|
|
16
|
-
pid: parseInt(parts[1]),
|
|
17
|
-
command: parts[parts.length - 1],
|
|
18
|
-
cpu: parts[2],
|
|
19
|
-
memory: parts[3],
|
|
20
|
-
};
|
|
21
|
-
});
|
|
52
|
+
const processes = isWindows ? parseWindowsTasklistCsv(stdout) : parsePsAux(stdout);
|
|
22
53
|
return {
|
|
23
54
|
content: [{
|
|
24
55
|
type: "text",
|
|
@@ -693,12 +693,6 @@ export default async function uninstall() {
|
|
|
693
693
|
logToFile('\nIf you want to reinstall later, you can run:');
|
|
694
694
|
logToFile('npx @wonderwhy-er/desktop-commander@latest setup');
|
|
695
695
|
|
|
696
|
-
logToFile('\n🎁 We\'re sorry to see you leaving, we’d love to understand your decision not to use Desktop Commander.')
|
|
697
|
-
logToFile('In return for a brief 30-minute call, we’ll send you a $20 Amazon gift card as a thank-you.');
|
|
698
|
-
logToFile('To get a gift card, please fill out this form:');
|
|
699
|
-
logToFile(' https://tally.so/r/w8lyRo');
|
|
700
|
-
|
|
701
|
-
|
|
702
696
|
logToFile('\nThank you for using Desktop Commander! 👋\n');
|
|
703
697
|
|
|
704
698
|
// Send final tracking event
|
|
@@ -712,11 +706,6 @@ export default async function uninstall() {
|
|
|
712
706
|
logToFile('You may need to manually remove Desktop Commander from Claude\'s configuration.');
|
|
713
707
|
logToFile(`Configuration file location: ${claudeConfigPath}\n`);
|
|
714
708
|
|
|
715
|
-
logToFile('\n🎁 We\'re sorry to see you leaving, we\'d love to understand your decision not to use Desktop Commander.')
|
|
716
|
-
logToFile('In return for a brief 30-minute call, we\'ll send you a $20 Amazon gift card as a thank-you.');
|
|
717
|
-
logToFile('To get a gift card, please fill out this form:');
|
|
718
|
-
logToFile(' https://tally.so/r/w8lyRo');
|
|
719
|
-
|
|
720
709
|
await ensureTrackingCompleted('uninstall_partial_failure');
|
|
721
710
|
|
|
722
711
|
return false;
|
|
@@ -735,10 +724,6 @@ export default async function uninstall() {
|
|
|
735
724
|
logToFile('You may need to manually remove Desktop Commander from Claude\'s configuration.');
|
|
736
725
|
logToFile(`Configuration file location: ${claudeConfigPath}\n`);
|
|
737
726
|
|
|
738
|
-
logToFile('\n🎁 We\'re sorry to see you leaving, we\'d love to understand your decision not to use Desktop Commander.')
|
|
739
|
-
logToFile('In return for a brief 30-minute call, we\'ll send you a $20 Amazon gift card as a thank-you.');
|
|
740
|
-
logToFile('To get a gift card, please fill out this form:');
|
|
741
|
-
logToFile('https://tally.so/r/w8lyRo');
|
|
742
727
|
return false;
|
|
743
728
|
}
|
|
744
729
|
}
|
|
@@ -19,6 +19,7 @@ import { FileHandler, ReadOptions, FileResult, FileInfo } from './base.js';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class TextFileHandler implements FileHandler {
|
|
21
21
|
canHandle(_path: string): boolean;
|
|
22
|
+
private detectTextEncoding;
|
|
22
23
|
read(filePath: string, options?: ReadOptions): Promise<FileResult>;
|
|
23
24
|
write(path: string, content: string, mode?: 'rewrite' | 'append'): Promise<void>;
|
|
24
25
|
getInfo(path: string): Promise<FileInfo>;
|
package/dist/utils/files/text.js
CHANGED
|
@@ -38,6 +38,20 @@ export class TextFileHandler {
|
|
|
38
38
|
// The factory routes binary files to BinaryFileHandler before reaching here
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
|
+
async detectTextEncoding(filePath) {
|
|
42
|
+
const fd = await fs.open(filePath, 'r');
|
|
43
|
+
try {
|
|
44
|
+
const bom = Buffer.alloc(2);
|
|
45
|
+
const { bytesRead } = await fd.read(bom, 0, bom.length, 0);
|
|
46
|
+
if (bytesRead === 2 && bom[0] === 0xff && bom[1] === 0xfe) {
|
|
47
|
+
return 'utf16le';
|
|
48
|
+
}
|
|
49
|
+
return 'utf8';
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
await fd.close();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
41
55
|
async read(filePath, options) {
|
|
42
56
|
const offset = options?.offset ?? 0;
|
|
43
57
|
const length = options?.length ?? 1000; // Default from config
|
|
@@ -69,7 +83,11 @@ export class TextFileHandler {
|
|
|
69
83
|
// For text files that aren't too large, count lines
|
|
70
84
|
if (stats.isFile() && stats.size < FILE_SIZE_LIMITS.LINE_COUNT_LIMIT) {
|
|
71
85
|
try {
|
|
72
|
-
const
|
|
86
|
+
const encoding = await this.detectTextEncoding(path);
|
|
87
|
+
let content = await fs.readFile(path, encoding);
|
|
88
|
+
if (encoding === 'utf16le' && content.charCodeAt(0) === 0xfeff) {
|
|
89
|
+
content = content.slice(1);
|
|
90
|
+
}
|
|
73
91
|
const lineCount = TextFileHandler.countLines(content);
|
|
74
92
|
info.metadata.lineCount = lineCount;
|
|
75
93
|
}
|
|
@@ -100,11 +118,14 @@ export class TextFileHandler {
|
|
|
100
118
|
/**
|
|
101
119
|
* Get file line count (for files under size limit)
|
|
102
120
|
*/
|
|
103
|
-
async getFileLineCount(filePath, signal) {
|
|
121
|
+
async getFileLineCount(filePath, signal, encoding = 'utf8') {
|
|
104
122
|
try {
|
|
105
123
|
const stats = await fs.stat(filePath);
|
|
106
124
|
if (stats.size < FILE_SIZE_LIMITS.LINE_COUNT_LIMIT) {
|
|
107
|
-
|
|
125
|
+
let content = await fs.readFile(filePath, { encoding, signal });
|
|
126
|
+
if (encoding === 'utf16le' && content.charCodeAt(0) === 0xfeff) {
|
|
127
|
+
content = content.slice(1);
|
|
128
|
+
}
|
|
108
129
|
return TextFileHandler.countLines(content);
|
|
109
130
|
}
|
|
110
131
|
}
|
|
@@ -182,7 +203,16 @@ export class TextFileHandler {
|
|
|
182
203
|
async readFileWithSmartPositioning(filePath, offset, length, mimeType, includeStatusMessage = true, signal) {
|
|
183
204
|
const stats = await fs.stat(filePath);
|
|
184
205
|
const fileSize = stats.size;
|
|
185
|
-
const
|
|
206
|
+
const encoding = await this.detectTextEncoding(filePath);
|
|
207
|
+
const totalLines = await this.getFileLineCount(filePath, signal, encoding);
|
|
208
|
+
// UTF-16LE needs character-aware streaming. Skip the two-byte BOM and keep
|
|
209
|
+
// the same line pagination/status semantics as ordinary text reads.
|
|
210
|
+
if (encoding === 'utf16le') {
|
|
211
|
+
if (offset < 0) {
|
|
212
|
+
return await this.readFromEndWithReadline(filePath, Math.abs(offset), mimeType, includeStatusMessage, totalLines, signal, 'utf16le', 2);
|
|
213
|
+
}
|
|
214
|
+
return await this.readFromStartWithReadline(filePath, offset, length, mimeType, includeStatusMessage, totalLines, signal, 'utf16le', 2);
|
|
215
|
+
}
|
|
186
216
|
// For negative offsets (tail behavior), use reverse reading
|
|
187
217
|
if (offset < 0) {
|
|
188
218
|
const requestedLines = Math.abs(offset);
|
|
@@ -252,9 +282,9 @@ export class TextFileHandler {
|
|
|
252
282
|
/**
|
|
253
283
|
* Read from end using readline with circular buffer
|
|
254
284
|
*/
|
|
255
|
-
async readFromEndWithReadline(filePath, requestedLines, mimeType, includeStatusMessage = true, fileTotalLines, signal) {
|
|
285
|
+
async readFromEndWithReadline(filePath, requestedLines, mimeType, includeStatusMessage = true, fileTotalLines, signal, encoding, start) {
|
|
256
286
|
const rl = createInterface({
|
|
257
|
-
input: createReadStream(filePath, { signal }),
|
|
287
|
+
input: createReadStream(filePath, { signal, encoding, start }),
|
|
258
288
|
crlfDelay: Infinity
|
|
259
289
|
});
|
|
260
290
|
const buffer = new Array(requestedLines);
|
|
@@ -284,9 +314,9 @@ export class TextFileHandler {
|
|
|
284
314
|
/**
|
|
285
315
|
* Read from start/middle using readline
|
|
286
316
|
*/
|
|
287
|
-
async readFromStartWithReadline(filePath, offset, length, mimeType, includeStatusMessage = true, fileTotalLines, signal) {
|
|
317
|
+
async readFromStartWithReadline(filePath, offset, length, mimeType, includeStatusMessage = true, fileTotalLines, signal, encoding, start) {
|
|
288
318
|
const rl = createInterface({
|
|
289
|
-
input: createReadStream(filePath, { signal }),
|
|
319
|
+
input: createReadStream(filePath, { signal, encoding, start }),
|
|
290
320
|
crlfDelay: Infinity
|
|
291
321
|
});
|
|
292
322
|
const result = [];
|
|
@@ -37,14 +37,6 @@ declare class UsageTracker {
|
|
|
37
37
|
* Get current usage stats from config
|
|
38
38
|
*/
|
|
39
39
|
getStats(): Promise<ToolUsageStats>;
|
|
40
|
-
/**
|
|
41
|
-
* Save usage stats to config.
|
|
42
|
-
* Non-blocking: the tool-call return path must not wait on a disk write. The
|
|
43
|
-
* in-memory stats are already updated by the caller (getStats returns the live
|
|
44
|
-
* config object), so persistence is coalesced in the background. This is what
|
|
45
|
-
* keeps a saturated libuv threadpool from gating tool responses on every call.
|
|
46
|
-
*/
|
|
47
|
-
private saveStats;
|
|
48
40
|
/**
|
|
49
41
|
* Determine which category a tool belongs to
|
|
50
42
|
*/
|
|
@@ -44,16 +44,6 @@ class UsageTracker {
|
|
|
44
44
|
const stats = await configManager.getValue('usageStats');
|
|
45
45
|
return stats || this.getDefaultStats();
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Save usage stats to config.
|
|
49
|
-
* Non-blocking: the tool-call return path must not wait on a disk write. The
|
|
50
|
-
* in-memory stats are already updated by the caller (getStats returns the live
|
|
51
|
-
* config object), so persistence is coalesced in the background. This is what
|
|
52
|
-
* keeps a saturated libuv threadpool from gating tool responses on every call.
|
|
53
|
-
*/
|
|
54
|
-
async saveStats(stats) {
|
|
55
|
-
await configManager.setValueNonBlocking('usageStats', stats);
|
|
56
|
-
}
|
|
57
47
|
/**
|
|
58
48
|
* Determine which category a tool belongs to
|
|
59
49
|
*/
|
|
@@ -104,51 +94,53 @@ class UsageTracker {
|
|
|
104
94
|
* Track a successful tool call
|
|
105
95
|
*/
|
|
106
96
|
async trackSuccess(toolName) {
|
|
107
|
-
const stats = await this.getStats();
|
|
108
|
-
// Update session
|
|
109
97
|
this.updateSession();
|
|
110
|
-
|
|
111
|
-
stats.totalToolCalls++;
|
|
112
|
-
stats.successfulCalls++;
|
|
113
|
-
stats.lastUsed = Date.now();
|
|
114
|
-
// Update tool-specific counter
|
|
115
|
-
stats.toolCounts[toolName] = (stats.toolCounts[toolName] || 0) + 1;
|
|
116
|
-
// Update category counter
|
|
98
|
+
const now = Date.now();
|
|
117
99
|
const category = this.getToolCategory(toolName);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
100
|
+
const newSession = this.currentSession?.commandsInSession === 1;
|
|
101
|
+
return await configManager.updateValueNonBlocking('usageStats', (stored) => {
|
|
102
|
+
const defaults = { ...this.getDefaultStats(), firstUsed: now, lastUsed: now };
|
|
103
|
+
const stats = {
|
|
104
|
+
...defaults,
|
|
105
|
+
...(stored || {}),
|
|
106
|
+
toolCounts: { ...(stored?.toolCounts || {}) },
|
|
107
|
+
};
|
|
108
|
+
stats.totalToolCalls++;
|
|
109
|
+
stats.successfulCalls++;
|
|
110
|
+
stats.lastUsed = Math.max(stats.lastUsed || 0, now);
|
|
111
|
+
stats.toolCounts[toolName] = (stats.toolCounts[toolName] || 0) + 1;
|
|
112
|
+
if (category)
|
|
113
|
+
stats[category]++;
|
|
114
|
+
if (newSession)
|
|
115
|
+
stats.totalSessions++;
|
|
116
|
+
return stats;
|
|
117
|
+
});
|
|
127
118
|
}
|
|
128
119
|
/**
|
|
129
120
|
* Track a failed tool call
|
|
130
121
|
*/
|
|
131
122
|
async trackFailure(toolName) {
|
|
132
|
-
const stats = await this.getStats();
|
|
133
|
-
// Update session
|
|
134
123
|
this.updateSession();
|
|
135
|
-
|
|
136
|
-
stats.totalToolCalls++;
|
|
137
|
-
stats.failedCalls++;
|
|
138
|
-
stats.lastUsed = Date.now();
|
|
139
|
-
// Update tool-specific counter (we count failures too)
|
|
140
|
-
stats.toolCounts[toolName] = (stats.toolCounts[toolName] || 0) + 1;
|
|
141
|
-
// Update category counter
|
|
124
|
+
const now = Date.now();
|
|
142
125
|
const category = this.getToolCategory(toolName);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
126
|
+
const newSession = this.currentSession?.commandsInSession === 1;
|
|
127
|
+
return await configManager.updateValueNonBlocking('usageStats', (stored) => {
|
|
128
|
+
const defaults = { ...this.getDefaultStats(), firstUsed: now, lastUsed: now };
|
|
129
|
+
const stats = {
|
|
130
|
+
...defaults,
|
|
131
|
+
...(stored || {}),
|
|
132
|
+
toolCounts: { ...(stored?.toolCounts || {}) },
|
|
133
|
+
};
|
|
134
|
+
stats.totalToolCalls++;
|
|
135
|
+
stats.failedCalls++;
|
|
136
|
+
stats.lastUsed = Math.max(stats.lastUsed || 0, now);
|
|
137
|
+
stats.toolCounts[toolName] = (stats.toolCounts[toolName] || 0) + 1;
|
|
138
|
+
if (category)
|
|
139
|
+
stats[category]++;
|
|
140
|
+
if (newSession)
|
|
141
|
+
stats.totalSessions++;
|
|
142
|
+
return stats;
|
|
143
|
+
});
|
|
152
144
|
}
|
|
153
145
|
/**
|
|
154
146
|
* Check if user should be prompted for feedback based on usage patterns
|
|
@@ -258,16 +250,23 @@ class UsageTracker {
|
|
|
258
250
|
* Mark that user was prompted for feedback
|
|
259
251
|
*/
|
|
260
252
|
async markFeedbackPrompted() {
|
|
261
|
-
const
|
|
262
|
-
const today = new Date().toISOString().split('T')[0];
|
|
263
|
-
stats.lastFeedbackPrompt = Date.now();
|
|
264
|
-
stats.lastFeedbackPromptDate = today;
|
|
265
|
-
stats.feedbackAttempts = (stats.feedbackAttempts || 0) + 1;
|
|
266
|
-
// Mark session so we don't prompt again this session
|
|
253
|
+
const now = Date.now();
|
|
254
|
+
const today = new Date(now).toISOString().split('T')[0];
|
|
267
255
|
if (this.currentSession) {
|
|
268
256
|
this.currentSession.promptedThisSession = true;
|
|
269
257
|
}
|
|
270
|
-
await
|
|
258
|
+
await configManager.updateValueNonBlocking('usageStats', (stored) => {
|
|
259
|
+
const defaults = { ...this.getDefaultStats(), firstUsed: now, lastUsed: now };
|
|
260
|
+
const stats = {
|
|
261
|
+
...defaults,
|
|
262
|
+
...(stored || {}),
|
|
263
|
+
toolCounts: { ...(stored?.toolCounts || {}) },
|
|
264
|
+
};
|
|
265
|
+
stats.lastFeedbackPrompt = Math.max(stats.lastFeedbackPrompt || 0, now);
|
|
266
|
+
stats.lastFeedbackPromptDate = today;
|
|
267
|
+
stats.feedbackAttempts = (stats.feedbackAttempts || 0) + 1;
|
|
268
|
+
return stats;
|
|
269
|
+
});
|
|
271
270
|
}
|
|
272
271
|
/**
|
|
273
272
|
* Mark that user has given feedback
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.
|
|
1
|
+
export declare const VERSION = "0.2.50";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.50';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderwhy-er/desktop-commander",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.50",
|
|
4
4
|
"description": "MCP server for terminal operations and file editing",
|
|
5
5
|
"mcpName": "io.github.wonderwhy-er/desktop-commander",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,9 +56,8 @@
|
|
|
56
56
|
"release:minor": "node scripts/publish-release.cjs --minor",
|
|
57
57
|
"release:major": "node scripts/publish-release.cjs --major",
|
|
58
58
|
"release:dry": "node scripts/publish-release.cjs --dry-run",
|
|
59
|
-
"release:
|
|
60
|
-
"release:alpha": "node scripts/publish-release.cjs --
|
|
61
|
-
"release:skip-mcp": "node scripts/publish-release.cjs --skip-mcp",
|
|
59
|
+
"release:rehearsal": "node scripts/publish-release.cjs --rehearsal",
|
|
60
|
+
"release:alpha": "node scripts/publish-release.cjs --alpha",
|
|
62
61
|
"logs:view": "npm run build && node scripts/view-fuzzy-logs.js",
|
|
63
62
|
"logs:analyze": "npm run build && node scripts/analyze-fuzzy-logs.js",
|
|
64
63
|
"logs:clear": "npm run build && node scripts/clear-fuzzy-logs.js",
|
|
@@ -113,6 +112,7 @@
|
|
|
113
112
|
"open": "^10.2.0",
|
|
114
113
|
"pdf-lib": "^1.17.1",
|
|
115
114
|
"pizzip": "^3.2.0",
|
|
115
|
+
"proper-lockfile": "^4.1.2",
|
|
116
116
|
"remark": "^15.0.1",
|
|
117
117
|
"remark-gfm": "^4.0.1",
|
|
118
118
|
"remark-parse": "^11.0.0",
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
"@anthropic-ai/mcpb": "^1.2.0",
|
|
131
131
|
"@modelcontextprotocol/ext-apps": "^1.0.1",
|
|
132
132
|
"@types/node": "^20.17.24",
|
|
133
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
133
134
|
"commander": "^13.1.0",
|
|
134
135
|
"esbuild": "^0.27.2",
|
|
135
136
|
"js-tiktoken": "^1.0.21",
|
package/dist/utils/mcp-ui.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether tools advertise interactive MCP UI widgets. Shown by default; a
|
|
3
|
-
* boolean showMcpUI config value is an explicit user override. Any non-boolean
|
|
4
|
-
* value (unset, or a stringly-typed "false") means the default applies.
|
|
5
|
-
*/
|
|
6
|
-
export declare function mcpUiEnabledFor(userOverride: unknown): boolean;
|
|
7
|
-
export declare function shouldShowMcpUi(): Promise<boolean>;
|
package/dist/utils/mcp-ui.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { configManager } from '../config-manager.js';
|
|
2
|
-
/**
|
|
3
|
-
* Whether tools advertise interactive MCP UI widgets. Shown by default; a
|
|
4
|
-
* boolean showMcpUI config value is an explicit user override. Any non-boolean
|
|
5
|
-
* value (unset, or a stringly-typed "false") means the default applies.
|
|
6
|
-
*/
|
|
7
|
-
export function mcpUiEnabledFor(userOverride) {
|
|
8
|
-
return typeof userOverride === 'boolean' ? userOverride : true;
|
|
9
|
-
}
|
|
10
|
-
// Decided once per server process: a session must render consistently. Flipping
|
|
11
|
-
// tool UI _meta mid-session confuses hosts (open widgets / other threads sharing
|
|
12
|
-
// this server see tools lose their UI), so config changes made while the server
|
|
13
|
-
// is running take effect on the next restart.
|
|
14
|
-
let sessionDecision = null;
|
|
15
|
-
export async function shouldShowMcpUi() {
|
|
16
|
-
if (!sessionDecision) {
|
|
17
|
-
sessionDecision = configManager.getValue('showMcpUI')
|
|
18
|
-
.then(mcpUiEnabledFor)
|
|
19
|
-
.catch(() => true);
|
|
20
|
-
}
|
|
21
|
-
return sessionDecision;
|
|
22
|
-
}
|