@trops/dash-core 0.1.494 → 0.1.496

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
@@ -48852,7 +48852,7 @@ var GrantManuallyModal = function GrantManuallyModal(_ref) {
48852
48852
  isOpen: isOpen,
48853
48853
  setIsOpen: setIsOpen,
48854
48854
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
48855
- className: "flex flex-col w-full max-w-xl ring-2 ring-amber-500",
48855
+ className: "flex flex-col w-full max-w-xl border-2 border-amber-500 rounded",
48856
48856
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
48857
48857
  className: "px-5 py-4 border-b border-gray-700",
48858
48858
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -48871,20 +48871,12 @@ var GrantManuallyModal = function GrantManuallyModal(_ref) {
48871
48871
  children: "Server name"
48872
48872
  }), /*#__PURE__*/jsxRuntime.jsx("input", {
48873
48873
  type: "text",
48874
- list: "known-mcp-servers",
48875
48874
  value: serverName,
48876
48875
  onChange: function onChange(e) {
48877
48876
  return setServerName(e.target.value);
48878
48877
  },
48879
- placeholder: "e.g. filesystem, github, slack",
48880
- className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700"
48881
- }), /*#__PURE__*/jsxRuntime.jsx("datalist", {
48882
- id: "known-mcp-servers",
48883
- children: knownServerNames.map(function (n) {
48884
- return /*#__PURE__*/jsxRuntime.jsx("option", {
48885
- value: n
48886
- }, n);
48887
- })
48878
+ placeholder: knownServerNames.length > 0 ? "e.g. ".concat(knownServerNames.slice(0, 3).join(", ")) : "e.g. filesystem, github, slack",
48879
+ className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 text-gray-200"
48888
48880
  })]
48889
48881
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
48890
48882
  className: "flex flex-col gap-1",
@@ -48898,7 +48890,7 @@ var GrantManuallyModal = function GrantManuallyModal(_ref) {
48898
48890
  return setToolsText(e.target.value);
48899
48891
  },
48900
48892
  placeholder: "e.g. read_file, list_directory",
48901
- className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 font-mono"
48893
+ className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 text-gray-200 font-mono"
48902
48894
  })]
48903
48895
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
48904
48896
  className: "flex flex-col gap-1",
@@ -48912,7 +48904,7 @@ var GrantManuallyModal = function GrantManuallyModal(_ref) {
48912
48904
  },
48913
48905
  placeholder: "/Users/jane/Documents\n/tmp/notes",
48914
48906
  rows: 3,
48915
- className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 font-mono"
48907
+ className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 text-gray-200 font-mono"
48916
48908
  })]
48917
48909
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
48918
48910
  className: "flex flex-col gap-1",
@@ -48926,10 +48918,10 @@ var GrantManuallyModal = function GrantManuallyModal(_ref) {
48926
48918
  },
48927
48919
  placeholder: "/tmp/output",
48928
48920
  rows: 3,
48929
- className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 font-mono"
48921
+ className: "text-xs px-2 py-1.5 rounded bg-gray-800 border border-gray-700 text-gray-200 font-mono"
48930
48922
  })]
48931
48923
  }), error && /*#__PURE__*/jsxRuntime.jsx("div", {
48932
- className: "text-xs text-red-400 bg-red-900 bg-opacity-20 border border-red-700 rounded px-3 py-2",
48924
+ className: "text-xs text-red-400 bg-red-950 border border-red-700 rounded px-3 py-2",
48933
48925
  children: error
48934
48926
  })]
48935
48927
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -49210,6 +49202,7 @@ var WidgetGrantRow = function WidgetGrantRow(_ref6) {
49210
49202
  }), allServerNames.map(function (serverName) {
49211
49203
  var decl = declaredServers[serverName] || {};
49212
49204
  var grant = grantedServers[serverName];
49205
+ var allStale = isServerEntirelyStale(decl, grant);
49213
49206
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
49214
49207
  className: "flex flex-col space-y-2 border-t border-gray-800 pt-2",
49215
49208
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -49226,6 +49219,9 @@ var WidgetGrantRow = function WidgetGrantRow(_ref6) {
49226
49219
  return onRevokeServer(serverName);
49227
49220
  }
49228
49221
  })]
49222
+ }), allStale && /*#__PURE__*/jsxRuntime.jsx("div", {
49223
+ className: "text-xs text-amber-400 bg-amber-900 bg-opacity-20 border border-amber-700 rounded px-2 py-1.5",
49224
+ children: "All grants on this server are no longer in the manifest \u2014 the widget likely no longer uses this server. Consider revoking."
49229
49225
  }), /*#__PURE__*/jsxRuntime.jsx(PermsList, {
49230
49226
  label: "Tools",
49231
49227
  declaredItems: decl.tools || [],
@@ -49259,17 +49255,44 @@ var PermsList = function PermsList(_ref7) {
49259
49255
  }), all.map(function (item) {
49260
49256
  var isGranted = grantedSet.has(item);
49261
49257
  var isDeclared = declaredSet.has(item);
49258
+ var isStale = isGranted && !isDeclared;
49262
49259
  return /*#__PURE__*/jsxRuntime.jsxs("span", {
49263
- className: "text-xs font-mono break-all ".concat(isGranted ? "opacity-100" : isDeclared ? "opacity-50 line-through" : "opacity-100 text-amber-400"),
49264
- children: [item, !isDeclared && isGranted && /*#__PURE__*/jsxRuntime.jsx("span", {
49265
- className: "ml-2 opacity-60",
49266
- children: "(no longer declared)"
49260
+ className: "text-xs font-mono break-all ".concat(isStale ? "text-amber-400" : isGranted ? "opacity-100" : "opacity-50 line-through"),
49261
+ children: [item, isStale && /*#__PURE__*/jsxRuntime.jsx("span", {
49262
+ className: "ml-2 not-italic font-sans normal-case tracking-normal text-amber-400",
49263
+ children: "(stale \u2014 widget no longer requests this; consider revoking)"
49267
49264
  })]
49268
49265
  }, item);
49269
49266
  })]
49270
49267
  });
49271
49268
  };
49272
49269
 
49270
+ /**
49271
+ * True when the granted entry has at least one item AND every granted
49272
+ * item is missing from the current declared block (i.e. all of this
49273
+ * server's grants are unused by the current manifest). Used to surface
49274
+ * a "this whole server's grant looks unused" suggestion at the row level.
49275
+ */
49276
+ function isServerEntirelyStale(decl, grant) {
49277
+ if (!grant) return false;
49278
+ var declTools = new Set(decl.tools || []);
49279
+ var declRead = new Set(decl.readPaths || []);
49280
+ var declWrite = new Set(decl.writePaths || []);
49281
+ var grantedTools = grant.tools || [];
49282
+ var grantedRead = grant.readPaths || [];
49283
+ var grantedWrite = grant.writePaths || [];
49284
+ var total = grantedTools.length + grantedRead.length + grantedWrite.length;
49285
+ if (total === 0) return false;
49286
+ var stale = grantedTools.every(function (t) {
49287
+ return !declTools.has(t);
49288
+ }) && grantedRead.every(function (p) {
49289
+ return !declRead.has(p);
49290
+ }) && grantedWrite.every(function (p) {
49291
+ return !declWrite.has(p);
49292
+ });
49293
+ return stale;
49294
+ }
49295
+
49273
49296
  /**
49274
49297
  * Renders a small badge showing how the user got to this grant. Helps
49275
49298
  * the user audit grants that were approved against a scanner guess
@@ -49373,6 +49396,31 @@ var EXAMPLE_FIXTURES = [{
49373
49396
  }
49374
49397
  }
49375
49398
  }
49399
+ }, {
49400
+ caption: "Stale grant — the widget upgraded and dropped readPaths from its manifest, but the user's grant is still present.",
49401
+ widgetId: "@example/upgraded-widget",
49402
+ hasManifest: true,
49403
+ grantOrigin: "declared",
49404
+ declared: {
49405
+ // Manifest now declares only the tool, no paths.
49406
+ servers: {
49407
+ filesystem: {
49408
+ tools: ["read_file"],
49409
+ readPaths: [],
49410
+ writePaths: []
49411
+ }
49412
+ }
49413
+ },
49414
+ granted: {
49415
+ grantOrigin: "declared",
49416
+ servers: {
49417
+ filesystem: {
49418
+ tools: ["read_file"],
49419
+ readPaths: ["~/Documents/old-notes"],
49420
+ writePaths: []
49421
+ }
49422
+ }
49423
+ }
49376
49424
  }];
49377
49425
  var noop = function noop() {};
49378
49426