@trops/dash-core 0.1.526 → 0.1.528

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.
@@ -3549,17 +3549,42 @@ function parseManifestPermissions(packageJson) {
3549
3549
  return { servers };
3550
3550
  }
3551
3551
 
3552
+ /**
3553
+ * Translate a dotted component widget id into the npm package id whose
3554
+ * package.json holds the manifest. Mirrors the construction logic in
3555
+ * `src/Components/Dashboard/WidgetsTab.js` (`<scope>.<pkg>.<comp>`):
3556
+ *
3557
+ * "@trops/gmail" → "@trops/gmail"
3558
+ * "trops.gmail.GmailCompose" → "@trops/gmail"
3559
+ * "ai-built.pipeline.ProspectWorkspace" → "@ai-built/pipeline"
3560
+ * "pipeline.AutomationHub" → "pipeline" (bare, no scope)
3561
+ * "legacy-bare-package" → "legacy-bare-package"
3562
+ *
3563
+ * The grant store keys grants by the dotted form; the on-disk widget
3564
+ * folder is keyed by the npm form. This bridges the two.
3565
+ */
3566
+ function dottedComponentIdToPackageId(widgetId) {
3567
+ if (typeof widgetId !== "string" || !widgetId) return null;
3568
+ if (widgetId.startsWith("@")) return widgetId;
3569
+ const parts = widgetId.split(".");
3570
+ if (parts.length >= 3) return `@${parts[0]}/${parts[1]}`;
3571
+ if (parts.length === 2) return parts[0];
3572
+ return widgetId;
3573
+ }
3574
+
3552
3575
  /**
3553
3576
  * Find a widget's installed package.json on disk. Widgets live under
3554
3577
  * userData/widgets/<scope>/<name>/ for scoped packages or
3555
- * userData/widgets/<name>/ for unscoped. The widgetId is the npm
3556
- * package name (e.g. "@trops/notes-summarizer" or "notes-summarizer").
3578
+ * userData/widgets/<name>/ for unscoped. Accepts either npm package
3579
+ * ids ("@trops/gmail") or dotted component ids
3580
+ * ("trops.gmail.GmailCompose") — the latter is translated first.
3557
3581
  */
3558
3582
  function resolveWidgetPackagePath(widgetId) {
3559
- if (typeof widgetId !== "string" || !widgetId) return null;
3583
+ const packageId = dottedComponentIdToPackageId(widgetId);
3584
+ if (typeof packageId !== "string" || !packageId) return null;
3560
3585
  const widgetsRoot = path$f.join(app$a.getPath("userData"), "widgets");
3561
3586
  // Split scope from name for "@scope/name" form.
3562
- const parts = widgetId.startsWith("@") ? widgetId.split("/") : [widgetId];
3587
+ const parts = packageId.startsWith("@") ? packageId.split("/") : [packageId];
3563
3588
  return path$f.join(widgetsRoot, ...parts, "package.json");
3564
3589
  }
3565
3590
 
@@ -3603,6 +3628,7 @@ function clearCache() {
3603
3628
  var widgetPermissions = {
3604
3629
  getWidgetMcpPermissions: getWidgetMcpPermissions$1,
3605
3630
  parseManifestPermissions,
3631
+ dottedComponentIdToPackageId,
3606
3632
  expandHome,
3607
3633
  clearCache,
3608
3634
  };
@@ -62273,7 +62299,11 @@ function buildGrantsListing$1(
62273
62299
  });
62274
62300
  }
62275
62301
 
62276
- // Orphan grants: granted but not in the installed list.
62302
+ // Orphan grants: granted but not in the installed list. Honor any
62303
+ // declared block the controller resolved for this dotted-form grant
62304
+ // key — see widgetPermissions.dottedComponentIdToPackageId, which
62305
+ // bridges grant keys (`trops.gmail.GmailCompose`) to on-disk package
62306
+ // paths (`@trops/gmail`).
62277
62307
  for (const [widgetId, grant] of grants) {
62278
62308
  if (seen.has(widgetId)) continue;
62279
62309
  const grantOrigin =
@@ -62282,11 +62312,12 @@ function buildGrantsListing$1(
62282
62312
  typeof grant.grantOrigin === "string"
62283
62313
  ? grant.grantOrigin
62284
62314
  : null;
62315
+ const decl = declared.get(widgetId) || null;
62285
62316
  rows.push({
62286
62317
  widgetId,
62287
- declared: null,
62318
+ declared: decl,
62288
62319
  granted: grant,
62289
- hasManifest: false,
62320
+ hasManifest: decl !== null,
62290
62321
  grantOrigin,
62291
62322
  });
62292
62323
  }
@@ -62542,6 +62573,17 @@ function setupWidgetMcpGrantsHandlers() {
62542
62573
  const declared = getWidgetMcpPermissions(widgetId);
62543
62574
  if (declared) declaredByWidget.set(widgetId, declared);
62544
62575
  }
62576
+ // Also resolve declared blocks for every dotted-form grant key.
62577
+ // getWidgetMcpPermissions translates dotted ids to npm package
62578
+ // paths internally, so the same package's manifest is shared
62579
+ // across all of its components. Without this, orphan-grant rows
62580
+ // ship to the renderer with declared:null and every granted tool
62581
+ // looks "stale" in Settings → Privacy.
62582
+ for (const widgetId of grantsByWidget.keys()) {
62583
+ if (declaredByWidget.has(widgetId)) continue;
62584
+ const declared = getWidgetMcpPermissions(widgetId);
62585
+ if (declared) declaredByWidget.set(widgetId, declared);
62586
+ }
62545
62587
 
62546
62588
  return buildGrantsListing(
62547
62589
  installedWidgets,