@trops/dash-core 0.1.296 → 0.1.298

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.
@@ -70367,7 +70367,7 @@ const widgetTools$1 = [
70367
70367
  {
70368
70368
  name: "list_widgets",
70369
70369
  description:
70370
- "List all available widgets from the registry. Returns scoped component names (e.g. 'trops.gong.GongCallSearch') that can be passed directly to add_widget. Also includes description, provider requirements, and package info.",
70370
+ "List all available widgets from the registry. Returns scoped component names (e.g. 'trops.gong.GongCallSearch') that can be passed directly to add_widget. Each widget includes an 'installed' boolean — if true, use add_widget directly; if false, call install_widget first. Also includes description, provider requirements, and package info.",
70371
70371
  inputSchema: {
70372
70372
  type: "object",
70373
70373
  properties: {},
@@ -70377,7 +70377,7 @@ const widgetTools$1 = [
70377
70377
  {
70378
70378
  name: "search_widgets",
70379
70379
  description:
70380
- "Search the widget registry by keyword. Returns matching widgets with scoped names (e.g. 'trops.slack.SlackChannelFeed') that can be passed directly to add_widget. Also includes description and provider info.",
70380
+ "Search the widget registry by keyword. Returns matching widgets with scoped names (e.g. 'trops.slack.SlackChannelFeed') that can be passed directly to add_widget. Each widget includes an 'installed' boolean — if true, use add_widget directly; if false, call install_widget first. Also includes description and provider info.",
70381
70381
  inputSchema: {
70382
70382
  type: "object",
70383
70383
  properties: {
@@ -71637,6 +71637,41 @@ async function handleConfigureWidget$1({ dashboardId, widgetId, config }) {
71637
71637
  };
71638
71638
  }
71639
71639
 
71640
+ /**
71641
+ * Build a Set of installed package identifiers for quick lookup.
71642
+ * Includes both scoped ("@trops/slack") and bare ("slack") forms.
71643
+ */
71644
+ function getInstalledPackageNames() {
71645
+ const installed = new Set();
71646
+ try {
71647
+ const registry = getWidgetRegistry();
71648
+ const widgets = registry.getWidgets();
71649
+ for (const w of widgets) {
71650
+ const name = w.name || w.packageId || "";
71651
+ installed.add(name.toLowerCase());
71652
+ // Also add bare name for scoped packages ("@trops/slack" → "slack")
71653
+ if (name.includes("/")) {
71654
+ installed.add(name.split("/").pop().toLowerCase());
71655
+ }
71656
+ }
71657
+ } catch {
71658
+ // Widget registry may not be initialized (e.g. in tests)
71659
+ }
71660
+ return installed;
71661
+ }
71662
+
71663
+ /**
71664
+ * Check if a registry package is locally installed.
71665
+ */
71666
+ function isPackageInstalled(pkg, installedNames) {
71667
+ const candidates = [
71668
+ pkg.name,
71669
+ pkg.scope ? `@${pkg.scope}/${pkg.name}` : null,
71670
+ pkg.scope ? `${pkg.scope}/${pkg.name}` : null,
71671
+ ].filter(Boolean);
71672
+ return candidates.some((c) => installedNames.has(c.toLowerCase()));
71673
+ }
71674
+
71640
71675
  /**
71641
71676
  * list_widgets — List available widgets from the registry.
71642
71677
  */
@@ -71644,12 +71679,15 @@ async function handleListWidgets$1() {
71644
71679
  try {
71645
71680
  const index = await registryController$1.fetchRegistryIndex();
71646
71681
  const packages = index.packages || [];
71682
+ const installedNames = getInstalledPackageNames();
71647
71683
 
71648
71684
  const widgets = [];
71649
71685
  for (const pkg of packages) {
71650
71686
  // Skip non-widget packages
71651
71687
  if (pkg.type && pkg.type !== "widget") continue;
71652
71688
 
71689
+ const installed = isPackageInstalled(pkg, installedNames);
71690
+
71653
71691
  for (const w of pkg.widgets || []) {
71654
71692
  const shortName = w.name || pkg.name;
71655
71693
  const scopedName =
@@ -71663,6 +71701,7 @@ async function handleListWidgets$1() {
71663
71701
  icon: w.icon || pkg.icon || null,
71664
71702
  package: pkg.name,
71665
71703
  scope: pkg.scope || null,
71704
+ installed,
71666
71705
  providers: (w.providers || pkg.providers || []).map((p) => ({
71667
71706
  type: p.type,
71668
71707
  providerClass: p.providerClass || "api",
@@ -71684,6 +71723,7 @@ async function handleListWidgets$1() {
71684
71723
  icon: pkg.icon || null,
71685
71724
  package: pkg.name,
71686
71725
  scope: pkg.scope || null,
71726
+ installed,
71687
71727
  providers: (pkg.providers || []).map((p) => ({
71688
71728
  type: p.type,
71689
71729
  providerClass: p.providerClass || "api",
@@ -71737,11 +71777,14 @@ async function handleSearchWidgets$1({ query }) {
71737
71777
  try {
71738
71778
  const result = await registryController$1.searchRegistry(query.trim());
71739
71779
  const packages = result.packages || [];
71780
+ const installedNames = getInstalledPackageNames();
71740
71781
 
71741
71782
  const widgets = [];
71742
71783
  for (const pkg of packages) {
71743
71784
  if (pkg.type && pkg.type !== "widget") continue;
71744
71785
 
71786
+ const installed = isPackageInstalled(pkg, installedNames);
71787
+
71745
71788
  for (const w of pkg.widgets || []) {
71746
71789
  const shortName = w.name || pkg.name;
71747
71790
  const scopedName =
@@ -71755,6 +71798,7 @@ async function handleSearchWidgets$1({ query }) {
71755
71798
  icon: w.icon || pkg.icon || null,
71756
71799
  package: pkg.name,
71757
71800
  scope: pkg.scope || null,
71801
+ installed,
71758
71802
  providers: (w.providers || pkg.providers || []).map((p) => ({
71759
71803
  type: p.type,
71760
71804
  providerClass: p.providerClass || "api",
@@ -71775,6 +71819,7 @@ async function handleSearchWidgets$1({ query }) {
71775
71819
  icon: pkg.icon || null,
71776
71820
  package: pkg.name,
71777
71821
  scope: pkg.scope || null,
71822
+ installed,
71778
71823
  providers: (pkg.providers || []).map((p) => ({
71779
71824
  type: p.type,
71780
71825
  providerClass: p.providerClass || "api",