@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.esm.js
CHANGED
|
@@ -43122,10 +43122,51 @@ var ProviderDetail = function ProviderDetail(_ref) {
|
|
|
43122
43122
|
return _objectSpread$B(_objectSpread$B({}, prev), {}, _defineProperty({}, key, value));
|
|
43123
43123
|
});
|
|
43124
43124
|
};
|
|
43125
|
+
|
|
43126
|
+
// Pre-select: intersect with existing allowedTools, or select all
|
|
43127
|
+
var preselectTools = function preselectTools(tools) {
|
|
43128
|
+
var allToolNames = (tools || []).map(function (t) {
|
|
43129
|
+
return t.name;
|
|
43130
|
+
});
|
|
43131
|
+
if (provider !== null && provider !== void 0 && provider.allowedTools) {
|
|
43132
|
+
setSelectedTools(allToolNames.filter(function (t) {
|
|
43133
|
+
return provider.allowedTools.includes(t);
|
|
43134
|
+
}));
|
|
43135
|
+
} else {
|
|
43136
|
+
setSelectedTools(allToolNames);
|
|
43137
|
+
}
|
|
43138
|
+
};
|
|
43139
|
+
|
|
43140
|
+
// Test Connection never stops a server your dashboards are using: if the
|
|
43141
|
+
// provider is already connected, report it as is (saving a provider
|
|
43142
|
+
// restarts it, so it runs with the saved credentials). Only a server the
|
|
43143
|
+
// test itself started is stopped afterwards.
|
|
43125
43144
|
var handleTestConnection = function handleTestConnection() {
|
|
43126
43145
|
if (!dashApi || !(provider !== null && provider !== void 0 && provider.mcpConfig) || !providerName) return;
|
|
43127
43146
|
setIsTesting(true);
|
|
43128
43147
|
setTestResult(null);
|
|
43148
|
+
if (typeof dashApi.mcpGetServerStatus !== "function") {
|
|
43149
|
+
startTestServer();
|
|
43150
|
+
return;
|
|
43151
|
+
}
|
|
43152
|
+
dashApi.mcpGetServerStatus(providerName, function (event, status) {
|
|
43153
|
+
if (status && status.status === "connected") {
|
|
43154
|
+
var tools = status.tools || [];
|
|
43155
|
+
setTestResult({
|
|
43156
|
+
success: true,
|
|
43157
|
+
tools: tools,
|
|
43158
|
+
message: "Connected and in use. Found ".concat(tools.length, " tools.")
|
|
43159
|
+
});
|
|
43160
|
+
preselectTools(tools);
|
|
43161
|
+
setIsTesting(false);
|
|
43162
|
+
return;
|
|
43163
|
+
}
|
|
43164
|
+
startTestServer();
|
|
43165
|
+
}, function () {
|
|
43166
|
+
return startTestServer();
|
|
43167
|
+
});
|
|
43168
|
+
};
|
|
43169
|
+
var startTestServer = function startTestServer() {
|
|
43129
43170
|
dashApi.mcpStartServer(providerName, provider.mcpConfig, provider.credentials, function (event, result) {
|
|
43130
43171
|
if (result.error) {
|
|
43131
43172
|
setTestResult({
|
|
@@ -43140,20 +43181,9 @@ var ProviderDetail = function ProviderDetail(_ref) {
|
|
|
43140
43181
|
tools: result.tools || [],
|
|
43141
43182
|
message: "Connected! Found ".concat((result.tools || []).length, " tools.")
|
|
43142
43183
|
});
|
|
43184
|
+
preselectTools(result.tools);
|
|
43143
43185
|
|
|
43144
|
-
//
|
|
43145
|
-
var allToolNames = (result.tools || []).map(function (t) {
|
|
43146
|
-
return t.name;
|
|
43147
|
-
});
|
|
43148
|
-
if (provider !== null && provider !== void 0 && provider.allowedTools) {
|
|
43149
|
-
setSelectedTools(allToolNames.filter(function (t) {
|
|
43150
|
-
return provider.allowedTools.includes(t);
|
|
43151
|
-
}));
|
|
43152
|
-
} else {
|
|
43153
|
-
setSelectedTools(allToolNames);
|
|
43154
|
-
}
|
|
43155
|
-
|
|
43156
|
-
// Stop after test
|
|
43186
|
+
// Only the test was using it — stop it again.
|
|
43157
43187
|
dashApi.mcpStopServer(providerName, function () {}, function () {});
|
|
43158
43188
|
setIsTesting(false);
|
|
43159
43189
|
}, function (event, err) {
|