@trops/dash-core 0.1.650 → 0.1.651
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/dist/index.esm.js +43 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +43 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43140,10 +43140,51 @@ var ProviderDetail = function ProviderDetail(_ref) {
|
|
|
43140
43140
|
return _objectSpread$B(_objectSpread$B({}, prev), {}, _defineProperty({}, key, value));
|
|
43141
43141
|
});
|
|
43142
43142
|
};
|
|
43143
|
+
|
|
43144
|
+
// Pre-select: intersect with existing allowedTools, or select all
|
|
43145
|
+
var preselectTools = function preselectTools(tools) {
|
|
43146
|
+
var allToolNames = (tools || []).map(function (t) {
|
|
43147
|
+
return t.name;
|
|
43148
|
+
});
|
|
43149
|
+
if (provider !== null && provider !== void 0 && provider.allowedTools) {
|
|
43150
|
+
setSelectedTools(allToolNames.filter(function (t) {
|
|
43151
|
+
return provider.allowedTools.includes(t);
|
|
43152
|
+
}));
|
|
43153
|
+
} else {
|
|
43154
|
+
setSelectedTools(allToolNames);
|
|
43155
|
+
}
|
|
43156
|
+
};
|
|
43157
|
+
|
|
43158
|
+
// Test Connection never stops a server your dashboards are using: if the
|
|
43159
|
+
// provider is already connected, report it as is (saving a provider
|
|
43160
|
+
// restarts it, so it runs with the saved credentials). Only a server the
|
|
43161
|
+
// test itself started is stopped afterwards.
|
|
43143
43162
|
var handleTestConnection = function handleTestConnection() {
|
|
43144
43163
|
if (!dashApi || !(provider !== null && provider !== void 0 && provider.mcpConfig) || !providerName) return;
|
|
43145
43164
|
setIsTesting(true);
|
|
43146
43165
|
setTestResult(null);
|
|
43166
|
+
if (typeof dashApi.mcpGetServerStatus !== "function") {
|
|
43167
|
+
startTestServer();
|
|
43168
|
+
return;
|
|
43169
|
+
}
|
|
43170
|
+
dashApi.mcpGetServerStatus(providerName, function (event, status) {
|
|
43171
|
+
if (status && status.status === "connected") {
|
|
43172
|
+
var tools = status.tools || [];
|
|
43173
|
+
setTestResult({
|
|
43174
|
+
success: true,
|
|
43175
|
+
tools: tools,
|
|
43176
|
+
message: "Connected and in use. Found ".concat(tools.length, " tools.")
|
|
43177
|
+
});
|
|
43178
|
+
preselectTools(tools);
|
|
43179
|
+
setIsTesting(false);
|
|
43180
|
+
return;
|
|
43181
|
+
}
|
|
43182
|
+
startTestServer();
|
|
43183
|
+
}, function () {
|
|
43184
|
+
return startTestServer();
|
|
43185
|
+
});
|
|
43186
|
+
};
|
|
43187
|
+
var startTestServer = function startTestServer() {
|
|
43147
43188
|
dashApi.mcpStartServer(providerName, provider.mcpConfig, provider.credentials, function (event, result) {
|
|
43148
43189
|
if (result.error) {
|
|
43149
43190
|
setTestResult({
|
|
@@ -43158,20 +43199,9 @@ var ProviderDetail = function ProviderDetail(_ref) {
|
|
|
43158
43199
|
tools: result.tools || [],
|
|
43159
43200
|
message: "Connected! Found ".concat((result.tools || []).length, " tools.")
|
|
43160
43201
|
});
|
|
43202
|
+
preselectTools(result.tools);
|
|
43161
43203
|
|
|
43162
|
-
//
|
|
43163
|
-
var allToolNames = (result.tools || []).map(function (t) {
|
|
43164
|
-
return t.name;
|
|
43165
|
-
});
|
|
43166
|
-
if (provider !== null && provider !== void 0 && provider.allowedTools) {
|
|
43167
|
-
setSelectedTools(allToolNames.filter(function (t) {
|
|
43168
|
-
return provider.allowedTools.includes(t);
|
|
43169
|
-
}));
|
|
43170
|
-
} else {
|
|
43171
|
-
setSelectedTools(allToolNames);
|
|
43172
|
-
}
|
|
43173
|
-
|
|
43174
|
-
// Stop after test
|
|
43204
|
+
// Only the test was using it — stop it again.
|
|
43175
43205
|
dashApi.mcpStopServer(providerName, function () {}, function () {});
|
|
43176
43206
|
setIsTesting(false);
|
|
43177
43207
|
}, function (event, err) {
|