@hcu-lab.me/mcp-device 1.0.5 → 1.0.7
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 +7 -71
- package/dist/bootstrap.js +1 -1
- package/dist/config-manager.js +56 -19
- package/dist/config.js +1 -1
- package/dist/custom-stdio.js +1 -2
- package/dist/data/onboarding-prompts.json +22 -11
- package/dist/device/device-state.d.ts +2 -5
- package/dist/device/device-state.js +3 -85
- package/dist/device/device.d.ts +1 -1
- package/dist/device/device.js +69 -9
- package/dist/device/execution-engine.d.ts +11 -1
- package/dist/device/execution-engine.js +85 -126
- package/dist/device/gateway-channel.d.ts +19 -1
- package/dist/device/gateway-channel.js +107 -21
- package/dist/device/gateway-identity.d.ts +1 -0
- package/dist/device/gateway-identity.js +4 -0
- package/dist/device/gateway-tool-adapter.d.ts +3 -3
- package/dist/device/gateway-tool-adapter.js +12 -11
- package/dist/device/linux-service.d.ts +6 -0
- package/dist/device/linux-service.js +12 -5
- package/dist/device/runtime-owner.d.ts +1 -0
- package/dist/device/runtime-owner.js +6 -6
- package/dist/device/self-update.d.ts +107 -12
- package/dist/device/self-update.js +660 -62
- package/dist/device/update-helper.cjs +343 -0
- package/dist/device/windows-service.d.ts +3 -4
- package/dist/device/windows-service.js +5 -44
- package/dist/handlers/filesystem-handlers.js +3 -0
- package/dist/index.js +7 -3
- package/dist/npm-scripts/remote.d.ts +5 -0
- package/dist/npm-scripts/remote.js +50 -3
- package/dist/server.js +83 -167
- package/dist/terminal-manager.js +41 -1
- package/dist/tools/config.d.ts +1 -1
- package/dist/tools/filesystem.js +3 -3
- package/dist/tools/pdf/markdown.js +1 -1
- package/dist/tools/schemas.d.ts +2 -3
- package/dist/tools/schemas.js +0 -10
- package/dist/ui/config-editor/index.html +1 -1
- package/dist/ui/file-preview/index.html +1 -1
- package/dist/ui/file-preview/styles.css +2 -2
- package/dist/utils/capture.d.ts +5 -28
- package/dist/utils/capture.js +11 -455
- package/dist/utils/feature-flags.d.ts +0 -47
- package/dist/utils/feature-flags.js +5 -199
- package/dist/utils/files/docx.d.ts +2 -2
- package/dist/utils/files/docx.js +2 -2
- package/dist/utils/files/factory.js +20 -0
- package/dist/utils/files/text.d.ts +1 -0
- package/dist/utils/files/text.js +78 -34
- package/dist/utils/trackTools.js +23 -2
- package/dist/utils/usageTracker.js +2 -24
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -7
- package/dist/tools/feedback.d.ts +0 -8
- package/dist/tools/feedback.js +0 -132
package/dist/tools/feedback.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { usageTracker } from '../utils/usageTracker.js';
|
|
2
|
-
import { capture } from '../utils/capture.js';
|
|
3
|
-
import { configManager } from '../config-manager.js';
|
|
4
|
-
import { exec } from 'child_process';
|
|
5
|
-
import { promisify } from 'util';
|
|
6
|
-
import * as os from 'os';
|
|
7
|
-
const execAsync = promisify(exec);
|
|
8
|
-
/**
|
|
9
|
-
* Open feedback form in browser with optional pre-filled data
|
|
10
|
-
*/
|
|
11
|
-
export async function giveFeedbackToDesktopCommander(params = {}) {
|
|
12
|
-
try {
|
|
13
|
-
// Get usage stats for context
|
|
14
|
-
const stats = await usageTracker.getStats();
|
|
15
|
-
// Capture feedback tool usage event
|
|
16
|
-
await capture('feedback_tool_called', {
|
|
17
|
-
total_calls: stats.totalToolCalls,
|
|
18
|
-
successful_calls: stats.successfulCalls,
|
|
19
|
-
failed_calls: stats.failedCalls,
|
|
20
|
-
days_since_first_use: Math.floor((Date.now() - stats.firstUsed) / (1000 * 60 * 60 * 24)),
|
|
21
|
-
total_sessions: stats.totalSessions,
|
|
22
|
-
platform: os.platform(),
|
|
23
|
-
});
|
|
24
|
-
// Build Tally.so URL with pre-filled parameters
|
|
25
|
-
const tallyUrl = await buildTallyUrl(params, stats);
|
|
26
|
-
// Open URL in default browser
|
|
27
|
-
const success = await openUrlInBrowser(tallyUrl);
|
|
28
|
-
if (success) {
|
|
29
|
-
// Capture successful browser opening
|
|
30
|
-
await capture('feedback_form_opened_successfully', {
|
|
31
|
-
total_calls: stats.totalToolCalls,
|
|
32
|
-
platform: os.platform()
|
|
33
|
-
});
|
|
34
|
-
// Mark that user has given feedback (or at least opened the form)
|
|
35
|
-
await usageTracker.markFeedbackGiven();
|
|
36
|
-
return {
|
|
37
|
-
content: [{
|
|
38
|
-
type: "text",
|
|
39
|
-
text: `🎉 **Feedback form opened in your browser!**\n\n` +
|
|
40
|
-
`Thank you for taking the time to share your experience with MCP Device. ` +
|
|
41
|
-
`Your feedback helps us build better features and improve the tool for everyone.\n\n` +
|
|
42
|
-
`The form has been pre-filled with the information you provided. ` +
|
|
43
|
-
`You can modify or add any additional details before submitting.\n\n` +
|
|
44
|
-
`**Form URL**: ${tallyUrl.length > 100 ? tallyUrl.substring(0, 100) + '...' : tallyUrl}`
|
|
45
|
-
}]
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
// Capture browser opening failure
|
|
50
|
-
await capture('feedback_form_open_failed', {
|
|
51
|
-
total_calls: stats.totalToolCalls,
|
|
52
|
-
platform: os.platform(),
|
|
53
|
-
error_type: 'browser_open_failed'
|
|
54
|
-
});
|
|
55
|
-
return {
|
|
56
|
-
content: [{
|
|
57
|
-
type: "text",
|
|
58
|
-
text: `⚠️ **Couldn't open browser automatically**\n\n` +
|
|
59
|
-
`Please copy and paste this URL into your browser to access the feedback form:\n\n` +
|
|
60
|
-
`${tallyUrl}\n\n` +
|
|
61
|
-
`The form has been pre-filled with your information. Thank you for your feedback!`
|
|
62
|
-
}]
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
// Capture error event
|
|
68
|
-
await capture('feedback_tool_error', {
|
|
69
|
-
error_message: error instanceof Error ? error.message : String(error),
|
|
70
|
-
error_type: error instanceof Error ? error.constructor.name : 'unknown'
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
content: [{
|
|
74
|
-
type: "text",
|
|
75
|
-
text: `❌ **Error opening feedback form**: ${error instanceof Error ? error.message : String(error)}\n\n` +
|
|
76
|
-
`You can still access our feedback form directly at: https://tally.so/r/mKqoKg\n\n` +
|
|
77
|
-
`We appreciate your willingness to provide feedback!`
|
|
78
|
-
}],
|
|
79
|
-
isError: true
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Build Tally.so URL with pre-filled parameters
|
|
85
|
-
*/
|
|
86
|
-
async function buildTallyUrl(params, stats) {
|
|
87
|
-
const baseUrl = 'https://tally.so/r/mKqoKg';
|
|
88
|
-
const urlParams = new URLSearchParams();
|
|
89
|
-
// Only auto-filled hidden fields remain
|
|
90
|
-
urlParams.set('tool_call_count', stats.totalToolCalls.toString());
|
|
91
|
-
// Calculate days using
|
|
92
|
-
const daysUsing = Math.floor((Date.now() - stats.firstUsed) / (1000 * 60 * 60 * 24));
|
|
93
|
-
urlParams.set('days_using', daysUsing.toString());
|
|
94
|
-
// Add platform info
|
|
95
|
-
urlParams.set('platform', os.platform());
|
|
96
|
-
// Add client_id from analytics config
|
|
97
|
-
try {
|
|
98
|
-
const clientId = await configManager.getValue('clientId') || 'unknown';
|
|
99
|
-
urlParams.set('client_id', clientId);
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
// Fallback if config read fails
|
|
103
|
-
urlParams.set('client_id', 'unknown');
|
|
104
|
-
}
|
|
105
|
-
return `${baseUrl}?${urlParams.toString()}`;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Open URL in default browser (cross-platform)
|
|
109
|
-
*/
|
|
110
|
-
async function openUrlInBrowser(url) {
|
|
111
|
-
try {
|
|
112
|
-
const platform = os.platform();
|
|
113
|
-
let command;
|
|
114
|
-
switch (platform) {
|
|
115
|
-
case 'darwin': // macOS
|
|
116
|
-
command = `open "${url}"`;
|
|
117
|
-
break;
|
|
118
|
-
case 'win32': // Windows
|
|
119
|
-
command = `start "" "${url}"`;
|
|
120
|
-
break;
|
|
121
|
-
default: // Linux and others
|
|
122
|
-
command = `xdg-open "${url}"`;
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
await execAsync(command);
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
console.error('Failed to open browser:', error);
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
}
|