@trops/dash-core 0.1.171 → 0.1.172
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 +649 -16
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -26872,7 +26872,7 @@ async function searchThemes(query = "", filters = {}) {
|
|
|
26872
26872
|
return searchRegistry$1(query, { ...filters, type: "theme" });
|
|
26873
26873
|
}
|
|
26874
26874
|
|
|
26875
|
-
var registryController$
|
|
26875
|
+
var registryController$3 = {
|
|
26876
26876
|
fetchRegistryIndex,
|
|
26877
26877
|
searchRegistry: searchRegistry$1,
|
|
26878
26878
|
searchDashboards,
|
|
@@ -31852,7 +31852,7 @@ const { app: app$2, dialog: dialog$1 } = require$$0$2;
|
|
|
31852
31852
|
const AdmZip$1 = require$$3$4;
|
|
31853
31853
|
|
|
31854
31854
|
const themeController$3 = themeController_1;
|
|
31855
|
-
const registryController$
|
|
31855
|
+
const registryController$2 = registryController$3;
|
|
31856
31856
|
const registryApiController$1 = registryApiController$2;
|
|
31857
31857
|
const {
|
|
31858
31858
|
getAuthStatus,
|
|
@@ -32082,7 +32082,7 @@ async function prepareThemeForPublish$1(win, appId, themeKey, options = {}) {
|
|
|
32082
32082
|
async function installThemeFromRegistry$1(win, appId, packageName) {
|
|
32083
32083
|
try {
|
|
32084
32084
|
// Look up the package
|
|
32085
|
-
const pkg = await registryController$
|
|
32085
|
+
const pkg = await registryController$2.getPackage(packageName);
|
|
32086
32086
|
if (!pkg) {
|
|
32087
32087
|
return {
|
|
32088
32088
|
success: false,
|
|
@@ -32272,7 +32272,7 @@ const {
|
|
|
32272
32272
|
buildProviderRequirements,
|
|
32273
32273
|
applyEventWiringToLayout,
|
|
32274
32274
|
} = dashboardConfigUtils$1;
|
|
32275
|
-
const { searchRegistry, getPackage } = registryController$
|
|
32275
|
+
const { searchRegistry, getPackage } = registryController$3;
|
|
32276
32276
|
const themeController$2 = themeController_1;
|
|
32277
32277
|
|
|
32278
32278
|
const configFilename = "workspaces.json";
|
|
@@ -32998,7 +32998,7 @@ async function checkCompatibility$1(dashboardWidgets, widgetRegistry = null) {
|
|
|
32998
32998
|
const {
|
|
32999
32999
|
checkDashboardCompatibility,
|
|
33000
33000
|
} = dashboardConfigUtils$1;
|
|
33001
|
-
const { fetchRegistryIndex } = registryController$
|
|
33001
|
+
const { fetchRegistryIndex } = registryController$3;
|
|
33002
33002
|
|
|
33003
33003
|
const installedWidgets = widgetRegistry ? widgetRegistry.getWidgets() : [];
|
|
33004
33004
|
|
|
@@ -33153,7 +33153,7 @@ async function prepareDashboardForPublish$1(
|
|
|
33153
33153
|
}
|
|
33154
33154
|
|
|
33155
33155
|
// 6. Check which widgets exist in the registry (soft warning, not blocking)
|
|
33156
|
-
const { fetchRegistryIndex } = registryController$
|
|
33156
|
+
const { fetchRegistryIndex } = registryController$3;
|
|
33157
33157
|
let registryPackages = [];
|
|
33158
33158
|
let registryCheckFailed = false;
|
|
33159
33159
|
try {
|
|
@@ -33300,7 +33300,7 @@ async function getDashboardPreview$1(packageName, widgetRegistry = null) {
|
|
|
33300
33300
|
buildDashboardPreview,
|
|
33301
33301
|
checkDashboardCompatibility,
|
|
33302
33302
|
} = dashboardConfigUtils$1;
|
|
33303
|
-
const { getPackage, fetchRegistryIndex } = registryController$
|
|
33303
|
+
const { getPackage, fetchRegistryIndex } = registryController$3;
|
|
33304
33304
|
|
|
33305
33305
|
const pkg = await getPackage(packageName);
|
|
33306
33306
|
if (!pkg) {
|
|
@@ -33345,7 +33345,7 @@ async function getDashboardPreview$1(packageName, widgetRegistry = null) {
|
|
|
33345
33345
|
*/
|
|
33346
33346
|
async function checkDashboardUpdatesForApp$1(appId) {
|
|
33347
33347
|
const { checkDashboardUpdates } = dashboardConfigUtils$1;
|
|
33348
|
-
const { fetchRegistryIndex } = registryController$
|
|
33348
|
+
const { fetchRegistryIndex } = registryController$3;
|
|
33349
33349
|
|
|
33350
33350
|
try {
|
|
33351
33351
|
const filename = path$1.join(
|
|
@@ -66111,7 +66111,7 @@ const registeredResources = [];
|
|
|
66111
66111
|
* Register a tool to be exposed via the MCP server.
|
|
66112
66112
|
* Call this before starting the server (or restart after registering).
|
|
66113
66113
|
*/
|
|
66114
|
-
function registerTool$
|
|
66114
|
+
function registerTool$2(toolDef) {
|
|
66115
66115
|
registeredTools.push(toolDef);
|
|
66116
66116
|
}
|
|
66117
66117
|
|
|
@@ -66434,7 +66434,7 @@ const mcpDashServerController$3 = {
|
|
|
66434
66434
|
},
|
|
66435
66435
|
|
|
66436
66436
|
// Expose registration functions for other controllers
|
|
66437
|
-
registerTool: registerTool$
|
|
66437
|
+
registerTool: registerTool$2,
|
|
66438
66438
|
registerResource,
|
|
66439
66439
|
getServerContext,
|
|
66440
66440
|
};
|
|
@@ -69042,7 +69042,99 @@ const dashboardTools$1 = [
|
|
|
69042
69042
|
},
|
|
69043
69043
|
];
|
|
69044
69044
|
|
|
69045
|
-
|
|
69045
|
+
const widgetTools$1 = [
|
|
69046
|
+
{
|
|
69047
|
+
name: "add_widget",
|
|
69048
|
+
description:
|
|
69049
|
+
"Add a widget to a dashboard by component name. Use list_widgets or search_widgets to find available widget names.",
|
|
69050
|
+
inputSchema: {
|
|
69051
|
+
type: "object",
|
|
69052
|
+
properties: {
|
|
69053
|
+
dashboardId: {
|
|
69054
|
+
type: "string",
|
|
69055
|
+
description:
|
|
69056
|
+
"Dashboard ID to add the widget to. Omit to use the active dashboard.",
|
|
69057
|
+
},
|
|
69058
|
+
widgetName: {
|
|
69059
|
+
type: "string",
|
|
69060
|
+
description:
|
|
69061
|
+
"Component name of the widget to add (e.g. 'Clock', 'WeatherWidget')",
|
|
69062
|
+
},
|
|
69063
|
+
},
|
|
69064
|
+
required: ["widgetName"],
|
|
69065
|
+
},
|
|
69066
|
+
},
|
|
69067
|
+
{
|
|
69068
|
+
name: "remove_widget",
|
|
69069
|
+
description: "Remove a widget instance from a dashboard by its ID",
|
|
69070
|
+
inputSchema: {
|
|
69071
|
+
type: "object",
|
|
69072
|
+
properties: {
|
|
69073
|
+
dashboardId: {
|
|
69074
|
+
type: "string",
|
|
69075
|
+
description: "Dashboard ID. Omit to use the active dashboard.",
|
|
69076
|
+
},
|
|
69077
|
+
widgetId: {
|
|
69078
|
+
type: "string",
|
|
69079
|
+
description: "ID of the widget instance to remove",
|
|
69080
|
+
},
|
|
69081
|
+
},
|
|
69082
|
+
required: ["widgetId"],
|
|
69083
|
+
},
|
|
69084
|
+
},
|
|
69085
|
+
{
|
|
69086
|
+
name: "configure_widget",
|
|
69087
|
+
description:
|
|
69088
|
+
"Update a widget's configuration. The config object is merged into the existing config.",
|
|
69089
|
+
inputSchema: {
|
|
69090
|
+
type: "object",
|
|
69091
|
+
properties: {
|
|
69092
|
+
dashboardId: {
|
|
69093
|
+
type: "string",
|
|
69094
|
+
description: "Dashboard ID. Omit to use the active dashboard.",
|
|
69095
|
+
},
|
|
69096
|
+
widgetId: {
|
|
69097
|
+
type: "string",
|
|
69098
|
+
description: "ID of the widget instance to configure",
|
|
69099
|
+
},
|
|
69100
|
+
config: {
|
|
69101
|
+
type: "object",
|
|
69102
|
+
description:
|
|
69103
|
+
"Configuration object to merge into existing widget config",
|
|
69104
|
+
},
|
|
69105
|
+
},
|
|
69106
|
+
required: ["widgetId", "config"],
|
|
69107
|
+
},
|
|
69108
|
+
},
|
|
69109
|
+
{
|
|
69110
|
+
name: "list_widgets",
|
|
69111
|
+
description:
|
|
69112
|
+
"List available widgets from the registry, including name, description, and provider info",
|
|
69113
|
+
inputSchema: {
|
|
69114
|
+
type: "object",
|
|
69115
|
+
properties: {},
|
|
69116
|
+
required: [],
|
|
69117
|
+
},
|
|
69118
|
+
},
|
|
69119
|
+
{
|
|
69120
|
+
name: "search_widgets",
|
|
69121
|
+
description:
|
|
69122
|
+
"Search the widget registry by keyword. Returns matching widgets with name, description, and provider info.",
|
|
69123
|
+
inputSchema: {
|
|
69124
|
+
type: "object",
|
|
69125
|
+
properties: {
|
|
69126
|
+
query: {
|
|
69127
|
+
type: "string",
|
|
69128
|
+
description:
|
|
69129
|
+
"Search keyword to match against widget names, descriptions, and tags",
|
|
69130
|
+
},
|
|
69131
|
+
},
|
|
69132
|
+
required: ["query"],
|
|
69133
|
+
},
|
|
69134
|
+
},
|
|
69135
|
+
];
|
|
69136
|
+
|
|
69137
|
+
var toolDefinitions = { dashboardTools: dashboardTools$1, widgetTools: widgetTools$1 };
|
|
69046
69138
|
|
|
69047
69139
|
/**
|
|
69048
69140
|
* toolHandlers.js
|
|
@@ -69392,12 +69484,502 @@ async function handleGetAppStats$1() {
|
|
|
69392
69484
|
};
|
|
69393
69485
|
}
|
|
69394
69486
|
|
|
69487
|
+
// --- Widget Tool Handlers ---
|
|
69488
|
+
|
|
69489
|
+
const registryController$1 = registryController$3;
|
|
69490
|
+
|
|
69491
|
+
/**
|
|
69492
|
+
* Helper: find a workspace by ID or return the first (active) one.
|
|
69493
|
+
*/
|
|
69494
|
+
function findWorkspace(workspaces, dashboardId) {
|
|
69495
|
+
if (dashboardId) {
|
|
69496
|
+
const ws = workspaces.find((w) => String(w.id) === dashboardId);
|
|
69497
|
+
if (!ws) {
|
|
69498
|
+
return {
|
|
69499
|
+
error: true,
|
|
69500
|
+
response: {
|
|
69501
|
+
content: [
|
|
69502
|
+
{
|
|
69503
|
+
type: "text",
|
|
69504
|
+
text: JSON.stringify({
|
|
69505
|
+
error: `Dashboard not found: ${dashboardId}`,
|
|
69506
|
+
}),
|
|
69507
|
+
},
|
|
69508
|
+
],
|
|
69509
|
+
isError: true,
|
|
69510
|
+
},
|
|
69511
|
+
};
|
|
69512
|
+
}
|
|
69513
|
+
return { workspace: ws };
|
|
69514
|
+
}
|
|
69515
|
+
if (!workspaces.length) {
|
|
69516
|
+
return {
|
|
69517
|
+
error: true,
|
|
69518
|
+
response: {
|
|
69519
|
+
content: [
|
|
69520
|
+
{
|
|
69521
|
+
type: "text",
|
|
69522
|
+
text: JSON.stringify({ error: "No dashboards exist" }),
|
|
69523
|
+
},
|
|
69524
|
+
],
|
|
69525
|
+
isError: true,
|
|
69526
|
+
},
|
|
69527
|
+
};
|
|
69528
|
+
}
|
|
69529
|
+
return { workspace: workspaces[0] };
|
|
69530
|
+
}
|
|
69531
|
+
|
|
69532
|
+
/**
|
|
69533
|
+
* Helper: generate the next unique layout item ID within a workspace.
|
|
69534
|
+
*/
|
|
69535
|
+
function nextLayoutId(layout) {
|
|
69536
|
+
if (!Array.isArray(layout) || layout.length === 0) return 1;
|
|
69537
|
+
const maxId = layout.reduce(
|
|
69538
|
+
(max, item) => Math.max(max, Number(item.id) || 0),
|
|
69539
|
+
0,
|
|
69540
|
+
);
|
|
69541
|
+
return maxId + 1;
|
|
69542
|
+
}
|
|
69543
|
+
|
|
69544
|
+
/**
|
|
69545
|
+
* add_widget — Add a widget to a dashboard by component name.
|
|
69546
|
+
*/
|
|
69547
|
+
async function handleAddWidget$1({ dashboardId, widgetName }) {
|
|
69548
|
+
if (!widgetName || typeof widgetName !== "string" || !widgetName.trim()) {
|
|
69549
|
+
return {
|
|
69550
|
+
content: [
|
|
69551
|
+
{
|
|
69552
|
+
type: "text",
|
|
69553
|
+
text: JSON.stringify({
|
|
69554
|
+
error: "widgetName is required and must be a non-empty string",
|
|
69555
|
+
}),
|
|
69556
|
+
},
|
|
69557
|
+
],
|
|
69558
|
+
isError: true,
|
|
69559
|
+
};
|
|
69560
|
+
}
|
|
69561
|
+
|
|
69562
|
+
const { win, appId } = requireContext();
|
|
69563
|
+
const result = workspaceController$1.listWorkspacesForApplication(win, appId);
|
|
69564
|
+
if (result.error) {
|
|
69565
|
+
return {
|
|
69566
|
+
content: [
|
|
69567
|
+
{ type: "text", text: JSON.stringify({ error: result.message }) },
|
|
69568
|
+
],
|
|
69569
|
+
isError: true,
|
|
69570
|
+
};
|
|
69571
|
+
}
|
|
69572
|
+
|
|
69573
|
+
const found = findWorkspace(result.workspaces || [], dashboardId);
|
|
69574
|
+
if (found.error) return found.response;
|
|
69575
|
+
|
|
69576
|
+
const workspace = found.workspace;
|
|
69577
|
+
const layout = workspace.layout || [];
|
|
69578
|
+
|
|
69579
|
+
// Find the first container to add the widget into
|
|
69580
|
+
const container = layout.find(
|
|
69581
|
+
(item) =>
|
|
69582
|
+
item.component === "Container" ||
|
|
69583
|
+
item.component === "LayoutContainer" ||
|
|
69584
|
+
item.component === "LayoutGridContainer",
|
|
69585
|
+
);
|
|
69586
|
+
const parentId = container ? container.id : 0;
|
|
69587
|
+
|
|
69588
|
+
const newId = nextLayoutId(layout);
|
|
69589
|
+
const maxOrder = layout.reduce(
|
|
69590
|
+
(max, item) => Math.max(max, Number(item.order) || 0),
|
|
69591
|
+
0,
|
|
69592
|
+
);
|
|
69593
|
+
|
|
69594
|
+
const newItem = {
|
|
69595
|
+
id: newId,
|
|
69596
|
+
order: maxOrder + 1,
|
|
69597
|
+
component: widgetName.trim(),
|
|
69598
|
+
parentId,
|
|
69599
|
+
config: {},
|
|
69600
|
+
};
|
|
69601
|
+
|
|
69602
|
+
workspace.layout = [...layout, newItem];
|
|
69603
|
+
|
|
69604
|
+
const saveResult = workspaceController$1.saveWorkspaceForApplication(
|
|
69605
|
+
win,
|
|
69606
|
+
appId,
|
|
69607
|
+
workspace,
|
|
69608
|
+
);
|
|
69609
|
+
if (saveResult.error) {
|
|
69610
|
+
return {
|
|
69611
|
+
content: [
|
|
69612
|
+
{
|
|
69613
|
+
type: "text",
|
|
69614
|
+
text: JSON.stringify({ error: saveResult.message }),
|
|
69615
|
+
},
|
|
69616
|
+
],
|
|
69617
|
+
isError: true,
|
|
69618
|
+
};
|
|
69619
|
+
}
|
|
69620
|
+
|
|
69621
|
+
return {
|
|
69622
|
+
content: [
|
|
69623
|
+
{
|
|
69624
|
+
type: "text",
|
|
69625
|
+
text: JSON.stringify(
|
|
69626
|
+
{
|
|
69627
|
+
widgetId: String(newId),
|
|
69628
|
+
name: widgetName.trim(),
|
|
69629
|
+
dashboardId: String(workspace.id),
|
|
69630
|
+
},
|
|
69631
|
+
null,
|
|
69632
|
+
2,
|
|
69633
|
+
),
|
|
69634
|
+
},
|
|
69635
|
+
],
|
|
69636
|
+
};
|
|
69637
|
+
}
|
|
69638
|
+
|
|
69639
|
+
/**
|
|
69640
|
+
* remove_widget — Remove a widget instance from a dashboard.
|
|
69641
|
+
*/
|
|
69642
|
+
async function handleRemoveWidget$1({ dashboardId, widgetId }) {
|
|
69643
|
+
if (!widgetId || typeof widgetId !== "string") {
|
|
69644
|
+
return {
|
|
69645
|
+
content: [
|
|
69646
|
+
{
|
|
69647
|
+
type: "text",
|
|
69648
|
+
text: JSON.stringify({ error: "widgetId is required" }),
|
|
69649
|
+
},
|
|
69650
|
+
],
|
|
69651
|
+
isError: true,
|
|
69652
|
+
};
|
|
69653
|
+
}
|
|
69654
|
+
|
|
69655
|
+
const { win, appId } = requireContext();
|
|
69656
|
+
const result = workspaceController$1.listWorkspacesForApplication(win, appId);
|
|
69657
|
+
if (result.error) {
|
|
69658
|
+
return {
|
|
69659
|
+
content: [
|
|
69660
|
+
{ type: "text", text: JSON.stringify({ error: result.message }) },
|
|
69661
|
+
],
|
|
69662
|
+
isError: true,
|
|
69663
|
+
};
|
|
69664
|
+
}
|
|
69665
|
+
|
|
69666
|
+
const found = findWorkspace(result.workspaces || [], dashboardId);
|
|
69667
|
+
if (found.error) return found.response;
|
|
69668
|
+
|
|
69669
|
+
const workspace = found.workspace;
|
|
69670
|
+
const layout = workspace.layout || [];
|
|
69671
|
+
|
|
69672
|
+
const exists = layout.some((item) => String(item.id) === widgetId);
|
|
69673
|
+
if (!exists) {
|
|
69674
|
+
return {
|
|
69675
|
+
content: [
|
|
69676
|
+
{
|
|
69677
|
+
type: "text",
|
|
69678
|
+
text: JSON.stringify({
|
|
69679
|
+
error: `Widget not found: ${widgetId}`,
|
|
69680
|
+
}),
|
|
69681
|
+
},
|
|
69682
|
+
],
|
|
69683
|
+
isError: true,
|
|
69684
|
+
};
|
|
69685
|
+
}
|
|
69686
|
+
|
|
69687
|
+
workspace.layout = layout.filter((item) => String(item.id) !== widgetId);
|
|
69688
|
+
|
|
69689
|
+
const saveResult = workspaceController$1.saveWorkspaceForApplication(
|
|
69690
|
+
win,
|
|
69691
|
+
appId,
|
|
69692
|
+
workspace,
|
|
69693
|
+
);
|
|
69694
|
+
if (saveResult.error) {
|
|
69695
|
+
return {
|
|
69696
|
+
content: [
|
|
69697
|
+
{
|
|
69698
|
+
type: "text",
|
|
69699
|
+
text: JSON.stringify({ error: saveResult.message }),
|
|
69700
|
+
},
|
|
69701
|
+
],
|
|
69702
|
+
isError: true,
|
|
69703
|
+
};
|
|
69704
|
+
}
|
|
69705
|
+
|
|
69706
|
+
return {
|
|
69707
|
+
content: [
|
|
69708
|
+
{
|
|
69709
|
+
type: "text",
|
|
69710
|
+
text: JSON.stringify({
|
|
69711
|
+
success: true,
|
|
69712
|
+
removed: widgetId,
|
|
69713
|
+
remainingWidgets: countWidgets(workspace.layout),
|
|
69714
|
+
}),
|
|
69715
|
+
},
|
|
69716
|
+
],
|
|
69717
|
+
};
|
|
69718
|
+
}
|
|
69719
|
+
|
|
69720
|
+
/**
|
|
69721
|
+
* configure_widget — Update widget settings (partial merge).
|
|
69722
|
+
*/
|
|
69723
|
+
async function handleConfigureWidget$1({ dashboardId, widgetId, config }) {
|
|
69724
|
+
if (!widgetId || typeof widgetId !== "string") {
|
|
69725
|
+
return {
|
|
69726
|
+
content: [
|
|
69727
|
+
{
|
|
69728
|
+
type: "text",
|
|
69729
|
+
text: JSON.stringify({ error: "widgetId is required" }),
|
|
69730
|
+
},
|
|
69731
|
+
],
|
|
69732
|
+
isError: true,
|
|
69733
|
+
};
|
|
69734
|
+
}
|
|
69735
|
+
|
|
69736
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
69737
|
+
return {
|
|
69738
|
+
content: [
|
|
69739
|
+
{
|
|
69740
|
+
type: "text",
|
|
69741
|
+
text: JSON.stringify({
|
|
69742
|
+
error: "config is required and must be an object",
|
|
69743
|
+
}),
|
|
69744
|
+
},
|
|
69745
|
+
],
|
|
69746
|
+
isError: true,
|
|
69747
|
+
};
|
|
69748
|
+
}
|
|
69749
|
+
|
|
69750
|
+
const { win, appId } = requireContext();
|
|
69751
|
+
const result = workspaceController$1.listWorkspacesForApplication(win, appId);
|
|
69752
|
+
if (result.error) {
|
|
69753
|
+
return {
|
|
69754
|
+
content: [
|
|
69755
|
+
{ type: "text", text: JSON.stringify({ error: result.message }) },
|
|
69756
|
+
],
|
|
69757
|
+
isError: true,
|
|
69758
|
+
};
|
|
69759
|
+
}
|
|
69760
|
+
|
|
69761
|
+
const found = findWorkspace(result.workspaces || [], dashboardId);
|
|
69762
|
+
if (found.error) return found.response;
|
|
69763
|
+
|
|
69764
|
+
const workspace = found.workspace;
|
|
69765
|
+
const layout = workspace.layout || [];
|
|
69766
|
+
const item = layout.find((i) => String(i.id) === widgetId);
|
|
69767
|
+
|
|
69768
|
+
if (!item) {
|
|
69769
|
+
return {
|
|
69770
|
+
content: [
|
|
69771
|
+
{
|
|
69772
|
+
type: "text",
|
|
69773
|
+
text: JSON.stringify({
|
|
69774
|
+
error: `Widget not found: ${widgetId}`,
|
|
69775
|
+
}),
|
|
69776
|
+
},
|
|
69777
|
+
],
|
|
69778
|
+
isError: true,
|
|
69779
|
+
};
|
|
69780
|
+
}
|
|
69781
|
+
|
|
69782
|
+
// Merge config
|
|
69783
|
+
item.config = { ...(item.config || {}), ...config };
|
|
69784
|
+
|
|
69785
|
+
const saveResult = workspaceController$1.saveWorkspaceForApplication(
|
|
69786
|
+
win,
|
|
69787
|
+
appId,
|
|
69788
|
+
workspace,
|
|
69789
|
+
);
|
|
69790
|
+
if (saveResult.error) {
|
|
69791
|
+
return {
|
|
69792
|
+
content: [
|
|
69793
|
+
{
|
|
69794
|
+
type: "text",
|
|
69795
|
+
text: JSON.stringify({ error: saveResult.message }),
|
|
69796
|
+
},
|
|
69797
|
+
],
|
|
69798
|
+
isError: true,
|
|
69799
|
+
};
|
|
69800
|
+
}
|
|
69801
|
+
|
|
69802
|
+
return {
|
|
69803
|
+
content: [
|
|
69804
|
+
{
|
|
69805
|
+
type: "text",
|
|
69806
|
+
text: JSON.stringify(
|
|
69807
|
+
{
|
|
69808
|
+
widgetId,
|
|
69809
|
+
component: item.component,
|
|
69810
|
+
config: item.config,
|
|
69811
|
+
},
|
|
69812
|
+
null,
|
|
69813
|
+
2,
|
|
69814
|
+
),
|
|
69815
|
+
},
|
|
69816
|
+
],
|
|
69817
|
+
};
|
|
69818
|
+
}
|
|
69819
|
+
|
|
69820
|
+
/**
|
|
69821
|
+
* list_widgets — List available widgets from the registry.
|
|
69822
|
+
*/
|
|
69823
|
+
async function handleListWidgets$1() {
|
|
69824
|
+
try {
|
|
69825
|
+
const index = await registryController$1.fetchRegistryIndex();
|
|
69826
|
+
const packages = index.packages || [];
|
|
69827
|
+
|
|
69828
|
+
const widgets = [];
|
|
69829
|
+
for (const pkg of packages) {
|
|
69830
|
+
// Skip non-widget packages
|
|
69831
|
+
if (pkg.type && pkg.type !== "widget") continue;
|
|
69832
|
+
|
|
69833
|
+
for (const w of pkg.widgets || []) {
|
|
69834
|
+
widgets.push({
|
|
69835
|
+
name: w.name || pkg.name,
|
|
69836
|
+
displayName: w.displayName || w.name || pkg.displayName || pkg.name,
|
|
69837
|
+
description: w.description || pkg.description || "",
|
|
69838
|
+
icon: w.icon || pkg.icon || null,
|
|
69839
|
+
package: pkg.name,
|
|
69840
|
+
providers: (w.providers || pkg.providers || []).map((p) => ({
|
|
69841
|
+
type: p.type,
|
|
69842
|
+
providerClass: p.providerClass || "api",
|
|
69843
|
+
required: p.required !== false,
|
|
69844
|
+
})),
|
|
69845
|
+
});
|
|
69846
|
+
}
|
|
69847
|
+
|
|
69848
|
+
// If a package has no widgets array, treat the package itself as a widget
|
|
69849
|
+
if (!pkg.widgets || pkg.widgets.length === 0) {
|
|
69850
|
+
widgets.push({
|
|
69851
|
+
name: pkg.name,
|
|
69852
|
+
displayName: pkg.displayName || pkg.name,
|
|
69853
|
+
description: pkg.description || "",
|
|
69854
|
+
icon: pkg.icon || null,
|
|
69855
|
+
package: pkg.name,
|
|
69856
|
+
providers: (pkg.providers || []).map((p) => ({
|
|
69857
|
+
type: p.type,
|
|
69858
|
+
providerClass: p.providerClass || "api",
|
|
69859
|
+
required: p.required !== false,
|
|
69860
|
+
})),
|
|
69861
|
+
});
|
|
69862
|
+
}
|
|
69863
|
+
}
|
|
69864
|
+
|
|
69865
|
+
return {
|
|
69866
|
+
content: [
|
|
69867
|
+
{
|
|
69868
|
+
type: "text",
|
|
69869
|
+
text: JSON.stringify({ widgets, count: widgets.length }, null, 2),
|
|
69870
|
+
},
|
|
69871
|
+
],
|
|
69872
|
+
};
|
|
69873
|
+
} catch (err) {
|
|
69874
|
+
return {
|
|
69875
|
+
content: [
|
|
69876
|
+
{
|
|
69877
|
+
type: "text",
|
|
69878
|
+
text: JSON.stringify({
|
|
69879
|
+
error: `Failed to fetch widget registry: ${err.message}`,
|
|
69880
|
+
}),
|
|
69881
|
+
},
|
|
69882
|
+
],
|
|
69883
|
+
isError: true,
|
|
69884
|
+
};
|
|
69885
|
+
}
|
|
69886
|
+
}
|
|
69887
|
+
|
|
69888
|
+
/**
|
|
69889
|
+
* search_widgets — Search the registry by keyword.
|
|
69890
|
+
*/
|
|
69891
|
+
async function handleSearchWidgets$1({ query }) {
|
|
69892
|
+
if (!query || typeof query !== "string" || !query.trim()) {
|
|
69893
|
+
return {
|
|
69894
|
+
content: [
|
|
69895
|
+
{
|
|
69896
|
+
type: "text",
|
|
69897
|
+
text: JSON.stringify({
|
|
69898
|
+
error: "query is required and must be a non-empty string",
|
|
69899
|
+
}),
|
|
69900
|
+
},
|
|
69901
|
+
],
|
|
69902
|
+
isError: true,
|
|
69903
|
+
};
|
|
69904
|
+
}
|
|
69905
|
+
|
|
69906
|
+
try {
|
|
69907
|
+
const result = await registryController$1.searchRegistry(query.trim());
|
|
69908
|
+
const packages = result.packages || [];
|
|
69909
|
+
|
|
69910
|
+
const widgets = [];
|
|
69911
|
+
for (const pkg of packages) {
|
|
69912
|
+
if (pkg.type && pkg.type !== "widget") continue;
|
|
69913
|
+
|
|
69914
|
+
for (const w of pkg.widgets || []) {
|
|
69915
|
+
widgets.push({
|
|
69916
|
+
name: w.name || pkg.name,
|
|
69917
|
+
displayName: w.displayName || w.name || pkg.displayName || pkg.name,
|
|
69918
|
+
description: w.description || pkg.description || "",
|
|
69919
|
+
icon: w.icon || pkg.icon || null,
|
|
69920
|
+
package: pkg.name,
|
|
69921
|
+
providers: (w.providers || pkg.providers || []).map((p) => ({
|
|
69922
|
+
type: p.type,
|
|
69923
|
+
providerClass: p.providerClass || "api",
|
|
69924
|
+
required: p.required !== false,
|
|
69925
|
+
})),
|
|
69926
|
+
});
|
|
69927
|
+
}
|
|
69928
|
+
|
|
69929
|
+
if (!pkg.widgets || pkg.widgets.length === 0) {
|
|
69930
|
+
widgets.push({
|
|
69931
|
+
name: pkg.name,
|
|
69932
|
+
displayName: pkg.displayName || pkg.name,
|
|
69933
|
+
description: pkg.description || "",
|
|
69934
|
+
icon: pkg.icon || null,
|
|
69935
|
+
package: pkg.name,
|
|
69936
|
+
providers: (pkg.providers || []).map((p) => ({
|
|
69937
|
+
type: p.type,
|
|
69938
|
+
providerClass: p.providerClass || "api",
|
|
69939
|
+
required: p.required !== false,
|
|
69940
|
+
})),
|
|
69941
|
+
});
|
|
69942
|
+
}
|
|
69943
|
+
}
|
|
69944
|
+
|
|
69945
|
+
return {
|
|
69946
|
+
content: [
|
|
69947
|
+
{
|
|
69948
|
+
type: "text",
|
|
69949
|
+
text: JSON.stringify(
|
|
69950
|
+
{ query: query.trim(), widgets, count: widgets.length },
|
|
69951
|
+
null,
|
|
69952
|
+
2,
|
|
69953
|
+
),
|
|
69954
|
+
},
|
|
69955
|
+
],
|
|
69956
|
+
};
|
|
69957
|
+
} catch (err) {
|
|
69958
|
+
return {
|
|
69959
|
+
content: [
|
|
69960
|
+
{
|
|
69961
|
+
type: "text",
|
|
69962
|
+
text: JSON.stringify({
|
|
69963
|
+
error: `Failed to search widget registry: ${err.message}`,
|
|
69964
|
+
}),
|
|
69965
|
+
},
|
|
69966
|
+
],
|
|
69967
|
+
isError: true,
|
|
69968
|
+
};
|
|
69969
|
+
}
|
|
69970
|
+
}
|
|
69971
|
+
|
|
69395
69972
|
var toolHandlers = {
|
|
69396
69973
|
handleListDashboards: handleListDashboards$1,
|
|
69397
69974
|
handleGetDashboard: handleGetDashboard$1,
|
|
69398
69975
|
handleCreateDashboard: handleCreateDashboard$1,
|
|
69399
69976
|
handleDeleteDashboard: handleDeleteDashboard$1,
|
|
69400
69977
|
handleGetAppStats: handleGetAppStats$1,
|
|
69978
|
+
handleAddWidget: handleAddWidget$1,
|
|
69979
|
+
handleRemoveWidget: handleRemoveWidget$1,
|
|
69980
|
+
handleConfigureWidget: handleConfigureWidget$1,
|
|
69981
|
+
handleListWidgets: handleListWidgets$1,
|
|
69982
|
+
handleSearchWidgets: handleSearchWidgets$1,
|
|
69401
69983
|
};
|
|
69402
69984
|
|
|
69403
69985
|
/**
|
|
@@ -69407,7 +69989,7 @@ var toolHandlers = {
|
|
|
69407
69989
|
* Call registerDashboardTools() during app startup (before or after server start).
|
|
69408
69990
|
*/
|
|
69409
69991
|
|
|
69410
|
-
const { registerTool } = mcpDashServerController_1;
|
|
69992
|
+
const { registerTool: registerTool$1 } = mcpDashServerController_1;
|
|
69411
69993
|
const { dashboardTools } = toolDefinitions;
|
|
69412
69994
|
const {
|
|
69413
69995
|
handleListDashboards,
|
|
@@ -69418,7 +70000,7 @@ const {
|
|
|
69418
70000
|
} = toolHandlers;
|
|
69419
70001
|
|
|
69420
70002
|
// Map tool names to handler functions
|
|
69421
|
-
const handlerMap = {
|
|
70003
|
+
const handlerMap$1 = {
|
|
69422
70004
|
list_dashboards: handleListDashboards,
|
|
69423
70005
|
get_dashboard: handleGetDashboard,
|
|
69424
70006
|
create_dashboard: handleCreateDashboard,
|
|
@@ -69431,12 +70013,12 @@ const handlerMap = {
|
|
|
69431
70013
|
*/
|
|
69432
70014
|
function registerDashboardTools$1() {
|
|
69433
70015
|
for (const tool of dashboardTools) {
|
|
69434
|
-
const handler = handlerMap[tool.name];
|
|
70016
|
+
const handler = handlerMap$1[tool.name];
|
|
69435
70017
|
if (!handler) {
|
|
69436
70018
|
console.warn(`[dashboardTools] No handler found for tool: ${tool.name}`);
|
|
69437
70019
|
continue;
|
|
69438
70020
|
}
|
|
69439
|
-
registerTool({
|
|
70021
|
+
registerTool$1({
|
|
69440
70022
|
name: tool.name,
|
|
69441
70023
|
description: tool.description,
|
|
69442
70024
|
inputSchema: tool.inputSchema,
|
|
@@ -69450,6 +70032,54 @@ function registerDashboardTools$1() {
|
|
|
69450
70032
|
|
|
69451
70033
|
var dashboardTools_1 = { registerDashboardTools: registerDashboardTools$1 };
|
|
69452
70034
|
|
|
70035
|
+
/**
|
|
70036
|
+
* widgetTools.js
|
|
70037
|
+
*
|
|
70038
|
+
* Registers widget MCP tools with the MCP Dash server.
|
|
70039
|
+
* Call registerWidgetTools() during app startup (before or after server start).
|
|
70040
|
+
*/
|
|
70041
|
+
|
|
70042
|
+
const { registerTool } = mcpDashServerController_1;
|
|
70043
|
+
const { widgetTools } = toolDefinitions;
|
|
70044
|
+
const {
|
|
70045
|
+
handleAddWidget,
|
|
70046
|
+
handleRemoveWidget,
|
|
70047
|
+
handleConfigureWidget,
|
|
70048
|
+
handleListWidgets,
|
|
70049
|
+
handleSearchWidgets,
|
|
70050
|
+
} = toolHandlers;
|
|
70051
|
+
|
|
70052
|
+
// Map tool names to handler functions
|
|
70053
|
+
const handlerMap = {
|
|
70054
|
+
add_widget: handleAddWidget,
|
|
70055
|
+
remove_widget: handleRemoveWidget,
|
|
70056
|
+
configure_widget: handleConfigureWidget,
|
|
70057
|
+
list_widgets: handleListWidgets,
|
|
70058
|
+
search_widgets: handleSearchWidgets,
|
|
70059
|
+
};
|
|
70060
|
+
|
|
70061
|
+
/**
|
|
70062
|
+
* Register all widget tools with the MCP server controller.
|
|
70063
|
+
*/
|
|
70064
|
+
function registerWidgetTools$1() {
|
|
70065
|
+
for (const tool of widgetTools) {
|
|
70066
|
+
const handler = handlerMap[tool.name];
|
|
70067
|
+
if (!handler) {
|
|
70068
|
+
console.warn(`[widgetTools] No handler found for tool: ${tool.name}`);
|
|
70069
|
+
continue;
|
|
70070
|
+
}
|
|
70071
|
+
registerTool({
|
|
70072
|
+
name: tool.name,
|
|
70073
|
+
description: tool.description,
|
|
70074
|
+
inputSchema: tool.inputSchema,
|
|
70075
|
+
handler,
|
|
70076
|
+
});
|
|
70077
|
+
}
|
|
70078
|
+
console.log(`[widgetTools] Registered ${widgetTools.length} widget tools`);
|
|
70079
|
+
}
|
|
70080
|
+
|
|
70081
|
+
var widgetTools_1 = { registerWidgetTools: registerWidgetTools$1 };
|
|
70082
|
+
|
|
69453
70083
|
/**
|
|
69454
70084
|
* dashboardRatingsApi.js
|
|
69455
70085
|
*
|
|
@@ -69706,7 +70336,7 @@ const settingsController = settingsController_1;
|
|
|
69706
70336
|
const providerController = requireProviderController();
|
|
69707
70337
|
const layoutController = layoutController_1;
|
|
69708
70338
|
const mcpController = mcpControllerExports;
|
|
69709
|
-
const registryController = registryController$
|
|
70339
|
+
const registryController = registryController$3;
|
|
69710
70340
|
const algoliaController = algoliaController_1;
|
|
69711
70341
|
const openaiController = openaiController_1;
|
|
69712
70342
|
const menuItemsController = menuItemsController_1;
|
|
@@ -69772,7 +70402,9 @@ const dynamicWidgetLoader = dynamicWidgetLoaderExports;
|
|
|
69772
70402
|
|
|
69773
70403
|
// --- MCP Dash Server Tools ---
|
|
69774
70404
|
const { registerDashboardTools } = dashboardTools_1;
|
|
70405
|
+
const { registerWidgetTools } = widgetTools_1;
|
|
69775
70406
|
registerDashboardTools();
|
|
70407
|
+
registerWidgetTools();
|
|
69776
70408
|
|
|
69777
70409
|
// --- Schema ---
|
|
69778
70410
|
const dashboardConfigValidator = dashboardConfigValidator$1;
|
|
@@ -69868,6 +70500,7 @@ var electron = {
|
|
|
69868
70500
|
|
|
69869
70501
|
// MCP Dash Server Tools
|
|
69870
70502
|
registerDashboardTools,
|
|
70503
|
+
registerWidgetTools,
|
|
69871
70504
|
};
|
|
69872
70505
|
|
|
69873
70506
|
var index = /*@__PURE__*/getDefaultExportFromCjs(electron);
|