@trops/dash-core 0.1.295 → 0.1.296

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.
@@ -30050,7 +30050,7 @@ async function deleteRegistryPackage(scope, name) {
30050
30050
  }
30051
30051
  }
30052
30052
 
30053
- var registryAuthController$1 = {
30053
+ var registryAuthController$2 = {
30054
30054
  initiateDeviceFlow: initiateDeviceFlow$1,
30055
30055
  pollForToken: pollForToken$1,
30056
30056
  getStoredToken: getStoredToken$3,
@@ -31010,7 +31010,7 @@ var schedulerController_1 = schedulerController$2;
31010
31010
  const { dynamicWidgetLoader } = dynamicWidgetLoaderExports;
31011
31011
  const { compileWidget, findWidgetsDir } = widgetCompiler$1;
31012
31012
  const { toPackageId, parsePackageId } = packageId;
31013
- const { getStoredToken } = registryAuthController$1;
31013
+ const { getStoredToken } = registryAuthController$2;
31014
31014
 
31015
31015
  let WIDGETS_CACHE_DIR = null;
31016
31016
  let REGISTRY_CONFIG_FILE = null;
@@ -32207,7 +32207,7 @@ var widgetRegistryExports = widgetRegistry$1.exports;
32207
32207
 
32208
32208
  const fs$1 = require$$0$3;
32209
32209
  const path$4 = require$$1$2;
32210
- const { getStoredToken: getStoredToken$2 } = registryAuthController$1;
32210
+ const { getStoredToken: getStoredToken$2 } = registryAuthController$2;
32211
32211
 
32212
32212
  const REGISTRY_BASE_URL =
32213
32213
  process.env.DASH_REGISTRY_API_URL ||
@@ -32315,7 +32315,7 @@ const {
32315
32315
  getRegistryProfile: getRegistryProfile$1,
32316
32316
  getStoredToken: getStoredToken$1,
32317
32317
  clearToken: clearToken$1,
32318
- } = registryAuthController$1;
32318
+ } = registryAuthController$2;
32319
32319
 
32320
32320
  /**
32321
32321
  * Sanitize a name for use as a filename (lowercase, hyphens only).
@@ -32889,7 +32889,7 @@ const {
32889
32889
  applyEventWiringToLayout,
32890
32890
  } = dashboardConfigUtils$1;
32891
32891
  const { searchRegistry, getPackage } = registryController$3;
32892
- const { getStoredToken, clearToken } = registryAuthController$1;
32892
+ const { getStoredToken, clearToken } = registryAuthController$2;
32893
32893
  const themeController$3 = themeController_1;
32894
32894
 
32895
32895
  const configFilename = "workspaces.json";
@@ -34089,7 +34089,7 @@ async function prepareDashboardForPublish$1(
34089
34089
  let registryUsername = options.githubUser || "";
34090
34090
  if (!registryUsername) {
34091
34091
  try {
34092
- const { getRegistryProfile } = registryAuthController$1;
34092
+ const { getRegistryProfile } = registryAuthController$2;
34093
34093
  const profile = await getRegistryProfile();
34094
34094
  registryUsername = profile?.username || options.authorId || "";
34095
34095
  } catch {
@@ -34139,7 +34139,7 @@ async function prepareDashboardForPublish$1(
34139
34139
  // 11. Attempt to publish to registry if authenticated
34140
34140
  let registrySubmission = null;
34141
34141
  try {
34142
- const { getAuthStatus } = registryAuthController$1;
34142
+ const { getAuthStatus } = registryAuthController$2;
34143
34143
  const { publishToRegistry } = registryApiController$2;
34144
34144
  const authStatus = getAuthStatus();
34145
34145
 
@@ -68015,7 +68015,7 @@ const {
68015
68015
  getRegistryPackages,
68016
68016
  updateRegistryPackage,
68017
68017
  clearToken: clearRegistryToken,
68018
- } = registryAuthController$1;
68018
+ } = registryAuthController$2;
68019
68019
  const {
68020
68020
  publishToRegistry,
68021
68021
  getRegistryUrl,
@@ -70390,6 +70390,22 @@ const widgetTools$1 = [
70390
70390
  required: ["query"],
70391
70391
  },
70392
70392
  },
70393
+ {
70394
+ name: "install_widget",
70395
+ description:
70396
+ "Install a widget package from the Dash registry. Requires registry authentication — the user must be signed in via Settings > Account in the Dash app. Use search_widgets first to find available packages, then install by package name (e.g., 'slack', 'gong', 'chat'). After installation, use add_widget to place it on a dashboard.",
70397
+ inputSchema: {
70398
+ type: "object",
70399
+ properties: {
70400
+ packageName: {
70401
+ type: "string",
70402
+ description:
70403
+ "Package name from the registry (e.g., 'slack', 'gong', 'chat'). Use the 'package' field from search_widgets results.",
70404
+ },
70405
+ },
70406
+ required: ["packageName"],
70407
+ },
70408
+ },
70393
70409
  ];
70394
70410
 
70395
70411
  const themeTools$1 = [
@@ -71099,6 +71115,8 @@ async function handleGetAppStats$1() {
71099
71115
  // --- Widget Tool Handlers ---
71100
71116
 
71101
71117
  const registryController$1 = registryController$3;
71118
+ const registryAuthController$1 = registryAuthController$2;
71119
+ const { getWidgetRegistry } = widgetRegistryExports;
71102
71120
 
71103
71121
  /**
71104
71122
  * Helper: find a workspace by ID or return the first (active) one.
@@ -71793,6 +71811,155 @@ async function handleSearchWidgets$1({ query }) {
71793
71811
  }
71794
71812
  }
71795
71813
 
71814
+ /**
71815
+ * install_widget — Install a widget package from the Dash registry.
71816
+ * Requires the user to be authenticated via Settings > Account.
71817
+ */
71818
+ async function handleInstallWidget$1({ packageName }) {
71819
+ if (!packageName || typeof packageName !== "string" || !packageName.trim()) {
71820
+ return {
71821
+ content: [
71822
+ {
71823
+ type: "text",
71824
+ text: JSON.stringify({
71825
+ error: "packageName is required and must be a non-empty string",
71826
+ }),
71827
+ },
71828
+ ],
71829
+ isError: true,
71830
+ };
71831
+ }
71832
+
71833
+ // Check authentication
71834
+ const auth = registryAuthController$1.getStoredToken();
71835
+ if (!auth) {
71836
+ return {
71837
+ content: [
71838
+ {
71839
+ type: "text",
71840
+ text: JSON.stringify({
71841
+ error:
71842
+ "Not authenticated with the Dash registry. Please sign in via Settings > Account in the Dash app first.",
71843
+ authRequired: true,
71844
+ }),
71845
+ },
71846
+ ],
71847
+ isError: true,
71848
+ };
71849
+ }
71850
+
71851
+ try {
71852
+ // Look up the package in the registry
71853
+ const pkg = await registryController$1.getPackage(packageName.trim());
71854
+ if (!pkg) {
71855
+ return {
71856
+ content: [
71857
+ {
71858
+ type: "text",
71859
+ text: JSON.stringify({
71860
+ error: `Package "${packageName}" not found in the registry. Use search_widgets to find available packages.`,
71861
+ }),
71862
+ },
71863
+ ],
71864
+ isError: true,
71865
+ };
71866
+ }
71867
+
71868
+ if (!pkg.downloadUrl) {
71869
+ return {
71870
+ content: [
71871
+ {
71872
+ type: "text",
71873
+ text: JSON.stringify({
71874
+ error: `Package "${packageName}" has no download URL in the registry.`,
71875
+ }),
71876
+ },
71877
+ ],
71878
+ isError: true,
71879
+ };
71880
+ }
71881
+
71882
+ // Download and install
71883
+ const registry = getWidgetRegistry();
71884
+ const config = await registry.downloadWidget(pkg.name, pkg.downloadUrl);
71885
+
71886
+ // Notify all renderer windows
71887
+ const { win } = requireContext$1();
71888
+ const { BrowserWindow } = require("electron");
71889
+ BrowserWindow.getAllWindows().forEach((w) => {
71890
+ w.webContents.send("widget:installed", {
71891
+ widgetName: pkg.name,
71892
+ config,
71893
+ });
71894
+ });
71895
+
71896
+ // Build the list of installed widget names for the response
71897
+ const widgetNames = (pkg.widgets || []).map((w) => {
71898
+ const scopedName =
71899
+ pkg.scope && pkg.name && w.name
71900
+ ? `${pkg.scope}.${pkg.name}.${w.name}`
71901
+ : w.name || pkg.name;
71902
+ return {
71903
+ name: scopedName,
71904
+ displayName: w.displayName || w.name,
71905
+ };
71906
+ });
71907
+
71908
+ return {
71909
+ content: [
71910
+ {
71911
+ type: "text",
71912
+ text: JSON.stringify(
71913
+ {
71914
+ success: true,
71915
+ package: pkg.name,
71916
+ scope: pkg.scope || null,
71917
+ version: pkg.version || null,
71918
+ widgets: widgetNames,
71919
+ message: `Successfully installed "${pkg.displayName || pkg.name}". Use add_widget with the widget names above to add them to a dashboard.`,
71920
+ },
71921
+ null,
71922
+ 2,
71923
+ ),
71924
+ },
71925
+ ],
71926
+ };
71927
+ } catch (err) {
71928
+ // Handle auth expiration
71929
+ if (
71930
+ err.message &&
71931
+ (err.message.includes("401") || err.message.includes("Unauthorized"))
71932
+ ) {
71933
+ registryAuthController$1.clearToken();
71934
+ return {
71935
+ content: [
71936
+ {
71937
+ type: "text",
71938
+ text: JSON.stringify({
71939
+ error:
71940
+ "Authentication expired. Please sign in again via Settings > Account in the Dash app.",
71941
+ authRequired: true,
71942
+ }),
71943
+ },
71944
+ ],
71945
+ isError: true,
71946
+ };
71947
+ }
71948
+
71949
+ return {
71950
+ content: [
71951
+ {
71952
+ type: "text",
71953
+ text: JSON.stringify({
71954
+ error: `Failed to install widget package: ${err.message}`,
71955
+ }),
71956
+ },
71957
+ ],
71958
+ isError: true,
71959
+ };
71960
+ }
71961
+ }
71962
+
71796
71963
  // --- Theme Tool Handlers ---
71797
71964
 
71798
71965
  const settingsController$2 = settingsController_1;
@@ -73177,6 +73344,7 @@ var toolHandlers = {
73177
73344
  handleConfigureWidget: handleConfigureWidget$1,
73178
73345
  handleListWidgets: handleListWidgets$1,
73179
73346
  handleSearchWidgets: handleSearchWidgets$1,
73347
+ handleInstallWidget: handleInstallWidget$1,
73180
73348
  handleListThemes: handleListThemes$1,
73181
73349
  handleGetTheme: handleGetTheme$1,
73182
73350
  handleCreateTheme: handleCreateTheme$1,
@@ -73261,6 +73429,7 @@ const {
73261
73429
  handleConfigureWidget,
73262
73430
  handleListWidgets,
73263
73431
  handleSearchWidgets,
73432
+ handleInstallWidget,
73264
73433
  } = toolHandlers;
73265
73434
 
73266
73435
  // Map tool names to handler functions
@@ -73270,6 +73439,7 @@ const handlerMap$6 = {
73270
73439
  configure_widget: handleConfigureWidget,
73271
73440
  list_widgets: handleListWidgets,
73272
73441
  search_widgets: handleSearchWidgets,
73442
+ install_widget: handleInstallWidget,
73273
73443
  };
73274
73444
 
73275
73445
  /**
@@ -74371,7 +74541,7 @@ const pluginController = pluginController_1;
74371
74541
  const llmController = llmController_1;
74372
74542
  const cliController = cliController_1;
74373
74543
  const dashboardConfigController = dashboardConfigController$1;
74374
- const registryAuthController = registryAuthController$1;
74544
+ const registryAuthController = registryAuthController$2;
74375
74545
  const registryApiController = registryApiController$2;
74376
74546
  const notificationController = notificationController_1;
74377
74547
  const schedulerController = schedulerController_1;