@trops/dash-core 0.1.487 → 0.1.490

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 CHANGED
@@ -48552,6 +48552,243 @@ var AiAssistantSection = function AiAssistantSection() {
48552
48552
  });
48553
48553
  };
48554
48554
 
48555
+ var PrivacySecuritySection = function PrivacySecuritySection() {
48556
+ var _useState = useState([]),
48557
+ _useState2 = _slicedToArray(_useState, 2),
48558
+ rows = _useState2[0],
48559
+ setRows = _useState2[1];
48560
+ var _useState3 = useState(true),
48561
+ _useState4 = _slicedToArray(_useState3, 2),
48562
+ loading = _useState4[0],
48563
+ setLoading = _useState4[1];
48564
+ var _useState5 = useState(null),
48565
+ _useState6 = _slicedToArray(_useState5, 2),
48566
+ error = _useState6[0],
48567
+ setError = _useState6[1];
48568
+ var reload = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
48569
+ var _api$widgetMcp, api, result, _t;
48570
+ return _regeneratorRuntime.wrap(function (_context) {
48571
+ while (1) switch (_context.prev = _context.next) {
48572
+ case 0:
48573
+ setError(null);
48574
+ _context.prev = 1;
48575
+ api = typeof window !== "undefined" ? window.mainApi : null;
48576
+ if (api !== null && api !== void 0 && (_api$widgetMcp = api.widgetMcp) !== null && _api$widgetMcp !== void 0 && _api$widgetMcp.listAll) {
48577
+ _context.next = 2;
48578
+ break;
48579
+ }
48580
+ setRows([]);
48581
+ setLoading(false);
48582
+ return _context.abrupt("return");
48583
+ case 2:
48584
+ _context.next = 3;
48585
+ return api.widgetMcp.listAll();
48586
+ case 3:
48587
+ result = _context.sent;
48588
+ setRows(Array.isArray(result) ? result : []);
48589
+ _context.next = 5;
48590
+ break;
48591
+ case 4:
48592
+ _context.prev = 4;
48593
+ _t = _context["catch"](1);
48594
+ setError((_t === null || _t === void 0 ? void 0 : _t.message) || String(_t));
48595
+ case 5:
48596
+ _context.prev = 5;
48597
+ setLoading(false);
48598
+ return _context.finish(5);
48599
+ case 6:
48600
+ case "end":
48601
+ return _context.stop();
48602
+ }
48603
+ }, _callee, null, [[1, 4, 5, 6]]);
48604
+ })), []);
48605
+ useEffect(function () {
48606
+ reload();
48607
+ }, [reload]);
48608
+ var revokeWidget = /*#__PURE__*/function () {
48609
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(widgetId) {
48610
+ var _window$mainApi, _window$mainApi$revok, _t2;
48611
+ return _regeneratorRuntime.wrap(function (_context2) {
48612
+ while (1) switch (_context2.prev = _context2.next) {
48613
+ case 0:
48614
+ _context2.prev = 0;
48615
+ _context2.next = 1;
48616
+ return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi.widgetMcp) === null || _window$mainApi === void 0 || (_window$mainApi$revok = _window$mainApi.revoke) === null || _window$mainApi$revok === void 0 ? void 0 : _window$mainApi$revok.call(_window$mainApi, widgetId);
48617
+ case 1:
48618
+ reload();
48619
+ _context2.next = 3;
48620
+ break;
48621
+ case 2:
48622
+ _context2.prev = 2;
48623
+ _t2 = _context2["catch"](0);
48624
+ setError((_t2 === null || _t2 === void 0 ? void 0 : _t2.message) || String(_t2));
48625
+ case 3:
48626
+ case "end":
48627
+ return _context2.stop();
48628
+ }
48629
+ }, _callee2, null, [[0, 2]]);
48630
+ }));
48631
+ return function revokeWidget(_x) {
48632
+ return _ref2.apply(this, arguments);
48633
+ };
48634
+ }();
48635
+ var revokeServer = /*#__PURE__*/function () {
48636
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(widgetId, serverName) {
48637
+ var _window$mainApi2, _window$mainApi2$revo, _t3;
48638
+ return _regeneratorRuntime.wrap(function (_context3) {
48639
+ while (1) switch (_context3.prev = _context3.next) {
48640
+ case 0:
48641
+ _context3.prev = 0;
48642
+ _context3.next = 1;
48643
+ return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.widgetMcp) === null || _window$mainApi2 === void 0 || (_window$mainApi2$revo = _window$mainApi2.revokeServer) === null || _window$mainApi2$revo === void 0 ? void 0 : _window$mainApi2$revo.call(_window$mainApi2, widgetId, serverName);
48644
+ case 1:
48645
+ reload();
48646
+ _context3.next = 3;
48647
+ break;
48648
+ case 2:
48649
+ _context3.prev = 2;
48650
+ _t3 = _context3["catch"](0);
48651
+ setError((_t3 === null || _t3 === void 0 ? void 0 : _t3.message) || String(_t3));
48652
+ case 3:
48653
+ case "end":
48654
+ return _context3.stop();
48655
+ }
48656
+ }, _callee3, null, [[0, 2]]);
48657
+ }));
48658
+ return function revokeServer(_x2, _x3) {
48659
+ return _ref3.apply(this, arguments);
48660
+ };
48661
+ }();
48662
+ if (loading) {
48663
+ return /*#__PURE__*/jsx("div", {
48664
+ className: "flex flex-col p-6",
48665
+ children: /*#__PURE__*/jsx("span", {
48666
+ className: "text-sm opacity-60",
48667
+ children: "Loading\u2026"
48668
+ })
48669
+ });
48670
+ }
48671
+ return /*#__PURE__*/jsxs("div", {
48672
+ className: "flex flex-col space-y-6 p-6",
48673
+ children: [/*#__PURE__*/jsxs("div", {
48674
+ className: "flex flex-col space-y-2",
48675
+ children: [/*#__PURE__*/jsx(SubHeading3, {
48676
+ title: "Widget MCP permissions",
48677
+ padding: false
48678
+ }), /*#__PURE__*/jsx("span", {
48679
+ className: "text-xs opacity-60",
48680
+ children: "Tools and paths each widget is allowed to call via MCP. Granted paths are visible to other widgets in the same dashboard that use the same MCP server. Revoke any time."
48681
+ })]
48682
+ }), error && /*#__PURE__*/jsx("div", {
48683
+ className: "text-xs text-red-400 bg-red-900 bg-opacity-20 border border-red-700 rounded p-3",
48684
+ children: error
48685
+ }), rows.length === 0 && /*#__PURE__*/jsx("div", {
48686
+ className: "text-sm opacity-60",
48687
+ children: "No widgets have requested MCP permissions yet."
48688
+ }), rows.map(function (_ref4) {
48689
+ var widgetId = _ref4.widgetId,
48690
+ declared = _ref4.declared,
48691
+ granted = _ref4.granted;
48692
+ return /*#__PURE__*/jsx(WidgetGrantRow, {
48693
+ widgetId: widgetId,
48694
+ declared: declared,
48695
+ granted: granted,
48696
+ onRevokeWidget: function onRevokeWidget() {
48697
+ return revokeWidget(widgetId);
48698
+ },
48699
+ onRevokeServer: function onRevokeServer(serverName) {
48700
+ return revokeServer(widgetId, serverName);
48701
+ }
48702
+ }, widgetId);
48703
+ })]
48704
+ });
48705
+ };
48706
+ var WidgetGrantRow = function WidgetGrantRow(_ref5) {
48707
+ var widgetId = _ref5.widgetId,
48708
+ declared = _ref5.declared,
48709
+ granted = _ref5.granted,
48710
+ onRevokeWidget = _ref5.onRevokeWidget,
48711
+ onRevokeServer = _ref5.onRevokeServer;
48712
+ var declaredServers = declared && declared.servers || {};
48713
+ var grantedServers = granted && granted.servers || {};
48714
+ var allServerNames = Array.from(new Set([].concat(_toConsumableArray(Object.keys(declaredServers)), _toConsumableArray(Object.keys(grantedServers)))));
48715
+ return /*#__PURE__*/jsxs("div", {
48716
+ className: "flex flex-col space-y-3 border border-gray-700 rounded p-3",
48717
+ children: [/*#__PURE__*/jsxs("div", {
48718
+ className: "flex flex-row items-center justify-between",
48719
+ children: [/*#__PURE__*/jsx("span", {
48720
+ className: "text-sm font-mono break-all",
48721
+ children: widgetId
48722
+ }), Object.keys(grantedServers).length > 0 && /*#__PURE__*/jsx(Button, {
48723
+ title: "Revoke all",
48724
+ onClick: onRevokeWidget
48725
+ })]
48726
+ }), !declared && !granted && /*#__PURE__*/jsx("span", {
48727
+ className: "text-xs opacity-50",
48728
+ children: "(no manifest, no grant \u2014 should not happen)"
48729
+ }), allServerNames.map(function (serverName) {
48730
+ var decl = declaredServers[serverName] || {};
48731
+ var grant = grantedServers[serverName];
48732
+ return /*#__PURE__*/jsxs("div", {
48733
+ className: "flex flex-col space-y-2 border-t border-gray-800 pt-2",
48734
+ children: [/*#__PURE__*/jsxs("div", {
48735
+ className: "flex flex-row items-center justify-between",
48736
+ children: [/*#__PURE__*/jsxs("span", {
48737
+ className: "text-xs uppercase tracking-wider opacity-70",
48738
+ children: [serverName, !grant && /*#__PURE__*/jsx("span", {
48739
+ className: "ml-2 text-amber-400 normal-case tracking-normal",
48740
+ children: "(declared, not granted)"
48741
+ })]
48742
+ }), grant && /*#__PURE__*/jsx(Button, {
48743
+ title: "Revoke server",
48744
+ onClick: function onClick() {
48745
+ return onRevokeServer(serverName);
48746
+ }
48747
+ })]
48748
+ }), /*#__PURE__*/jsx(PermsList, {
48749
+ label: "Tools",
48750
+ declaredItems: decl.tools || [],
48751
+ grantedItems: (grant === null || grant === void 0 ? void 0 : grant.tools) || []
48752
+ }), /*#__PURE__*/jsx(PermsList, {
48753
+ label: "Read paths",
48754
+ declaredItems: decl.readPaths || [],
48755
+ grantedItems: (grant === null || grant === void 0 ? void 0 : grant.readPaths) || []
48756
+ }), /*#__PURE__*/jsx(PermsList, {
48757
+ label: "Write paths",
48758
+ declaredItems: decl.writePaths || [],
48759
+ grantedItems: (grant === null || grant === void 0 ? void 0 : grant.writePaths) || []
48760
+ })]
48761
+ }, serverName);
48762
+ })]
48763
+ });
48764
+ };
48765
+ var PermsList = function PermsList(_ref6) {
48766
+ var label = _ref6.label,
48767
+ declaredItems = _ref6.declaredItems,
48768
+ grantedItems = _ref6.grantedItems;
48769
+ if (declaredItems.length === 0 && grantedItems.length === 0) return null;
48770
+ var grantedSet = new Set(grantedItems);
48771
+ var declaredSet = new Set(declaredItems);
48772
+ var all = Array.from(new Set([].concat(_toConsumableArray(declaredItems), _toConsumableArray(grantedItems))));
48773
+ return /*#__PURE__*/jsxs("div", {
48774
+ className: "flex flex-col space-y-1",
48775
+ children: [/*#__PURE__*/jsx("span", {
48776
+ className: "text-xs opacity-50",
48777
+ children: label
48778
+ }), all.map(function (item) {
48779
+ var isGranted = grantedSet.has(item);
48780
+ var isDeclared = declaredSet.has(item);
48781
+ return /*#__PURE__*/jsxs("span", {
48782
+ className: "text-xs font-mono break-all ".concat(isGranted ? "opacity-100" : isDeclared ? "opacity-50 line-through" : "opacity-100 text-amber-400"),
48783
+ children: [item, !isDeclared && isGranted && /*#__PURE__*/jsx("span", {
48784
+ className: "ml-2 opacity-60",
48785
+ children: "(no longer declared)"
48786
+ })]
48787
+ }, item);
48788
+ })]
48789
+ });
48790
+ };
48791
+
48555
48792
  var SECTIONS = [{
48556
48793
  key: "general",
48557
48794
  label: "General",
@@ -48592,6 +48829,10 @@ var SECTIONS = [{
48592
48829
  key: "ai-assistant",
48593
48830
  label: "AI Assistant",
48594
48831
  icon: "wand-magic-sparkles"
48832
+ }, {
48833
+ key: "privacy-security",
48834
+ label: "Privacy & Security",
48835
+ icon: "shield-halved"
48595
48836
  }];
48596
48837
  var AppSettingsModal = function AppSettingsModal(_ref) {
48597
48838
  var isOpen = _ref.isOpen,
@@ -48779,6 +49020,9 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
48779
49020
  }), activeSection === "ai-assistant" && /*#__PURE__*/jsx("div", {
48780
49021
  className: "flex-1 overflow-y-auto p-6 ".concat(panelStyles.textColor || "text-gray-200"),
48781
49022
  children: /*#__PURE__*/jsx(AiAssistantSection, {})
49023
+ }), activeSection === "privacy-security" && /*#__PURE__*/jsx("div", {
49024
+ className: "flex-1 overflow-y-auto ".concat(panelStyles.textColor || "text-gray-200"),
49025
+ children: /*#__PURE__*/jsx(PrivacySecuritySection, {})
48782
49026
  })]
48783
49027
  }), /*#__PURE__*/jsx(SettingsModal.Footer, {
48784
49028
  children: /*#__PURE__*/jsx("div", {