@trops/dash-core 0.1.526 → 0.1.527

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
  };