@trops/dash-core 0.1.511 → 0.1.512
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 +27 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +27 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -425,6 +425,7 @@ var WidgetApi = {
|
|
|
425
425
|
if (eApi) {
|
|
426
426
|
// remove the listeners (reset)
|
|
427
427
|
if ("removeAllListeners" in eApi) {
|
|
428
|
+
var _this$params;
|
|
428
429
|
eApi.removeAllListeners(eApi.events.DATA_SAVE_TO_FILE_COMPLETE);
|
|
429
430
|
eApi.removeAllListeners(eApi.events.DATA_SAVE_TO_FILE_ERROR);
|
|
430
431
|
if (callbackComplete !== null) {
|
|
@@ -437,8 +438,13 @@ var WidgetApi = {
|
|
|
437
438
|
return callbackError(response);
|
|
438
439
|
});
|
|
439
440
|
}
|
|
440
|
-
//
|
|
441
|
-
|
|
441
|
+
// Auto-thread widgetId from the singleton's per-widget
|
|
442
|
+
// state when the caller didn't supply one explicitly. This
|
|
443
|
+
// is what makes the fs gate fire for ordinary widgets that
|
|
444
|
+
// call `widgetApi.storeData({data, filename})` without
|
|
445
|
+
// knowing about widgetId.
|
|
446
|
+
var effectiveWidgetId = widgetId || ((_this$params = this.params) === null || _this$params === void 0 ? void 0 : _this$params.name) || null;
|
|
447
|
+
eApi.data.saveData(data, toFilename, append, returnEmpty, effectiveWidgetId);
|
|
442
448
|
}
|
|
443
449
|
}
|
|
444
450
|
} catch (e) {
|
|
@@ -473,6 +479,7 @@ var WidgetApi = {
|
|
|
473
479
|
var toFilename = filename !== null ? filename : "".concat(uuid, ".json");
|
|
474
480
|
var eApi = this.electronApi();
|
|
475
481
|
if ("removeAllListeners" in eApi) {
|
|
482
|
+
var _this$params2;
|
|
476
483
|
eApi.removeAllListeners(eApi.events.DATA_READ_FROM_FILE_COMPLETE);
|
|
477
484
|
eApi.removeAllListeners(eApi.events.DATA_READ_FROM_FILE_ERROR);
|
|
478
485
|
if (callbackComplete !== null) {
|
|
@@ -495,7 +502,9 @@ var WidgetApi = {
|
|
|
495
502
|
return callbackError(response);
|
|
496
503
|
});
|
|
497
504
|
}
|
|
498
|
-
|
|
505
|
+
// Auto-thread widgetId from the singleton — same as storeData.
|
|
506
|
+
var effectiveWidgetId = widgetId || ((_this$params2 = this.params) === null || _this$params2 === void 0 ? void 0 : _this$params2.name) || null;
|
|
507
|
+
eApi.data.readData(toFilename, [], effectiveWidgetId);
|
|
499
508
|
}
|
|
500
509
|
} catch (e) {
|
|
501
510
|
}
|
|
@@ -1670,12 +1679,15 @@ var ElectronDashboardApi = /*#__PURE__*/function () {
|
|
|
1670
1679
|
value: function mcpCallTool(serverName, toolName, args, allowedTools, onSuccess, onError) {
|
|
1671
1680
|
var _this22 = this;
|
|
1672
1681
|
var workspaceId = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
1682
|
+
var widgetId = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
|
|
1673
1683
|
if (this.api !== null) {
|
|
1674
1684
|
try {
|
|
1675
|
-
// widgetId is
|
|
1676
|
-
//
|
|
1677
|
-
//
|
|
1678
|
-
|
|
1685
|
+
// widgetId is the package-level identity for the MCP gate.
|
|
1686
|
+
// Callers (typically `useMcpProvider`) pass `widgetData.name`
|
|
1687
|
+
// so the gate's `getGrant(widgetId)` lookup matches the grant
|
|
1688
|
+
// written at install consent. workspaceId scopes the server
|
|
1689
|
+
// process per workspace (Slice 3a).
|
|
1690
|
+
this.api.mcp.callTool(serverName, toolName, args, allowedTools, widgetId, workspaceId).then(function (result) {
|
|
1679
1691
|
onSuccess(_this22.events.MCP_CALL_TOOL_COMPLETE, result);
|
|
1680
1692
|
})["catch"](function (error) {
|
|
1681
1693
|
onError(_this22.events.MCP_CALL_TOOL_ERROR, error);
|
|
@@ -29901,6 +29913,7 @@ var useMcpProvider = function useMcpProvider(providerType) {
|
|
|
29901
29913
|
widgetRequiredTools,
|
|
29902
29914
|
isRequired,
|
|
29903
29915
|
workspaceId,
|
|
29916
|
+
widgetIdForGate,
|
|
29904
29917
|
_args3 = arguments;
|
|
29905
29918
|
return _regeneratorRuntime.wrap(function (_context3) {
|
|
29906
29919
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -29930,7 +29943,12 @@ var useMcpProvider = function useMcpProvider(providerType) {
|
|
|
29930
29943
|
// Slice 3a: scope the MCP server process per workspace. The
|
|
29931
29944
|
// workspace UUID is the canonical "current dashboard" identity
|
|
29932
29945
|
// (see useNotifications, useScheduler for the same pattern).
|
|
29933
|
-
workspaceId = (workspace === null || workspace === void 0 || (_workspace$workspaceD5 = workspace.workspaceData) === null || _workspace$workspaceD5 === void 0 ? void 0 : _workspace$workspaceD5.id) || null;
|
|
29946
|
+
workspaceId = (workspace === null || workspace === void 0 || (_workspace$workspaceD5 = workspace.workspaceData) === null || _workspace$workspaceD5 === void 0 ? void 0 : _workspace$workspaceD5.id) || null; // widgetData.name is the package-level identity the MCP gate's
|
|
29947
|
+
// grant store keys on. Without this, the gate's per-widget
|
|
29948
|
+
// permissioning is silent (the legacy widgetId-null bypass
|
|
29949
|
+
// skips the gate entirely). Threading it here makes JIT
|
|
29950
|
+
// consent fire for widgets without the user-grant cached.
|
|
29951
|
+
widgetIdForGate = (widgetData === null || widgetData === void 0 ? void 0 : widgetData.name) || null;
|
|
29934
29952
|
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
29935
29953
|
var timeout = setTimeout(function () {
|
|
29936
29954
|
reject(new Error("Tool call \"".concat(toolName, "\" timed out after 30s")));
|
|
@@ -29945,7 +29963,7 @@ var useMcpProvider = function useMcpProvider(providerType) {
|
|
|
29945
29963
|
}, function (event, err) {
|
|
29946
29964
|
clearTimeout(timeout);
|
|
29947
29965
|
reject(new Error((err === null || err === void 0 ? void 0 : err.message) || "Failed to call MCP tool"));
|
|
29948
|
-
}, workspaceId);
|
|
29966
|
+
}, workspaceId, widgetIdForGate);
|
|
29949
29967
|
}));
|
|
29950
29968
|
case 3:
|
|
29951
29969
|
case "end":
|