@trops/dash-core 0.1.493 → 0.1.495

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
@@ -49123,9 +49123,9 @@ var PrivacySecuritySection = function PrivacySecuritySection() {
49123
49123
  padding: false
49124
49124
  }), /*#__PURE__*/jsxRuntime.jsx("span", {
49125
49125
  className: "text-xs opacity-60",
49126
- 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."
49126
+ children: "Granting access here is a trust signal about the widget \u2014 not a per-dashboard switch."
49127
49127
  })]
49128
- }), error && /*#__PURE__*/jsxRuntime.jsx("div", {
49128
+ }), /*#__PURE__*/jsxRuntime.jsx(HowThisWorksPanel, {}), error && /*#__PURE__*/jsxRuntime.jsx("div", {
49129
49129
  className: "text-xs text-red-400 bg-red-900 bg-opacity-20 border border-red-700 rounded p-3",
49130
49130
  children: error
49131
49131
  }), rows.length === 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -49210,6 +49210,7 @@ var WidgetGrantRow = function WidgetGrantRow(_ref6) {
49210
49210
  }), allServerNames.map(function (serverName) {
49211
49211
  var decl = declaredServers[serverName] || {};
49212
49212
  var grant = grantedServers[serverName];
49213
+ var allStale = isServerEntirelyStale(decl, grant);
49213
49214
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
49214
49215
  className: "flex flex-col space-y-2 border-t border-gray-800 pt-2",
49215
49216
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -49226,6 +49227,9 @@ var WidgetGrantRow = function WidgetGrantRow(_ref6) {
49226
49227
  return onRevokeServer(serverName);
49227
49228
  }
49228
49229
  })]
49230
+ }), allStale && /*#__PURE__*/jsxRuntime.jsx("div", {
49231
+ className: "text-xs text-amber-400 bg-amber-900 bg-opacity-20 border border-amber-700 rounded px-2 py-1.5",
49232
+ children: "All grants on this server are no longer in the manifest \u2014 the widget likely no longer uses this server. Consider revoking."
49229
49233
  }), /*#__PURE__*/jsxRuntime.jsx(PermsList, {
49230
49234
  label: "Tools",
49231
49235
  declaredItems: decl.tools || [],
@@ -49259,17 +49263,44 @@ var PermsList = function PermsList(_ref7) {
49259
49263
  }), all.map(function (item) {
49260
49264
  var isGranted = grantedSet.has(item);
49261
49265
  var isDeclared = declaredSet.has(item);
49266
+ var isStale = isGranted && !isDeclared;
49262
49267
  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)"
49268
+ className: "text-xs font-mono break-all ".concat(isStale ? "text-amber-400" : isGranted ? "opacity-100" : "opacity-50 line-through"),
49269
+ children: [item, isStale && /*#__PURE__*/jsxRuntime.jsx("span", {
49270
+ className: "ml-2 not-italic font-sans normal-case tracking-normal text-amber-400",
49271
+ children: "(stale \u2014 widget no longer requests this; consider revoking)"
49267
49272
  })]
49268
49273
  }, item);
49269
49274
  })]
49270
49275
  });
49271
49276
  };
49272
49277
 
49278
+ /**
49279
+ * True when the granted entry has at least one item AND every granted
49280
+ * item is missing from the current declared block (i.e. all of this
49281
+ * server's grants are unused by the current manifest). Used to surface
49282
+ * a "this whole server's grant looks unused" suggestion at the row level.
49283
+ */
49284
+ function isServerEntirelyStale(decl, grant) {
49285
+ if (!grant) return false;
49286
+ var declTools = new Set(decl.tools || []);
49287
+ var declRead = new Set(decl.readPaths || []);
49288
+ var declWrite = new Set(decl.writePaths || []);
49289
+ var grantedTools = grant.tools || [];
49290
+ var grantedRead = grant.readPaths || [];
49291
+ var grantedWrite = grant.writePaths || [];
49292
+ var total = grantedTools.length + grantedRead.length + grantedWrite.length;
49293
+ if (total === 0) return false;
49294
+ var stale = grantedTools.every(function (t) {
49295
+ return !declTools.has(t);
49296
+ }) && grantedRead.every(function (p) {
49297
+ return !declRead.has(p);
49298
+ }) && grantedWrite.every(function (p) {
49299
+ return !declWrite.has(p);
49300
+ });
49301
+ return stale;
49302
+ }
49303
+
49273
49304
  /**
49274
49305
  * Renders a small badge showing how the user got to this grant. Helps
49275
49306
  * the user audit grants that were approved against a scanner guess
@@ -49300,6 +49331,248 @@ var GrantOriginBadge = function GrantOriginBadge(_ref8) {
49300
49331
  });
49301
49332
  };
49302
49333
 
49334
+ // Mock fixtures for the "Example rows" section. These use the same
49335
+ // WidgetGrantRow component the real rows use, so the preview always
49336
+ // reflects the real rendering. Click handlers are no-ops — the panel is
49337
+ // for visualization only.
49338
+ var EXAMPLE_FIXTURES = [{
49339
+ caption: "Declared by the developer and granted by the user.",
49340
+ widgetId: "@example/notes-summarizer",
49341
+ hasManifest: true,
49342
+ grantOrigin: "declared",
49343
+ declared: {
49344
+ servers: {
49345
+ filesystem: {
49346
+ tools: ["read_file", "list_directory"],
49347
+ readPaths: ["~/Documents/notes"],
49348
+ writePaths: []
49349
+ }
49350
+ }
49351
+ },
49352
+ granted: {
49353
+ grantOrigin: "declared",
49354
+ servers: {
49355
+ filesystem: {
49356
+ tools: ["read_file", "list_directory"],
49357
+ readPaths: ["~/Documents/notes"],
49358
+ writePaths: []
49359
+ }
49360
+ }
49361
+ }
49362
+ }, {
49363
+ caption: "Declared by the developer — the user hasn't decided yet.",
49364
+ widgetId: "@example/code-search",
49365
+ hasManifest: true,
49366
+ grantOrigin: null,
49367
+ declared: {
49368
+ servers: {
49369
+ github: {
49370
+ tools: ["search_repositories", "get_file_contents"]
49371
+ }
49372
+ }
49373
+ },
49374
+ granted: null
49375
+ }, {
49376
+ caption: "Detected by the install-time scanner and granted.",
49377
+ widgetId: "@example/file-helper",
49378
+ hasManifest: false,
49379
+ grantOrigin: "discovered",
49380
+ declared: null,
49381
+ granted: {
49382
+ grantOrigin: "discovered",
49383
+ servers: {
49384
+ filesystem: {
49385
+ tools: ["read_file"],
49386
+ readPaths: [],
49387
+ writePaths: []
49388
+ }
49389
+ }
49390
+ }
49391
+ }, {
49392
+ caption: "Granted manually because the widget had no manifest.",
49393
+ widgetId: "@example/legacy-widget",
49394
+ hasManifest: false,
49395
+ grantOrigin: "manual",
49396
+ declared: null,
49397
+ granted: {
49398
+ grantOrigin: "manual",
49399
+ servers: {
49400
+ filesystem: {
49401
+ tools: ["read_file", "write_file"],
49402
+ readPaths: ["~/Downloads"],
49403
+ writePaths: ["/tmp/widget-output"]
49404
+ }
49405
+ }
49406
+ }
49407
+ }, {
49408
+ caption: "Stale grant — the widget upgraded and dropped readPaths from its manifest, but the user's grant is still present.",
49409
+ widgetId: "@example/upgraded-widget",
49410
+ hasManifest: true,
49411
+ grantOrigin: "declared",
49412
+ declared: {
49413
+ // Manifest now declares only the tool, no paths.
49414
+ servers: {
49415
+ filesystem: {
49416
+ tools: ["read_file"],
49417
+ readPaths: [],
49418
+ writePaths: []
49419
+ }
49420
+ }
49421
+ },
49422
+ granted: {
49423
+ grantOrigin: "declared",
49424
+ servers: {
49425
+ filesystem: {
49426
+ tools: ["read_file"],
49427
+ readPaths: ["~/Documents/old-notes"],
49428
+ writePaths: []
49429
+ }
49430
+ }
49431
+ }
49432
+ }];
49433
+ var noop = function noop() {};
49434
+
49435
+ /**
49436
+ * Collapsible explainer that documents how grants flow per-widget vs
49437
+ * per-dashboard, with a concrete example table and rendered preview rows
49438
+ * for each grant state. Default-collapsed so users who don't care never
49439
+ * see it.
49440
+ */
49441
+ var HowThisWorksPanel = function HowThisWorksPanel() {
49442
+ var _useState1 = React.useState(false),
49443
+ _useState10 = _slicedToArray(_useState1, 2),
49444
+ open = _useState10[0],
49445
+ setOpen = _useState10[1];
49446
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
49447
+ className: "border border-gray-700 rounded",
49448
+ children: [/*#__PURE__*/jsxRuntime.jsxs("button", {
49449
+ type: "button",
49450
+ onClick: function onClick() {
49451
+ return setOpen(function (v) {
49452
+ return !v;
49453
+ });
49454
+ },
49455
+ className: "w-full flex flex-row items-center justify-between px-3 py-2 text-left text-sm hover:bg-gray-800",
49456
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
49457
+ children: "How widget MCP permissions work"
49458
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
49459
+ icon: open ? "chevron-up" : "chevron-down",
49460
+ className: "h-3 w-3 opacity-60"
49461
+ })]
49462
+ }), open && /*#__PURE__*/jsxRuntime.jsxs("div", {
49463
+ className: "flex flex-col space-y-4 px-3 py-3 border-t border-gray-800 text-xs leading-relaxed",
49464
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
49465
+ className: "space-y-2",
49466
+ children: [/*#__PURE__*/jsxRuntime.jsxs("p", {
49467
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
49468
+ className: "font-semibold",
49469
+ children: "The grant is about the widget, not the dashboard."
49470
+ }), " ", "When you grant ", /*#__PURE__*/jsxRuntime.jsx("code", {
49471
+ children: "@trops/notes-summarizer"
49472
+ }), " access to", " ", /*#__PURE__*/jsxRuntime.jsx("code", {
49473
+ children: "~/Documents"
49474
+ }), ", you're saying \"I trust this widget with this path, anywhere.\" Grants live one-per-widget, regardless of how many dashboards use it."]
49475
+ }), /*#__PURE__*/jsxRuntime.jsxs("p", {
49476
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
49477
+ className: "font-semibold",
49478
+ children: "Each dashboard automatically scopes its servers."
49479
+ }), " ", "When you open a dashboard, Dash spawns a separate MCP server process per dashboard. That server is configured with only the paths granted to widgets actually on that dashboard \u2014 nothing else. Two dashboards using the same widget share the same grant; two dashboards using different widgets get different effective scopes."]
49480
+ }), /*#__PURE__*/jsxRuntime.jsxs("p", {
49481
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
49482
+ className: "font-semibold",
49483
+ children: "What this doesn't do."
49484
+ }), " ", "There's no way today to say \"this widget can use filesystem on Dashboard 1 but not Dashboard 2.\" Grants are per-widget; per-(widget, dashboard) granularity would need a bigger UX rework. If you don't want a widget to access a path on a particular dashboard, the workaround is to remove it from that dashboard or revoke the grant entirely."]
49485
+ })]
49486
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
49487
+ className: "space-y-2",
49488
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
49489
+ className: "font-semibold",
49490
+ children: ["Example: widget A granted ", /*#__PURE__*/jsxRuntime.jsx("code", {
49491
+ children: "/Documents"
49492
+ }), ", widget B granted ", /*#__PURE__*/jsxRuntime.jsx("code", {
49493
+ children: "/Code"
49494
+ })]
49495
+ }), /*#__PURE__*/jsxRuntime.jsxs("table", {
49496
+ className: "w-full text-xs border border-gray-800",
49497
+ children: [/*#__PURE__*/jsxRuntime.jsx("thead", {
49498
+ children: /*#__PURE__*/jsxRuntime.jsxs("tr", {
49499
+ className: "bg-gray-900",
49500
+ children: [/*#__PURE__*/jsxRuntime.jsx("th", {
49501
+ className: "text-left px-2 py-1 border-b border-gray-800",
49502
+ children: "Scenario"
49503
+ }), /*#__PURE__*/jsxRuntime.jsx("th", {
49504
+ className: "text-left px-2 py-1 border-b border-gray-800",
49505
+ children: "Dashboard 1 sees"
49506
+ }), /*#__PURE__*/jsxRuntime.jsx("th", {
49507
+ className: "text-left px-2 py-1 border-b border-gray-800",
49508
+ children: "Dashboard 2 sees"
49509
+ })]
49510
+ })
49511
+ }), /*#__PURE__*/jsxRuntime.jsxs("tbody", {
49512
+ children: [/*#__PURE__*/jsxRuntime.jsxs("tr", {
49513
+ children: [/*#__PURE__*/jsxRuntime.jsx("td", {
49514
+ className: "px-2 py-1 border-b border-gray-800",
49515
+ children: "A on Dash 1, B on Dash 2"
49516
+ }), /*#__PURE__*/jsxRuntime.jsx("td", {
49517
+ className: "px-2 py-1 border-b border-gray-800 font-mono",
49518
+ children: "/Documents"
49519
+ }), /*#__PURE__*/jsxRuntime.jsx("td", {
49520
+ className: "px-2 py-1 border-b border-gray-800 font-mono",
49521
+ children: "/Code"
49522
+ })]
49523
+ }), /*#__PURE__*/jsxRuntime.jsxs("tr", {
49524
+ children: [/*#__PURE__*/jsxRuntime.jsx("td", {
49525
+ className: "px-2 py-1 border-b border-gray-800",
49526
+ children: "A on both, B on Dash 2"
49527
+ }), /*#__PURE__*/jsxRuntime.jsx("td", {
49528
+ className: "px-2 py-1 border-b border-gray-800 font-mono",
49529
+ children: "/Documents"
49530
+ }), /*#__PURE__*/jsxRuntime.jsx("td", {
49531
+ className: "px-2 py-1 border-b border-gray-800 font-mono",
49532
+ children: "/Documents, /Code"
49533
+ })]
49534
+ }), /*#__PURE__*/jsxRuntime.jsxs("tr", {
49535
+ children: [/*#__PURE__*/jsxRuntime.jsx("td", {
49536
+ className: "px-2 py-1",
49537
+ children: "A + B both on Dash 1"
49538
+ }), /*#__PURE__*/jsxRuntime.jsx("td", {
49539
+ className: "px-2 py-1 font-mono",
49540
+ children: "/Documents, /Code"
49541
+ }), /*#__PURE__*/jsxRuntime.jsx("td", {
49542
+ className: "px-2 py-1 opacity-60",
49543
+ children: "(no server)"
49544
+ })]
49545
+ })]
49546
+ })]
49547
+ })]
49548
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
49549
+ className: "space-y-3",
49550
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49551
+ className: "font-semibold",
49552
+ children: "What each row state looks like"
49553
+ }), EXAMPLE_FIXTURES.map(function (f) {
49554
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
49555
+ className: "space-y-1",
49556
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49557
+ className: "italic opacity-60",
49558
+ children: f.caption
49559
+ }), /*#__PURE__*/jsxRuntime.jsx(WidgetGrantRow, {
49560
+ widgetId: f.widgetId,
49561
+ declared: f.declared,
49562
+ granted: f.granted,
49563
+ hasManifest: f.hasManifest,
49564
+ grantOrigin: f.grantOrigin,
49565
+ onRevokeWidget: noop,
49566
+ onRevokeServer: noop,
49567
+ onGrantManually: noop
49568
+ })]
49569
+ }, f.widgetId);
49570
+ })]
49571
+ })]
49572
+ })]
49573
+ });
49574
+ };
49575
+
49303
49576
  var SECTIONS = [{
49304
49577
  key: "general",
49305
49578
  label: "General",