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