@trops/dash-core 0.1.175 → 0.1.176
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/electron/index.js +417 -93
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -1215,7 +1215,7 @@ const { getFileContents: getFileContents$7 } = file;
|
|
|
1215
1215
|
const configFilename$5 = "workspaces.json";
|
|
1216
1216
|
const appName$7 = "Dashboard";
|
|
1217
1217
|
|
|
1218
|
-
const workspaceController$
|
|
1218
|
+
const workspaceController$3 = {
|
|
1219
1219
|
/**
|
|
1220
1220
|
* createWorkspace
|
|
1221
1221
|
*
|
|
@@ -1457,7 +1457,7 @@ const workspaceController$2 = {
|
|
|
1457
1457
|
},
|
|
1458
1458
|
};
|
|
1459
1459
|
|
|
1460
|
-
var workspaceController_1 = workspaceController$
|
|
1460
|
+
var workspaceController_1 = workspaceController$3;
|
|
1461
1461
|
|
|
1462
1462
|
const { app: app$9 } = require$$0$2;
|
|
1463
1463
|
const path$f = require$$1$2;
|
|
@@ -1467,7 +1467,7 @@ const { getFileContents: getFileContents$6 } = file;
|
|
|
1467
1467
|
const configFilename$4 = "themes.json";
|
|
1468
1468
|
const appName$6 = "Dashboard";
|
|
1469
1469
|
|
|
1470
|
-
const themeController$
|
|
1470
|
+
const themeController$5 = {
|
|
1471
1471
|
/**
|
|
1472
1472
|
* saveTheme
|
|
1473
1473
|
* Create a new Theme that can be used in the application
|
|
@@ -1598,7 +1598,7 @@ const themeController$4 = {
|
|
|
1598
1598
|
},
|
|
1599
1599
|
};
|
|
1600
1600
|
|
|
1601
|
-
var themeController_1 = themeController$
|
|
1601
|
+
var themeController_1 = themeController$5;
|
|
1602
1602
|
|
|
1603
1603
|
/**
|
|
1604
1604
|
* Utils/tranaform
|
|
@@ -4294,7 +4294,7 @@ function copyDirectory(source, destination) {
|
|
|
4294
4294
|
}
|
|
4295
4295
|
}
|
|
4296
4296
|
|
|
4297
|
-
const settingsController$
|
|
4297
|
+
const settingsController$4 = {
|
|
4298
4298
|
/**
|
|
4299
4299
|
* saveSettingsForApplication
|
|
4300
4300
|
* Save the settings object to a file (settings.json)
|
|
@@ -4526,7 +4526,7 @@ const settingsController$3 = {
|
|
|
4526
4526
|
},
|
|
4527
4527
|
};
|
|
4528
4528
|
|
|
4529
|
-
var settingsController_1 = settingsController$
|
|
4529
|
+
var settingsController_1 = settingsController$4;
|
|
4530
4530
|
|
|
4531
4531
|
/**
|
|
4532
4532
|
* responseCache.js
|
|
@@ -31851,7 +31851,7 @@ const path$2 = require$$1$2;
|
|
|
31851
31851
|
const { app: app$2, dialog: dialog$1 } = require$$0$2;
|
|
31852
31852
|
const AdmZip$1 = require$$3$4;
|
|
31853
31853
|
|
|
31854
|
-
const themeController$
|
|
31854
|
+
const themeController$4 = themeController_1;
|
|
31855
31855
|
const registryController$2 = registryController$3;
|
|
31856
31856
|
const registryApiController$1 = registryApiController$2;
|
|
31857
31857
|
const {
|
|
@@ -31958,7 +31958,7 @@ function extractColors(themeData) {
|
|
|
31958
31958
|
async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
|
|
31959
31959
|
try {
|
|
31960
31960
|
// Read the theme data
|
|
31961
|
-
const themesResult = themeController$
|
|
31961
|
+
const themesResult = themeController$4.listThemesForApplication(win, appId);
|
|
31962
31962
|
if (themesResult.error) {
|
|
31963
31963
|
return {
|
|
31964
31964
|
success: false,
|
|
@@ -32169,7 +32169,7 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
|
|
|
32169
32169
|
const themeKey = pkg.displayName || pkg.name;
|
|
32170
32170
|
|
|
32171
32171
|
// Save via themeController
|
|
32172
|
-
const saveResult = themeController$
|
|
32172
|
+
const saveResult = themeController$4.saveThemeForApplication(
|
|
32173
32173
|
win,
|
|
32174
32174
|
appId,
|
|
32175
32175
|
themeKey,
|
|
@@ -32206,7 +32206,7 @@ async function installThemeFromRegistry$1(win, appId, packageName) {
|
|
|
32206
32206
|
*/
|
|
32207
32207
|
function getThemePublishPreview$1(appId, themeKey) {
|
|
32208
32208
|
try {
|
|
32209
|
-
const themesResult = themeController$
|
|
32209
|
+
const themesResult = themeController$4.listThemesForApplication(null, appId);
|
|
32210
32210
|
if (themesResult.error) {
|
|
32211
32211
|
return {
|
|
32212
32212
|
success: false,
|
|
@@ -32273,7 +32273,7 @@ const {
|
|
|
32273
32273
|
applyEventWiringToLayout,
|
|
32274
32274
|
} = dashboardConfigUtils$1;
|
|
32275
32275
|
const { searchRegistry, getPackage } = registryController$3;
|
|
32276
|
-
const themeController$
|
|
32276
|
+
const themeController$3 = themeController_1;
|
|
32277
32277
|
|
|
32278
32278
|
const configFilename = "workspaces.json";
|
|
32279
32279
|
const appName$1 = "Dashboard";
|
|
@@ -32353,7 +32353,7 @@ async function exportDashboardConfig$1(
|
|
|
32353
32353
|
// 4. Bundle theme if workspace has a themeKey
|
|
32354
32354
|
if (workspace.themeKey) {
|
|
32355
32355
|
try {
|
|
32356
|
-
const themeResult = themeController$
|
|
32356
|
+
const themeResult = themeController$3.listThemesForApplication(
|
|
32357
32357
|
win,
|
|
32358
32358
|
appId,
|
|
32359
32359
|
);
|
|
@@ -32708,7 +32708,7 @@ async function processDashboardConfig(
|
|
|
32708
32708
|
if (dashboardConfig.theme) {
|
|
32709
32709
|
const bundledTheme = dashboardConfig.theme;
|
|
32710
32710
|
try {
|
|
32711
|
-
const themeResult = themeController$
|
|
32711
|
+
const themeResult = themeController$3.listThemesForApplication(win, appId);
|
|
32712
32712
|
const existingThemes = themeResult.themes || {};
|
|
32713
32713
|
const themeKey = bundledTheme.key;
|
|
32714
32714
|
|
|
@@ -32722,7 +32722,7 @@ async function processDashboardConfig(
|
|
|
32722
32722
|
installedAt: new Date().toISOString(),
|
|
32723
32723
|
};
|
|
32724
32724
|
}
|
|
32725
|
-
themeController$
|
|
32725
|
+
themeController$3.saveThemeForApplication(
|
|
32726
32726
|
win,
|
|
32727
32727
|
appId,
|
|
32728
32728
|
themeKey,
|
|
@@ -33120,7 +33120,7 @@ async function prepareDashboardForPublish$1(
|
|
|
33120
33120
|
// 4. Bundle theme if workspace has a themeKey
|
|
33121
33121
|
if (workspace.themeKey) {
|
|
33122
33122
|
try {
|
|
33123
|
-
const themeResult = themeController$
|
|
33123
|
+
const themeResult = themeController$3.listThemesForApplication(
|
|
33124
33124
|
win,
|
|
33125
33125
|
appId,
|
|
33126
33126
|
);
|
|
@@ -66056,7 +66056,7 @@ const {
|
|
|
66056
66056
|
StreamableHTTPServerTransport,
|
|
66057
66057
|
} = streamableHttp;
|
|
66058
66058
|
|
|
66059
|
-
const settingsController$
|
|
66059
|
+
const settingsController$3 = settingsController_1;
|
|
66060
66060
|
|
|
66061
66061
|
// --- State ---
|
|
66062
66062
|
let mcpServer = null;
|
|
@@ -66118,7 +66118,7 @@ function registerTool$4(toolDef) {
|
|
|
66118
66118
|
/**
|
|
66119
66119
|
* Register a resource to be exposed via the MCP server.
|
|
66120
66120
|
*/
|
|
66121
|
-
function registerResource(resourceDef) {
|
|
66121
|
+
function registerResource$1(resourceDef) {
|
|
66122
66122
|
registeredResources.push(resourceDef);
|
|
66123
66123
|
}
|
|
66124
66124
|
|
|
@@ -66141,16 +66141,16 @@ function applyRegistrations(server) {
|
|
|
66141
66141
|
|
|
66142
66142
|
// --- Settings Helpers ---
|
|
66143
66143
|
function getMcpServerSettings(win) {
|
|
66144
|
-
const result = settingsController$
|
|
66144
|
+
const result = settingsController$3.getSettingsForApplication(win);
|
|
66145
66145
|
const settings = result?.settings || {};
|
|
66146
66146
|
return settings.mcpDashServer || {};
|
|
66147
66147
|
}
|
|
66148
66148
|
|
|
66149
66149
|
function saveMcpServerSettings(win, mcpSettings) {
|
|
66150
|
-
const result = settingsController$
|
|
66150
|
+
const result = settingsController$3.getSettingsForApplication(win);
|
|
66151
66151
|
const settings = result?.settings || {};
|
|
66152
66152
|
settings.mcpDashServer = mcpSettings;
|
|
66153
|
-
settingsController$
|
|
66153
|
+
settingsController$3.saveSettingsForApplication(win, settings);
|
|
66154
66154
|
}
|
|
66155
66155
|
|
|
66156
66156
|
// --- App ID Resolution ---
|
|
@@ -66189,7 +66189,7 @@ function getServerContext() {
|
|
|
66189
66189
|
}
|
|
66190
66190
|
|
|
66191
66191
|
// --- Controller ---
|
|
66192
|
-
const mcpDashServerController$
|
|
66192
|
+
const mcpDashServerController$4 = {
|
|
66193
66193
|
/**
|
|
66194
66194
|
* Start the MCP Dash server.
|
|
66195
66195
|
* @param {BrowserWindow} win
|
|
@@ -66207,7 +66207,7 @@ const mcpDashServerController$3 = {
|
|
|
66207
66207
|
const serverSettings = getMcpServerSettings(win);
|
|
66208
66208
|
const port = options.port || serverSettings.port || 3141;
|
|
66209
66209
|
const token =
|
|
66210
|
-
serverSettings.token || mcpDashServerController$
|
|
66210
|
+
serverSettings.token || mcpDashServerController$4.getOrCreateToken(win);
|
|
66211
66211
|
|
|
66212
66212
|
// Create McpServer
|
|
66213
66213
|
mcpServer = new McpServer({
|
|
@@ -66385,8 +66385,8 @@ const mcpDashServerController$3 = {
|
|
|
66385
66385
|
* Restart the server (stop + start).
|
|
66386
66386
|
*/
|
|
66387
66387
|
restartServer: async (win, options = {}) => {
|
|
66388
|
-
await mcpDashServerController$
|
|
66389
|
-
return mcpDashServerController$
|
|
66388
|
+
await mcpDashServerController$4.stopServer(win);
|
|
66389
|
+
return mcpDashServerController$4.startServer(win, options);
|
|
66390
66390
|
},
|
|
66391
66391
|
|
|
66392
66392
|
/**
|
|
@@ -66426,7 +66426,7 @@ const mcpDashServerController$3 = {
|
|
|
66426
66426
|
const serverSettings = getMcpServerSettings(win);
|
|
66427
66427
|
if (serverSettings.enabled) {
|
|
66428
66428
|
console.log("[mcpDashServer] Auto-starting server...");
|
|
66429
|
-
return mcpDashServerController$
|
|
66429
|
+
return mcpDashServerController$4.startServer(win, {
|
|
66430
66430
|
port: serverSettings.port,
|
|
66431
66431
|
});
|
|
66432
66432
|
}
|
|
@@ -66435,11 +66435,11 @@ const mcpDashServerController$3 = {
|
|
|
66435
66435
|
|
|
66436
66436
|
// Expose registration functions for other controllers
|
|
66437
66437
|
registerTool: registerTool$4,
|
|
66438
|
-
registerResource,
|
|
66438
|
+
registerResource: registerResource$1,
|
|
66439
66439
|
getServerContext,
|
|
66440
66440
|
};
|
|
66441
66441
|
|
|
66442
|
-
var mcpDashServerController_1 = mcpDashServerController$
|
|
66442
|
+
var mcpDashServerController_1 = mcpDashServerController$4;
|
|
66443
66443
|
|
|
66444
66444
|
/**
|
|
66445
66445
|
* clientFactories.js
|
|
@@ -66872,7 +66872,7 @@ const {
|
|
|
66872
66872
|
matchTailwindFamily,
|
|
66873
66873
|
generateThemeFromPalette,
|
|
66874
66874
|
} = paletteToThemeMapper_1;
|
|
66875
|
-
const mcpDashServerController$
|
|
66875
|
+
const mcpDashServerController$3 = mcpDashServerController_1;
|
|
66876
66876
|
|
|
66877
66877
|
var controller = {
|
|
66878
66878
|
showDialog,
|
|
@@ -66955,7 +66955,7 @@ var controller = {
|
|
|
66955
66955
|
assignRoles,
|
|
66956
66956
|
matchTailwindFamily,
|
|
66957
66957
|
generateThemeFromPalette,
|
|
66958
|
-
mcpDashServerController: mcpDashServerController$
|
|
66958
|
+
mcpDashServerController: mcpDashServerController$3,
|
|
66959
66959
|
};
|
|
66960
66960
|
|
|
66961
66961
|
const { ipcRenderer: ipcRenderer$q } = require$$0$2;
|
|
@@ -69297,16 +69297,16 @@ var toolDefinitions = { dashboardTools: dashboardTools$1, widgetTools: widgetToo
|
|
|
69297
69297
|
* MCP tool handlers for dashboard/workspace CRUD and app statistics.
|
|
69298
69298
|
* Each handler delegates to existing controllers via getServerContext().
|
|
69299
69299
|
*/
|
|
69300
|
-
const mcpDashServerController$
|
|
69301
|
-
const workspaceController$
|
|
69302
|
-
const themeController$
|
|
69303
|
-
const providerController$
|
|
69300
|
+
const mcpDashServerController$2 = mcpDashServerController_1;
|
|
69301
|
+
const workspaceController$2 = workspaceController_1;
|
|
69302
|
+
const themeController$2 = themeController_1;
|
|
69303
|
+
const providerController$2 = requireProviderController();
|
|
69304
69304
|
|
|
69305
69305
|
/**
|
|
69306
69306
|
* Helper: get win + appId or throw a descriptive error.
|
|
69307
69307
|
*/
|
|
69308
|
-
function requireContext() {
|
|
69309
|
-
const ctx = mcpDashServerController$
|
|
69308
|
+
function requireContext$1() {
|
|
69309
|
+
const ctx = mcpDashServerController$2.getServerContext();
|
|
69310
69310
|
if (!ctx) {
|
|
69311
69311
|
throw new Error("MCP server is not running or has no active window");
|
|
69312
69312
|
}
|
|
@@ -69317,7 +69317,7 @@ function requireContext() {
|
|
|
69317
69317
|
* Helper: count widgets in a workspace's layout array.
|
|
69318
69318
|
* Widgets are layout items whose component is registered and is not a container.
|
|
69319
69319
|
*/
|
|
69320
|
-
function countWidgets(layout) {
|
|
69320
|
+
function countWidgets$1(layout) {
|
|
69321
69321
|
if (!Array.isArray(layout)) return 0;
|
|
69322
69322
|
return layout.filter(
|
|
69323
69323
|
(item) =>
|
|
@@ -69332,8 +69332,8 @@ function countWidgets(layout) {
|
|
|
69332
69332
|
* list_dashboards — Returns all workspaces with id, name, widget count, active state.
|
|
69333
69333
|
*/
|
|
69334
69334
|
async function handleListDashboards$1() {
|
|
69335
|
-
const { win, appId } = requireContext();
|
|
69336
|
-
const result = workspaceController$
|
|
69335
|
+
const { win, appId } = requireContext$1();
|
|
69336
|
+
const result = workspaceController$2.listWorkspacesForApplication(win, appId);
|
|
69337
69337
|
|
|
69338
69338
|
if (result.error) {
|
|
69339
69339
|
return {
|
|
@@ -69350,7 +69350,7 @@ async function handleListDashboards$1() {
|
|
|
69350
69350
|
const dashboards = (result.workspaces || []).map((ws, index) => ({
|
|
69351
69351
|
id: String(ws.id),
|
|
69352
69352
|
name: ws.name || ws.label || `Dashboard ${index + 1}`,
|
|
69353
|
-
widgetCount: countWidgets(ws.layout),
|
|
69353
|
+
widgetCount: countWidgets$1(ws.layout),
|
|
69354
69354
|
isActive: index === 0,
|
|
69355
69355
|
}));
|
|
69356
69356
|
|
|
@@ -69363,8 +69363,8 @@ async function handleListDashboards$1() {
|
|
|
69363
69363
|
* get_dashboard — Returns full details for a dashboard by ID (or the active one).
|
|
69364
69364
|
*/
|
|
69365
69365
|
async function handleGetDashboard$1({ dashboardId }) {
|
|
69366
|
-
const { win, appId } = requireContext();
|
|
69367
|
-
const result = workspaceController$
|
|
69366
|
+
const { win, appId } = requireContext$1();
|
|
69367
|
+
const result = workspaceController$2.listWorkspacesForApplication(win, appId);
|
|
69368
69368
|
|
|
69369
69369
|
if (result.error) {
|
|
69370
69370
|
return {
|
|
@@ -69459,7 +69459,7 @@ async function handleCreateDashboard$1({ name }) {
|
|
|
69459
69459
|
};
|
|
69460
69460
|
}
|
|
69461
69461
|
|
|
69462
|
-
const { win, appId } = requireContext();
|
|
69462
|
+
const { win, appId } = requireContext$1();
|
|
69463
69463
|
|
|
69464
69464
|
const newWorkspace = {
|
|
69465
69465
|
id: Date.now(),
|
|
@@ -69479,7 +69479,7 @@ async function handleCreateDashboard$1({ name }) {
|
|
|
69479
69479
|
],
|
|
69480
69480
|
};
|
|
69481
69481
|
|
|
69482
|
-
const result = workspaceController$
|
|
69482
|
+
const result = workspaceController$2.saveWorkspaceForApplication(
|
|
69483
69483
|
win,
|
|
69484
69484
|
appId,
|
|
69485
69485
|
newWorkspace,
|
|
@@ -69529,10 +69529,10 @@ async function handleDeleteDashboard$1({ dashboardId }) {
|
|
|
69529
69529
|
};
|
|
69530
69530
|
}
|
|
69531
69531
|
|
|
69532
|
-
const { win, appId } = requireContext();
|
|
69532
|
+
const { win, appId } = requireContext$1();
|
|
69533
69533
|
|
|
69534
69534
|
// Check how many dashboards exist
|
|
69535
|
-
const listResult = workspaceController$
|
|
69535
|
+
const listResult = workspaceController$2.listWorkspacesForApplication(
|
|
69536
69536
|
win,
|
|
69537
69537
|
appId,
|
|
69538
69538
|
);
|
|
@@ -69570,7 +69570,7 @@ async function handleDeleteDashboard$1({ dashboardId }) {
|
|
|
69570
69570
|
|
|
69571
69571
|
// Use numeric ID if stored as number
|
|
69572
69572
|
const targetWs = workspaces.find((ws) => String(ws.id) === dashboardId);
|
|
69573
|
-
const result = workspaceController$
|
|
69573
|
+
const result = workspaceController$2.deleteWorkspaceForApplication(
|
|
69574
69574
|
win,
|
|
69575
69575
|
appId,
|
|
69576
69576
|
targetWs.id,
|
|
@@ -69606,24 +69606,24 @@ async function handleDeleteDashboard$1({ dashboardId }) {
|
|
|
69606
69606
|
* get_app_stats — Returns counts of dashboards, widgets, themes, and providers.
|
|
69607
69607
|
*/
|
|
69608
69608
|
async function handleGetAppStats$1() {
|
|
69609
|
-
const { win, appId } = requireContext();
|
|
69609
|
+
const { win, appId } = requireContext$1();
|
|
69610
69610
|
|
|
69611
69611
|
// Dashboards + widget count
|
|
69612
|
-
const wsResult = workspaceController$
|
|
69612
|
+
const wsResult = workspaceController$2.listWorkspacesForApplication(win, appId);
|
|
69613
69613
|
const workspaces = wsResult.workspaces || [];
|
|
69614
69614
|
const dashboardCount = workspaces.length;
|
|
69615
69615
|
const widgetCount = workspaces.reduce(
|
|
69616
|
-
(sum, ws) => sum + countWidgets(ws.layout),
|
|
69616
|
+
(sum, ws) => sum + countWidgets$1(ws.layout),
|
|
69617
69617
|
0,
|
|
69618
69618
|
);
|
|
69619
69619
|
|
|
69620
69620
|
// Themes
|
|
69621
|
-
const themeResult = themeController$
|
|
69621
|
+
const themeResult = themeController$2.listThemesForApplication(win, appId);
|
|
69622
69622
|
const themes = themeResult.themes || {};
|
|
69623
69623
|
const themeCount = Object.keys(themes).length;
|
|
69624
69624
|
|
|
69625
69625
|
// Providers
|
|
69626
|
-
const providerResult = providerController$
|
|
69626
|
+
const providerResult = providerController$2.listProviders(win, appId);
|
|
69627
69627
|
const providers = providerResult.providers || {};
|
|
69628
69628
|
const providerCount = Object.keys(providers).length;
|
|
69629
69629
|
|
|
@@ -69714,8 +69714,8 @@ async function handleAddWidget$1({ dashboardId, widgetName }) {
|
|
|
69714
69714
|
};
|
|
69715
69715
|
}
|
|
69716
69716
|
|
|
69717
|
-
const { win, appId } = requireContext();
|
|
69718
|
-
const result = workspaceController$
|
|
69717
|
+
const { win, appId } = requireContext$1();
|
|
69718
|
+
const result = workspaceController$2.listWorkspacesForApplication(win, appId);
|
|
69719
69719
|
if (result.error) {
|
|
69720
69720
|
return {
|
|
69721
69721
|
content: [
|
|
@@ -69756,7 +69756,7 @@ async function handleAddWidget$1({ dashboardId, widgetName }) {
|
|
|
69756
69756
|
|
|
69757
69757
|
workspace.layout = [...layout, newItem];
|
|
69758
69758
|
|
|
69759
|
-
const saveResult = workspaceController$
|
|
69759
|
+
const saveResult = workspaceController$2.saveWorkspaceForApplication(
|
|
69760
69760
|
win,
|
|
69761
69761
|
appId,
|
|
69762
69762
|
workspace,
|
|
@@ -69807,8 +69807,8 @@ async function handleRemoveWidget$1({ dashboardId, widgetId }) {
|
|
|
69807
69807
|
};
|
|
69808
69808
|
}
|
|
69809
69809
|
|
|
69810
|
-
const { win, appId } = requireContext();
|
|
69811
|
-
const result = workspaceController$
|
|
69810
|
+
const { win, appId } = requireContext$1();
|
|
69811
|
+
const result = workspaceController$2.listWorkspacesForApplication(win, appId);
|
|
69812
69812
|
if (result.error) {
|
|
69813
69813
|
return {
|
|
69814
69814
|
content: [
|
|
@@ -69841,7 +69841,7 @@ async function handleRemoveWidget$1({ dashboardId, widgetId }) {
|
|
|
69841
69841
|
|
|
69842
69842
|
workspace.layout = layout.filter((item) => String(item.id) !== widgetId);
|
|
69843
69843
|
|
|
69844
|
-
const saveResult = workspaceController$
|
|
69844
|
+
const saveResult = workspaceController$2.saveWorkspaceForApplication(
|
|
69845
69845
|
win,
|
|
69846
69846
|
appId,
|
|
69847
69847
|
workspace,
|
|
@@ -69865,7 +69865,7 @@ async function handleRemoveWidget$1({ dashboardId, widgetId }) {
|
|
|
69865
69865
|
text: JSON.stringify({
|
|
69866
69866
|
success: true,
|
|
69867
69867
|
removed: widgetId,
|
|
69868
|
-
remainingWidgets: countWidgets(workspace.layout),
|
|
69868
|
+
remainingWidgets: countWidgets$1(workspace.layout),
|
|
69869
69869
|
}),
|
|
69870
69870
|
},
|
|
69871
69871
|
],
|
|
@@ -69902,8 +69902,8 @@ async function handleConfigureWidget$1({ dashboardId, widgetId, config }) {
|
|
|
69902
69902
|
};
|
|
69903
69903
|
}
|
|
69904
69904
|
|
|
69905
|
-
const { win, appId } = requireContext();
|
|
69906
|
-
const result = workspaceController$
|
|
69905
|
+
const { win, appId } = requireContext$1();
|
|
69906
|
+
const result = workspaceController$2.listWorkspacesForApplication(win, appId);
|
|
69907
69907
|
if (result.error) {
|
|
69908
69908
|
return {
|
|
69909
69909
|
content: [
|
|
@@ -69937,7 +69937,7 @@ async function handleConfigureWidget$1({ dashboardId, widgetId, config }) {
|
|
|
69937
69937
|
// Merge config
|
|
69938
69938
|
item.config = { ...(item.config || {}), ...config };
|
|
69939
69939
|
|
|
69940
|
-
const saveResult = workspaceController$
|
|
69940
|
+
const saveResult = workspaceController$2.saveWorkspaceForApplication(
|
|
69941
69941
|
win,
|
|
69942
69942
|
appId,
|
|
69943
69943
|
workspace,
|
|
@@ -70126,7 +70126,7 @@ async function handleSearchWidgets$1({ query }) {
|
|
|
70126
70126
|
|
|
70127
70127
|
// --- Theme Tool Handlers ---
|
|
70128
70128
|
|
|
70129
|
-
const settingsController$
|
|
70129
|
+
const settingsController$2 = settingsController_1;
|
|
70130
70130
|
const themeFromUrlController$1 = themeFromUrlController_1;
|
|
70131
70131
|
const paletteToThemeMapper$1 = paletteToThemeMapper_1;
|
|
70132
70132
|
const extractionCacheController$1 = extractionCacheController_1;
|
|
@@ -70136,8 +70136,8 @@ const { THEME_SAVE_COMPLETE, SETTINGS_SAVE_COMPLETE } = events$8;
|
|
|
70136
70136
|
* list_themes — Returns all saved themes with name, active state, and color summary.
|
|
70137
70137
|
*/
|
|
70138
70138
|
async function handleListThemes$1() {
|
|
70139
|
-
const { win, appId } = requireContext();
|
|
70140
|
-
const result = themeController$
|
|
70139
|
+
const { win, appId } = requireContext$1();
|
|
70140
|
+
const result = themeController$2.listThemesForApplication(win, appId);
|
|
70141
70141
|
|
|
70142
70142
|
if (result.error) {
|
|
70143
70143
|
return {
|
|
@@ -70149,7 +70149,7 @@ async function handleListThemes$1() {
|
|
|
70149
70149
|
}
|
|
70150
70150
|
|
|
70151
70151
|
const themes = result.themes || {};
|
|
70152
|
-
const settingsResult = settingsController$
|
|
70152
|
+
const settingsResult = settingsController$2.getSettingsForApplication(win);
|
|
70153
70153
|
const activeThemeKey = settingsResult?.settings?.theme || null;
|
|
70154
70154
|
|
|
70155
70155
|
const themeList = Object.keys(themes).map((name) => ({
|
|
@@ -70190,8 +70190,8 @@ async function handleGetTheme$1({ name }) {
|
|
|
70190
70190
|
};
|
|
70191
70191
|
}
|
|
70192
70192
|
|
|
70193
|
-
const { win, appId } = requireContext();
|
|
70194
|
-
const result = themeController$
|
|
70193
|
+
const { win, appId } = requireContext$1();
|
|
70194
|
+
const result = themeController$2.listThemesForApplication(win, appId);
|
|
70195
70195
|
|
|
70196
70196
|
if (result.error) {
|
|
70197
70197
|
return {
|
|
@@ -70217,7 +70217,7 @@ async function handleGetTheme$1({ name }) {
|
|
|
70217
70217
|
};
|
|
70218
70218
|
}
|
|
70219
70219
|
|
|
70220
|
-
const settingsResult = settingsController$
|
|
70220
|
+
const settingsResult = settingsController$2.getSettingsForApplication(win);
|
|
70221
70221
|
const activeThemeKey = settingsResult?.settings?.theme || null;
|
|
70222
70222
|
|
|
70223
70223
|
return {
|
|
@@ -70270,10 +70270,10 @@ async function handleCreateTheme$1({ name, colors }) {
|
|
|
70270
70270
|
};
|
|
70271
70271
|
}
|
|
70272
70272
|
|
|
70273
|
-
const { win, appId } = requireContext();
|
|
70273
|
+
const { win, appId } = requireContext$1();
|
|
70274
70274
|
const themeName = name.trim();
|
|
70275
70275
|
|
|
70276
|
-
const result = themeController$
|
|
70276
|
+
const result = themeController$2.saveThemeForApplication(
|
|
70277
70277
|
win,
|
|
70278
70278
|
appId,
|
|
70279
70279
|
themeName,
|
|
@@ -70338,7 +70338,7 @@ async function handleCreateThemeFromUrl$1({ url, name }) {
|
|
|
70338
70338
|
};
|
|
70339
70339
|
}
|
|
70340
70340
|
|
|
70341
|
-
const { win, appId } = requireContext();
|
|
70341
|
+
const { win, appId } = requireContext$1();
|
|
70342
70342
|
const { BrowserWindow } = require$$0$2;
|
|
70343
70343
|
|
|
70344
70344
|
const LOAD_TIMEOUT_MS = 15000;
|
|
@@ -70488,7 +70488,7 @@ async function handleCreateThemeFromUrl$1({ url, name }) {
|
|
|
70488
70488
|
}
|
|
70489
70489
|
|
|
70490
70490
|
// Save the generated theme
|
|
70491
|
-
const saveResult = themeController$
|
|
70491
|
+
const saveResult = themeController$2.saveThemeForApplication(
|
|
70492
70492
|
win,
|
|
70493
70493
|
appId,
|
|
70494
70494
|
themeName,
|
|
@@ -70558,11 +70558,11 @@ async function handleApplyTheme$1({ name }) {
|
|
|
70558
70558
|
};
|
|
70559
70559
|
}
|
|
70560
70560
|
|
|
70561
|
-
const { win, appId } = requireContext();
|
|
70561
|
+
const { win, appId } = requireContext$1();
|
|
70562
70562
|
const themeName = name.trim();
|
|
70563
70563
|
|
|
70564
70564
|
// Verify the theme exists
|
|
70565
|
-
const themeResult = themeController$
|
|
70565
|
+
const themeResult = themeController$2.listThemesForApplication(win, appId);
|
|
70566
70566
|
if (themeResult.error) {
|
|
70567
70567
|
return {
|
|
70568
70568
|
content: [
|
|
@@ -70591,11 +70591,11 @@ async function handleApplyTheme$1({ name }) {
|
|
|
70591
70591
|
}
|
|
70592
70592
|
|
|
70593
70593
|
// Update settings to set the active theme
|
|
70594
|
-
const settingsResult = settingsController$
|
|
70594
|
+
const settingsResult = settingsController$2.getSettingsForApplication(win);
|
|
70595
70595
|
const settings = settingsResult?.settings || {};
|
|
70596
70596
|
settings.theme = themeName;
|
|
70597
70597
|
|
|
70598
|
-
const saveResult = settingsController$
|
|
70598
|
+
const saveResult = settingsController$2.saveSettingsForApplication(
|
|
70599
70599
|
win,
|
|
70600
70600
|
settings,
|
|
70601
70601
|
);
|
|
@@ -70634,8 +70634,8 @@ const { PROVIDER_LIST_COMPLETE } = events$8;
|
|
|
70634
70634
|
* Credentials/secrets are NEVER included in the response.
|
|
70635
70635
|
*/
|
|
70636
70636
|
async function handleListProviders$1() {
|
|
70637
|
-
const { win, appId } = requireContext();
|
|
70638
|
-
const result = providerController$
|
|
70637
|
+
const { win, appId } = requireContext$1();
|
|
70638
|
+
const result = providerController$2.listProviders(win, appId);
|
|
70639
70639
|
|
|
70640
70640
|
if (result.error) {
|
|
70641
70641
|
return {
|
|
@@ -70737,12 +70737,12 @@ async function handleAddProvider$1({
|
|
|
70737
70737
|
};
|
|
70738
70738
|
}
|
|
70739
70739
|
|
|
70740
|
-
const { win, appId } = requireContext();
|
|
70740
|
+
const { win, appId } = requireContext$1();
|
|
70741
70741
|
const providerName = name.trim();
|
|
70742
70742
|
const providerType = type.trim();
|
|
70743
70743
|
|
|
70744
70744
|
// Check for duplicate names
|
|
70745
|
-
const existing = providerController$
|
|
70745
|
+
const existing = providerController$2.listProviders(win, appId);
|
|
70746
70746
|
if (!existing.error) {
|
|
70747
70747
|
const duplicate = (existing.providers || []).find(
|
|
70748
70748
|
(p) => p.name === providerName,
|
|
@@ -70762,7 +70762,7 @@ async function handleAddProvider$1({
|
|
|
70762
70762
|
}
|
|
70763
70763
|
}
|
|
70764
70764
|
|
|
70765
|
-
const result = providerController$
|
|
70765
|
+
const result = providerController$2.saveProvider(
|
|
70766
70766
|
win,
|
|
70767
70767
|
appId,
|
|
70768
70768
|
providerName,
|
|
@@ -70783,7 +70783,7 @@ async function handleAddProvider$1({
|
|
|
70783
70783
|
}
|
|
70784
70784
|
|
|
70785
70785
|
// Notify the renderer so the UI updates
|
|
70786
|
-
const listResult = providerController$
|
|
70786
|
+
const listResult = providerController$2.listProviders(win, appId);
|
|
70787
70787
|
win.webContents.send(PROVIDER_LIST_COMPLETE, listResult);
|
|
70788
70788
|
|
|
70789
70789
|
return {
|
|
@@ -70823,10 +70823,10 @@ async function handleRemoveProvider$1({ name }) {
|
|
|
70823
70823
|
};
|
|
70824
70824
|
}
|
|
70825
70825
|
|
|
70826
|
-
const { win, appId } = requireContext();
|
|
70826
|
+
const { win, appId } = requireContext$1();
|
|
70827
70827
|
const providerName = name.trim();
|
|
70828
70828
|
|
|
70829
|
-
const result = providerController$
|
|
70829
|
+
const result = providerController$2.deleteProvider(win, appId, providerName);
|
|
70830
70830
|
|
|
70831
70831
|
if (result.error) {
|
|
70832
70832
|
return {
|
|
@@ -70838,7 +70838,7 @@ async function handleRemoveProvider$1({ name }) {
|
|
|
70838
70838
|
}
|
|
70839
70839
|
|
|
70840
70840
|
// Notify the renderer so the UI updates
|
|
70841
|
-
const listResult = providerController$
|
|
70841
|
+
const listResult = providerController$2.listProviders(win, appId);
|
|
70842
70842
|
win.webContents.send(PROVIDER_LIST_COMPLETE, listResult);
|
|
70843
70843
|
|
|
70844
70844
|
return {
|
|
@@ -70890,7 +70890,7 @@ const {
|
|
|
70890
70890
|
} = toolHandlers;
|
|
70891
70891
|
|
|
70892
70892
|
// Map tool names to handler functions
|
|
70893
|
-
const handlerMap$
|
|
70893
|
+
const handlerMap$4 = {
|
|
70894
70894
|
list_dashboards: handleListDashboards,
|
|
70895
70895
|
get_dashboard: handleGetDashboard,
|
|
70896
70896
|
create_dashboard: handleCreateDashboard,
|
|
@@ -70903,7 +70903,7 @@ const handlerMap$3 = {
|
|
|
70903
70903
|
*/
|
|
70904
70904
|
function registerDashboardTools$1() {
|
|
70905
70905
|
for (const tool of dashboardTools) {
|
|
70906
|
-
const handler = handlerMap$
|
|
70906
|
+
const handler = handlerMap$4[tool.name];
|
|
70907
70907
|
if (!handler) {
|
|
70908
70908
|
console.warn(`[dashboardTools] No handler found for tool: ${tool.name}`);
|
|
70909
70909
|
continue;
|
|
@@ -70940,7 +70940,7 @@ const {
|
|
|
70940
70940
|
} = toolHandlers;
|
|
70941
70941
|
|
|
70942
70942
|
// Map tool names to handler functions
|
|
70943
|
-
const handlerMap$
|
|
70943
|
+
const handlerMap$3 = {
|
|
70944
70944
|
add_widget: handleAddWidget,
|
|
70945
70945
|
remove_widget: handleRemoveWidget,
|
|
70946
70946
|
configure_widget: handleConfigureWidget,
|
|
@@ -70953,7 +70953,7 @@ const handlerMap$2 = {
|
|
|
70953
70953
|
*/
|
|
70954
70954
|
function registerWidgetTools$1() {
|
|
70955
70955
|
for (const tool of widgetTools) {
|
|
70956
|
-
const handler = handlerMap$
|
|
70956
|
+
const handler = handlerMap$3[tool.name];
|
|
70957
70957
|
if (!handler) {
|
|
70958
70958
|
console.warn(`[widgetTools] No handler found for tool: ${tool.name}`);
|
|
70959
70959
|
continue;
|
|
@@ -70988,7 +70988,7 @@ const {
|
|
|
70988
70988
|
} = toolHandlers;
|
|
70989
70989
|
|
|
70990
70990
|
// Map tool names to handler functions
|
|
70991
|
-
const handlerMap$
|
|
70991
|
+
const handlerMap$2 = {
|
|
70992
70992
|
list_themes: handleListThemes,
|
|
70993
70993
|
get_theme: handleGetTheme,
|
|
70994
70994
|
create_theme: handleCreateTheme,
|
|
@@ -71001,7 +71001,7 @@ const handlerMap$1 = {
|
|
|
71001
71001
|
*/
|
|
71002
71002
|
function registerThemeTools$1() {
|
|
71003
71003
|
for (const tool of themeTools) {
|
|
71004
|
-
const handler = handlerMap$
|
|
71004
|
+
const handler = handlerMap$2[tool.name];
|
|
71005
71005
|
if (!handler) {
|
|
71006
71006
|
console.warn(`[themeTools] No handler found for tool: ${tool.name}`);
|
|
71007
71007
|
continue;
|
|
@@ -71034,7 +71034,7 @@ const {
|
|
|
71034
71034
|
} = toolHandlers;
|
|
71035
71035
|
|
|
71036
71036
|
// Map tool names to handler functions
|
|
71037
|
-
const handlerMap = {
|
|
71037
|
+
const handlerMap$1 = {
|
|
71038
71038
|
list_providers: handleListProviders,
|
|
71039
71039
|
add_provider: handleAddProvider,
|
|
71040
71040
|
remove_provider: handleRemoveProvider,
|
|
@@ -71045,7 +71045,7 @@ const handlerMap = {
|
|
|
71045
71045
|
*/
|
|
71046
71046
|
function registerProviderTools$1() {
|
|
71047
71047
|
for (const tool of providerTools) {
|
|
71048
|
-
const handler = handlerMap[tool.name];
|
|
71048
|
+
const handler = handlerMap$1[tool.name];
|
|
71049
71049
|
if (!handler) {
|
|
71050
71050
|
console.warn(`[providerTools] No handler found for tool: ${tool.name}`);
|
|
71051
71051
|
continue;
|
|
@@ -71064,6 +71064,327 @@ function registerProviderTools$1() {
|
|
|
71064
71064
|
|
|
71065
71065
|
var providerTools_1 = { registerProviderTools: registerProviderTools$1 };
|
|
71066
71066
|
|
|
71067
|
+
/**
|
|
71068
|
+
* resourceDefinitions.js
|
|
71069
|
+
*
|
|
71070
|
+
* MCP resource definitions for read-only app state via dash:// URIs.
|
|
71071
|
+
* Each resource exposes a snapshot of Dash state to external LLM clients.
|
|
71072
|
+
*/
|
|
71073
|
+
|
|
71074
|
+
const dashResources$1 = [
|
|
71075
|
+
{
|
|
71076
|
+
name: "active-dashboard",
|
|
71077
|
+
uri: "dash://dashboards/active",
|
|
71078
|
+
description:
|
|
71079
|
+
"Current active dashboard — layout, widgets, theme, and widget count",
|
|
71080
|
+
},
|
|
71081
|
+
{
|
|
71082
|
+
name: "all-dashboards",
|
|
71083
|
+
uri: "dash://dashboards",
|
|
71084
|
+
description:
|
|
71085
|
+
"Summary of all dashboards — IDs, names, widget counts, active state",
|
|
71086
|
+
},
|
|
71087
|
+
{
|
|
71088
|
+
name: "all-themes",
|
|
71089
|
+
uri: "dash://themes",
|
|
71090
|
+
description:
|
|
71091
|
+
"All saved themes — names, active state, and color definitions",
|
|
71092
|
+
},
|
|
71093
|
+
{
|
|
71094
|
+
name: "all-providers",
|
|
71095
|
+
uri: "dash://providers",
|
|
71096
|
+
description:
|
|
71097
|
+
"All configured providers — names, types, classes (no credentials or secrets)",
|
|
71098
|
+
},
|
|
71099
|
+
{
|
|
71100
|
+
name: "app-info",
|
|
71101
|
+
uri: "dash://app/info",
|
|
71102
|
+
description:
|
|
71103
|
+
"Application info — version, appId, and counts of dashboards, widgets, themes, providers",
|
|
71104
|
+
},
|
|
71105
|
+
];
|
|
71106
|
+
|
|
71107
|
+
var resourceDefinitions = { dashResources: dashResources$1 };
|
|
71108
|
+
|
|
71109
|
+
/**
|
|
71110
|
+
* resourceHandlers.js
|
|
71111
|
+
*
|
|
71112
|
+
* MCP resource handlers for read-only app state.
|
|
71113
|
+
* Each handler delegates to existing controllers via getServerContext().
|
|
71114
|
+
* Returns { contents: [{ uri, mimeType, text }] } per MCP resource spec.
|
|
71115
|
+
*/
|
|
71116
|
+
|
|
71117
|
+
const mcpDashServerController$1 = mcpDashServerController_1;
|
|
71118
|
+
const workspaceController$1 = workspaceController_1;
|
|
71119
|
+
const themeController$1 = themeController_1;
|
|
71120
|
+
const providerController$1 = requireProviderController();
|
|
71121
|
+
const settingsController$1 = settingsController_1;
|
|
71122
|
+
|
|
71123
|
+
/**
|
|
71124
|
+
* Helper: get win + appId or throw a descriptive error.
|
|
71125
|
+
*/
|
|
71126
|
+
function requireContext() {
|
|
71127
|
+
const ctx = mcpDashServerController$1.getServerContext();
|
|
71128
|
+
if (!ctx) {
|
|
71129
|
+
throw new Error("MCP server is not running or has no active window");
|
|
71130
|
+
}
|
|
71131
|
+
return ctx;
|
|
71132
|
+
}
|
|
71133
|
+
|
|
71134
|
+
/**
|
|
71135
|
+
* Helper: count widgets in a workspace's layout array.
|
|
71136
|
+
*/
|
|
71137
|
+
function countWidgets(layout) {
|
|
71138
|
+
if (!Array.isArray(layout)) return 0;
|
|
71139
|
+
return layout.filter(
|
|
71140
|
+
(item) =>
|
|
71141
|
+
item.component &&
|
|
71142
|
+
item.component !== "Container" &&
|
|
71143
|
+
item.component !== "LayoutContainer" &&
|
|
71144
|
+
item.component !== "LayoutGridContainer",
|
|
71145
|
+
).length;
|
|
71146
|
+
}
|
|
71147
|
+
|
|
71148
|
+
/**
|
|
71149
|
+
* Helper: wrap data as an MCP resource response.
|
|
71150
|
+
*/
|
|
71151
|
+
function resourceResponse(uri, data) {
|
|
71152
|
+
return {
|
|
71153
|
+
contents: [
|
|
71154
|
+
{
|
|
71155
|
+
uri,
|
|
71156
|
+
mimeType: "application/json",
|
|
71157
|
+
text: JSON.stringify(data, null, 2),
|
|
71158
|
+
},
|
|
71159
|
+
],
|
|
71160
|
+
};
|
|
71161
|
+
}
|
|
71162
|
+
|
|
71163
|
+
/**
|
|
71164
|
+
* dash://dashboards/active — Current active dashboard state.
|
|
71165
|
+
*/
|
|
71166
|
+
async function handleActiveDashboard$1(uri) {
|
|
71167
|
+
const { win, appId } = requireContext();
|
|
71168
|
+
const result = workspaceController$1.listWorkspacesForApplication(win, appId);
|
|
71169
|
+
|
|
71170
|
+
if (result.error) {
|
|
71171
|
+
return resourceResponse(uri.href, { error: result.message });
|
|
71172
|
+
}
|
|
71173
|
+
|
|
71174
|
+
const workspaces = result.workspaces || [];
|
|
71175
|
+
const workspace = workspaces[0];
|
|
71176
|
+
|
|
71177
|
+
if (!workspace) {
|
|
71178
|
+
return resourceResponse(uri.href, { error: "No dashboards exist" });
|
|
71179
|
+
}
|
|
71180
|
+
|
|
71181
|
+
const widgets = (workspace.layout || [])
|
|
71182
|
+
.filter(
|
|
71183
|
+
(item) =>
|
|
71184
|
+
item.component &&
|
|
71185
|
+
item.component !== "Container" &&
|
|
71186
|
+
item.component !== "LayoutContainer" &&
|
|
71187
|
+
item.component !== "LayoutGridContainer",
|
|
71188
|
+
)
|
|
71189
|
+
.map((item) => ({
|
|
71190
|
+
id: String(item.id),
|
|
71191
|
+
type: item.component,
|
|
71192
|
+
config: item.config || {},
|
|
71193
|
+
}));
|
|
71194
|
+
|
|
71195
|
+
return resourceResponse(uri.href, {
|
|
71196
|
+
id: String(workspace.id),
|
|
71197
|
+
name: workspace.name || workspace.label || "Dashboard",
|
|
71198
|
+
widgetCount: widgets.length,
|
|
71199
|
+
widgets,
|
|
71200
|
+
layout: workspace.layout || [],
|
|
71201
|
+
theme: workspace.theme || null,
|
|
71202
|
+
});
|
|
71203
|
+
}
|
|
71204
|
+
|
|
71205
|
+
/**
|
|
71206
|
+
* dash://dashboards — All dashboards summary.
|
|
71207
|
+
*/
|
|
71208
|
+
async function handleAllDashboards$1(uri) {
|
|
71209
|
+
const { win, appId } = requireContext();
|
|
71210
|
+
const result = workspaceController$1.listWorkspacesForApplication(win, appId);
|
|
71211
|
+
|
|
71212
|
+
if (result.error) {
|
|
71213
|
+
return resourceResponse(uri.href, { error: result.message });
|
|
71214
|
+
}
|
|
71215
|
+
|
|
71216
|
+
const dashboards = (result.workspaces || []).map((ws, index) => ({
|
|
71217
|
+
id: String(ws.id),
|
|
71218
|
+
name: ws.name || ws.label || `Dashboard ${index + 1}`,
|
|
71219
|
+
widgetCount: countWidgets(ws.layout),
|
|
71220
|
+
isActive: index === 0,
|
|
71221
|
+
}));
|
|
71222
|
+
|
|
71223
|
+
return resourceResponse(uri.href, {
|
|
71224
|
+
dashboards,
|
|
71225
|
+
count: dashboards.length,
|
|
71226
|
+
});
|
|
71227
|
+
}
|
|
71228
|
+
|
|
71229
|
+
/**
|
|
71230
|
+
* dash://themes — All themes with active state.
|
|
71231
|
+
*/
|
|
71232
|
+
async function handleAllThemes$1(uri) {
|
|
71233
|
+
const { win, appId } = requireContext();
|
|
71234
|
+
const result = themeController$1.listThemesForApplication(win, appId);
|
|
71235
|
+
|
|
71236
|
+
if (result.error) {
|
|
71237
|
+
return resourceResponse(uri.href, { error: result.message });
|
|
71238
|
+
}
|
|
71239
|
+
|
|
71240
|
+
const themes = result.themes || {};
|
|
71241
|
+
const settingsResult = settingsController$1.getSettingsForApplication(win);
|
|
71242
|
+
const activeThemeKey = settingsResult?.settings?.theme || null;
|
|
71243
|
+
|
|
71244
|
+
const themeList = Object.keys(themes).map((name) => ({
|
|
71245
|
+
name,
|
|
71246
|
+
isActive: name === activeThemeKey,
|
|
71247
|
+
colors: themes[name],
|
|
71248
|
+
}));
|
|
71249
|
+
|
|
71250
|
+
return resourceResponse(uri.href, {
|
|
71251
|
+
themes: themeList,
|
|
71252
|
+
count: themeList.length,
|
|
71253
|
+
activeTheme: activeThemeKey,
|
|
71254
|
+
});
|
|
71255
|
+
}
|
|
71256
|
+
|
|
71257
|
+
/**
|
|
71258
|
+
* dash://providers — All providers (no secrets).
|
|
71259
|
+
*/
|
|
71260
|
+
async function handleAllProviders$1(uri) {
|
|
71261
|
+
const { win, appId } = requireContext();
|
|
71262
|
+
const result = providerController$1.listProviders(win, appId);
|
|
71263
|
+
|
|
71264
|
+
if (result.error) {
|
|
71265
|
+
return resourceResponse(uri.href, { error: result.message });
|
|
71266
|
+
}
|
|
71267
|
+
|
|
71268
|
+
const providers = (result.providers || []).map((p) => ({
|
|
71269
|
+
name: p.name,
|
|
71270
|
+
type: p.type,
|
|
71271
|
+
providerClass: p.providerClass || "credential",
|
|
71272
|
+
dateCreated: p.dateCreated,
|
|
71273
|
+
dateUpdated: p.dateUpdated,
|
|
71274
|
+
}));
|
|
71275
|
+
|
|
71276
|
+
return resourceResponse(uri.href, {
|
|
71277
|
+
providers,
|
|
71278
|
+
count: providers.length,
|
|
71279
|
+
});
|
|
71280
|
+
}
|
|
71281
|
+
|
|
71282
|
+
/**
|
|
71283
|
+
* dash://app/info — Version, appId, and aggregate stats.
|
|
71284
|
+
*/
|
|
71285
|
+
async function handleAppInfo$1(uri) {
|
|
71286
|
+
const { win, appId } = requireContext();
|
|
71287
|
+
|
|
71288
|
+
// Dashboards + widget count
|
|
71289
|
+
const wsResult = workspaceController$1.listWorkspacesForApplication(win, appId);
|
|
71290
|
+
const workspaces = wsResult.workspaces || [];
|
|
71291
|
+
const dashboardCount = workspaces.length;
|
|
71292
|
+
const widgetCount = workspaces.reduce(
|
|
71293
|
+
(sum, ws) => sum + countWidgets(ws.layout),
|
|
71294
|
+
0,
|
|
71295
|
+
);
|
|
71296
|
+
|
|
71297
|
+
// Themes
|
|
71298
|
+
const themeResult = themeController$1.listThemesForApplication(win, appId);
|
|
71299
|
+
const themes = themeResult.themes || {};
|
|
71300
|
+
const themeCount = Object.keys(themes).length;
|
|
71301
|
+
|
|
71302
|
+
// Providers
|
|
71303
|
+
const providerResult = providerController$1.listProviders(win, appId);
|
|
71304
|
+
const providers = providerResult.providers || {};
|
|
71305
|
+
const providerCount = Array.isArray(providers)
|
|
71306
|
+
? providers.length
|
|
71307
|
+
: Object.keys(providers).length;
|
|
71308
|
+
|
|
71309
|
+
// Server status
|
|
71310
|
+
const status = mcpDashServerController$1.getStatus(win);
|
|
71311
|
+
|
|
71312
|
+
return resourceResponse(uri.href, {
|
|
71313
|
+
appId,
|
|
71314
|
+
server: {
|
|
71315
|
+
version: "1.0.0",
|
|
71316
|
+
port: status.port,
|
|
71317
|
+
uptime: status.uptime,
|
|
71318
|
+
toolCount: status.toolCount,
|
|
71319
|
+
resourceCount: status.resourceCount,
|
|
71320
|
+
},
|
|
71321
|
+
stats: {
|
|
71322
|
+
dashboardCount,
|
|
71323
|
+
widgetCount,
|
|
71324
|
+
themeCount,
|
|
71325
|
+
providerCount,
|
|
71326
|
+
},
|
|
71327
|
+
});
|
|
71328
|
+
}
|
|
71329
|
+
|
|
71330
|
+
var resourceHandlers = {
|
|
71331
|
+
handleActiveDashboard: handleActiveDashboard$1,
|
|
71332
|
+
handleAllDashboards: handleAllDashboards$1,
|
|
71333
|
+
handleAllThemes: handleAllThemes$1,
|
|
71334
|
+
handleAllProviders: handleAllProviders$1,
|
|
71335
|
+
handleAppInfo: handleAppInfo$1,
|
|
71336
|
+
};
|
|
71337
|
+
|
|
71338
|
+
/**
|
|
71339
|
+
* resources.js
|
|
71340
|
+
*
|
|
71341
|
+
* Registers MCP resources with the MCP Dash server.
|
|
71342
|
+
* Call registerResources() during app startup (before or after server start).
|
|
71343
|
+
*/
|
|
71344
|
+
|
|
71345
|
+
const { registerResource } = mcpDashServerController_1;
|
|
71346
|
+
const { dashResources } = resourceDefinitions;
|
|
71347
|
+
const {
|
|
71348
|
+
handleActiveDashboard,
|
|
71349
|
+
handleAllDashboards,
|
|
71350
|
+
handleAllThemes,
|
|
71351
|
+
handleAllProviders,
|
|
71352
|
+
handleAppInfo,
|
|
71353
|
+
} = resourceHandlers;
|
|
71354
|
+
|
|
71355
|
+
// Map resource URIs to handler functions
|
|
71356
|
+
const handlerMap = {
|
|
71357
|
+
"dash://dashboards/active": handleActiveDashboard,
|
|
71358
|
+
"dash://dashboards": handleAllDashboards,
|
|
71359
|
+
"dash://themes": handleAllThemes,
|
|
71360
|
+
"dash://providers": handleAllProviders,
|
|
71361
|
+
"dash://app/info": handleAppInfo,
|
|
71362
|
+
};
|
|
71363
|
+
|
|
71364
|
+
/**
|
|
71365
|
+
* Register all MCP resources with the server controller.
|
|
71366
|
+
*/
|
|
71367
|
+
function registerResources$1() {
|
|
71368
|
+
for (const resource of dashResources) {
|
|
71369
|
+
const handler = handlerMap[resource.uri];
|
|
71370
|
+
if (!handler) {
|
|
71371
|
+
console.warn(
|
|
71372
|
+
`[resources] No handler found for resource: ${resource.uri}`,
|
|
71373
|
+
);
|
|
71374
|
+
continue;
|
|
71375
|
+
}
|
|
71376
|
+
registerResource({
|
|
71377
|
+
name: resource.name,
|
|
71378
|
+
uri: resource.uri,
|
|
71379
|
+
metadata: { description: resource.description },
|
|
71380
|
+
handler,
|
|
71381
|
+
});
|
|
71382
|
+
}
|
|
71383
|
+
console.log(`[resources] Registered ${dashResources.length} MCP resources`);
|
|
71384
|
+
}
|
|
71385
|
+
|
|
71386
|
+
var resources = { registerResources: registerResources$1 };
|
|
71387
|
+
|
|
71067
71388
|
/**
|
|
71068
71389
|
* dashboardRatingsApi.js
|
|
71069
71390
|
*
|
|
@@ -71389,10 +71710,12 @@ const { registerDashboardTools } = dashboardTools_1;
|
|
|
71389
71710
|
const { registerWidgetTools } = widgetTools_1;
|
|
71390
71711
|
const { registerThemeTools } = themeTools_1;
|
|
71391
71712
|
const { registerProviderTools } = providerTools_1;
|
|
71713
|
+
const { registerResources } = resources;
|
|
71392
71714
|
registerDashboardTools();
|
|
71393
71715
|
registerWidgetTools();
|
|
71394
71716
|
registerThemeTools();
|
|
71395
71717
|
registerProviderTools();
|
|
71718
|
+
registerResources();
|
|
71396
71719
|
|
|
71397
71720
|
// --- Schema ---
|
|
71398
71721
|
const dashboardConfigValidator = dashboardConfigValidator$1;
|
|
@@ -71491,6 +71814,7 @@ var electron = {
|
|
|
71491
71814
|
registerWidgetTools,
|
|
71492
71815
|
registerThemeTools,
|
|
71493
71816
|
registerProviderTools,
|
|
71817
|
+
registerResources,
|
|
71494
71818
|
};
|
|
71495
71819
|
|
|
71496
71820
|
var index = /*@__PURE__*/getDefaultExportFromCjs(electron);
|